From patchwork Fri Feb 9 14:38:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 127851 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp679987ljc; Fri, 9 Feb 2018 06:42:22 -0800 (PST) X-Google-Smtp-Source: AH8x224dMaNPsTPgUaGiCgwbsKaA0WJswK6h9u9GvbcIGzYYp8MgRMgQedykErYZJ1orqOmamQWS X-Received: by 10.107.176.14 with SMTP id z14mr3141491ioe.8.1518187342394; Fri, 09 Feb 2018 06:42:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518187342; cv=none; d=google.com; s=arc-20160816; b=q0POHpwBvKvdbmN/jdfUXkEbzaRfOkx/CXh5tUfRJoOUkbNs4S3JDuYA+KUCaA/3ns JJDwHGs3kcmDE2XqudvAeHqxUvHs4wi0nmd3vOJ1iS7p+Z9mQsr47ZzgjCj2goDxXG51 n1r0oCrj3SDFO6wM9KqVF7QlZ4kBE6zS1tD6zmyWbbJjunMX5o1GDMb2i22RoRKYmSsL UaN+m5kvw3dkFNB+4/byVtgeCNulEVycKlvglESuHHCBbOI/4T2UrWixKRcIhr+6UoAQ 53O/Vrn3oP2rjdFfjEs2XmvtQO8J1/66149Pts9IWEgU/Vpx2CU5+KJOP5YMc9tQ/39N 6iDw== 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=at4BE4HMA7Q8dthVhqOWQuBF7b2V3/YertPfsPvVzKo=; b=RquEay1ECeH9h6+2JuvuQdYOoh2a0s2Yx1Olkv65sA1vhoLJfKLZhMp1vSOSgCDEpV 5MM0H6eINwoAf/H3h3xOrMVSHvcLnzIWvsyY6lD7Rp7A7CDiBXIqM+deGH0KUa5neV4U s5+ivK06HTwE37NhaWhnH0M6fVXEJeoeGrYbtiC2S13UOfrDeuqP/JZt9+8wFz2hDISV 4nPcNbFny6wWLXgEoDcQ6mY9htUNVAT0gF54lGhs2X/3yaBrQuM/bt930bDKE/HWRgBc 5v7bIJXYUzGa9E7E6USbao+YxhP3nRRL7MiHu/67DPj9eRT3fbAw+fKAdh1mvda3Sdh8 A4dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Uign/kH9; 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 j11si1637716iof.88.2018.02.09.06.42.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Feb 2018 06:42:22 -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=Uign/kH9; 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 1ek9qE-00083A-33; Fri, 09 Feb 2018 14:39:54 +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 1ek9qC-00080k-LM for xen-devel@lists.xenproject.org; Fri, 09 Feb 2018 14:39:52 +0000 X-Inumbo-ID: 04da154f-0da7-11e8-ba59-bc764e045a96 Received: from mail-wm0-x244.google.com (unknown [2a00:1450:400c:c09::244]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 04da154f-0da7-11e8-ba59-bc764e045a96; Fri, 09 Feb 2018 15:39:23 +0100 (CET) Received: by mail-wm0-x244.google.com with SMTP id j21so4253983wmh.1 for ; Fri, 09 Feb 2018 06:39:51 -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=2wa0uv65g6PdsTL604ZVuIDVHONult9LJ5R3l3gM2mU=; b=Uign/kH9yyOpDqniOAJTsi0cVDpdGv+q0tJU5ZjiOE7AFdrNbEhAxGsRs/mqRAfDrV YsLiMKAtYYr3WVi7JW8Y8i0S4zDYb6V8miKvI99AR6pVr7EVCctAOuQs81fRoZ/o76cr T6d5cI4qKsjOXhRT2dXeGomi1RrcJ6CFzd8YI= 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=2wa0uv65g6PdsTL604ZVuIDVHONult9LJ5R3l3gM2mU=; b=oTS1/md95p/brpQlChaiMZmLMYYpuJ8FTmr2y+an9Bwcg58/Wi/ZYzCyZBMv+4s6u9 TwD7W1JsUYS48mGWOXR7oT1ZhENVcQUltKkBzk9pBdICUxdG5j71k6yGVW5N+uhVkmY+ mgK6MSN40Y/DQtgzkwfa4RIGYu+phN173EdGnb9pQ98FndID6kLiATcxhJ4ip9zuIqzp fgJpG5fjjn7uMbQR7IqdnbF7z4WuZFWnqSZofEk/JyjxHR66yo7C22Ra7/Wy7TCldVMC Fvjt8uVWWGeYFKmIa5jjbYra4+SpvNBqBDI9UX9H+8cfLcrL21ic7hUkkBoxy23ilwlA knOA== X-Gm-Message-State: APf1xPDrul86+Xyg/pXwjn6dsshMnQReYej5c6r1jioPZZjJ01bzKyu2 9x97t/eESR43lfuu9qYvu7BdjJwuGYA= X-Received: by 10.28.241.4 with SMTP id p4mr2088685wmh.103.1518187190478; Fri, 09 Feb 2018 06:39:50 -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.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Feb 2018 06:39:49 -0800 (PST) From: Andre Przywara To: Stefano Stabellini , Julien Grall , xen-devel@lists.xenproject.org Date: Fri, 9 Feb 2018 14:38:53 +0000 Message-Id: <20180209143937.28866-6-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 05/49] ARM: vGICv3: always use architected redist stride 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" The redistributor-stride property in a GICv3 DT node is only there to cover broken platforms where this value deviates from the architected one. Since we emulate the GICv3 distributor even for Dom0, we don't need to copy the broken behaviour. All the special handling for Dom0s using GICv3 is just for using the hardware's memory map, which is unaffected by the redistributor stride - it can never be smaller than the architected two pages. Remove the redistributor-stride property from Dom0's DT node and also remove the code that tried to reuse the hardware value for Dom0's GICv3 emulation. Signed-off-by: Andre Przywara --- xen/arch/arm/gic-v3.c | 5 ----- xen/arch/arm/vgic-v3.c | 14 ++++++-------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index 7837d93dc1..02c85e4c0c 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -1164,11 +1164,6 @@ static int gicv3_make_hwdom_dt_node(const struct domain *d, if ( res ) return res; - res = fdt_property_cell(fdt, "redistributor-stride", - d->arch.vgic.rdist_stride); - if ( res ) - return res; - res = fdt_property_cell(fdt, "#redistributor-regions", gicv3.rdist_count); if ( res ) return res; diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c index 12338c6b21..e45bbc6dcf 100644 --- a/xen/arch/arm/vgic-v3.c +++ b/xen/arch/arm/vgic-v3.c @@ -1024,10 +1024,9 @@ static struct vcpu *get_vcpu_from_rdist(struct domain *d, paddr_t gpa, uint32_t *offset) { struct vcpu *v; - uint32_t stride = d->arch.vgic.rdist_stride; unsigned int vcpu_id; - vcpu_id = region->first_cpu + ((gpa - region->base) / stride); + vcpu_id = region->first_cpu + ((gpa - region->base) / GICV3_GICR_SIZE); if ( unlikely(vcpu_id >= d->max_vcpus) ) return NULL; @@ -1586,7 +1585,6 @@ static int vgic_v3_vcpu_init(struct vcpu *v) /* Convenient alias */ struct domain *d = v->domain; - uint32_t rdist_stride = d->arch.vgic.rdist_stride; /* * Find the region where the re-distributor lives. For this purpose, @@ -1602,11 +1600,11 @@ static int vgic_v3_vcpu_init(struct vcpu *v) /* Get the base address of the redistributor */ rdist_base = region->base; - rdist_base += (v->vcpu_id - region->first_cpu) * rdist_stride; + rdist_base += (v->vcpu_id - region->first_cpu) * GICV3_GICR_SIZE; /* Check if a valid region was found for the re-distributor */ if ( (rdist_base < region->base) || - ((rdist_base + rdist_stride) > (region->base + region->size)) ) + ((rdist_base + GICV3_GICR_SIZE) > (region->base + region->size)) ) { dprintk(XENLOG_ERR, "d%u: Unable to find a re-distributor for VCPU %u\n", @@ -1622,7 +1620,7 @@ static int vgic_v3_vcpu_init(struct vcpu *v) * VGIC_V3_RDIST_LAST flags. * Note that we are assuming max_vcpus will never change. */ - last_cpu = (region->size / rdist_stride) + region->first_cpu - 1; + last_cpu = (region->size / GICV3_GICR_SIZE) + region->first_cpu - 1; if ( v->vcpu_id == last_cpu || (v->vcpu_id == (d->max_vcpus - 1)) ) v->arch.vgic.flags |= VGIC_V3_RDIST_LAST; @@ -1693,7 +1691,7 @@ static int vgic_v3_domain_init(struct domain *d) /* Set the first CPU handled by this region */ d->arch.vgic.rdist_regions[i].first_cpu = first_cpu; - first_cpu += size / d->arch.vgic.rdist_stride; + first_cpu += size / GICV3_GICR_SIZE; } d->arch.vgic.intid_bits = vgic_v3_hw.intid_bits; @@ -1705,7 +1703,7 @@ static int vgic_v3_domain_init(struct domain *d) d->arch.vgic.rdist_stride = GUEST_GICV3_RDIST_STRIDE; /* The first redistributor should contain enough space for all CPUs */ - BUILD_BUG_ON((GUEST_GICV3_GICR0_SIZE / GUEST_GICV3_RDIST_STRIDE) < MAX_VIRT_CPUS); + BUILD_BUG_ON((GUEST_GICV3_GICR0_SIZE / GICV3_GICR_SIZE) < MAX_VIRT_CPUS); d->arch.vgic.rdist_regions[0].base = GUEST_GICV3_GICR0_BASE; d->arch.vgic.rdist_regions[0].size = GUEST_GICV3_GICR0_SIZE; d->arch.vgic.rdist_regions[0].first_cpu = 0;