History

Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Peter Anvin: "This is a collection of miscellaneous fixes, the most important one is the fix for the Samsung laptop bricking issue (auto-blacklisting the samsung-laptop driver); the efi_enabled() changes you see below are prerequisites for that fix. The other issues fixed are booting on OLPC XO-1.5, an UV fix, NMI debugging, and requiring CAP_SYS_RAWIO for MSR references, just as with I/O port references." * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: samsung-laptop: Disable on EFI hardware efi: Make 'efi_enabled' a function to query EFI facilities smp: Fix SMP function call empty cpu mask race x86/msr: Add capabilities check x86/dma-debug: Bump PREALLOC_DMA_DEBUG_ENTRIES x86/olpc: Fix olpc-xo1-sci.c build errors arch/x86/platform/uv: Fix incorrect tlb flush all issue x86-64: Fix unwind annotations in recent NMI changes x86-32: Start out cr0 clean, disable paging before modifying cr3/4

Linus Torvalds committed 13 years ago

Commit bdb0ae62 parents 0fe94b9 e00942422 files · +118 −66Browse files

Unified · Split

22 files
  1. arch/x86/Kconfig +1 −0
  2. arch/x86/include/asm/efi.h +1 −0
  3. arch/x86/include/asm/uv/uv.h +1 −1
  4. arch/x86/kernel/entry_64.S +3 −4
  5. arch/x86/kernel/head_32.S +7 −2
  6. arch/x86/kernel/msr.c +3 −0
  7. arch/x86/kernel/pci-dma.c +1 −1
  8. arch/x86/kernel/reboot.c +1 −1
  9. arch/x86/kernel/setup.c +14 −14
  10. arch/x86/platform/efi/efi.c +34 −23
  11. arch/x86/platform/uv/tlb_uv.c +7 −3
  12. drivers/acpi/osl.c +1 −1
  13. drivers/firmware/dmi_scan.c +1 −1
  14. drivers/firmware/efivars.c +2 −2
  15. drivers/firmware/iscsi_ibft_find.c +1 −1
  16. drivers/gpu/drm/radeon/radeon_device.c +2 −1
  17. drivers/platform/x86/ibm_rtl.c +1 −1
  18. drivers/platform/x86/samsung-laptop.c +4 −0
  19. drivers/scsi/isci/init.c +1 −1
  20. include/linux/efi.h +18 −6
  21. init/main.c +2 −2
  22. kernel/smp.c +12 −1
