]> Git Repo - linux.git/blob - arch/x86/xen/enlighten_pvh.c
netlink: make validation more configurable for future strictness
[linux.git] / arch / x86 / xen / enlighten_pvh.c
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/acpi.h>
3
4 #include <xen/hvc-console.h>
5
6 #include <asm/io_apic.h>
7 #include <asm/hypervisor.h>
8 #include <asm/e820/api.h>
9
10 #include <xen/xen.h>
11 #include <asm/xen/interface.h>
12 #include <asm/xen/hypercall.h>
13
14 #include <xen/interface/memory.h>
15
16 /*
17  * PVH variables.
18  *
19  * The variable xen_pvh needs to live in the data segment since it is used
20  * after startup_{32|64} is invoked, which will clear the .bss segment.
21  */
22 bool xen_pvh __attribute__((section(".data"))) = 0;
23
24 void __init xen_pvh_init(void)
25 {
26         u32 msr;
27         u64 pfn;
28
29         xen_pvh = 1;
30         xen_start_flags = pvh_start_info.flags;
31
32         msr = cpuid_ebx(xen_cpuid_base() + 2);
33         pfn = __pa(hypercall_page);
34         wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32));
35 }
36
37 void __init mem_map_via_hcall(struct boot_params *boot_params_p)
38 {
39         struct xen_memory_map memmap;
40         int rc;
41
42         memmap.nr_entries = ARRAY_SIZE(boot_params_p->e820_table);
43         set_xen_guest_handle(memmap.buffer, boot_params_p->e820_table);
44         rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
45         if (rc) {
46                 xen_raw_printk("XENMEM_memory_map failed (%d)\n", rc);
47                 BUG();
48         }
49         boot_params_p->e820_entries = memmap.nr_entries;
50 }
This page took 0.037406 seconds and 4 git commands to generate.