Commit 8b2cb7a8f531d6ca72a8aff873b9bb1c6b3122ba

Authored by Huang, Ying
Committed by Ingo Molnar
1 parent bfd074e05b

x86: 32-bit EFI runtime service support: fixes in sync with 64-bit support

support according to fixes of x86_64 support.

- Delete efi_rt_lock because it is used during system early boot,
  before SMP is initialized.

- Change local_flush_tlb() to __flush_tlb_all() to flush global page
  mapping.

- Clean up includes.

- Revise Kconfig description.

- Enable noefi kernel parameter on i386.

Signed-off-by: Huang Ying <ying.huang@intel.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

Showing 7 changed files with 25 additions and 45 deletions Side-by-side Diff

Documentation/kernel-parameters.txt
... ... @@ -1169,6 +1169,8 @@
1169 1169  
1170 1170 nodisconnect [HW,SCSI,M68K] Disables SCSI disconnects.
1171 1171  
  1172 + noefi [X86-32,X86-64] Disable EFI runtime services support.
  1173 +
1172 1174 noexec [IA-64]
1173 1175  
1174 1176 noexec [X86-32,X86-64]
Documentation/x86_64/boot-options.txt
... ... @@ -306,9 +306,5 @@
306 306 newfallback: use new unwinder but fall back to old if it gets
307 307 stuck (default)
308 308  
309   -EFI
310   -
311   - noefi Disable EFI support
312   -
313 309 Miscellaneous
... ... @@ -961,21 +961,18 @@
961 961  
962 962 config EFI
963 963 def_bool n
964   - prompt "Boot from EFI support"
  964 + prompt "EFI runtime service support"
965 965 depends on ACPI
966 966 ---help---
967   - This enables the kernel to boot on EFI platforms using
968   - system configuration information passed to it from the firmware.
969   - This also enables the kernel to use any EFI runtime services that are
  967 + This enables the kernel to use EFI runtime services that are
970 968 available (such as the EFI variable services).
971 969  
972   - This option is only useful on systems that have EFI firmware
973   - and will result in a kernel image that is ~8k larger. In addition,
974   - you must use the latest ELILO loader available at
975   - <http://elilo.sourceforge.net> in order to take advantage of
976   - kernel initialization using EFI information (neither GRUB nor LILO know
977   - anything about EFI). However, even with this option, the resultant
978   - kernel should continue to boot on existing non-EFI platforms.
  970 + This option is only useful on systems that have EFI firmware.
  971 + In addition, you should use the latest ELILO loader available
  972 + at <http://elilo.sourceforge.net> in order to take advantage
  973 + of EFI runtime services. However, even with this option, the
  974 + resultant kernel should continue to boot on existing non-EFI
  975 + platforms.
979 976  
980 977 config IRQBALANCE
981 978 def_bool y
arch/x86/kernel/efi.c
... ... @@ -55,6 +55,13 @@
55 55 struct efi efi_phys __initdata;
56 56 static efi_system_table_t efi_systab __initdata;
57 57  
  58 +static int __init setup_noefi(char *arg)
  59 +{
  60 + efi_enabled = 0;
  61 + return 0;
  62 +}
  63 +early_param("noefi", setup_noefi);
  64 +
