Message ID | 20201119190751.22345-7-julien@xen.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | xen/arm: mm: Add limited support for superpages | expand |
On Thu, 19 Nov 2020, Julien Grall wrote: > From: Julien Grall <julien.grall@arm.com> > > Now that map_pages_to_xen() has been extended to support 2MB mappings, > we can replace the create_mappings() calls by map_pages_to_xen() calls. > > The mapping can also be marked read-only as Xen as no business to modify > the host Device Tree. > > Signed-off-by: Julien Grall <julien.grall@arm.com> Acked-by: Stefano Stabellini <sstabellini@kernel.org> > --- > xen/arch/arm/mm.c | 18 +++++++++++++----- > 1 file changed, 13 insertions(+), 5 deletions(-) > > diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c > index aee6d410ac4f..37ea9d5ce20a 100644 > --- a/xen/arch/arm/mm.c > +++ b/xen/arch/arm/mm.c > @@ -558,6 +558,7 @@ void * __init early_fdt_map(paddr_t fdt_paddr) > paddr_t offset; > void *fdt_virt; > uint32_t size; > + int rc; > > /* > * Check whether the physical FDT address is set and meets the minimum > @@ -573,8 +574,12 @@ void * __init early_fdt_map(paddr_t fdt_paddr) > /* The FDT is mapped using 2MB superpage */ > BUILD_BUG_ON(BOOT_FDT_VIRT_START % SZ_2M); > > - create_mappings(xen_second, BOOT_FDT_VIRT_START, paddr_to_pfn(base_paddr), > - SZ_2M >> PAGE_SHIFT, SZ_2M); > + rc = map_pages_to_xen(BOOT_FDT_VIRT_START, maddr_to_mfn(base_paddr), > + SZ_2M >> PAGE_SHIFT, > + PAGE_HYPERVISOR_RO | _PAGE_BLOCK); > + if ( rc ) > + panic("Unable to map the device-tree.\n"); > + > > offset = fdt_paddr % SECOND_SIZE; > fdt_virt = (void *)BOOT_FDT_VIRT_START + offset; > @@ -588,9 +593,12 @@ void * __init early_fdt_map(paddr_t fdt_paddr) > > if ( (offset + size) > SZ_2M ) > { > - create_mappings(xen_second, BOOT_FDT_VIRT_START + SZ_2M, > - paddr_to_pfn(base_paddr + SZ_2M), > - SZ_2M >> PAGE_SHIFT, SZ_2M); > + rc = map_pages_to_xen(BOOT_FDT_VIRT_START + SZ_2M, > + maddr_to_mfn(base_paddr + SZ_2M), > + SZ_2M >> PAGE_SHIFT, > + PAGE_HYPERVISOR_RO | _PAGE_BLOCK); > + if ( rc ) > + panic("Unable to map the device-tree\n"); > } > > return fdt_virt; > -- > 2.17.1 >
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index aee6d410ac4f..37ea9d5ce20a 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -558,6 +558,7 @@ void * __init early_fdt_map(paddr_t fdt_paddr) paddr_t offset; void *fdt_virt; uint32_t size; + int rc; /* * Check whether the physical FDT address is set and meets the minimum @@ -573,8 +574,12 @@ void * __init early_fdt_map(paddr_t fdt_paddr) /* The FDT is mapped using 2MB superpage */ BUILD_BUG_ON(BOOT_FDT_VIRT_START % SZ_2M); - create_mappings(xen_second, BOOT_FDT_VIRT_START, paddr_to_pfn(base_paddr), - SZ_2M >> PAGE_SHIFT, SZ_2M); + rc = map_pages_to_xen(BOOT_FDT_VIRT_START, maddr_to_mfn(base_paddr), + SZ_2M >> PAGE_SHIFT, + PAGE_HYPERVISOR_RO | _PAGE_BLOCK); + if ( rc ) + panic("Unable to map the device-tree.\n"); + offset = fdt_paddr % SECOND_SIZE; fdt_virt = (void *)BOOT_FDT_VIRT_START + offset; @@ -588,9 +593,12 @@ void * __init early_fdt_map(paddr_t fdt_paddr) if ( (offset + size) > SZ_2M ) { - create_mappings(xen_second, BOOT_FDT_VIRT_START + SZ_2M, - paddr_to_pfn(base_paddr + SZ_2M), - SZ_2M >> PAGE_SHIFT, SZ_2M); + rc = map_pages_to_xen(BOOT_FDT_VIRT_START + SZ_2M, + maddr_to_mfn(base_paddr + SZ_2M), + SZ_2M >> PAGE_SHIFT, + PAGE_HYPERVISOR_RO | _PAGE_BLOCK); + if ( rc ) + panic("Unable to map the device-tree\n"); } return fdt_virt;