]>
Commit | Line | Data |
---|---|---|
0ee08727 GKH |
1 | From 72813bfbf0276a97c82af038efb5f02dcdd9e310 Mon Sep 17 00:00:00 2001 |
2 | From: Roger Pau Monne <roger.pau@citrix.com> | |
3 | Date: Tue, 23 Apr 2019 15:04:16 +0200 | |
4 | Subject: xen/pvh: correctly setup the PV EFI interface for dom0 | |
5 | MIME-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ||
9 | From: Roger Pau Monne <roger.pau@citrix.com> | |
10 | ||
11 | commit 72813bfbf0276a97c82af038efb5f02dcdd9e310 upstream. | |
12 | ||
13 | This involves initializing the boot params EFI related fields and the | |
14 | efi global variable. | |
15 | ||
16 | Without this fix a PVH dom0 doesn't detect when booted from EFI, and | |
17 | thus doesn't support accessing any of the EFI related data. | |
18 | ||
19 | Reported-by: PGNet Dev <pgnet.dev@gmail.com> | |
20 | Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> | |
21 | Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> | |
22 | Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> | |
23 | Cc: stable@vger.kernel.org # 4.19+ | |
24 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
25 | ||
26 | --- | |
27 | arch/x86/platform/pvh/enlighten.c | 8 ++++---- | |
28 | arch/x86/xen/efi.c | 12 ++++++------ | |
29 | arch/x86/xen/enlighten_pv.c | 2 +- | |
30 | arch/x86/xen/enlighten_pvh.c | 6 +++++- | |
31 | arch/x86/xen/xen-ops.h | 4 ++-- | |
32 | 5 files changed, 18 insertions(+), 14 deletions(-) | |
33 | ||
34 | --- a/arch/x86/platform/pvh/enlighten.c | |
35 | +++ b/arch/x86/platform/pvh/enlighten.c | |
36 | @@ -44,8 +44,6 @@ void __init __weak mem_map_via_hcall(str | |
37 | ||
38 | static void __init init_pvh_bootparams(bool xen_guest) | |
39 | { | |
40 | - memset(&pvh_bootparams, 0, sizeof(pvh_bootparams)); | |
41 | - | |
42 | if ((pvh_start_info.version > 0) && (pvh_start_info.memmap_entries)) { | |
43 | struct hvm_memmap_table_entry *ep; | |
44 | int i; | |
45 | @@ -103,7 +101,7 @@ static void __init init_pvh_bootparams(b | |
46 | * If we are trying to boot a Xen PVH guest, it is expected that the kernel | |
47 | * will have been configured to provide the required override for this routine. | |
48 | */ | |
49 | -void __init __weak xen_pvh_init(void) | |
50 | +void __init __weak xen_pvh_init(struct boot_params *boot_params) | |
51 | { | |
52 | xen_raw_printk("Error: Missing xen PVH initialization\n"); | |
53 | BUG(); | |
54 | @@ -112,7 +110,7 @@ void __init __weak xen_pvh_init(void) | |
55 | static void hypervisor_specific_init(bool xen_guest) | |
56 | { | |
57 | if (xen_guest) | |
58 | - xen_pvh_init(); | |
59 | + xen_pvh_init(&pvh_bootparams); | |
60 | } | |
61 | ||
62 | /* | |
63 | @@ -131,6 +129,8 @@ void __init xen_prepare_pvh(void) | |
64 | BUG(); | |
65 | } | |
66 | ||
67 | + memset(&pvh_bootparams, 0, sizeof(pvh_bootparams)); | |
68 | + | |
69 | hypervisor_specific_init(xen_guest); | |
70 | ||
71 | init_pvh_bootparams(xen_guest); | |
72 | --- a/arch/x86/xen/efi.c | |
73 | +++ b/arch/x86/xen/efi.c | |
74 | @@ -158,7 +158,7 @@ static enum efi_secureboot_mode xen_efi_ | |
75 | return efi_secureboot_mode_unknown; | |
76 | } | |
77 | ||
78 | -void __init xen_efi_init(void) | |
79 | +void __init xen_efi_init(struct boot_params *boot_params) | |
80 | { | |
81 | efi_system_table_t *efi_systab_xen; | |
82 | ||
83 | @@ -167,12 +167,12 @@ void __init xen_efi_init(void) | |
84 | if (efi_systab_xen == NULL) | |
85 | return; | |
86 | ||
87 | - strncpy((char *)&boot_params.efi_info.efi_loader_signature, "Xen", | |
88 | - sizeof(boot_params.efi_info.efi_loader_signature)); | |
89 | - boot_params.efi_info.efi_systab = (__u32)__pa(efi_systab_xen); | |
90 | - boot_params.efi_info.efi_systab_hi = (__u32)(__pa(efi_systab_xen) >> 32); | |
91 | + strncpy((char *)&boot_params->efi_info.efi_loader_signature, "Xen", | |
92 | + sizeof(boot_params->efi_info.efi_loader_signature)); | |
93 | + boot_params->efi_info.efi_systab = (__u32)__pa(efi_systab_xen); | |
94 | + boot_params->efi_info.efi_systab_hi = (__u32)(__pa(efi_systab_xen) >> 32); | |
95 | ||
96 | - boot_params.secure_boot = xen_efi_get_secureboot(); | |
97 | + boot_params->secure_boot = xen_efi_get_secureboot(); | |
98 | ||
99 | set_bit(EFI_BOOT, &efi.flags); | |
100 | set_bit(EFI_PARAVIRT, &efi.flags); | |
101 | --- a/arch/x86/xen/enlighten_pv.c | |
102 | +++ b/arch/x86/xen/enlighten_pv.c | |
103 | @@ -1403,7 +1403,7 @@ asmlinkage __visible void __init xen_sta | |
104 | /* We need this for printk timestamps */ | |
105 | xen_setup_runstate_info(0); | |
106 | ||
107 | - xen_efi_init(); | |
108 | + xen_efi_init(&boot_params); | |
109 | ||
110 | /* Start the world */ | |
111 | #ifdef CONFIG_X86_32 | |
112 | --- a/arch/x86/xen/enlighten_pvh.c | |
113 | +++ b/arch/x86/xen/enlighten_pvh.c | |
114 | @@ -13,6 +13,8 @@ | |
115 | ||
116 | #include <xen/interface/memory.h> | |
117 | ||
118 | +#include "xen-ops.h" | |
119 | + | |
120 | /* | |
121 | * PVH variables. | |
122 | * | |
123 | @@ -21,7 +23,7 @@ | |
124 | */ | |
125 | bool xen_pvh __attribute__((section(".data"))) = 0; | |
126 | ||
127 | -void __init xen_pvh_init(void) | |
128 | +void __init xen_pvh_init(struct boot_params *boot_params) | |
129 | { | |
130 | u32 msr; | |
131 | u64 pfn; | |
132 | @@ -33,6 +35,8 @@ void __init xen_pvh_init(void) | |
133 | msr = cpuid_ebx(xen_cpuid_base() + 2); | |
134 | pfn = __pa(hypercall_page); | |
135 | wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32)); | |
136 | + | |
137 | + xen_efi_init(boot_params); | |
138 | } | |
139 | ||
140 | void __init mem_map_via_hcall(struct boot_params *boot_params_p) | |
141 | --- a/arch/x86/xen/xen-ops.h | |
142 | +++ b/arch/x86/xen/xen-ops.h | |
143 | @@ -122,9 +122,9 @@ static inline void __init xen_init_vga(c | |
144 | void __init xen_init_apic(void); | |
145 | ||
146 | #ifdef CONFIG_XEN_EFI | |
147 | -extern void xen_efi_init(void); | |
148 | +extern void xen_efi_init(struct boot_params *boot_params); | |
149 | #else | |
150 | -static inline void __init xen_efi_init(void) | |
151 | +static inline void __init xen_efi_init(struct boot_params *boot_params) | |
152 | { | |
153 | } | |
154 | #endif |