diff options
author | Roger Pau Monné <royger@FreeBSD.org> | 2018-07-19 07:54:45 +0000 |
---|---|---|
committer | Roger Pau Monné <royger@FreeBSD.org> | 2018-07-19 07:54:45 +0000 |
commit | cfa0b7b82fbdda56d7160569def5c6133eb045aa (patch) | |
tree | 44e7cf2428ea60f8f9c19dc9cc77cadf2a4384ca /sys/x86 | |
parent | f2577f25c192695eb7449db7d733ec1803a9a4f2 (diff) | |
download | src-cfa0b7b82fbdda56d7160569def5c6133eb045aa.tar.gz src-cfa0b7b82fbdda56d7160569def5c6133eb045aa.zip |
Notes
Diffstat (limited to 'sys/x86')
-rw-r--r-- | sys/x86/xen/hvm.c | 46 | ||||
-rw-r--r-- | sys/x86/xen/pv.c | 77 |
2 files changed, 100 insertions, 23 deletions
diff --git a/sys/x86/xen/hvm.c b/sys/x86/xen/hvm.c index 286a80f80366..1b98ab61e429 100644 --- a/sys/x86/xen/hvm.c +++ b/sys/x86/xen/hvm.c @@ -94,8 +94,6 @@ DPCPU_DEFINE(struct vcpu_info *, vcpu_info); /*------------------ Hypervisor Access Shared Memory Regions -----------------*/ shared_info_t *HYPERVISOR_shared_info; -start_info_t *HYPERVISOR_start_info; - /*------------------------------ Sysctl tunables -----------------------------*/ int xen_disable_pv_disks = 0; @@ -425,3 +423,47 @@ xen_hvm_cpu_init(void) DPCPU_SET(vcpu_info, vcpu_info); } SYSINIT(xen_hvm_cpu_init, SI_SUB_INTR, SI_ORDER_FIRST, xen_hvm_cpu_init, NULL); + +/* HVM/PVH start_info accessors */ +static vm_paddr_t +hvm_get_xenstore_mfn(void) +{ + + return (hvm_get_parameter(HVM_PARAM_STORE_PFN)); +} + +static evtchn_port_t +hvm_get_xenstore_evtchn(void) +{ + + return (hvm_get_parameter(HVM_PARAM_STORE_EVTCHN)); +} + +static vm_paddr_t +hvm_get_console_mfn(void) +{ + + return (hvm_get_parameter(HVM_PARAM_CONSOLE_PFN)); +} + +static evtchn_port_t +hvm_get_console_evtchn(void) +{ + + return (hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN)); +} + +static uint32_t +hvm_get_start_flags(void) +{ + + return (0); +} + +struct hypervisor_info hypervisor_info = { + .get_xenstore_mfn = hvm_get_xenstore_mfn, + .get_xenstore_evtchn = hvm_get_xenstore_evtchn, + .get_console_mfn = hvm_get_console_mfn, + .get_console_evtchn = hvm_get_console_evtchn, + .get_start_flags = hvm_get_start_flags, +}; diff --git a/sys/x86/xen/pv.c b/sys/x86/xen/pv.c index 4c812c3b5dad..2963e1fbc011 100644 --- a/sys/x86/xen/pv.c +++ b/sys/x86/xen/pv.c @@ -125,9 +125,55 @@ struct init_ops xen_init_ops = { static struct bios_smap xen_smap[MAX_E820_ENTRIES]; +static start_info_t *legacy_start_info; + +/*----------------------- Legacy PVH start_info accessors --------------------*/ +static vm_paddr_t +legacy_get_xenstore_mfn(void) +{ + + return (legacy_start_info->store_mfn); +} + +static evtchn_port_t +legacy_get_xenstore_evtchn(void) +{ + + return (legacy_start_info->store_evtchn); +} + +static vm_paddr_t +legacy_get_console_mfn(void) +{ + + return (legacy_start_info->console.domU.mfn); +} + +static evtchn_port_t +legacy_get_console_evtchn(void) +{ + + return (legacy_start_info->console.domU.evtchn); +} + +static uint32_t +legacy_get_start_flags(void) +{ + + return (legacy_start_info->flags); +} + +struct hypervisor_info legacy_info = { + .get_xenstore_mfn = legacy_get_xenstore_mfn, + .get_xenstore_evtchn = legacy_get_xenstore_evtchn, + .get_console_mfn = legacy_get_console_mfn, + .get_console_evtchn = legacy_get_console_evtchn, + .get_start_flags = legacy_get_start_flags, +}; + /*-------------------------------- Xen PV init -------------------------------*/ /* - * First function called by the Xen PVH boot sequence. + * First function called by the Xen legacy PVH boot sequence. * * Set some Xen global variables and prepare the environment so it is * as similar as possible to what native FreeBSD init function expects. @@ -155,22 +201,11 @@ hammer_time_xen(start_info_t *si, uint64_t xenstack) physfree = xenstack + 3 * PAGE_SIZE - KERNBASE; /* Setup Xen global variables */ - HYPERVISOR_start_info = si; + legacy_start_info = si; HYPERVISOR_shared_info = (shared_info_t *)(si->shared_info + KERNBASE); /* - * Setup some misc global variables for Xen devices - * - * XXX: Devices that need these specific variables should - * be rewritten to fetch this info by themselves from the - * start_info page. - */ - xen_store = (struct xenstore_domain_interface *) - (ptoa(si->store_mfn) + KERNBASE); - console_page = (char *)(ptoa(si->console.domU.mfn) + KERNBASE); - - /* * Use the stack Xen gives us to build the page tables * as native FreeBSD expects to find them (created * by the boot trampoline). @@ -202,6 +237,7 @@ hammer_time_xen(start_info_t *si, uint64_t xenstack) /* Set the hooks for early functions that diverge from bare metal */ init_ops = xen_init_ops; apic_ops = xen_apic_ops; + hypervisor_info = legacy_info; /* Now we can jump into the native init function */ return (hammer_time(0, physfree)); @@ -291,8 +327,8 @@ xen_pv_set_env(void) char *cmd_line_next, *cmd_line; size_t env_size; - cmd_line = HYPERVISOR_start_info->cmd_line; - env_size = sizeof(HYPERVISOR_start_info->cmd_line); + cmd_line = legacy_start_info->cmd_line; + env_size = sizeof(legacy_start_info->cmd_line); /* Skip leading spaces */ for (; isspace(*cmd_line) && (env_size != 0); cmd_line++) @@ -322,9 +358,8 @@ xen_pv_parse_symtab(void) int i, j; size = end; - sym_end = HYPERVISOR_start_info->mod_start != 0 ? - HYPERVISOR_start_info->mod_start : - HYPERVISOR_start_info->mfn_list; + sym_end = legacy_start_info->mod_start != 0 ? + legacy_start_info->mod_start : legacy_start_info->mfn_list; /* * Make sure the size is right headed, sym_end is just a @@ -375,8 +410,8 @@ xen_pv_parse_preload_data(u_int64_t modulep) vm_paddr_t metadata; char *envp; - if (HYPERVISOR_start_info->mod_start != 0) { - preload_metadata = (caddr_t)(HYPERVISOR_start_info->mod_start); + if (legacy_start_info->mod_start != 0) { + preload_metadata = (caddr_t)legacy_start_info->mod_start; kmdp = preload_search_by_type("elf kernel"); if (kmdp == NULL) @@ -391,7 +426,7 @@ xen_pv_parse_preload_data(u_int64_t modulep) * which contains the relocated modulep address. */ metadata = MD_FETCH(kmdp, MODINFOMD_MODULEP, vm_paddr_t); - off = HYPERVISOR_start_info->mod_start - metadata; + off = legacy_start_info->mod_start - metadata; preload_bootstrap_relocate(off); |