Message ID | 20220221102218.33785-11-julien@xen.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | xen/arm: mm: Remove open-coding mappings | expand |
On Mon, 21 Feb 2022, Julien Grall wrote: > From: Julien Grall <jgrall@amazon.com> > > Now that map_pages_to_xen() has been extended to support 2MB mappings, > we can replace the create_mappings() call by map_pages_to_xen() call. > > Signed-off-by: Julien Grall <jgrall@amazon.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> > --- > Changes in v3: > - Fix build when CONFIG_DEBUG=y > > Changes in v2: > - New patch > > TODOs: > - add support for contiguous mapping > --- > xen/arch/arm/mm.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c > index f18f65745595..1e5c2c45dcf9 100644 > --- a/xen/arch/arm/mm.c > +++ b/xen/arch/arm/mm.c > @@ -809,7 +809,12 @@ void mmu_init_secondary_cpu(void) > void __init setup_xenheap_mappings(unsigned long base_mfn, > unsigned long nr_mfns) > { > - create_mappings(xen_second, XENHEAP_VIRT_START, base_mfn, nr_mfns, MB(32)); > + int rc; > + > + rc = map_pages_to_xen(XENHEAP_VIRT_START, _mfn(base_mfn), nr_mfns, > + PAGE_HYPERVISOR_RW | _PAGE_BLOCK); > + if ( rc ) > + panic("Unable to setup the xenheap mappings.\n"); > > /* Record where the xenheap is, for translation routines. */ > xenheap_virt_end = XENHEAP_VIRT_START + nr_mfns * PAGE_SIZE; > -- > 2.32.0 >
On 21/02/2022 10:22, Julien Grall wrote: > From: Julien Grall <jgrall@amazon.com> > > Now that map_pages_to_xen() has been extended to support 2MB mappings, > we can replace the create_mappings() call by map_pages_to_xen() call. > > Signed-off-by: Julien Grall <jgrall@amazon.com> > > --- > Changes in v3: > - Fix build when CONFIG_DEBUG=y > > Changes in v2: > - New patch > > TODOs: > - add support for contiguous mapping This todo was a left-over because _PAGE_BLOCK will try to use the contiguous bit (see patch #5). Cheers,
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index f18f65745595..1e5c2c45dcf9 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -809,7 +809,12 @@ void mmu_init_secondary_cpu(void) void __init setup_xenheap_mappings(unsigned long base_mfn, unsigned long nr_mfns) { - create_mappings(xen_second, XENHEAP_VIRT_START, base_mfn, nr_mfns, MB(32)); + int rc; + + rc = map_pages_to_xen(XENHEAP_VIRT_START, _mfn(base_mfn), nr_mfns, + PAGE_HYPERVISOR_RW | _PAGE_BLOCK); + if ( rc ) + panic("Unable to setup the xenheap mappings.\n"); /* Record where the xenheap is, for translation routines. */ xenheap_virt_end = XENHEAP_VIRT_START + nr_mfns * PAGE_SIZE;