From patchwork Wed Jan 24 14:35:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 125670 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp456999ljf; Wed, 24 Jan 2018 06:37:40 -0800 (PST) X-Google-Smtp-Source: AH8x227GgrPL4Pf0c+bPripWg6mfrqiYHh9V/Qy6QTwMI+4ke58oMepOoSON30aloZSGFXemg50t X-Received: by 10.107.26.202 with SMTP id a193mr8684958ioa.19.1516804660629; Wed, 24 Jan 2018 06:37:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516804660; cv=none; d=google.com; s=arc-20160816; b=s5xz2EM9b3qcb4WzLSw1CxtaA6j3cMu+YmlrGP2pKOWeVR3BQTH+4NjdUaWkUlyFv1 G8WUV7WaO3wbXr8XweaMtzJz2/Hdjpee9zsrvUq7KMT01IPxOdymaEj+HhLeSkMfm27B 2FouAZQY9fL8HiqqK+8vHjItk3mMQFGe2Ob/a/pZBq3jey4NEFbAatLmLPCrDTBH2EDv YFpQlVKG5eHwrCo2cjR5K066lBoUKPU3l1/EFJbivsfXnFB07cgg7zqsex8JvU1/Hf1W wFpwfPk6yiKWxANkSWgUqNlHiDisvuDsblnO7PjsKkHWyfbOFb0KT52XCqD1Uv3jdleB 4saA== 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=yAmzwuLLCo8MQoFMILtfSUIMjLWutbLcUwhzticnMyI=; b=I4Ho8YegAiwU505Q6Erir+fQbyRyFFVBk+9WMMy3qWsc7QG1+RrvcKhri/hyaiNbo3 feTlCx3WLWCeqoMpZVickAi/8AAF0ll8bRMmpproBJThE2d/+BajfaK1Wll0KMhwDemE Pqw0bwcbhCQFHf39no5HdUkWcjiJ5A+QEIFKR0vxP2my8yJL3R9498G4mjnwmB/HbZAs 1WAa/CNiKQOBKF1NjkaP7wf7W9ltF7zxv6krQEHDerUX5/PHpqChEx4rpmDxXbcLNCSo xawhqiYbistU+m1B/ZYu6lv4YBfAgyabOI7Po+2lSDnuw5/xVZ3eAzj2Pp+CWW+mxh4C bHoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=R+PbVQcv; 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 1si292511itj.89.2018.01.24.06.37.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 06:37:40 -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=R+PbVQcv; 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 1eeM93-00016J-7a; Wed, 24 Jan 2018 14:35:21 +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 1eeM92-000158-0z for xen-devel@lists.xenproject.org; Wed, 24 Jan 2018 14:35:20 +0000 X-Inumbo-ID: c9a7e403-0113-11e8-ba59-bc764e045a96 Received: from mail-wm0-x242.google.com (unknown [2a00:1450:400c:c09::242]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id c9a7e403-0113-11e8-ba59-bc764e045a96; Wed, 24 Jan 2018 15:35:14 +0100 (CET) Received: by mail-wm0-x242.google.com with SMTP id v71so9050780wmv.2 for ; Wed, 24 Jan 2018 06:35:17 -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=IjAi7w8qxTa4bp0P9zBdJ21qsAz+oEtbHGd3p4RFaDs=; b=R+PbVQcvpoUiwR9qCiLfijhuRw/0mNjfq8FAN64Beg80tdKuK+3qYCCGY4bApSBwZj Lu6ni+lJOwCIvho5SiYXCHKbv5V34VvKP8R4XR8GT9IxFD8t1XKeSrGE3QfNLVC540fk R8dqGawzzitgOhN2+cghViLeXaSLVKnreZCes= 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=IjAi7w8qxTa4bp0P9zBdJ21qsAz+oEtbHGd3p4RFaDs=; b=g4U9BTxZL5ONWq7Rn7E7P5PdH1mlWmTy9rzYG0XqRIwF4SlRH9xYq1KYre5UqjuDD5 o18Tko/v8SFVMhd8b0ua7oXcU/2bUwgUMK0IwKt6hcok8OleUMn/DGFcXUuBxuIz7MVM BTQ7+EBP5HUz5nNnct2AgWvWBmT0PpAIUjGApf4JB0y+pt2ekwH7NwAQ6qX/3fV6tzmt uYtDNqTGoGWSHn1fFF5E12eZ4llKIJbvzxI1lAaMPCRm9UqaFUbpTTOckjSUnytKReat +xS6eFX43Jyabk8Emz310mZy1HojxU0FBUjApXo96MiY2EMCvA9gqw5eZy9d3d+xofYq bXOA== X-Gm-Message-State: AKwxytfoQZoZWpw5RMCGGks5DlwUtyngH9KjmJdaOi8ns5+mZ4/C44m5 sxwlzPATgehrJAVUsYrYxjBcqw== X-Received: by 10.28.145.21 with SMTP id t21mr5791921wmd.136.1516804516575; Wed, 24 Jan 2018 06:35:16 -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.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Jan 2018 06:35:16 -0800 (PST) From: Andre Przywara To: Stefano Stabellini , Julien Grall Date: Wed, 24 Jan 2018 14:35:14 +0000 Message-Id: <20180124143517.18469-5-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 4/7] ARM: GICv3: use hardware GICv3 redistributor regions for Dom0 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 code to generate the DT node or MADT table for Dom0 reaches into the domain's VGIC structure to learn the number of redistributor regions and their base addresses. Since those values are copied from the hardware, we can as well use those hardware values directly when setting up the hardware domain. This avoids the hardware GIC code to reference vGIC data structures, making this variable VGIC internal. Signed-off-by: Andre Przywara --- xen/arch/arm/gic-v3.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index 9ad0cd19ef..1c24ecbba7 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -1168,10 +1168,10 @@ static int gicv3_make_hwdom_dt_node(const struct domain *d, if ( res ) return res; - if ( d->arch.vgic.nr_regions > 1 ) + if ( gicv3.rdist_count > 1 ) { res = fdt_property_cell(fdt, "#redistributor-regions", - d->arch.vgic.nr_regions); + gicv3.rdist_count); if ( res ) return res; } @@ -1182,7 +1182,7 @@ static int gicv3_make_hwdom_dt_node(const struct domain *d, * CPU interface and virtual cpu interfaces accessesed as System registers * So cells are created only for Distributor and rdist regions */ - len = len * (d->arch.vgic.nr_regions + 1); + len = len * (gicv3.rdist_count + 1); new_cells = xzalloc_bytes(len); if ( new_cells == NULL ) return -FDT_ERR_XEN(ENOMEM); @@ -1191,9 +1191,9 @@ static int gicv3_make_hwdom_dt_node(const struct domain *d, dt_set_range(&tmp, gic, d->arch.vgic.dbase, SZ_64K); - for ( i = 0; i < d->arch.vgic.nr_regions; i++ ) - dt_set_range(&tmp, gic, d->arch.vgic.rdist_regions[i].base, - d->arch.vgic.rdist_regions[i].size); + for ( i = 0; i < gicv3.rdist_count; i++ ) + dt_set_range(&tmp, gic, gicv3.rdist_regions[i].base, + gicv3.rdist_regions[i].size); res = fdt_property(fdt, "reg", new_cells, len); xfree(new_cells); @@ -1419,13 +1419,13 @@ static int gicv3_make_hwdom_madt(const struct domain *d, u32 offset) /* Add Generic Redistributor */ size = sizeof(struct acpi_madt_generic_redistributor); - for ( i = 0; i < d->arch.vgic.nr_regions; i++ ) + for ( i = 0; i < gicv3.rdist_count; i++ ) { gicr = (struct acpi_madt_generic_redistributor *)(base_ptr + table_len); gicr->header.type = ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR; gicr->header.length = size; - gicr->base_address = d->arch.vgic.rdist_regions[i].base; - gicr->length = d->arch.vgic.rdist_regions[i].size; + gicr->base_address = gicv3.rdist_regions[i].base; + gicr->length = gicv3.rdist_regions[i].size; table_len += size; } @@ -1438,8 +1438,7 @@ static unsigned long gicv3_get_hwdom_extra_madt_size(const struct domain *d) { unsigned long size; - size = sizeof(struct acpi_madt_generic_redistributor) - * d->arch.vgic.nr_regions; + size = sizeof(struct acpi_madt_generic_redistributor) * gicv3.rdist_count; size += sizeof(struct acpi_madt_generic_translator) * vgic_v3_its_count(d);