From patchwork Wed Jan 24 14:35:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 125671 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp457005ljf; Wed, 24 Jan 2018 06:37:41 -0800 (PST) X-Google-Smtp-Source: AH8x225WMsZo5iU7MY89R6297w8QE4RBrpODDsSTQBcSA+43/oyHmQgEZn5vnLxt2QlywG9uq8hu X-Received: by 10.107.13.143 with SMTP id 137mr8349300ion.265.1516804661070; Wed, 24 Jan 2018 06:37:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516804661; cv=none; d=google.com; s=arc-20160816; b=DzmD6BXYJp9KTW1jXSORbaXnW9gAQAEaVlXDKe4ubdNUB8kCQ/znjBVJLQyRI2gbEd 0agGOaBlZ2BvN8O77qYCWNVjRgnATyY+hr12qNvpz9WOzQQcs+oMRKcvQIUnTwQUrcYC +k9VETDAyY2Ky67r3wkVDhpBBSgElfbZm5kNz4h9UPoguHkbFNlh3mh01yupMsQYdrmT d1UugRL7ytWz0seKY2wCuU8EP+87A/O1eKmZr+rhjQwY3iv2VivLS2seHz1c2fE8ouRh /HbNf/ZHakVdnVlOMamEQd2IKh1ucoj8OYhSzeEcWQIQKvNYZTSjNr32q2tDb4yE9r3E OT/Q== 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:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=CmE32l0MxkUd9/tQNrRomYuaUkJQmE/gtW//OQw7fZQ=; b=PberrCV10Y27p2hq6ih9eWggst0XDHLd6iw5NMh884/Ob6S74gCy0KxfQyHp2c2x26 GvW5Cl636e2PViXX+XuNVvbsoCLXXQpM+/e6w3zjFbrmGuiXylgfgJKZVzY5G21zD2iQ cNrF7vyooDbeWSzVPx1Lri1XeXwj/p8a0XyEhqto0BpeVa8o/NX4FwVIocV2KUiGMdmG aVM5w2Zzq3OIVePCreETCWY07HWk1mrdtQdn0+f5oZbVVqNrk5bWtoY/DGB9AmcrrDkz Oszzv5O+enEu8Nh3unljmno9VWkQORJ5KDyZzfBl/jrwIK+nyxkL0H9M7bLFOEUolVYB mKGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=TORzvEsA; 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 p74si289398iod.339.2018.01.24.06.37.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 06:37:41 -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=TORzvEsA; 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 1eeM95-00019b-TP; Wed, 24 Jan 2018 14:35:23 +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 1eeM93-00017Q-Un for xen-devel@lists.xenproject.org; Wed, 24 Jan 2018 14:35:21 +0000 X-Inumbo-ID: cace189f-0113-11e8-ba59-bc764e045a96 Received: from mail-wr0-x244.google.com (unknown [2a00:1450:400c:c0c::244]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id cace189f-0113-11e8-ba59-bc764e045a96; Wed, 24 Jan 2018 15:35:16 +0100 (CET) Received: by mail-wr0-x244.google.com with SMTP id 36so4283869wrh.1 for ; Wed, 24 Jan 2018 06:35:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FVbdtoUVuq1WtjPSxIB9MQuDDJFs7LRF5SdOVSMEbyQ=; b=TORzvEsAmQDXBK9qepHtAYYodBcJ8xIuotnA83HE+3xJ1hwv21m00e8C3MuKaKdPQJ W5P8aAfsrlZoqPoQX+Xz3MrmhgtFowv2wtMwYnzS8NDVk5jZllNJbTuDRdWvLynot8ge 1xYcVepe0Cjp0AEzn6MXhtu23dE8WFm7F3Sw4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FVbdtoUVuq1WtjPSxIB9MQuDDJFs7LRF5SdOVSMEbyQ=; b=EQHREHpDbqOABZVXOxuxQEQkaLulNwxdYkRh+5IC8CSGo9WGxJ3jdl9huldkPlmwyW acdYZZRfcot/WqT8/5S3aOS/XxKfTsDAlwlaGK7pHpQwhjpRAhrJ2EKfk8xImiPuDuh8 typW3SZuGymvMLXbl4qAJc5MLm6Mt5pUXJxJovS5uyvc1IPnI2+nEl0dCuf1mkJTnMmn I5KkNsOQXlRmsatFQQGKADRAGyDjC3tn7Jk7x7O04I/d3/MARijXLB/OiRgSg7t5zZ9I 2yY48Fd/PgNUpf6VhYVBW/WfHTFvWo1gcZD4Ocgzd8QLnwB4mGN1VvzT5WzYQH10ysd1 gnjQ== X-Gm-Message-State: AKwxytcyDGfumO6IUr5XFTcKkzrpbdCOgYDWjjt0oT4snNTMoogHr95l xw8unxYxLg3DrooIQDMtKjKaLSTRYrw= X-Received: by 10.223.135.236 with SMTP id c41mr5618662wrc.7.1516804518470; Wed, 24 Jan 2018 06:35:18 -0800 (PST) Received: from e104803-lin.lan (mail.andrep.de. [217.160.17.100]) by smtp.gmail.com with ESMTPSA id l9sm3267923wrb.91.2018.01.24.06.35.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Jan 2018 06:35:18 -0800 (PST) From: Andre Przywara To: Stefano Stabellini , Julien Grall Date: Wed, 24 Jan 2018 14:35:16 +0000 Message-Id: <20180124143517.18469-7-andre.przywara@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180124143517.18469-1-andre.przywara@linaro.org> References: <20180124143517.18469-1-andre.przywara@linaro.org> Cc: xen-devel@lists.xenproject.org Subject: [Xen-devel] [PATCH 6/7] 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 Acked-by: Julien Grall --- 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 2893c66492..1684d9cf1b 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -1165,11 +1165,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; - if ( gicv3.rdist_count > 1 ) { res = fdt_property_cell(fdt, "#redistributor-regions", diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c index 7d3ea171b4..b4159317dd 100644 --- a/xen/arch/arm/vgic-v3.c +++ b/xen/arch/arm/vgic-v3.c @@ -1030,10 +1030,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; @@ -1594,7 +1593,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, @@ -1610,11 +1608,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", @@ -1630,7 +1628,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; @@ -1701,7 +1699,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; @@ -1713,7 +1711,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;