.. | .. |
---|
6 | 6 | #include <asm/io_apic.h> |
---|
7 | 7 | #include <asm/hypervisor.h> |
---|
8 | 8 | #include <asm/e820/api.h> |
---|
9 | | -#include <asm/x86_init.h> |
---|
10 | 9 | |
---|
| 10 | +#include <xen/xen.h> |
---|
11 | 11 | #include <asm/xen/interface.h> |
---|
12 | 12 | #include <asm/xen/hypercall.h> |
---|
13 | 13 | |
---|
14 | 14 | #include <xen/interface/memory.h> |
---|
15 | | -#include <xen/interface/hvm/start_info.h> |
---|
16 | 15 | |
---|
17 | 16 | #include "xen-ops.h" |
---|
18 | 17 | |
---|
19 | 18 | /* |
---|
20 | 19 | * PVH variables. |
---|
21 | 20 | * |
---|
22 | | - * xen_pvh pvh_bootparams and pvh_start_info need to live in data segment |
---|
23 | | - * since they are used after startup_{32|64}, which clear .bss, are invoked. |
---|
| 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 | 23 | */ |
---|
25 | | -bool xen_pvh __attribute__((section(".data"))) = 0; |
---|
26 | | -struct boot_params pvh_bootparams __attribute__((section(".data"))); |
---|
27 | | -struct hvm_start_info pvh_start_info __attribute__((section(".data"))); |
---|
| 24 | +bool xen_pvh __section(".data") = 0; |
---|
28 | 25 | |
---|
29 | | -unsigned int pvh_start_info_sz = sizeof(pvh_start_info); |
---|
30 | | - |
---|
31 | | -static u64 pvh_get_root_pointer(void) |
---|
32 | | -{ |
---|
33 | | - return pvh_start_info.rsdp_paddr; |
---|
34 | | -} |
---|
35 | | - |
---|
36 | | -static void __init init_pvh_bootparams(void) |
---|
37 | | -{ |
---|
38 | | - struct xen_memory_map memmap; |
---|
39 | | - int rc; |
---|
40 | | - |
---|
41 | | - memset(&pvh_bootparams, 0, sizeof(pvh_bootparams)); |
---|
42 | | - |
---|
43 | | - memmap.nr_entries = ARRAY_SIZE(pvh_bootparams.e820_table); |
---|
44 | | - set_xen_guest_handle(memmap.buffer, pvh_bootparams.e820_table); |
---|
45 | | - rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap); |
---|
46 | | - if (rc) { |
---|
47 | | - xen_raw_printk("XENMEM_memory_map failed (%d)\n", rc); |
---|
48 | | - BUG(); |
---|
49 | | - } |
---|
50 | | - pvh_bootparams.e820_entries = memmap.nr_entries; |
---|
51 | | - |
---|
52 | | - if (pvh_bootparams.e820_entries < E820_MAX_ENTRIES_ZEROPAGE - 1) { |
---|
53 | | - pvh_bootparams.e820_table[pvh_bootparams.e820_entries].addr = |
---|
54 | | - ISA_START_ADDRESS; |
---|
55 | | - pvh_bootparams.e820_table[pvh_bootparams.e820_entries].size = |
---|
56 | | - ISA_END_ADDRESS - ISA_START_ADDRESS; |
---|
57 | | - pvh_bootparams.e820_table[pvh_bootparams.e820_entries].type = |
---|
58 | | - E820_TYPE_RESERVED; |
---|
59 | | - pvh_bootparams.e820_entries++; |
---|
60 | | - } else |
---|
61 | | - xen_raw_printk("Warning: Can fit ISA range into e820\n"); |
---|
62 | | - |
---|
63 | | - pvh_bootparams.hdr.cmd_line_ptr = |
---|
64 | | - pvh_start_info.cmdline_paddr; |
---|
65 | | - |
---|
66 | | - /* The first module is always ramdisk. */ |
---|
67 | | - if (pvh_start_info.nr_modules) { |
---|
68 | | - struct hvm_modlist_entry *modaddr = |
---|
69 | | - __va(pvh_start_info.modlist_paddr); |
---|
70 | | - pvh_bootparams.hdr.ramdisk_image = modaddr->paddr; |
---|
71 | | - pvh_bootparams.hdr.ramdisk_size = modaddr->size; |
---|
72 | | - } |
---|
73 | | - |
---|
74 | | - /* |
---|
75 | | - * See Documentation/x86/boot.txt. |
---|
76 | | - * |
---|
77 | | - * Version 2.12 supports Xen entry point but we will use default x86/PC |
---|
78 | | - * environment (i.e. hardware_subarch 0). |
---|
79 | | - */ |
---|
80 | | - pvh_bootparams.hdr.version = (2 << 8) | 12; |
---|
81 | | - pvh_bootparams.hdr.type_of_loader = (9 << 4) | 0; /* Xen loader */ |
---|
82 | | - |
---|
83 | | - x86_init.acpi.get_root_pointer = pvh_get_root_pointer; |
---|
84 | | - |
---|
85 | | - xen_efi_init(&pvh_bootparams); |
---|
86 | | -} |
---|
87 | | - |
---|
88 | | -/* |
---|
89 | | - * This routine (and those that it might call) should not use |
---|
90 | | - * anything that lives in .bss since that segment will be cleared later. |
---|
91 | | - */ |
---|
92 | | -void __init xen_prepare_pvh(void) |
---|
| 26 | +void __init xen_pvh_init(struct boot_params *boot_params) |
---|
93 | 27 | { |
---|
94 | 28 | u32 msr; |
---|
95 | 29 | u64 pfn; |
---|
96 | | - |
---|
97 | | - if (pvh_start_info.magic != XEN_HVM_START_MAGIC_VALUE) { |
---|
98 | | - xen_raw_printk("Error: Unexpected magic value (0x%08x)\n", |
---|
99 | | - pvh_start_info.magic); |
---|
100 | | - BUG(); |
---|
101 | | - } |
---|
102 | 30 | |
---|
103 | 31 | xen_pvh = 1; |
---|
104 | 32 | xen_domain_type = XEN_HVM_DOMAIN; |
---|
.. | .. |
---|
108 | 36 | pfn = __pa(hypercall_page); |
---|
109 | 37 | wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32)); |
---|
110 | 38 | |
---|
111 | | - init_pvh_bootparams(); |
---|
| 39 | + xen_efi_init(boot_params); |
---|
| 40 | +} |
---|
| 41 | + |
---|
| 42 | +void __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; |
---|
112 | 55 | } |
---|