From patchwork Fri Feb 9 14:38:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 127834 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp679775ljc; Fri, 9 Feb 2018 06:42:08 -0800 (PST) X-Google-Smtp-Source: AH8x227Ba0GLJfJilA2mrNOMWYPNUlNpY1cK5c5SYnHWDfbbfPNQ8rIGsJGroGT4sfFBG7TUL7Iz X-Received: by 10.36.181.87 with SMTP id j23mr3578706iti.48.1518187328217; Fri, 09 Feb 2018 06:42:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518187328; cv=none; d=google.com; s=arc-20160816; b=KjHQkUJl5TeP+Wg2DbLCKPSAyyNqYoWGCHP6egka4Gz1g63uH4S/Uow/JrGMlJj8/0 b360Yb7mq5S0iN+gqcFSJ2OnbS0BgfzDJP99CK6NJMe8/zZxYh9nvt2noLEVy6EedglT gVj3jTUiShr5fyUg5R5rSYfnbDeCawaL7C/bbyKXsAiDrXthZ9lzLw3g2+vOY4JOxDt9 UQODLVscYrN/Q35NNrLbENsK18KV6Er4Z++R9kK+j40booBcu+fyqSwwPM9wi/5i8Z3Q 0odeF4PNOXmJ0F9+Con+dsfnYXcf2oni5euXnCnYKxRAm+2wEB3oSMGmOAsGhCZt8YHg ZUHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=88/pCnDcmau1jhFL5DHzpvjman9fqioQ6iisHGHOoww=; b=Wlz1Y0Jp07ZWaTGR6SbPk7jlEyaFjoQvZsnUzvpw7c+2hYy3N3WKAZsuw1zIRgfXu4 OkaNWx76DGCR2CTo3Sttsnj2NrawsXw7pWqHVXPQvV2wz/ZRytErG/WwSHwHmw/JxhDz UqoJ9g3R7IrZsThn20xhz7D7f38urkDuFek42Y3+HdNl4oKVtgqQaboAHKmr/1psEEYN gJ5a0mmhiVet2k80bcN2vIKpTXdvm90pUeBDn8tmPILbI5DX1cpedO2u5d72u+q3QoHw Dwt58jqx/2Oyt+Px0Zge4ok0hhvvyISDlWqbbsd7QPucStX9mexrnEa3MYcqZkTqRXni mJLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VPWlYlT+; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id f90si1636322ioi.246.2018.02.09.06.42.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Feb 2018 06:42:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VPWlYlT+; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ek9qC-00080l-HS; Fri, 09 Feb 2018 14:39:52 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ek9qB-0007yo-6z for xen-devel@lists.xenproject.org; Fri, 09 Feb 2018 14:39:51 +0000 X-Inumbo-ID: 0410c9c1-0da7-11e8-ba59-bc764e045a96 Received: from mail-wm0-x241.google.com (unknown [2a00:1450:400c:c09::241]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 0410c9c1-0da7-11e8-ba59-bc764e045a96; Fri, 09 Feb 2018 15:39:22 +0100 (CET) Received: by mail-wm0-x241.google.com with SMTP id f71so15761620wmf.0 for ; Fri, 09 Feb 2018 06:39:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=uoVLpF1viDJd1dhbm1gsSsv2I0nfbO3W0XGa+PzcCPU=; b=VPWlYlT+QC/lZpxQrzxjktc4rRoERSK4GOqTyN30vDDa2pjD3qVr5CJZTUJSh/uu+/ VrRu9Y7gT+oKX3K06I3X30i/MGDyyKcSGvsukxC0awi/rd+UnYtHHxSAYLDXCs5QUYRa 1ji04eDF1KWz1N35J2vCO6dTWZe/TOCeED+tY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=uoVLpF1viDJd1dhbm1gsSsv2I0nfbO3W0XGa+PzcCPU=; b=FsYDR4AsEyZIyjqnkjUQlp1zgZwkurNwO4GrpApLTymySoeLLW1RJkOAN9QCgOVqz9 JHL/MzUDbqcbnrkrE/Yz/FwEbaruMESWYTxU9LL160PcYWPNmfXY6jgWat9UpS7+ArwK zanIyay+ZkG88E/FXZDgPH2u0zl2zzsVEcV6bAJItNPaNgUZzxIJsxFjcTcV5SfNFYk1 B1d9V3ncUkfQZw9G+Q5GqznCDEL0jhkMritsyJeawVpElk6S+R5pn2eRqwEuowr6cYEX u+wWypVp9Jg2torDqA2ytsuCwh0SEMwGXI/6h6KpN5m3AYGVGwP+LJ0K59lprfwrIb0W YAnw== X-Gm-Message-State: APf1xPCPF73k6GiyZTfAnK6LqJkIS00jOF2jJn5c6up4FiWbApUGmmHQ jtIJJoahAnpI4+FZmFOzOL0XRA== X-Received: by 10.28.155.66 with SMTP id d63mr2066963wme.132.1518187189179; Fri, 09 Feb 2018 06:39:49 -0800 (PST) Received: from e104803-lin.lan (mail.andrep.de. [217.160.17.100]) by smtp.gmail.com with ESMTPSA id b35sm2552229wra.13.2018.02.09.06.39.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Feb 2018 06:39:48 -0800 (PST) From: Andre Przywara To: Stefano Stabellini , Julien Grall , xen-devel@lists.xenproject.org Date: Fri, 9 Feb 2018 14:38:52 +0000 Message-Id: <20180209143937.28866-5-andre.przywara@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180209143937.28866-1-andre.przywara@linaro.org> References: <20180209143937.28866-1-andre.przywara@linaro.org> Subject: [Xen-devel] [RFC PATCH 04/49] ARM: GICv3: simplify GICv3 redistributor stride handling X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Instead of hard coding the architected redistributor stride into the code, lets use a clear #define to the two values for GICv3 and GICv4 and clarify the algorithm to determine the needed stride value. Signed-off-by: Andre Przywara --- xen/arch/arm/gic-v3.c | 18 ++++++++++-------- xen/include/asm-arm/gic_v3_defs.h | 5 +++++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index bdca77417c..7837d93dc1 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -690,6 +690,15 @@ static int __init gicv3_populate_rdist(void) do { typer = readq_relaxed(ptr + GICR_TYPER); + /* Set the architectural redist size if not overridden by DT. */ + if ( !gicv3.rdist_stride ) + { + if ( typer & GICR_TYPER_VLPIS ) + gicv3.rdist_stride = GICV4_GICR_SIZE; + else + gicv3.rdist_stride = GICV3_GICR_SIZE; + } + if ( (typer >> 32) == aff ) { this_cpu(rbase) = ptr; @@ -732,14 +741,7 @@ static int __init gicv3_populate_rdist(void) if ( gicv3.rdist_regions[i].single_rdist ) break; - if ( gicv3.rdist_stride ) - ptr += gicv3.rdist_stride; - else - { - ptr += SZ_64K * 2; /* Skip RD_base + SGI_base */ - if ( typer & GICR_TYPER_VLPIS ) - ptr += SZ_64K * 2; /* Skip VLPI_base + reserved page */ - } + ptr += gicv3.rdist_stride; } while ( !(typer & GICR_TYPER_LAST) ); } diff --git a/xen/include/asm-arm/gic_v3_defs.h b/xen/include/asm-arm/gic_v3_defs.h index 65c9dc47cf..412e41afed 100644 --- a/xen/include/asm-arm/gic_v3_defs.h +++ b/xen/include/asm-arm/gic_v3_defs.h @@ -18,6 +18,8 @@ #ifndef __ASM_ARM_GIC_V3_DEFS_H__ #define __ASM_ARM_GIC_V3_DEFS_H__ +#include + /* * Additional registers defined in GIC v3. * Common GICD registers are defined in gic.h @@ -68,6 +70,9 @@ #define GICV3_GICD_IIDR_VAL 0x34c #define GICV3_GICR_IIDR_VAL GICV3_GICD_IIDR_VAL +#define GICV3_GICR_SIZE (2 * SZ_64K) +#define GICV4_GICR_SIZE (4 * SZ_64K) + #define GICR_CTLR (0x0000) #define GICR_IIDR (0x0004) #define GICR_TYPER (0x0008)