arch/x86/Kconfig+1−0
@@ -2138,6 +2138,7 @@ config OLPC_XO1_RTC · 2137 unmodified lines
21382138 config OLPC_XO1_SCI
21392139 bool "OLPC XO-1 SCI extras"
21402140 depends on OLPC && OLPC_XO1_PM
2141+ depends on INPUT=y
21412142 select POWER_SUPPLY
21422143 select GPIO_CS5535
21432144 select MFD_CORE
arch/x86/include/asm/efi.h+1−0
@@ -94,6 +94,7 @@ extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size, · 93 unmodified lines
9494 #endif /* CONFIG_X86_32 */
9595
9696 extern int add_efi_memmap;
97+extern unsigned long x86_efi_facility;
9798 extern void efi_set_executable(efi_memory_desc_t *md, bool executable);
9899 extern int efi_memblock_x86_reserve_range(void);
99100 extern void efi_call_phys_prelog(void);
arch/x86/include/asm/uv/uv.h+1−1
@@ -16,7 +16,7 @@ extern void uv_system_init(void); · 15 unmodified lines
1616 extern const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,
1717 struct mm_struct *mm,
1818 unsigned long start,
19− unsigned end,
19+ unsigned long end,
2020 unsigned int cpu);
2121
2222 #else /* X86_UV */
arch/x86/kernel/entry_64.S+3−4
@@ -1781,6 +1781,7 @@ first_nmi: · 1780 unmodified lines
17811781 * Leave room for the "copied" frame
17821782 */
17831783 subq $(5*8), %rsp
1784+ CFI_ADJUST_CFA_OFFSET 5*8
17841785
17851786 /* Copy the stack frame to the Saved frame */
17861787 .rept 5
@@ -1863,10 +1864,8 @@ end_repeat_nmi: · 76 unmodified lines
18631864 nmi_swapgs:
18641865 SWAPGS_UNSAFE_STACK
18651866 nmi_restore:
1866− RESTORE_ALL 8
1867−
1868− /* Pop the extra iret frame */
1869− addq $(5*8), %rsp
1867+ /* Pop the extra iret frame at once */
1868+ RESTORE_ALL 6*8
18701869
18711870 /* Clear the NMI executing stack variable */
18721871 movq $0, 5*8(%rsp)
arch/x86/kernel/head_32.S+7−2
@@ -300,6 +300,12 @@ ENTRY(startup_32_smp) · 299 unmodified lines
300300 leal -__PAGE_OFFSET(%ecx),%esp
301301
302302 default_entry:
303+#define CR0_STATE (X86_CR0_PE | X86_CR0_MP | X86_CR0_ET | \
304+ X86_CR0_NE | X86_CR0_WP | X86_CR0_AM | \
305+ X86_CR0_PG)
306+ movl $(CR0_STATE & ~X86_CR0_PG),%eax
307+ movl %eax,%cr0
308+
303309 /*
304310 * New page tables may be in 4Mbyte page mode and may
305311 * be using the global pages.
@@ -364,8 +370,7 @@ default_entry: · 58 unmodified lines
364370 */
365371 movl $pa(initial_page_table), %eax
366372 movl %eax,%cr3 /* set the page table pointer.. */
367− movl %cr0,%eax
368− orl $X86_CR0_PG,%eax
373+ movl $CR0_STATE,%eax
369374 movl %eax,%cr0 /* ..and set paging (PG) bit */
370375 ljmp $__BOOT_CS,$1f /* Clear prefetch and normalize %eip */
371376 1:
arch/x86/kernel/msr.c+3−0
@@ -174,6 +174,9 @@ static int msr_open(struct inode *inode, struct file *file) · 173 unmodified lines
174174 unsigned int cpu;
175175 struct cpuinfo_x86 *c;
176176
177+ if (!capable(CAP_SYS_RAWIO))
178+ return -EPERM;
179+
177180 cpu = iminor(file->f_path.dentry->d_inode);
178181 if (cpu >= nr_cpu_ids || !cpu_online(cpu))
179182 return -ENXIO; /* No such CPU */
arch/x86/kernel/pci-dma.c+1−1
@@ -56,7 +56,7 @@ struct device x86_dma_fallback_dev = { · 55 unmodified lines
5656 EXPORT_SYMBOL(x86_dma_fallback_dev);
5757
5858 /* Number of entries preallocated for DMA-API debugging */
59−#define PREALLOC_DMA_DEBUG_ENTRIES 32768
59+#define PREALLOC_DMA_DEBUG_ENTRIES 65536
6060
6161 int dma_set_mask(struct device *dev, u64 mask)
6262 {
arch/x86/kernel/reboot.c+1−1
@@ -584,7 +584,7 @@ static void native_machine_emergency_restart(void) · 583 unmodified lines
584584 break;
585585
586586 case BOOT_EFI:
587− if (efi_enabled)
587+ if (efi_enabled(EFI_RUNTIME_SERVICES))
588588 efi.reset_system(reboot_mode ?
589589 EFI_RESET_WARM :
590590 EFI_RESET_COLD,
arch/x86/kernel/setup.c+14−14
@@ -807,15 +807,15 @@ void __init setup_arch(char **cmdline_p) · 806 unmodified lines
807807 #ifdef CONFIG_EFI
808808 if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
809809 "EL32", 4)) {
810− efi_enabled = 1;
811− efi_64bit = false;
810+ set_bit(EFI_BOOT, &x86_efi_facility);
812811 } else if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
813812 "EL64", 4)) {
814− efi_enabled = 1;
815− efi_64bit = true;
813+ set_bit(EFI_BOOT, &x86_efi_facility);
814+ set_bit(EFI_64BIT, &x86_efi_facility);
816815 }
817− if (efi_enabled && efi_memblock_x86_reserve_range())
818− efi_enabled = 0;
816+
817+ if (efi_enabled(EFI_BOOT))
818+ efi_memblock_x86_reserve_range();
819819 #endif
820820
821821 x86_init.oem.arch_setup();
@@ -888,7 +888,7 @@ void __init setup_arch(char **cmdline_p) · 66 unmodified lines
888888
889889 finish_e820_parsing();
890890
891− if (efi_enabled)
891+ if (efi_enabled(EFI_BOOT))
892892 efi_init();
893893
894894 dmi_scan_machine();
@@ -971,7 +971,7 @@ void __init setup_arch(char **cmdline_p) · 76 unmodified lines
971971 * The EFI specification says that boot service code won't be called
972972 * after ExitBootServices(). This is, in fact, a lie.
973973 */
974− if (efi_enabled)
974+ if (efi_enabled(EFI_MEMMAP))
975975 efi_reserve_boot_services();
976976
977977 /* preallocate 4k for mptable mpc */
@@ -1114,7 +1114,7 @@ void __init setup_arch(char **cmdline_p) · 136 unmodified lines
11141114
11151115 #ifdef CONFIG_VT
11161116 #if defined(CONFIG_VGA_CONSOLE)
1117− if (!efi_enabled || (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY))
1117+ if (!efi_enabled(EFI_BOOT) || (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY))
11181118 conswitchp = &vga_con;
11191119 #elif defined(CONFIG_DUMMY_CONSOLE)
11201120 conswitchp = &dummy_con;
@@ -1131,14 +1131,14 @@ void __init setup_arch(char **cmdline_p) · 10 unmodified lines
11311131 register_refined_jiffies(CLOCK_TICK_RATE);
11321132
11331133 #ifdef CONFIG_EFI
1134− /* Once setup is done above, disable efi_enabled on mismatched
1135− * firmware/kernel archtectures since there is no support for
1136− * runtime services.
1134+ /* Once setup is done above, unmap the EFI memory map on
1135+ * mismatched firmware/kernel archtectures since there is no
1136+ * support for runtime services.
11371137 */
1138− if (efi_enabled && IS_ENABLED(CONFIG_X86_64) != efi_64bit) {
1138+ if (efi_enabled(EFI_BOOT) &&
1139+ IS_ENABLED(CONFIG_X86_64) != efi_enabled(EFI_64BIT)) {
11391140 pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n");
11401141 efi_unmap_memmap();
1141− efi_enabled = 0;
11421142 }
11431143 #endif
11441144 }
arch/x86/platform/efi/efi.c+34−23
@@ -51,9 +51,6 @@ · 50 unmodified lines
5151
5252 #define EFI_DEBUG 1
5353
54−int efi_enabled;
55−EXPORT_SYMBOL(efi_enabled);
56−
5754 struct efi __read_mostly efi = {
5855 .mps = EFI_INVALID_TABLE_ADDR,
5956 .acpi = EFI_INVALID_TABLE_ADDR,
@@ -69,19 +66,28 @@ EXPORT_SYMBOL(efi); · 9 unmodified lines
6966
7067 struct efi_memory_map memmap;
7168
72−bool efi_64bit;
73−
7469 static struct efi efi_phys __initdata;
7570 static efi_system_table_t efi_systab __initdata;
7671
7772 static inline bool efi_is_native(void)
7873 {
79− return IS_ENABLED(CONFIG_X86_64) == efi_64bit;
74+ return IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT);
75+}
76+
77+unsigned long x86_efi_facility;
78+
79+/*
80+ * Returns 1 if 'facility' is enabled, 0 otherwise.
81+ */
82+int efi_enabled(int facility)
83+{
84+ return test_bit(facility, &x86_efi_facility) != 0;
8085 }
86+EXPORT_SYMBOL(efi_enabled);
8187
8288 static int __init setup_noefi(char *arg)
8389 {
84− efi_enabled = 0;
90+ clear_bit(EFI_BOOT, &x86_efi_facility);
8591 return 0;
8692 }
8793 early_param("noefi", setup_noefi);
@@ -426,6 +432,7 @@ void __init efi_reserve_boot_services(void) · 338 unmodified lines
426432
427433 void __init efi_unmap_memmap(void)
428434 {
435+ clear_bit(EFI_MEMMAP, &x86_efi_facility);
429436 if (memmap.map) {
430437 early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size);
431438 memmap.map = NULL;
@@ -460,7 +467,7 @@ void __init efi_free_boot_services(void) · 28 unmodified lines
460467
461468 static int __init efi_systab_init(void *phys)
462469 {
463− if (efi_64bit) {
470+ if (efi_enabled(EFI_64BIT)) {
464471 efi_system_table_64_t *systab64;
465472 u64 tmp = 0;
466473
@@ -552,7 +559,7 @@ static int __init efi_config_init(u64 tables, int nr_tables) · 85 unmodified lines
552559 void *config_tables, *tablep;
553560 int i, sz;
554561
555− if (efi_64bit)
562+ if (efi_enabled(EFI_64BIT))
556563 sz = sizeof(efi_config_table_64_t);
557564 else
558565 sz = sizeof(efi_config_table_32_t);
@@ -572,7 +579,7 @@ static int __init efi_config_init(u64 tables, int nr_tables) · 13 unmodified lines
572579 efi_guid_t guid;
573580 unsigned long table;
574581
575− if (efi_64bit) {
582+ if (efi_enabled(EFI_64BIT)) {
576583 u64 table64;
577584 guid = ((efi_config_table_64_t *)tablep)->guid;
578585 table64 = ((efi_config_table_64_t *)tablep)->table;
@@ -684,7 +691,6 @@ void __init efi_init(void) · 105 unmodified lines
684691 if (boot_params.efi_info.efi_systab_hi ||
685692 boot_params.efi_info.efi_memmap_hi) {
686693 pr_info("Table located above 4GB, disabling EFI.\n");
687− efi_enabled = 0;
688694 return;
689695 }
690696 efi_phys.systab = (efi_system_table_t *)boot_params.efi_info.efi_systab;
@@ -694,10 +700,10 @@ void __init efi_init(void) · 3 unmodified lines
694700 ((__u64)boot_params.efi_info.efi_systab_hi<<32));
695701 #endif
696702
697− if (efi_systab_init(efi_phys.systab)) {
698− efi_enabled = 0;
703+ if (efi_systab_init(efi_phys.systab))
699704 return;
700− }
705+
706+ set_bit(EFI_SYSTEM_TABLES, &x86_efi_facility);
701707
702708 /*
703709 * Show what we know for posterity
@@ -715,10 +721,10 @@ void __init efi_init(void) · 11 unmodified lines
715721 efi.systab->hdr.revision >> 16,
716722 efi.systab->hdr.revision & 0xffff, vendor);
717723
718− if (efi_config_init(efi.systab->tables, efi.systab->nr_tables)) {
719− efi_enabled = 0;
724+ if (efi_config_init(efi.systab->tables, efi.systab->nr_tables))
720725 return;
721− }
726+
727+ set_bit(EFI_CONFIG_TABLES, &x86_efi_facility);
722728
723729 /*
724730 * Note: We currently don't support runtime services on an EFI
@@ -727,15 +733,17 @@ void __init efi_init(void) · 2 unmodified lines
727733
728734 if (!efi_is_native())
729735 pr_info("No EFI runtime due to 32/64-bit mismatch with kernel\n");
730− else if (efi_runtime_init()) {
731− efi_enabled = 0;
732− return;
736+ else {
737+ if (efi_runtime_init())
738+ return;
739+ set_bit(EFI_RUNTIME_SERVICES, &x86_efi_facility);
733740 }
734741
735− if (efi_memmap_init()) {
736− efi_enabled = 0;
742+ if (efi_memmap_init())
737743 return;
738− }
744+
745+ set_bit(EFI_MEMMAP, &x86_efi_facility);
746+
739747 #ifdef CONFIG_X86_32
740748 if (efi_is_native()) {
741749 x86_platform.get_wallclock = efi_get_time;
@@ -969,6 +977,9 @@ u32 efi_mem_type(unsigned long phys_addr) · 227 unmodified lines
969977 efi_memory_desc_t *md;
970978 void *p;
971979
980+ if (!efi_enabled(EFI_MEMMAP))
981+ return 0;
982+
972983 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
973984 md = p;
974985 if ((md->phys_addr <= phys_addr) &&
arch/x86/platform/uv/tlb_uv.c+7−3
@@ -1034,7 +1034,8 @@ static int set_distrib_bits(struct cpumask *flush_mask, struct bau_control *bcp, · 1033 unmodified lines
10341034 * globally purge translation cache of a virtual address or all TLB's
10351035 * @cpumask: mask of all cpu's in which the address is to be removed
10361036 * @mm: mm_struct containing virtual address range
1037− * @va: virtual address to be removed (or TLB_FLUSH_ALL for all TLB's on cpu)
1037+ * @start: start virtual address to be removed from TLB
1038+ * @end: end virtual address to be remove from TLB
10381039 * @cpu: the current cpu
10391040 *
10401041 * This is the entry point for initiating any UV global TLB shootdown.
@@ -1056,7 +1057,7 @@ static int set_distrib_bits(struct cpumask *flush_mask, struct bau_control *bcp, · 15 unmodified lines
10561057 */
10571058 const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,
10581059 struct mm_struct *mm, unsigned long start,
1059− unsigned end, unsigned int cpu)
1060+ unsigned long end, unsigned int cpu)
10601061 {
10611062 int locals = 0;
10621063 int remotes = 0;
@@ -1113,7 +1114,10 @@ const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask, · 50 unmodified lines
11131114
11141115 record_send_statistics(stat, locals, hubs, remotes, bau_desc);
11151116
1116− bau_desc->payload.address = start;
1117+ if (!end || (end - start) <= PAGE_SIZE)
1118+ bau_desc->payload.address = start;
1119+ else
1120+ bau_desc->payload.address = TLB_FLUSH_ALL;
11171121 bau_desc->payload.sending_cpu = cpu;
11181122 /*
11191123 * uv_flush_send_and_wait returns 0 if all cpu's were messaged,
drivers/acpi/osl.c+1−1
@@ -250,7 +250,7 @@ acpi_physical_address __init acpi_os_get_root_pointer(void) · 249 unmodified lines
250250 return acpi_rsdp;
251251 #endif
252252
253− if (efi_enabled) {
253+ if (efi_enabled(EFI_CONFIG_TABLES)) {
254254 if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
255255 return efi.acpi20;
256256 else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
drivers/firmware/dmi_scan.c+1−1
@@ -471,7 +471,7 @@ void __init dmi_scan_machine(void) · 470 unmodified lines
471471 char __iomem *p, *q;
472472 int rc;
473473
474− if (efi_enabled) {
474+ if (efi_enabled(EFI_CONFIG_TABLES)) {
475475 if (efi.smbios == EFI_INVALID_TABLE_ADDR)
476476 goto error;
477477
drivers/firmware/efivars.c+2−2
@@ -1782,7 +1782,7 @@ efivars_init(void) · 1781 unmodified lines
17821782 printk(KERN_INFO "EFI Variables Facility v%s %s\n", EFIVARS_VERSION,
17831783 EFIVARS_DATE);
17841784
1785− if (!efi_enabled)
1785+ if (!efi_enabled(EFI_RUNTIME_SERVICES))
17861786 return 0;
17871787
17881788 /* For now we'll register the efi directory at /sys/firmware/efi */
@@ -1822,7 +1822,7 @@ err_put: · 33 unmodified lines
18221822 static void __exit
18231823 efivars_exit(void)
18241824 {
1825− if (efi_enabled) {
1825+ if (efi_enabled(EFI_RUNTIME_SERVICES)) {
18261826 unregister_efivars(&__efivars);
18271827 kobject_put(efi_kobj);
18281828 }
drivers/firmware/iscsi_ibft_find.c+1−1
@@ -99,7 +99,7 @@ unsigned long __init find_ibft_region(unsigned long *sizep) · 98 unmodified lines
9999 /* iBFT 1.03 section 1.4.3.1 mandates that UEFI machines will
100100 * only use ACPI for this */
101101
102− if (!efi_enabled)
102+ if (!efi_enabled(EFI_BOOT))
103103 find_ibft_in_mem();
104104
105105 if (ibft_addr) {
drivers/gpu/drm/radeon/radeon_device.c+2−1
@@ -429,7 +429,8 @@ bool radeon_card_posted(struct radeon_device *rdev) · 428 unmodified lines
429429 {
430430 uint32_t reg;
431431
432− if (efi_enabled && rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE)
432+ if (efi_enabled(EFI_BOOT) &&
433+ rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE)
433434 return false;
434435
435436 /* first check CRTCs */
drivers/platform/x86/ibm_rtl.c+1−1
@@ -244,7 +244,7 @@ static int __init ibm_rtl_init(void) { · 243 unmodified lines
244244 if (force)
245245 pr_warn("module loaded by force\n");
246246 /* first ensure that we are running on IBM HW */
247− else if (efi_enabled || !dmi_check_system(ibm_rtl_dmi_table))
247+ else if (efi_enabled(EFI_BOOT) || !dmi_check_system(ibm_rtl_dmi_table))
248248 return -ENODEV;
249249
250250 /* Get the address for the Extended BIOS Data Area */
drivers/platform/x86/samsung-laptop.c+4−0
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 #include <linux/seq_file.h>
2727 #include <linux/debugfs.h>
2828 #include <linux/ctype.h>
29+#include <linux/efi.h>
2930 #include <acpi/video.h>
3031
3132 /*
@@ -1544,6 +1545,9 @@ static int __init samsung_init(void) · 1512 unmodified lines
15441545 struct samsung_laptop *samsung;
15451546 int ret;
15461547
1548+ if (efi_enabled(EFI_BOOT))
1549+ return -ENODEV;
1550+
15471551 quirks = &samsung_unknown;
15481552 if (!force && !dmi_check_system(samsung_dmi_table))
15491553 return -ENODEV;
drivers/scsi/isci/init.c+1−1
@@ -633,7 +633,7 @@ static int isci_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 632 unmodified lines
633633 return -ENOMEM;
634634 pci_set_drvdata(pdev, pci_info);
635635
636− if (efi_enabled)
636+ if (efi_enabled(EFI_RUNTIME_SERVICES))
637637 orom = isci_get_efi_var(pdev);
638638
639639 if (!orom)
include/linux/efi.h+18−6
@@ -618,18 +618,30 @@ extern int __init efi_setup_pcdp_console(char *); · 617 unmodified lines
618618 #endif
619619
620620 /*
621− * We play games with efi_enabled so that the compiler will, if possible, remove
622− * EFI-related code altogether.
621+ * We play games with efi_enabled so that the compiler will, if
622+ * possible, remove EFI-related code altogether.
623623 */
624+#define EFI_BOOT 0 /* Were we booted from EFI? */
625+#define EFI_SYSTEM_TABLES 1 /* Can we use EFI system tables? */
626+#define EFI_CONFIG_TABLES 2 /* Can we use EFI config tables? */
627+#define EFI_RUNTIME_SERVICES 3 /* Can we use runtime services? */
628+#define EFI_MEMMAP 4 /* Can we use EFI memory map? */
629+#define EFI_64BIT 5 /* Is the firmware 64-bit? */
630+
624631 #ifdef CONFIG_EFI
625632 # ifdef CONFIG_X86
626− extern int efi_enabled;
627− extern bool efi_64bit;
633+extern int efi_enabled(int facility);
628634 # else
629−# define efi_enabled 1
635+static inline int efi_enabled(int facility)
636+{
637+ return 1;
638+}
630639 # endif
631640 #else
632−# define efi_enabled 0
641+static inline int efi_enabled(int facility)
642+{
643+ return 0;
644+}
633645 #endif
634646
635647 /*
init/main.c+2−2
@@ -604,7 +604,7 @@ asmlinkage void __init start_kernel(void) · 603 unmodified lines
604604 pidmap_init();
605605 anon_vma_init();
606606 #ifdef CONFIG_X86
607− if (efi_enabled)
607+ if (efi_enabled(EFI_RUNTIME_SERVICES))
608608 efi_enter_virtual_mode();
609609 #endif
610610 thread_info_cache_init();
@@ -632,7 +632,7 @@ asmlinkage void __init start_kernel(void) · 21 unmodified lines
632632 acpi_early_init(); /* before LAPIC and SMP init */
633633 sfi_init_late();
634634
635− if (efi_enabled) {
635+ if (efi_enabled(EFI_RUNTIME_SERVICES)) {
636636 efi_late_init();
637637 efi_free_boot_services();
638638 }
kernel/smp.c+12−1
@@ -33,6 +33,7 @@ struct call_function_data { · 32 unmodified lines
3333 struct call_single_data csd;
3434 atomic_t refs;
3535 cpumask_var_t cpumask;
36+ cpumask_var_t cpumask_ipi;
3637 };
3738
3839 static DEFINE_PER_CPU_SHARED_ALIGNED(struct call_function_data, cfd_data);
@@ -56,6 +57,9 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu) · 17 unmodified lines
5657 if (!zalloc_cpumask_var_node(&cfd->cpumask, GFP_KERNEL,
5758 cpu_to_node(cpu)))
5859 return notifier_from_errno(-ENOMEM);
60+ if (!zalloc_cpumask_var_node(&cfd->cpumask_ipi, GFP_KERNEL,
61+ cpu_to_node(cpu)))
62+ return notifier_from_errno(-ENOMEM);
5963 break;
6064
6165 #ifdef CONFIG_HOTPLUG_CPU
@@ -65,6 +69,7 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu) · 3 unmodified lines
6569 case CPU_DEAD:
6670 case CPU_DEAD_FROZEN:
6771 free_cpumask_var(cfd->cpumask);
72+ free_cpumask_var(cfd->cpumask_ipi);
6873 break;
6974 #endif
7075 };
@@ -526,6 +531,12 @@ void smp_call_function_many(const struct cpumask *mask, · 455 unmodified lines
526531 return;
527532 }
528533
534+ /*
535+ * After we put an entry into the list, data->cpumask
536+ * may be cleared again when another CPU sends another IPI for
537+ * a SMP function call, so data->cpumask will be zero.
538+ */
539+ cpumask_copy(data->cpumask_ipi, data->cpumask);
529540 raw_spin_lock_irqsave(&call_function.lock, flags);
530541 /*
531542 * Place entry at the _HEAD_ of the list, so that any cpu still
@@ -549,7 +560,7 @@ void smp_call_function_many(const struct cpumask *mask, · 17 unmodified lines
549560 smp_mb();
550561
551562 /* Send a message to all CPUs in the map */
552− arch_send_call_function_ipi_mask(data->cpumask);
563+ arch_send_call_function_ipi_mask(data->cpumask_ipi);
553564
554565 /* Optionally wait for the CPUs to complete */
555566 if (wait)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t