[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 2/2] x86/setup: remap Xen image up to PFN_DOWN(__pa(_end))
Current limit, PFN_DOWN(xen_phys_start), introduced by commit b280442 (x86: make Xen early boot code relocatable) is not reliable. Potentially its value may fall below PFN_DOWN(__pa(_end)) and then part of Xen image may not be mapped after relocation. This will not happen in current code thanks to "x86/setup: do not relocate over current Xen image placement" patch. Though this safety measure may save a lot of debugging time when somebody decide to relax existing relocation restrictions one day. Additionally, remapping will execute a bit faster due to this change. Signed-off-by: Daniel Kiper <daniel.kiper@xxxxxxxxxx> --- xen/arch/x86/setup.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 9f8abd9..ac163e2 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -973,6 +973,11 @@ void __init noreturn __start_xen(unsigned long mbi_p) l3_pgentry_t *pl3e; l2_pgentry_t *pl2e; int i, j, k; + /* + * We have to calculate xen_remap_end_pfn before + * xen_phys_start change. + */ + unsigned long xen_remap_end_pfn = PFN_DOWN(__pa(_end)); /* Select relocation address. */ e = end - reloc_size; @@ -1002,7 +1007,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) /* Not present, 1GB mapping, or already relocated? */ if ( !(l3e_get_flags(*pl3e) & _PAGE_PRESENT) || (l3e_get_flags(*pl3e) & _PAGE_PSE) || - (l3e_get_pfn(*pl3e) > PFN_DOWN(xen_phys_start)) ) + (l3e_get_pfn(*pl3e) > xen_remap_end_pfn) ) continue; *pl3e = l3e_from_intpte(l3e_get_intpte(*pl3e) + xen_phys_start); @@ -1012,7 +1017,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) /* Not present, PSE, or already relocated? */ if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) || (l2e_get_flags(*pl2e) & _PAGE_PSE) || - (l2e_get_pfn(*pl2e) > PFN_DOWN(xen_phys_start)) ) + (l2e_get_pfn(*pl2e) > xen_remap_end_pfn) ) continue; *pl2e = l2e_from_intpte(l2e_get_intpte(*pl2e) + xen_phys_start); @@ -1036,7 +1041,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) unsigned int flags; if ( !(l2e_get_flags(*pl2e) & _PAGE_PRESENT) || - (l2e_get_pfn(*pl2e) > PFN_DOWN(xen_phys_start)) ) + (l2e_get_pfn(*pl2e) > xen_remap_end_pfn) ) continue; if ( !using_2M_mapping() ) -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |