From: Andrew Cooper Date: Fri, 10 Jan 2020 14:05:29 +0000 (+0000) Subject: x86/boot: Size the boot/directmap mappings dynamically X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~844 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=cbabbc9f56599b6e0fcf6d9c059066abac941bd4;p=xen.git x86/boot: Size the boot/directmap mappings dynamically ... rather than presuming that 16M will do. On the EFI side, use l2e_add_flags() to reduce the code-generation overhead of using l2e_from_paddr() twice. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index ef9f562505..0137ee99a4 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -687,14 +687,19 @@ trampoline_setup: * handling/walking), and identity map Xen into bootmap (needed for * the transition into long mode), using 2M superpages. */ - lea sym_esi(start),%ebx - lea (1<> L2_PAGETABLE_SHIFT) & (4 * L2_PAGETABLE_ENTRIES - 1)) + + for ( i = l2_4G_offset(_start); + i <= l2_4G_offset(_end - 1); ++i ) { - unsigned int slot = (xen_phys_start >> L2_PAGETABLE_SHIFT) + i; - paddr_t addr = slot << L2_PAGETABLE_SHIFT; + l2_pgentry_t pte = l2e_from_paddr(i << L2_PAGETABLE_SHIFT, + __PAGE_HYPERVISOR | _PAGE_PSE); + + l2_bootmap[i] = pte; + + /* Bootmap RWX/Non-global. Directmap RW/Global. */ + l2e_add_flags(pte, PAGE_HYPERVISOR); - l2_directmap[slot] = l2e_from_paddr(addr, PAGE_HYPERVISOR|_PAGE_PSE); - l2_bootmap[slot] = l2e_from_paddr(addr, __PAGE_HYPERVISOR|_PAGE_PSE); + l2_directmap[i] = pte; } +#undef l2_4G_offset } static void __init efi_arch_handle_module(struct file *file, const CHAR16 *name,