aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kiper <daniel.kiper@oracle.com>2017-06-22 06:51:37 -0400
committerIngo Molnar <mingo@kernel.org>2017-06-23 05:11:03 -0400
commit6c64447ec58b0bac612732303f7ab04562124587 (patch)
tree8005bb035065983c42fbf0421db2b25455f53f4c
parent457ea3f7e97881f937136ce0ba1f29f82b9abdb0 (diff)
x86/xen/efi: Initialize only the EFI struct members used by Xen
The current approach, which is the wholesale efi struct initialization from a 'efi_xen' local template is not robust. Usually if new member is defined then it is properly initialized in drivers/firmware/efi/efi.c, but not in arch/x86/xen/efi.c. The effect is that the Xen initialization clears any fields the generic code might have set and the Xen code does not know about yet. I saw this happen a few times, so let's initialize only the EFI struct members used by Xen and maintain no local duplicate, to avoid such issues in the future. Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: andrew.cooper3@citrix.com Cc: jgross@suse.com Cc: linux-efi@vger.kernel.org Cc: matt@codeblueprint.co.uk Cc: stable@vger.kernel.org Cc: xen-devel@lists.xenproject.org Link: http://lkml.kernel.org/r/1498128697-12943-3-git-send-email-daniel.kiper@oracle.com [ Clarified the changelog. ] Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/xen/efi.c45
1 files changed, 12 insertions, 33 deletions
diff --git a/arch/x86/xen/efi.c b/arch/x86/xen/efi.c
index 30bb2e80cfe7..a18703be9ead 100644
--- a/arch/x86/xen/efi.c
+++ b/arch/x86/xen/efi.c
@@ -54,38 +54,6 @@ static efi_system_table_t efi_systab_xen __initdata = {
54 .tables = EFI_INVALID_TABLE_ADDR /* Initialized later. */ 54 .tables = EFI_INVALID_TABLE_ADDR /* Initialized later. */
55}; 55};
56 56
57static const struct efi efi_xen __initconst = {
58 .systab = NULL, /* Initialized later. */
59 .runtime_version = 0, /* Initialized later. */
60 .mps = EFI_INVALID_TABLE_ADDR,
61 .acpi = EFI_INVALID_TABLE_ADDR,
62 .acpi20 = EFI_INVALID_TABLE_ADDR,
63 .smbios = EFI_INVALID_TABLE_ADDR,
64 .smbios3 = EFI_INVALID_TABLE_ADDR,
65 .sal_systab = EFI_INVALID_TABLE_ADDR,
66 .boot_info = EFI_INVALID_TABLE_ADDR,
67 .hcdp = EFI_INVALID_TABLE_ADDR,
68 .uga = EFI_INVALID_TABLE_ADDR,
69 .uv_systab = EFI_INVALID_TABLE_ADDR,
70 .fw_vendor = EFI_INVALID_TABLE_ADDR,
71 .runtime = EFI_INVALID_TABLE_ADDR,
72 .config_table = EFI_INVALID_TABLE_ADDR,
73 .get_time = xen_efi_get_time,
74 .set_time = xen_efi_set_time,
75 .get_wakeup_time = xen_efi_get_wakeup_time,
76 .set_wakeup_time = xen_efi_set_wakeup_time,
77 .get_variable = xen_efi_get_variable,
78 .get_next_variable = xen_efi_get_next_variable,
79 .set_variable = xen_efi_set_variable,
80 .query_variable_info = xen_efi_query_variable_info,
81 .update_capsule = xen_efi_update_capsule,
82 .query_capsule_caps = xen_efi_query_capsule_caps,
83 .get_next_high_mono_count = xen_efi_get_next_high_mono_count,
84 .reset_system = xen_efi_reset_system,
85 .set_virtual_address_map = NULL, /* Not used under Xen. */
86 .flags = 0 /* Initialized later. */
87};
88
89static efi_system_table_t __init *xen_efi_probe(void) 57static efi_system_table_t __init *xen_efi_probe(void)
90{ 58{
91 struct xen_platform_op op = { 59 struct xen_platform_op op = {
@@ -102,7 +70,18 @@ static efi_system_table_t __init *xen_efi_probe(void)
102 70
103 /* Here we know that Xen runs on EFI platform. */ 71 /* Here we know that Xen runs on EFI platform. */
104 72
105 efi = efi_xen; 73 efi.get_time = xen_efi_get_time;
74 efi.set_time = xen_efi_set_time;
75 efi.get_wakeup_time = xen_efi_get_wakeup_time;
76 efi.set_wakeup_time = xen_efi_set_wakeup_time;
77 efi.get_variable = xen_efi_get_variable;
78 efi.get_next_variable = xen_efi_get_next_variable;
79 efi.set_variable = xen_efi_set_variable;
80 efi.query_variable_info = xen_efi_query_variable_info;
81 efi.update_capsule = xen_efi_update_capsule;
82 efi.query_capsule_caps = xen_efi_query_capsule_caps;
83 efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count;
84 efi.reset_system = xen_efi_reset_system;
106 85
107 efi_systab_xen.tables = info->cfg.addr; 86 efi_systab_xen.tables = info->cfg.addr;
108 efi_systab_xen.nr_tables = info->cfg.nent; 87 efi_systab_xen.nr_tables = info->cfg.nent;