[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC v1 28/74] x86: initialise shared_info page
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- xen/arch/x86/guest/xen.c | 24 ++++++++++++++++++++++++ xen/arch/x86/setup.c | 3 +++ xen/include/asm-x86/fixmap.h | 3 +++ xen/include/asm-x86/guest/xen.h | 10 ++++++++++ 4 files changed, 40 insertions(+) diff --git a/xen/arch/x86/guest/xen.c b/xen/arch/x86/guest/xen.c index 152e471c06..594eae0828 100644 --- a/xen/arch/x86/guest/xen.c +++ b/xen/arch/x86/guest/xen.c @@ -72,6 +72,30 @@ void __init probe_hypervisor(void) xen_guest = true; } +static void map_shared_info(struct e820map *e820) +{ + paddr_t frame = 0xff000000; /* TODO: Hardcoded beside magic frames. */ + struct xen_add_to_physmap xatp = { + .domid = DOMID_SELF, + .idx = 0, + .space = XENMAPSPACE_shared_info, + .gpfn = frame >> PAGE_SHIFT, + }; + + if ( !e820_add_range(e820, frame, frame + PAGE_SIZE, E820_RESERVED) ) + panic("Failed to reserve shared_info range"); + + if ( xen_hypercall_memory_op(XENMEM_add_to_physmap, &xatp) ) + panic("Failed to map shared_info page"); + + set_fixmap(FIX_XEN_SHARED_INFO, frame); +} + +void __init hypervisor_early_setup(struct e820map *e820) +{ + map_shared_info(e820); +} + /* * Local variables: * mode: C diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index edb43bf2cb..353cdd4337 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -892,6 +892,9 @@ void __init noreturn __start_xen(unsigned long mbi_p) /* Create a temporary copy of the E820 map. */ memcpy(&boot_e820, &e820, sizeof(e820)); + if ( xen_guest ) + hypervisor_early_setup(&boot_e820); + /* Early kexec reservation (explicit static start address). */ nr_pages = 0; for ( i = 0; i < e820.nr_map; i++ ) diff --git a/xen/include/asm-x86/fixmap.h b/xen/include/asm-x86/fixmap.h index 51b0e7e945..ded4ddf21b 100644 --- a/xen/include/asm-x86/fixmap.h +++ b/xen/include/asm-x86/fixmap.h @@ -45,6 +45,9 @@ enum fixed_addresses { FIX_COM_BEGIN, FIX_COM_END, FIX_EHCI_DBGP, +#ifdef CONFIG_XEN_GUEST + FIX_XEN_SHARED_INFO, +#endif /* CONFIG_XEN_GUEST */ /* Everything else should go further down. */ FIX_APIC_BASE, FIX_IO_APIC_BASE_0, diff --git a/xen/include/asm-x86/guest/xen.h b/xen/include/asm-x86/guest/xen.h index 97a7c8d531..2f3bcd2fe4 100644 --- a/xen/include/asm-x86/guest/xen.h +++ b/xen/include/asm-x86/guest/xen.h @@ -21,17 +21,27 @@ #include <xen/types.h> +#include <asm/e820.h> +#include <asm/fixmap.h> + +#define XEN_shared_info ((struct shared_info *)fix_to_virt(FIX_XEN_SHARED_INFO)) + #ifdef CONFIG_XEN_GUEST extern bool xen_guest; void probe_hypervisor(void); +void hypervisor_early_setup(struct e820map *e820); #else #define xen_guest 0 static inline void probe_hypervisor(void) {}; +static inline void hypervisor_early_setup(struct e820map *e820) +{ + ASSERT_UNREACHABLE(); +}; #endif /* CONFIG_XEN_GUEST */ #endif /* __X86_GUEST_XEN_H__ */ -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |