From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v7 04/10] arch/arm: let map_mmio_regions() use start and count Date: Mon, 05 May 2014 19:55:18 +0100 Message-ID: <5367DE96.6050103@linaro.org> References: <1399305254-3695-1-git-send-email-avanzini.arianna@gmail.com> <1399305254-3695-5-git-send-email-avanzini.arianna@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1399305254-3695-5-git-send-email-avanzini.arianna@gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Arianna Avanzini , xen-devel@lists.xen.org Cc: julien.grall@citrix.com, paolo.valente@unimore.it, keir@xen.org, stefano.stabellini@eu.citrix.com, tim@xen.org, dario.faggioli@citrix.com, Ian.Jackson@eu.citrix.com, Ian.Campbell@eu.citrix.com, etrudeau@broadcom.com, JBeulich@suse.com, andrew.cooper3@citrix.com, viktor.kleinik@globallogic.com List-Id: xen-devel@lists.xenproject.org Hi Arianna, Thank you for the patch. On 05/05/14 16:54, Arianna Avanzini wrote: > Currently, the arguments given to the function map_mmio_regions() to > describe the memory range to be mapped are the start and end page frame > numbers of the range to be mapped. However, this could give rise to > issues due to the range being inclusive or exclusive of the end gfn > given as parameter. This commit changes the interface of the function > to accept the start gfn and the number of gfns to be mapped. > > Signed-off-by: Arianna Avanzini > Cc: Dario Faggioli > Cc: Paolo Valente > Cc: Stefano Stabellini > Cc: Julien Grall > Cc: Ian Campbell > Cc: Jan Beulich > Cc: Keir Fraser > Cc: Tim Deegan > Cc: Ian Jackson > Cc: Andrew Cooper > Cc: Eric Trudeau > Cc: Viktor Kleinik > --- > xen/arch/arm/domain_build.c | 2 +- > xen/arch/arm/gic.c | 11 +++-------- > xen/arch/arm/p2m.c | 4 ++-- > xen/arch/arm/platforms/exynos5.c | 6 ++---- > xen/arch/arm/platforms/omap5.c | 12 ++++-------- > xen/arch/arm/platforms/xgene-storm.c | 2 +- > xen/include/asm-arm/p2m.h | 7 ++++--- > 7 files changed, 17 insertions(+), 27 deletions(-) > > diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c > index fc3f110..23874a8 100644 > --- a/xen/arch/arm/domain_build.c > +++ b/xen/arch/arm/domain_build.c > @@ -753,7 +753,7 @@ static int map_device(struct domain *d, const struct dt_device_node *dev) > } > res = map_mmio_regions(d, > paddr_to_pfn(addr & PAGE_MASK), > - paddr_to_pfn_aligned(addr + size), > + size / PAGE_SIZE + (size % PAGE_SIZE ? 1 : 0), Would not it be easier to use paddr_to_pfn(PAGE_ALIGN(size))? > return 0; > diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c > index f3662fd..a7f4c8b 100644 > --- a/xen/arch/arm/platforms/xgene-storm.c > +++ b/xen/arch/arm/platforms/xgene-storm.c > @@ -48,7 +48,7 @@ static int map_one_mmio(struct domain *d, const char *what, > printk("Additional MMIO %"PRIpaddr"-%"PRIpaddr" (%s)\n", > start, end, what); > ret = map_mmio_regions(d, paddr_to_pfn(start), > - paddr_to_pfn_aligned(end), > + paddr_to_pfn_aligned(end) - paddr_to_pfn(start) + 1, I would directly give the pfn in argument of map_one_mmio. Regards, -- Julien Grall