1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/acpi.h>
3 #include <linux/export.h>
5 #include <xen/hvc-console.h>
7 #include <asm/bootparam.h>
8 #include <asm/io_apic.h>
9 #include <asm/hypervisor.h>
10 #include <asm/e820/api.h>
13 #include <asm/xen/interface.h>
14 #include <asm/xen/hypercall.h>
16 #include <xen/interface/memory.h>
23 * The variable xen_pvh needs to live in a data segment since it is used
24 * after startup_{32|64} is invoked, which will clear the .bss segment.
26 bool __ro_after_init xen_pvh;
27 EXPORT_SYMBOL_GPL(xen_pvh);
29 void __init xen_pvh_init(struct boot_params *boot_params)
35 xen_domain_type = XEN_HVM_DOMAIN;
36 xen_start_flags = pvh_start_info.flags;
38 msr = cpuid_ebx(xen_cpuid_base() + 2);
39 pfn = __pa(hypercall_page);
40 wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32));
42 if (xen_initial_domain())
43 x86_init.oem.arch_setup = xen_add_preferred_consoles;
44 x86_init.oem.banner = xen_banner;
46 xen_efi_init(boot_params);
48 if (xen_initial_domain()) {
49 struct xen_platform_op op = {
50 .cmd = XENPF_get_dom0_console,
52 int ret = HYPERVISOR_platform_op(&op);
55 xen_init_vga(&op.u.dom0_console,
56 min(ret * sizeof(char),
57 sizeof(op.u.dom0_console)),
58 &boot_params->screen_info);
62 void __init mem_map_via_hcall(struct boot_params *boot_params_p)
64 struct xen_memory_map memmap;
67 memmap.nr_entries = ARRAY_SIZE(boot_params_p->e820_table);
68 set_xen_guest_handle(memmap.buffer, boot_params_p->e820_table);
69 rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
71 xen_raw_printk("XENMEM_memory_map failed (%d)\n", rc);
74 boot_params_p->e820_entries = memmap.nr_entries;