|
27 | 27 | bool __ro_after_init xen_pvh; |
28 | 28 | EXPORT_SYMBOL_GPL(xen_pvh); |
29 | 29 |
|
30 | | -void __init xen_pvh_init(struct boot_params *boot_params) |
31 | | -{ |
32 | | - u32 msr; |
33 | | - u64 pfn; |
34 | | - |
35 | | - xen_pvh = 1; |
36 | | - xen_domain_type = XEN_HVM_DOMAIN; |
37 | | - xen_start_flags = pvh_start_info.flags; |
38 | | - |
39 | | - msr = cpuid_ebx(xen_cpuid_base() + 2); |
40 | | - pfn = __pa(hypercall_page); |
41 | | - wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32)); |
42 | | - |
43 | | - if (xen_initial_domain()) |
44 | | - x86_init.oem.arch_setup = xen_add_preferred_consoles; |
45 | | - x86_init.oem.banner = xen_banner; |
46 | | - |
47 | | - xen_efi_init(boot_params); |
48 | | - |
49 | | - if (xen_initial_domain()) { |
50 | | - struct xen_platform_op op = { |
51 | | - .cmd = XENPF_get_dom0_console, |
52 | | - }; |
53 | | - int ret = HYPERVISOR_platform_op(&op); |
54 | | - |
55 | | - if (ret > 0) |
56 | | - xen_init_vga(&op.u.dom0_console, |
57 | | - min(ret * sizeof(char), |
58 | | - sizeof(op.u.dom0_console)), |
59 | | - &boot_params->screen_info); |
60 | | - } |
61 | | -} |
62 | | - |
63 | | -void __init mem_map_via_hcall(struct boot_params *boot_params_p) |
64 | | -{ |
65 | | - struct xen_memory_map memmap; |
66 | | - int rc; |
67 | | - |
68 | | - memmap.nr_entries = ARRAY_SIZE(boot_params_p->e820_table); |
69 | | - set_xen_guest_handle(memmap.buffer, boot_params_p->e820_table); |
70 | | - rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap); |
71 | | - if (rc) { |
72 | | - xen_raw_printk("XENMEM_memory_map failed (%d)\n", rc); |
73 | | - BUG(); |
74 | | - } |
75 | | - boot_params_p->e820_entries = memmap.nr_entries; |
76 | | -} |
77 | | - |
78 | 30 | /* |
79 | 31 | * Reserve e820 UNUSABLE regions to inflate the memory balloon. |
80 | 32 | * |
@@ -141,3 +93,51 @@ void __init xen_reserve_extra_memory(struct boot_params *bootp) |
141 | 93 | xen_add_extra_mem(PFN_UP(e->addr), pages); |
142 | 94 | } |
143 | 95 | } |
| 96 | + |
| 97 | +void __init xen_pvh_init(struct boot_params *boot_params) |
| 98 | +{ |
| 99 | + u32 msr; |
| 100 | + u64 pfn; |
| 101 | + |
| 102 | + xen_pvh = 1; |
| 103 | + xen_domain_type = XEN_HVM_DOMAIN; |
| 104 | + xen_start_flags = pvh_start_info.flags; |
| 105 | + |
| 106 | + msr = cpuid_ebx(xen_cpuid_base() + 2); |
| 107 | + pfn = __pa(hypercall_page); |
| 108 | + wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32)); |
| 109 | + |
| 110 | + if (xen_initial_domain()) |
| 111 | + x86_init.oem.arch_setup = xen_add_preferred_consoles; |
| 112 | + x86_init.oem.banner = xen_banner; |
| 113 | + |
| 114 | + xen_efi_init(boot_params); |
| 115 | + |
| 116 | + if (xen_initial_domain()) { |
| 117 | + struct xen_platform_op op = { |
| 118 | + .cmd = XENPF_get_dom0_console, |
| 119 | + }; |
| 120 | + int ret = HYPERVISOR_platform_op(&op); |
| 121 | + |
| 122 | + if (ret > 0) |
| 123 | + xen_init_vga(&op.u.dom0_console, |
| 124 | + min(ret * sizeof(char), |
| 125 | + sizeof(op.u.dom0_console)), |
| 126 | + &boot_params->screen_info); |
| 127 | + } |
| 128 | +} |
| 129 | + |
| 130 | +void __init mem_map_via_hcall(struct boot_params *boot_params_p) |
| 131 | +{ |
| 132 | + struct xen_memory_map memmap; |
| 133 | + int rc; |
| 134 | + |
| 135 | + memmap.nr_entries = ARRAY_SIZE(boot_params_p->e820_table); |
| 136 | + set_xen_guest_handle(memmap.buffer, boot_params_p->e820_table); |
| 137 | + rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap); |
| 138 | + if (rc) { |
| 139 | + xen_raw_printk("XENMEM_memory_map failed (%d)\n", rc); |
| 140 | + BUG(); |
| 141 | + } |
| 142 | + boot_params_p->e820_entries = memmap.nr_entries; |
| 143 | +} |
0 commit comments