58 65 static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
59 66 {
60 67 return efi_call_virt2(get_time, tm, tc);
arch/x86/kernel/efi_32.c
... ... @@ -20,27 +20,15 @@
20 20 */
21 21  
22 22 #include <linux/kernel.h>
23   -#include <linux/init.h>
24   -#include <linux/mm.h>
25 23 #include <linux/types.h>
26   -#include <linux/time.h>
27   -#include <linux/spinlock.h>
28   -#include <linux/bootmem.h>
29 24 #include <linux/ioport.h>
30   -#include <linux/module.h>
31 25 #include <linux/efi.h>
32   -#include <linux/kexec.h>
33 26  
34   -#include <asm/setup.h>
35 27 #include <asm/io.h>
36 28 #include <asm/page.h>
37 29 #include <asm/pgtable.h>
38   -#include <asm/processor.h>
39   -#include <asm/desc.h>
40 30 #include <asm/tlbflush.h>
41 31  
42   -#define PFX "EFI: "
43   -
44 32 /*
45 33 * To make EFI call EFI runtime service in physical addressing mode we need
46 34 * prelog/epilog before/after the invocation to disable interrupt, to
47 35  
48 36  
... ... @@ -49,16 +37,14 @@
49 37 */
50 38  
51 39 static unsigned long efi_rt_eflags;
52   -static DEFINE_SPINLOCK(efi_rt_lock);
53 40 static pgd_t efi_bak_pg_dir_pointer[2];
54 41  
55   -void efi_call_phys_prelog(void) __acquires(efi_rt_lock)
  42 +void efi_call_phys_prelog(void)
56 43 {
57 44 unsigned long cr4;
58 45 unsigned long temp;
59 46 struct desc_ptr gdt_descr;
60 47  
61   - spin_lock(&efi_rt_lock);
62 48 local_irq_save(efi_rt_eflags);
63 49  
64 50 /*
65 51  
... ... @@ -88,14 +74,14 @@
88 74 /*
89 75 * After the lock is released, the original page table is restored.
90 76 */
91   - local_flush_tlb();
  77 + __flush_tlb_all();
92 78  
93 79 gdt_descr.address = __pa(get_cpu_gdt_table(0));
94 80 gdt_descr.size = GDT_SIZE - 1;
95 81 load_gdt(&gdt_descr);
96 82 }
97 83  
98   -void efi_call_phys_epilog(void) __releases(efi_rt_lock)
  84 +void efi_call_phys_epilog(void)
99 85 {
100 86 unsigned long cr4;
101 87 struct desc_ptr gdt_descr;
102 88  
... ... @@ -119,10 +105,9 @@
119 105 /*
120 106 * After the lock is released, the original page table is restored.
121 107 */
122   - local_flush_tlb();
  108 + __flush_tlb_all();
123 109  
124 110 local_irq_restore(efi_rt_eflags);
125   - spin_unlock(&efi_rt_lock);
126 111 }
127 112  
128 113 /*
... ... @@ -135,7 +120,7 @@
135 120 memmap.map = bt_ioremap((unsigned long) memmap.phys_map,
136 121 (memmap.nr_map * memmap.desc_size));
137 122 if (memmap.map == NULL)
138   - printk(KERN_ERR PFX "Could not remap the EFI memmap!\n");
  123 + printk(KERN_ERR "Could not remap the EFI memmap!\n");
139 124  
140 125 memmap.map_end = memmap.map + (memmap.nr_map * memmap.desc_size);
141 126 }
arch/x86/kernel/efi_64.c
... ... @@ -40,13 +40,6 @@
40 40 static pgd_t save_pgd __initdata;
41 41 static unsigned long efi_flags __initdata;
42 42  
43   -static int __init setup_noefi(char *arg)
44   -{
45   - efi_enabled = 0;
46   - return 0;
47   -}
48   -early_param("noefi", setup_noefi);
49   -
50 43 static void __init early_mapping_set_exec(unsigned long start,
51 44 unsigned long end,
52 45 int executable)
arch/x86/kernel/setup_32.c
... ... @@ -648,9 +648,6 @@
648 648 printk(KERN_INFO "BIOS-provided physical RAM map:\n");
649 649 print_memory_map(memory_setup());
650 650  
651   - if (efi_enabled)
652   - efi_init();
653   -
654 651 copy_edd();
655 652  
656 653 if (!boot_params.hdr.root_flags)
... ... @@ -676,6 +673,9 @@
676 673  
677 674 strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
678 675 *cmdline_p = command_line;
  676 +
  677 + if (efi_enabled)
  678 + efi_init();
679 679  
680 680 max_low_pfn = setup_memory();
681 681