From: Andrew Cooper Date: Mon, 29 Nov 2021 19:19:43 +0000 (+0000) Subject: x86/boot: Better describe the pagetable relocation loops X-Git-Tag: archive/raspbian/4.17.0-1+rpi1^2~33^2~1291 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3099ff3ce15481b4f1536470cb87ac0ebf82b7bb;p=xen.git x86/boot: Better describe the pagetable relocation loops The first loop relocates all reachable non-leaf entries in idle_pg_table[], which includes l2_xenmap[511]'s reference to l1_fixmap_x[]. The second loop relocates only leaf mappings in l2_xenmap[], so update the skip condition to be opposite to the first loop. No functional change. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 6f24104842..495b4b7d51 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1245,7 +1245,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) barrier(); move_memory(e, XEN_IMG_OFFSET, _end - _start, 1); - /* Walk initial pagetables, relocating page directory entries. */ + /* Walk idle_pg_table, relocating non-leaf entries. */ pl4e = __va(__pa(idle_pg_table)); for ( i = 0 ; i < L4_PAGETABLE_ENTRIES; i++, pl4e++ ) { @@ -1277,18 +1277,18 @@ void __init noreturn __start_xen(unsigned long mbi_p) } } - /* The only data mappings to be relocated are in the Xen area. */ - pl2e = __va(__pa(l2_xenmap)); - BUG_ON(using_2M_mapping() && l2_table_offset((unsigned long)_erodata) == l2_table_offset((unsigned long)_stext)); + /* Walk l2_xenmap[], relocating 2M superpage leaves. */ + pl2e = __va(__pa(l2_xenmap)); for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++, pl2e++ ) { unsigned int flags; if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) || + !(l2e_get_flags(*pl2e) & _PAGE_PSE) || (l2e_get_pfn(*pl2e) >= pte_update_limit) ) continue;