From patchwork Tue Jul 12 13:59:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 71846 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp493001qga; Tue, 12 Jul 2016 07:03:50 -0700 (PDT) X-Received: by 10.107.6.233 with SMTP id f102mr3386115ioi.55.1468332219661; Tue, 12 Jul 2016 07:03:39 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id 98si3823837ioj.204.2016.07.12.07.03.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jul 2016 07:03:39 -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 1bMyEI-0007eT-J5; Tue, 12 Jul 2016 14:00:06 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bMyEH-0007Sc-9K for xen-devel@lists.xen.org; Tue, 12 Jul 2016 14:00:05 +0000 Received: from [193.109.254.147] by server-1.bemta-14.messagelabs.com id FA/DB-14454-4E7F4875; Tue, 12 Jul 2016 14:00:04 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTffh95Z wg2VzdCyWfFzM4sDocXT3b6YAxijWzLyk/IoE1ozpDX/YC54LVyzumM3WwHiOt4uRi0NIYBOj xOR5U1ghnNOMEhdaL7J0MXJysAloStz5/IkJxBYRkJa49vkyI4jNLOAg8ebjPaAaDg5hgSiJP U1OIGEWAVWJNes72UFsXgFXiY8vLzGD2BICchInj01mBbE5geJfp58EGyMk4CJxYdlX1gmM3A sYGVYxahSnFpWlFukaGuklFWWmZ5TkJmbm6BoamujlphYXJ6an5iQmFesl5+duYgT6lwEIdjC eneZ8iFGSg0lJlLeZuSVciC8pP6UyI7E4I76oNCe1+BCjDAeHkgTvuW9AOcGi1PTUirTMHGCg waQlOHiURHhfg6R5iwsSc4sz0yFSpxgVpcR5J4AkBEASGaV5cG2w4L7EKCslzMsIdIgQT0FqU W5mCar8K0ZxDkYlYd5jIFN4MvNK4Ka/AlrMBLS41qEZZHFJIkJKqoExfkZaVdG9oEN7s/V2ql b4muTq9H/eGxv6vF13R0zH9DopuRjdbbuv3Dyl+4ax/sIuVbNDgkIdbLouIXLvswW4sz+s+G5 0VWJWv74yf0l797GDEqlbavke+z081vVsutkxqwN/Pe+w6S5pL52oN+NlWrbdz9Li74vnSV0+ 39r0qHX2acZYqw1KLMUZiYZazEXFiQA/ViWRaQIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-16.tower-27.messagelabs.com!1468332001!53282724!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.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 16240 invoked from network); 12 Jul 2016 14:00:01 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-16.tower-27.messagelabs.com with SMTP; 12 Jul 2016 14:00: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 ADEC9AB4; Tue, 12 Jul 2016 07:01:04 -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 1C82C3F213; Tue, 12 Jul 2016 06:59:59 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Jul 2016 14:59:31 +0100 Message-Id: <1468331975-27331-11-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1468331975-27331-1-git-send-email-julien.grall@arm.com> References: <1468331975-27331-1-git-send-email-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v7 10/14] 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 v6: - Qualify what is being mapped - Use PRI_mfn Changes in v4: - Patch added --- xen/arch/arm/mm.c | 2 +- xen/arch/arm/p2m.c | 12 ++++++------ xen/include/asm-arm/p2m.h | 4 ++-- 3 files changed, 9 insertions(+), 9 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..5fe1b91 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); + printk(XENLOG_G_ERR "Unable to map MFNs [%#"PRI_mfn" - %#"PRI_mfn" in Dom%d\n", + 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,