Loading...
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/acpi.h>
3#include <linux/export.h>
4
5#include <xen/hvc-console.h>
6
7#include <asm/io_apic.h>
8#include <asm/hypervisor.h>
9#include <asm/e820/api.h>
10
11#include <xen/xen.h>
12#include <asm/xen/interface.h>
13#include <asm/xen/hypercall.h>
14
15#include <xen/interface/memory.h>
16
17#include "xen-ops.h"
18
19/*
20 * PVH variables.
21 *
22 * The variable xen_pvh needs to live in a data segment since it is used
23 * after startup_{32|64} is invoked, which will clear the .bss segment.
24 */
25bool __ro_after_init xen_pvh;
26EXPORT_SYMBOL_GPL(xen_pvh);
27
28void __init xen_pvh_init(struct boot_params *boot_params)
29{
30 u32 msr;
31 u64 pfn;
32
33 xen_pvh = 1;
34 xen_domain_type = XEN_HVM_DOMAIN;
35 xen_start_flags = pvh_start_info.flags;
36
37 msr = cpuid_ebx(xen_cpuid_base() + 2);
38 pfn = __pa(hypercall_page);
39 wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32));
40
41 if (xen_initial_domain())
42 x86_init.oem.arch_setup = xen_add_preferred_consoles;
43 x86_init.oem.banner = xen_banner;
44
45 xen_efi_init(boot_params);
46}
47
48void __init mem_map_via_hcall(struct boot_params *boot_params_p)
49{
50 struct xen_memory_map memmap;
51 int rc;
52
53 memmap.nr_entries = ARRAY_SIZE(boot_params_p->e820_table);
54 set_xen_guest_handle(memmap.buffer, boot_params_p->e820_table);
55 rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
56 if (rc) {
57 xen_raw_printk("XENMEM_memory_map failed (%d)\n", rc);
58 BUG();
59 }
60 boot_params_p->e820_entries = memmap.nr_entries;
61}
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#include "xen-ops.h"
17
18/*
19 * PVH variables.
20 *
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.
23 */
24bool xen_pvh __attribute__((section(".data"))) = 0;
25
26void __init xen_pvh_init(struct boot_params *boot_params)
27{
28 u32 msr;
29 u64 pfn;
30
31 xen_pvh = 1;
32 xen_domain_type = XEN_HVM_DOMAIN;
33 xen_start_flags = pvh_start_info.flags;
34
35 msr = cpuid_ebx(xen_cpuid_base() + 2);
36 pfn = __pa(hypercall_page);
37 wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32));
38
39 xen_efi_init(boot_params);
40}
41
42void __init mem_map_via_hcall(struct boot_params *boot_params_p)
43{
44 struct xen_memory_map memmap;
45 int rc;
46
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);
50 if (rc) {
51 xen_raw_printk("XENMEM_memory_map failed (%d)\n", rc);
52 BUG();
53 }
54 boot_params_p->e820_entries = memmap.nr_entries;
55}