From patchwork Tue Jun 28 16:17:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 71104 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1681373qgy; Tue, 28 Jun 2016 09:19:18 -0700 (PDT) X-Received: by 10.36.39.147 with SMTP id g141mr15322491ita.0.1467130758528; Tue, 28 Jun 2016 09:19:18 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id v70si24940119ioi.97.2016.06.28.09.19.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jun 2016 09:19:18 -0700 (PDT) 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 1bHvhz-0007GP-MT; Tue, 28 Jun 2016 16:17:55 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bHvhy-0007Co-LM for xen-devel@lists.xen.org; Tue, 28 Jun 2016 16:17:54 +0000 Received: from [85.158.137.68] by server-8.bemta-3.messagelabs.com id BC/46-03780-133A2775; Tue, 28 Jun 2016 16:17:53 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRWlGSWpSXmKPExsVysyfVTddwcVG 4wbPtMhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8b37vfsBbuFKl59/cDSwHiFp4uRi0NIYCOj xON1/9ghnNOMEnfuHGXsYuTkYBPQlLjz+RMTiC0iIC1x7fNlsDizgIPEm4/3WEBsYYEoiaWn3 rGB2CwCqhLzPi4Aq+EVcJVY+X0xK4gtISAncfLYZDCbEyi+ZcpPsHohAReJCydusExg5F7AyL CKUaM4tagstUjX0FwvqSgzPaMkNzEzR9fQwFgvN7W4ODE9NScxqVgvOT93EyPQwwxAsIPx5Wn PQ4ySHExKorzfeovChfiS8lMqMxKLM+KLSnNSiw8xynBwKEnwyi4CygkWpaanVqRl5gBDDSYt wcGjJMLrCpLmLS5IzC3OTIdInWJUlBLn3b0QKCEAksgozYNrg4X3JUZZKWFeRqBDhHgKUotyM 0tQ5V8xinMwKgnz+oGM58nMK4Gb/gpoMRPQYtbqfJDFJYkIKakGxmSPyYILWuykDvCV5Jd5PN 6wt3iB7fOnS1nFDd78e7LGQLHRvLJJxYftenmBxXuGzMLtX/Qtj+x0LtxuorhujmaheblZ/PL 1S98tun1oL5u65t8X/fsU9Odl7LRXmcvOW9a14JU6f34sR/W/JJbGNVfPqXu+sz9j+pyn6Lnm uRXr0j5e8JmzVImlOCPRUIu5qDgRAIUv9M1qAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-10.tower-31.messagelabs.com!1467130669!47102581!3 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 55327 invoked from network); 28 Jun 2016 16:17:53 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-10.tower-31.messagelabs.com with SMTP; 28 Jun 2016 16:17:53 -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 490B22F; Tue, 28 Jun 2016 09:18:45 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.215.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 670163F21A; Tue, 28 Jun 2016 09:17:52 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 28 Jun 2016 17:17:19 +0100 Message-Id: <1467130643-23868-14-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1467130643-23868-1-git-send-email-julien.grall@arm.com> References: <1467130643-23868-1-git-send-email-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v5 13/17] xen/arm: Use the typesafes mfn and gfn in map_dev_mmio_region... 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" to avoid mixing machine frame with guest frame. Also drop the prefix start_. Signed-off-by: Julien Grall --- Changes in v4: - Patch added --- xen/arch/arm/mm.c | 2 +- xen/arch/arm/p2m.c | 10 +++++----- xen/include/asm-arm/p2m.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 0e408f8..b5fc034 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1145,7 +1145,7 @@ int xenmem_add_to_physmap_one( if ( extra.res0 ) return -EOPNOTSUPP; - rc = map_dev_mmio_region(d, gfn_x(gfn), 1, idx); + rc = map_dev_mmio_region(d, gfn, 1, _mfn(idx)); return rc; default: diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index f11094e..5ffc3df 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1211,20 +1211,20 @@ int unmap_mmio_regions(struct domain *d, } int map_dev_mmio_region(struct domain *d, - unsigned long start_gfn, + gfn_t gfn, unsigned long nr, - unsigned long mfn) + mfn_t mfn) { int res; - if ( !(nr && iomem_access_permitted(d, mfn, mfn + nr - 1)) ) + if ( !(nr && iomem_access_permitted(d, mfn_x(mfn), mfn_x(mfn) + nr - 1)) ) return 0; - res = map_mmio_regions(d, _gfn(start_gfn), nr, _mfn(mfn)); + res = map_mmio_regions(d, gfn, nr, mfn); if ( res < 0 ) { printk(XENLOG_G_ERR "Unable to map [%#lx - %#lx] in Dom%d\n", - mfn, mfn + nr - 1, d->domain_id); + mfn_x(mfn), mfn_x(mfn) + nr - 1, d->domain_id); return res; } diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index 4752161..8d29eda 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -152,9 +152,9 @@ int unmap_regions_rw_cache(struct domain *d, unsigned long mfn); int map_dev_mmio_region(struct domain *d, - unsigned long start_gfn, + gfn_t gfn, unsigned long nr, - unsigned long mfn); + mfn_t mfn); int guest_physmap_add_entry(struct domain *d, gfn_t gfn,