x86: relocate pvh_info
PATCH v5 1/1 x86: relocate pvh_info
Modify early boot code to relocate pvh info as well, so that we can be sure __va in __start_xen works.
---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Roger Pau Monné <[email protected]>
v5: Include kconfig.h. Use IS_ENABLED. Adjust code.
--- xen/arch/x86/boot/Makefile | 3 ++- xen/arch/x86/boot/defs.h | 3 +++ xen/arch/x86/boot/head.S | 25 ++++++++++--------- xen/arch/x86/boot/reloc.c | 60 ++++++++++++++++++++++++++++++++++++++++------ 4 files changed, 72 insertions(+), 19 deletions(-)
xen/arch/x86/boot/Makefile +2 -1
@@ -5,7 +5,8 @@ DEFS_H_DEPS = defs.h $(BASEDIR)/include/xen/stdbool.h CMDLINE_DEPS = $(DEFS_H_DEPS) video.h RELOC_DEPS = $(DEFS_H_DEPS) $(BASEDIR)/include/xen/multiboot.h \ - $(BASEDIR)/include/xen/multiboot2.h + $(BASEDIR)/include/xen/multiboot2.h \ + $(BASEDIR)/include/public/arch-x86/hvm/start_info.h head.o: cmdline.S reloc.S
xen/arch/x86/boot/defs.h +3 -0
@@ -51,6 +51,9 @@ typedef unsigned short u16;typedef unsigned int u32 ;typedef unsigned long long u64 ;typedef unsigned int size_t ; +typedef u8 uint8_t ; +typedef u32 uint32_t ; +typedef u64 uint64_t ;#define U16_MAX ((u16)(~0U))#define UINT_MAX (~0U)
xen/arch/x86/boot/head.S +14 -11
@@ -414,6 +414,7 @@ __pvh_start: /* Set trampoline_phys to use mfn 1 to avoid having a mapping at VA 0 */ movw $0x1000, sym_esi(trampoline_phys) + mov (%ebx), %eax /* mov $XEN_HVM_START_MAGIC_VALUE, %eax */ jmp trampoline_setup #endif /* CONFIG_PVH_GUEST */
@@ -578,18 +579,20 @@ trampoline_setup: /* Get bottom-most low-memory stack address. */ add $TRAMPOLINE_SPACE,%ecx -#ifdef CONFIG_PVH_GUEST - cmpb $0, sym_fs(pvh_boot) - jne 1f -#endif - - /* Save the Multiboot info struct (after relocation) for later use. */ + /* Save Multiboot / PVH info struct (after relocation) for later use. */ push %ecx /* Bottom-most low-memory stack address. */ - push %ebx /* Multiboot information address. */ - push %eax /* Multiboot magic. */ + push %ebx /* Multiboot / PVH information address. */ + push %eax /* Magic number. */ call reloc - mov %eax,sym_fs(multiboot_ptr) +#ifdef CONFIG_PVH_GUEST + cmp $0, sym_fs(pvh_boot) + je 1f + mov %eax, sym_fs(pvh_start_info_pa) + jmp 2f +#endif 1: + mov %eax, sym_fs(multiboot_ptr) +2: /* * Now trampoline_phys points to the following structure (lowest address
@@ -598,12 +601,12 @@ trampoline_setup: * +------------------------+ * | TRAMPOLINE_STACK_SPACE | * +------------------------+ - * | mbi data | + * | Data (MBI / PVH) | * +- - - - - - - - - - - - + * | TRAMPOLINE_SPACE | * +------------------------+ * - * mbi data grows downwards from the highest address of TRAMPOLINE_SPACE + * Data grows downwards from the highest address of TRAMPOLINE_SPACE * region to the end of the trampoline. The rest of TRAMPOLINE_SPACE is * reserved for trampoline code and data. */
xen/arch/x86/boot/reloc.c +53 -7
87 lines not on this page · raw message
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
xen/arch/x86/boot/reloc.c static multiboot_info_t *mbi2_reloc(u32 mbi_in) · line 262
Quoted 6 lines · Wei Liu
xen/arch/x86/boot/reloc.c +1
-1@@ -226,14 +259,27 @@ static multiboot_info_t *mbi2_reloc(u32 mbi_in)return mbi_out; } -multiboot_info_t __stdcall *reloc (u32 mb_magic,u32 mbi_in,u32 trampoline) +void __stdcall *reloc (u32 magic,u32 in,u32 trampoline)
As an final observation, void * __stdcall reloc() so the __stdcall isn't in the middle of the return type (Can be fixed on commit).
Otherwise, Reviewed-by: Andrew Cooper <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 10 lines · Andrew Cooper
xen/arch/x86/boot/reloc.c static multiboot_info_t *mbi2_reloc(u32 mbi_in) · line 262
Quoted 6 lines · Wei Liu
xen/arch/x86/boot/reloc.c +1
-1@@ -226,14 +259,27 @@ static multiboot_info_t *mbi2_reloc(u32 mbi_in)return mbi_out; } -multiboot_info_t __stdcall *reloc (u32 mb_magic,u32 mbi_in,u32 trampoline) +void __stdcall *reloc (u32 magic,u32 in,u32 trampoline)As an final observation, void *
__stdcallreloc()so the__stdcallisn't in the middle of the return type (Can be fixed on commit).
Sure.
Quoted 2 lines
Otherwise, Reviewed-by: Andrew Cooper <[email protected]>
Thanks.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel