This was recently (re?)introduced on x86 in 26447:f831d8dcf18f and is now used in generic code (specifically tmem in 26454:38847c15d8cd). This fixes the build on ARM. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Cc: Jan Beulich <JBeulich@suse.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Cc: Tim Deegan <tim@xen.org> --- xen/arch/arm/mm.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 9c5c334..7621d1b 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -208,6 +208,18 @@ void unmap_domain_page(const void *va) local_irq_restore(flags); } +unsigned long domain_page_map_to_mfn(const void *va) +{ + lpae_t *map = xen_second + second_linear_offset(DOMHEAP_VIRT_START); + int slot = ((unsigned long) va - DOMHEAP_VIRT_START) >> SECOND_SHIFT; + unsigned long offset = ((unsigned long)va>>THIRD_SHIFT) & LPAE_ENTRY_MASK; + + ASSERT(slot >= 0 && slot < DOMHEAP_ENTRIES); + ASSERT(map[slot].pt.avail != 0); + + return map[slot].pt.base + offset; +} + void __init arch_init_memory(void) { /* -- 1.7.9.1
>>> On 28.01.13 at 14:09, Ian Campbell <ian.campbell@citrix.com> wrote: > This was recently (re?)introduced on x86 in 26447:f831d8dcf18f and is > now used in generic code (specifically tmem in 26454:38847c15d8cd). > > This fixes the build on ARM.I''m sorry for that; me not noticing was caused by working on a tree where the ARM build was already broken before those patches. Which reminds me: IanJ - any chance of introducing a build-only (for the time being) test for ARM? Jan> Signed-off-by: Ian Campbell <ian.campbell@citrix.com> > Cc: Jan Beulich <JBeulich@suse.com> > Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > Cc: Tim Deegan <tim@xen.org> > --- > xen/arch/arm/mm.c | 12 ++++++++++++ > 1 files changed, 12 insertions(+), 0 deletions(-) > > diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c > index 9c5c334..7621d1b 100644 > --- a/xen/arch/arm/mm.c > +++ b/xen/arch/arm/mm.c > @@ -208,6 +208,18 @@ void unmap_domain_page(const void *va) > local_irq_restore(flags); > } > > +unsigned long domain_page_map_to_mfn(const void *va) > +{ > + lpae_t *map = xen_second + second_linear_offset(DOMHEAP_VIRT_START); > + int slot = ((unsigned long) va - DOMHEAP_VIRT_START) >> SECOND_SHIFT; > + unsigned long offset = ((unsigned long)va>>THIRD_SHIFT) & LPAE_ENTRY_MASK; > + > + ASSERT(slot >= 0 && slot < DOMHEAP_ENTRIES); > + ASSERT(map[slot].pt.avail != 0); > + > + return map[slot].pt.base + offset; > +} > + > void __init arch_init_memory(void) > { > /* > -- > 1.7.9.1
>>> On 28.01.13 at 14:09, Ian Campbell <ian.campbell@citrix.com> wrote: > This was recently (re?)introduced on x86 in 26447:f831d8dcf18f and is > now used in generic code (specifically tmem in 26454:38847c15d8cd).So does ARM really use tmem? If not, why is it being built there? If so, is it really expected to work (considering that it expects all memory to be visible through the 1:1 mapping)? Jan
On Mon, 2013-01-28 at 13:24 +0000, Jan Beulich wrote:> >>> On 28.01.13 at 14:09, Ian Campbell <ian.campbell@citrix.com> wrote: > > This was recently (re?)introduced on x86 in 26447:f831d8dcf18f and is > > now used in generic code (specifically tmem in 26454:38847c15d8cd). > > > > This fixes the build on ARM. > > I''m sorry for that; me not noticing was caused by working on a > tree where the ARM build was already broken before those > patches.That''s ok.> Which reminds me: IanJ - any chance of introducing a build-only > (for the time being) test for ARM?I''d love this. I''ve been taking a look at doing this in an armhf cross chroot, based on IanJ''s standalone osstest branch. It''s a bit fiddly though. Doing this as a normal cross compile is a bit tricky due to the tools. Ian.
On Mon, 2013-01-28 at 13:27 +0000, Jan Beulich wrote:> >>> On 28.01.13 at 14:09, Ian Campbell <ian.campbell@citrix.com> wrote: > > This was recently (re?)introduced on x86 in 26447:f831d8dcf18f and is > > now used in generic code (specifically tmem in 26454:38847c15d8cd). > > So does ARM really use tmem? If not, why is it being built there?Early on in the ARM effort I sent a patch to disable it and was shot down. In theory it might work. In practice I expect it will not and some function it uses will return ENOSYS (steal_page springs to mind) so it won''t actually work.> If so, is it really expected to work (considering that it expects all > memory to be visible through the 1:1 mapping)?I wasn''t aware of that limitation. In that case it is very unlikely to work! I haven''t done the 1-1 stuff for 64-bit ARM yet -- obviously when I do tmem might at least become plausible there. Ian.
>>> On 28.01.13 at 14:35, Ian Campbell <Ian.Campbell@citrix.com> wrote: > On Mon, 2013-01-28 at 13:24 +0000, Jan Beulich wrote: >> Which reminds me: IanJ - any chance of introducing a build-only >> (for the time being) test for ARM? > > I''d love this. > > I''ve been taking a look at doing this in an armhf cross chroot, based on > IanJ''s standalone osstest branch. It''s a bit fiddly though. > > Doing this as a normal cross compile is a bit tricky due to the tools.Hmm, indeed. Maybe a hypervisor only build would be better than nothing as a first step? Jan
On Mon, 2013-01-28 at 13:40 +0000, Jan Beulich wrote:> >>> On 28.01.13 at 14:35, Ian Campbell <Ian.Campbell@citrix.com> wrote: > > On Mon, 2013-01-28 at 13:24 +0000, Jan Beulich wrote: > >> Which reminds me: IanJ - any chance of introducing a build-only > >> (for the time being) test for ARM? > > > > I''d love this. > > > > I''ve been taking a look at doing this in an armhf cross chroot, based on > > IanJ''s standalone osstest branch. It''s a bit fiddly though. > > > > Doing this as a normal cross compile is a bit tricky due to the tools. > > Hmm, indeed. Maybe a hypervisor only build would be better > than nothing as a first step?Agreed, Ian (J) what do you think? Ian.
Stefano Stabellini
2013-Jan-28 16:33 UTC
Re: [PATCH] xen: arm: implement domain_page_map_to_mfn
On Mon, 28 Jan 2013, Ian Campbell wrote:> This was recently (re?)introduced on x86 in 26447:f831d8dcf18f and is > now used in generic code (specifically tmem in 26454:38847c15d8cd). > > This fixes the build on ARM. > > Signed-off-by: Ian Campbell <ian.campbell@citrix.com> > Cc: Jan Beulich <JBeulich@suse.com> > Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > Cc: Tim Deegan <tim@xen.org>Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>> xen/arch/arm/mm.c | 12 ++++++++++++ > 1 files changed, 12 insertions(+), 0 deletions(-) > > diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c > index 9c5c334..7621d1b 100644 > --- a/xen/arch/arm/mm.c > +++ b/xen/arch/arm/mm.c > @@ -208,6 +208,18 @@ void unmap_domain_page(const void *va) > local_irq_restore(flags); > } > > +unsigned long domain_page_map_to_mfn(const void *va) > +{ > + lpae_t *map = xen_second + second_linear_offset(DOMHEAP_VIRT_START); > + int slot = ((unsigned long) va - DOMHEAP_VIRT_START) >> SECOND_SHIFT; > + unsigned long offset = ((unsigned long)va>>THIRD_SHIFT) & LPAE_ENTRY_MASK; > + > + ASSERT(slot >= 0 && slot < DOMHEAP_ENTRIES); > + ASSERT(map[slot].pt.avail != 0); > + > + return map[slot].pt.base + offset; > +} > + > void __init arch_init_memory(void) > { > /* > -- > 1.7.9.1 >