From patchwork Tue Jan 17 15:52:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 91684 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp557254qgi; Tue, 17 Jan 2017 07:54:57 -0800 (PST) X-Received: by 10.107.136.31 with SMTP id k31mr37371794iod.112.1484668497679; Tue, 17 Jan 2017 07:54:57 -0800 (PST) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id u70si12686173itb.66.2017.01.17.07.54.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Jan 2017 07:54:57 -0800 (PST) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.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 1cTW4G-0001wH-0q; Tue, 17 Jan 2017 15:53:04 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cTW4E-0001w8-SL for xen-devel@lists.xen.org; Tue, 17 Jan 2017 15:53:02 +0000 Received: from [193.109.254.147] by server-5.bemta-6.messagelabs.com id D8/93-11476-EDD3E785; Tue, 17 Jan 2017 15:53:02 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrHLMWRWlGSWpSXmKPExsVysyfVTfeubV2 EwfFuTYslHxezODB6HN39mymAMYo1My8pvyKBNaPxrHPBDrmK5492MzcwnhHrYuTiEBLYxCix YMs2RgjnNKPEvct32LsYOTnYBDQl7nz+xARiiwhIS1z7fJkRxGYWcJB48/EeC4gtLOAjseHGH jCbRUBVYvr5O6wgNq+Ai8Tq7ffA5kgIyEmcPDaZdQIj5wJGhlWMGsWpRWWpRbpGRnpJRZnpGS W5iZk5uoYGZnq5qcXFiempOYlJxXrJ+bmbGIH+YgCCHYxr5gceYpTkYFIS5e14XBshxJeUn1K ZkVicEV9UmpNafIhRhoNDSYKXB+h/IcGi1PTUirTMHGDgwKQlOHiURHhf2ACleYsLEnOLM9Mh UqcYFaXEeXeAJARAEhmleXBtsGC9xCgrJczLCHSIEE9BalFuZgmq/CtGcQ5GJWHezSBTeDLzS uCmvwJazAS0+LpONcjikkSElFQDY2dH4pqtMlb525du0JduvKnLUZPYzirwKmVdpe1u5snM67 eyLXpj9fGjQv7SqF/lkz5c0N/8cc5DQ0XH8C3nNh7tvrBGml1a+AWnLN/SaRc2Me5epX3Nt/I I89XMyOATcTt4z690SVE4sON2/p4qiSmx5omPuK15vtm0z1zjsCqZZ53AK75Dr5RYijMSDbWY i4oTATSOGCJRAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-3.tower-27.messagelabs.com!1484668381!82059822!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31171 invoked from network); 17 Jan 2017 15:53:01 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-3.tower-27.messagelabs.com with SMTP; 17 Jan 2017 15:53:01 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 05941707; Tue, 17 Jan 2017 07:53:00 -0800 (PST) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.218.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 689C23F3D6; Tue, 17 Jan 2017 07:52:59 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 17 Jan 2017 15:52:53 +0000 Message-Id: <1484668373-26722-1-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 Cc: Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH] xen/arm: Don't mix GFN and MFN when using iomem_deny_access X-BeenThere: xen-devel@lists.xen.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.xen.org Sender: "Xen-devel" iomem_deny_access is working on MFN and not GFN. Make it clear by renaming the local variables. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- xen/arch/arm/domain_build.c | 6 +++--- xen/arch/arm/gic-v2.c | 18 +++++++++--------- xen/arch/arm/gic-v3.c | 18 +++++++++--------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 07b868d..63301e6 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1373,7 +1373,7 @@ static int acpi_iomem_deny_access(struct domain *d) { acpi_status status; struct acpi_table_spcr *spcr = NULL; - unsigned long gfn; + unsigned long mfn; int rc; /* Firstly permit full MMIO capabilities. */ @@ -1391,9 +1391,9 @@ static int acpi_iomem_deny_access(struct domain *d) return -EINVAL; } - gfn = spcr->serial_port.address >> PAGE_SHIFT; + mfn = spcr->serial_port.address >> PAGE_SHIFT; /* Deny MMIO access for UART */ - rc = iomem_deny_access(d, gfn, gfn + 1); + rc = iomem_deny_access(d, mfn, mfn + 1); if ( rc ) return rc; diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c index 9245e7d..cd8e504 100644 --- a/xen/arch/arm/gic-v2.c +++ b/xen/arch/arm/gic-v2.c @@ -991,26 +991,26 @@ static void __init gicv2_dt_init(void) static int gicv2_iomem_deny_access(const struct domain *d) { int rc; - unsigned long gfn, nr; + unsigned long mfn, nr; - gfn = dbase >> PAGE_SHIFT; - rc = iomem_deny_access(d, gfn, gfn + 1); + mfn = dbase >> PAGE_SHIFT; + rc = iomem_deny_access(d, mfn, mfn + 1); if ( rc ) return rc; - gfn = hbase >> PAGE_SHIFT; - rc = iomem_deny_access(d, gfn, gfn + 1); + mfn = hbase >> PAGE_SHIFT; + rc = iomem_deny_access(d, mfn, mfn + 1); if ( rc ) return rc; - gfn = cbase >> PAGE_SHIFT; + mfn = cbase >> PAGE_SHIFT; nr = DIV_ROUND_UP(csize, PAGE_SIZE); - rc = iomem_deny_access(d, gfn, gfn + nr); + rc = iomem_deny_access(d, mfn, mfn + nr); if ( rc ) return rc; - gfn = vbase >> PAGE_SHIFT; - return iomem_deny_access(d, gfn, gfn + nr); + mfn = vbase >> PAGE_SHIFT; + return iomem_deny_access(d, mfn, mfn + nr); } #ifdef CONFIG_ACPI diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index 12775f5..955591b 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -1238,37 +1238,37 @@ static void __init gicv3_dt_init(void) static int gicv3_iomem_deny_access(const struct domain *d) { int rc, i; - unsigned long gfn, nr; + unsigned long mfn, nr; - gfn = dbase >> PAGE_SHIFT; + mfn = dbase >> PAGE_SHIFT; nr = DIV_ROUND_UP(SZ_64K, PAGE_SIZE); - rc = iomem_deny_access(d, gfn, gfn + nr); + rc = iomem_deny_access(d, mfn, mfn + nr); if ( rc ) return rc; for ( i = 0; i < gicv3.rdist_count; i++ ) { - gfn = gicv3.rdist_regions[i].base >> PAGE_SHIFT; + mfn = gicv3.rdist_regions[i].base >> PAGE_SHIFT; nr = DIV_ROUND_UP(gicv3.rdist_regions[i].size, PAGE_SIZE); - rc = iomem_deny_access(d, gfn, gfn + nr); + rc = iomem_deny_access(d, mfn, mfn + nr); if ( rc ) return rc; } if ( cbase != INVALID_PADDR ) { - gfn = cbase >> PAGE_SHIFT; + mfn = cbase >> PAGE_SHIFT; nr = DIV_ROUND_UP(csize, PAGE_SIZE); - rc = iomem_deny_access(d, gfn, gfn + nr); + rc = iomem_deny_access(d, mfn, mfn + nr); if ( rc ) return rc; } if ( vbase != INVALID_PADDR ) { - gfn = vbase >> PAGE_SHIFT; + mfn = vbase >> PAGE_SHIFT; nr = DIV_ROUND_UP(csize, PAGE_SIZE); - return iomem_deny_access(d, gfn, gfn + nr); + return iomem_deny_access(d, mfn, mfn + nr); } return 0;