1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/acpi.h>
4 #include <xen/hvc-console.h>
6 #include <asm/io_apic.h>
7 #include <asm/hypervisor.h>
8 #include <asm/e820/api.h>
11 #include <asm/xen/interface.h>
12 #include <asm/xen/hypercall.h>
14 #include <xen/interface/memory.h>
21 * The variable xen_pvh needs to live in the data segment since it is used
22 * after startup_{32|64} is invoked, which will clear the .bss segment.
24 bool xen_pvh
__attribute__((section(".data"))) = 0;
26 void __init
xen_pvh_init(struct boot_params
*boot_params
)
32 xen_domain_type
= XEN_HVM_DOMAIN
;
33 xen_start_flags
= pvh_start_info
.flags
;
35 msr
= cpuid_ebx(xen_cpuid_base() + 2);
36 pfn
= __pa(hypercall_page
);
37 wrmsr_safe(msr
, (u32
)pfn
, (u32
)(pfn
>> 32));
39 xen_efi_init(boot_params
);
42 void __init
mem_map_via_hcall(struct boot_params
*boot_params_p
)
44 struct xen_memory_map memmap
;
47 memmap
.nr_entries
= ARRAY_SIZE(boot_params_p
->e820_table
);
48 set_xen_guest_handle(memmap
.buffer
, boot_params_p
->e820_table
);
49 rc
= HYPERVISOR_memory_op(XENMEM_memory_map
, &memmap
);
51 xen_raw_printk("XENMEM_memory_map failed (%d)\n", rc
);
54 boot_params_p
->e820_entries
= memmap
.nr_entries
;