Date: Mon, 17 May 2021 09:43:03 GMT From: =?utf-8?B?Um9nZXIgUGF1IE1vbm7DqQ==?= <royger@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: c93e6ea344a1 - main - xen: remove support for PVHv1 bootpath Message-ID: <202105170943.14H9h38q030585@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=c93e6ea344a1616219d18b6a2b6761ef19d38c39 commit c93e6ea344a1616219d18b6a2b6761ef19d38c39 Author: Mitchell Horne <mhorne@FreeBSD.org> AuthorDate: 2021-05-06 20:45:40 +0000 Commit: Roger Pau Monné <royger@FreeBSD.org> CommitDate: 2021-05-17 08:56:52 +0000 xen: remove support for PVHv1 bootpath PVHv1 is a legacy interface supported only by Xen versions 4.4 through 4.9. Reviewed by: royger --- sys/amd64/amd64/xen-locore.S | 24 ------ sys/x86/xen/pv.c | 186 ------------------------------------------- 2 files changed, 210 deletions(-) diff --git a/sys/amd64/amd64/xen-locore.S b/sys/amd64/amd64/xen-locore.S index 97d81711a051..c112fa909adf 100644 --- a/sys/amd64/amd64/xen-locore.S +++ b/sys/amd64/amd64/xen-locore.S @@ -54,7 +54,6 @@ ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz, "xen-3.0") ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .quad, KERNBASE) ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .quad, 0) - ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .quad, xen_start) ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .quad, hypercall_page) ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, .quad, HYPERVISOR_VIRT_START) ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz, "writable_descriptor_tables|auto_translated_physmap|supervisor_mode_kernel|hvm_callback_vector") @@ -72,29 +71,6 @@ ENTRY(hypercall_page) .skip 0x1000, 0x90 /* Fill with "nop"s */ -/* Legacy PVH entry point, to be removed. */ -ENTRY(xen_start) - /* Don't trust what the loader gives for rflags. */ - pushq $PSL_KERNEL - popfq - - /* Parameters for the xen init function */ - movq %rsi, %rdi /* shared_info (arg 1) */ - movq %rsp, %rsi /* xenstack (arg 2) */ - - /* Use our own stack */ - movq $bootstack,%rsp - xorl %ebp, %ebp - - /* u_int64_t hammer_time_xen(start_info_t *si, u_int64_t xenstack); */ - call hammer_time_xen_legacy - movq %rax, %rsp /* set up kstack for mi_startup() */ - call mi_startup /* autoconfiguration, mountroot etc */ - - /* NOTREACHED */ -0: hlt - jmp 0b - /* PVH entry point. */ .code32 ENTRY(xen_start32) diff --git a/sys/x86/xen/pv.c b/sys/x86/xen/pv.c index a2424423aded..3511df779a92 100644 --- a/sys/x86/xen/pv.c +++ b/sys/x86/xen/pv.c @@ -88,13 +88,11 @@ __FBSDID("$FreeBSD$"); /* Native initial function */ extern u_int64_t hammer_time(u_int64_t, u_int64_t); /* Xen initial function */ -uint64_t hammer_time_xen_legacy(start_info_t *, uint64_t); uint64_t hammer_time_xen(vm_paddr_t); #define MAX_E820_ENTRIES 128 /*--------------------------- Forward Declarations ---------------------------*/ -static caddr_t xen_legacy_pvh_parse_preload_data(uint64_t); static caddr_t xen_pvh_parse_preload_data(uint64_t); static void xen_pvh_parse_memmap(caddr_t, vm_paddr_t *, int *); @@ -118,18 +116,6 @@ extern char *dbg_stack; extern uint32_t end; /*-------------------------------- Global Data -------------------------------*/ -/* Xen init_ops implementation. */ -struct init_ops xen_legacy_init_ops = { - .parse_preload_data = xen_legacy_pvh_parse_preload_data, - .early_clock_source_init = xen_clock_init, - .early_delay = xen_delay, - .parse_memmap = xen_pvh_parse_memmap, -#ifdef SMP - .start_all_aps = xen_pv_start_all_aps, -#endif - .msi_init = xen_msi_init, -}; - struct init_ops xen_pvh_init_ops = { .parse_preload_data = xen_pvh_parse_preload_data, .early_clock_source_init = xen_clock_init, @@ -144,134 +130,9 @@ struct init_ops xen_pvh_init_ops = { static struct bios_smap xen_smap[MAX_E820_ENTRIES]; -static start_info_t *legacy_start_info; static struct hvm_start_info *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 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. - */ -uint64_t -hammer_time_xen_legacy(start_info_t *si, uint64_t xenstack) -{ - uint64_t physfree; - uint64_t *PT4 = (u_int64_t *)xenstack; - uint64_t *PT3 = (u_int64_t *)(xenstack + PAGE_SIZE); - uint64_t *PT2 = (u_int64_t *)(xenstack + 2 * PAGE_SIZE); - int i; - char *kenv; - - xen_domain_type = XEN_PV_DOMAIN; - vm_guest = VM_GUEST_XEN; - - if ((si == NULL) || (xenstack == 0)) { - xc_printf("ERROR: invalid start_info or xen stack, halting\n"); - HYPERVISOR_shutdown(SHUTDOWN_crash); - } - - xc_printf("FreeBSD PVH running on %s\n", si->magic); - - /* We use 3 pages of xen stack for the boot pagetables */ - physfree = xenstack + 3 * PAGE_SIZE - KERNBASE; - - /* Setup Xen global variables */ - legacy_start_info = si; - HYPERVISOR_shared_info = - (shared_info_t *)(si->shared_info + KERNBASE); - - /* - * Use the stack Xen gives us to build the page tables - * as native FreeBSD expects to find them (created - * by the boot trampoline). - */ - for (i = 0; i < (PAGE_SIZE / sizeof(uint64_t)); i++) { - /* - * Each slot of the level 4 pages points - * to the same level 3 page - */ - PT4[i] = ((uint64_t)&PT3[0]) - KERNBASE; - PT4[i] |= PG_V | PG_RW | PG_U; - - /* - * Each slot of the level 3 pages points - * to the same level 2 page - */ - PT3[i] = ((uint64_t)&PT2[0]) - KERNBASE; - PT3[i] |= PG_V | PG_RW | PG_U; - - /* - * The level 2 page slots are mapped with - * 2MB pages for 1GB. - */ - PT2[i] = i * (2 * 1024 * 1024); - PT2[i] |= PG_V | PG_RW | PG_PS | PG_U; - } - load_cr3(((uint64_t)&PT4[0]) - KERNBASE); - - /* - * Init an empty static kenv using a free page. The contents will be - * filled from the parse_preload_data hook. - */ - kenv = (void *)(physfree + KERNBASE); - physfree += PAGE_SIZE; - bzero_early(kenv, PAGE_SIZE); - init_static_kenv(kenv, PAGE_SIZE); - - /* Set the hooks for early functions that diverge from bare metal */ - init_ops = xen_legacy_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)); -} uint64_t hammer_time_xen(vm_paddr_t start_info_paddr) @@ -512,53 +373,6 @@ xen_pvh_parse_symtab(void) } #endif -static caddr_t -xen_legacy_pvh_parse_preload_data(uint64_t modulep) -{ - caddr_t kmdp; - vm_ooffset_t off; - vm_paddr_t metadata; - char *envp; - - 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) - kmdp = preload_search_by_type("elf64 kernel"); - KASSERT(kmdp != NULL, ("unable to find kernel")); - - /* - * Xen has relocated the metadata and the modules, - * so we need to recalculate it's position. This is - * done by saving the original modulep address and - * then calculating the offset with mod_start, - * which contains the relocated modulep address. - */ - metadata = MD_FETCH(kmdp, MODINFOMD_MODULEP, vm_paddr_t); - off = legacy_start_info->mod_start - metadata; - - preload_bootstrap_relocate(off); - - boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); - envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); - if (envp != NULL) - envp += off; - xen_pvh_set_env(envp, NULL); - } else { - /* Parse the extra boot information given by Xen */ - boot_parse_cmdline_delim(legacy_start_info->cmd_line, ","); - kmdp = NULL; - } - - boothowto |= boot_env_to_howto(); - -#ifdef DDB - xen_pvh_parse_symtab(); -#endif - return (kmdp); -} - static caddr_t xen_pvh_parse_preload_data(uint64_t modulep) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105170943.14H9h38q030585>