From patchwork Mon Jun 27 16:54:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 70944 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1167649qgy; Mon, 27 Jun 2016 09:56:46 -0700 (PDT) X-Received: by 10.36.80.139 with SMTP id m133mr10115998itb.63.1467046594185; Mon, 27 Jun 2016 09:56:34 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id t94si18147011ioi.66.2016.06.27.09.56.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jun 2016 09:56:34 -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 1bHZo1-0005lf-61; Mon, 27 Jun 2016 16:54:41 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bHZnz-0005hu-6w for xen-devel@lists.xen.org; Mon, 27 Jun 2016 16:54:39 +0000 Received: from [193.109.254.147] by server-1.bemta-14.messagelabs.com id 0F/56-14454-E4A51775; Mon, 27 Jun 2016 16:54:38 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRWlGSWpSXmKPExsVysyfVTdc3qjD coL/R0GLJx8UsDoweR3f/ZgpgjGLNzEvKr0hgzTg16R1rwW6hilObTrE2MF7h6WLk4hAS2MQo seXtTyYI5zSjxPtP71m6GDk52AQ0Je58/sQEYosISEtc+3yZEcRmFgiTuP1mF5gtLBAlsbnnE Vg9i4CqxIRtk1lBbF4BF4m7ffvBaiQE5CROHoOIcwLF915YygxiCwk4Sxyc9p19AiP3AkaGVY waxalFZalFuoZGeklFmekZJbmJmTm6hoYmermpxcWJ6ak5iUnFesn5uZsYgR5mAIIdjGenOR9 ilORgUhLl3fYoN1yILyk/pTIjsTgjvqg0J7X4EKMMB4eSBG9SZGG4kGBRanpqRVpmDjDUYNIS HDxKIrwmIGne4oLE3OLMdIjUKUZFKXFeJZCEAEgiozQPrg0W3pcYZaWEeRmBDhHiKUgtys0sQ ZV/xSjOwagkzNsOMoUnM68EbvoroMVMQItZq/NBFpckIqSkGhg9/LV7mjdsy7xcpr7nXcXizD 3Ol08emPdy6v+G7BVe/22eLyh8sn7/jXdbNymZuCbv7A19ynDiQIK5e7mR9mc/12dX9lwq2ax +ZctE92xdjddHnunKralrWM70fqXFrCJt31esvvc19wYHrTn2kv35a97ahDCXgLsH793MrV5j 5X3pZ+GOCWlCSizFGYmGWsxFxYkASk+drGoCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-16.tower-27.messagelabs.com!1467046477!50361032!1 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 44943 invoked from network); 27 Jun 2016 16:54:37 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-16.tower-27.messagelabs.com with SMTP; 27 Jun 2016 16:54:37 -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 74ED3523; Mon, 27 Jun 2016 09:55:28 -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 460783F246; Mon, 27 Jun 2016 09:54:36 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 27 Jun 2016 17:54:08 +0100 Message-Id: <1467046452-1261-13-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1467046452-1261-1-git-send-email-julien.grall@arm.com> References: <1467046452-1261-1-git-send-email-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org, wei.chen@linaro.org Subject: [Xen-devel] [PATCH v4 12/16] 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 685dc94..faadebf 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,