From patchwork Mon Mar 5 16:03:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 130703 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp2856067lja; Mon, 5 Mar 2018 08:09:02 -0800 (PST) X-Google-Smtp-Source: AG47ELssYDR+kbZxy9UnjcrRuvkCkIm2NrGLorkWn1BnD6z73JQ09B1IyL6CY2eu+NxtkhOJmKUU X-Received: by 10.107.170.14 with SMTP id t14mr17900892ioe.98.1520266039903; Mon, 05 Mar 2018 08:07:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520266039; cv=none; d=google.com; s=arc-20160816; b=EmBcSYGwhGqvpIeLoVaFNjwSRb6Aa6FRr1PmHud3a4FwN1ljGBIYMqvNY5tc9GgdIK gRNr7YsydwIOxTLGxkcFiDjuvG5Mj3pfCgj5x1YtPfni3svXCz4Popha7Ua3CFEIY/Er 5fHzYtCXN6bAi3zaQiWO022Z5SjeTSheVyKTMizBGv7rZCgPK5BbcRWocRUpohilpW4o vFPgIpCgV3+J3XNimXe6lZTSrK8nWX+HKvpn5rpvnxCwxh0yB95FbOH4vV6oIhVcJ142 2KeExHtkNrlDsr62BrlYM7gcg37wRdxDm1Bs92QDWzRB4127CKGOBlJxkWYlE0RsU2S1 ZaYg== 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=3XT0k3U6qvD5udrQlogCgtcAX1RvDncQX9b7d8ibdRg=; b=KYnJ3WD6G2Wlv0fY1qugUgtj7bhb9U2BiiBIJzfR3xOkaOmf0u+PCANCfQCXwXHgRs vdMfFJpvljEt9bSL9Ba47zV4Mc5RUJTBw1ccKtsSPa1JdKGaXSVAeg4OWk7WXFvUUeMD tFCP3A7XHvo0i7mkMmPAlmzSYF40OCg8Fyrdz2Wfy9QdSjAQFbeQySTwHJv2MdCu5IIA KuIxylMXlIV1Phn1lMfK2H/9NbhnfMTeJFkqwkTOMiwZC3T03YSiHvu995/s9z9Kfu5/ WnQAaSNzTXg4z565P6NYKYrJZQOBHShPgRR57PHyIr4jdXsF3g7sRpjnMBrIRCCWpw3U 1kGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fK4MD7O0; 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 j74si3712435ioe.259.2018.03.05.08.07.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 08:07:19 -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=fK4MD7O0; 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 1essbH-00077c-Dc; Mon, 05 Mar 2018 16:04:31 +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 1essbF-000778-Mx for xen-devel@lists.xenproject.org; Mon, 05 Mar 2018 16:04:29 +0000 X-Inumbo-ID: ba9a3a28-208e-11e8-ba59-bc764e045a96 Received: from mail-wr0-x243.google.com (unknown [2a00:1450:400c:c0c::243]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id ba9a3a28-208e-11e8-ba59-bc764e045a96; Mon, 05 Mar 2018 17:03:23 +0100 (CET) Received: by mail-wr0-x243.google.com with SMTP id z12so17844078wrg.4 for ; Mon, 05 Mar 2018 08:04:28 -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=kNBQZsZdRUTjZPmqh/x1L5DIzDnXivy3PFCqMs9+bno=; b=fK4MD7O0TeAsnrsLswZsA0WRh/P5i0MR+0EpowrzaYSMJyxcItjpxOji5BzfEGWBWc 3ci27Q2RCH9Ve8mnBdMH0P+C5nXlvv9rBvBdVRXVhQNeWnoODDeLOAett2jTlaUkSXKs PoN39r6317iVnsSHxF7+PHqC95MaSx4LRwHLc= 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=kNBQZsZdRUTjZPmqh/x1L5DIzDnXivy3PFCqMs9+bno=; b=DS2N/+aQZjT1zmm7W+Y7a4lKLUD6iqpJRmEZT+E0UfzvOru1PXLq9DOX993PHctkQg 6hKOZVSto/MME3/+b648dUJathY5FZEuzV1TO/+f0aClBWl7rWkHA3wuAx55d3BaB7gO 1f+grxr7NA0ObIzyZY+2QkELlHga/ryHU1qnAc5j1OqFv/AfTab8lvvyUd5Ztd9yl0vy p8kxc8iGNvJKjyypbW4zXUkZQcIAHld1HaBb7kTI5CuAJeVG7xR7kYiYSZ7YcivavZEW osyXXBRvgt4W2QRmwxiTIYLAg94ESL9MVJtzQAJp+pxMz6ZWcSkNbV0TcB87hTJWaswM ljCQ== X-Gm-Message-State: APf1xPDtuIZeFjYmARASipn841cW/r+xLP+l6wFMEpc+47fA7ZEGHf3y dfNjD/e4MWn2Xga6+iGJ9noZRQ== X-Received: by 10.223.184.147 with SMTP id i19mr12668401wrf.102.1520265867534; Mon, 05 Mar 2018 08:04:27 -0800 (PST) Received: from e104803-lin.lan (mail.andrep.de. [217.160.17.100]) by smtp.gmail.com with ESMTPSA id y6sm6574381wmy.14.2018.03.05.08.04.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Mar 2018 08:04:27 -0800 (PST) From: Andre Przywara To: Julien Grall , Stefano Stabellini Date: Mon, 5 Mar 2018 16:03:23 +0000 Message-Id: <20180305160415.16760-6-andre.przywara@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180305160415.16760-1-andre.przywara@linaro.org> References: <20180305160415.16760-1-andre.przywara@linaro.org> Cc: xen-devel@lists.xenproject.org Subject: [Xen-devel] [PATCH 05/57] 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 --- Changelog RFC ... v1: - Add Julien's ACK xen/arch/arm/gic-v3.c | 4 ---- xen/arch/arm/vgic-v3.c | 14 ++++++-------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index be1787b39a..02c85e4c0c 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -1164,10 +1164,6 @@ static int gicv3_make_hwdom_dt_node(const struct domain *d, if ( res ) return res; - res = fdt_property_cell(fdt, "redistributor-stride", gicv3.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 d5b34a7d0f..56cc38ffcc 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; @@ -1708,7 +1706,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;