Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+118 -66
+1
arch/x86/Kconfig
··· 2138 2138 config OLPC_XO1_SCI 2139 2139 bool "OLPC XO-1 SCI extras" 2140 2140 depends on OLPC && OLPC_XO1_PM 2141 + depends on INPUT=y 2141 2142 select POWER_SUPPLY 2142 2143 select GPIO_CS5535 2143 2144 select MFD_CORE
+1
arch/x86/include/asm/efi.h
··· 94 94 #endif /* CONFIG_X86_32 */ 95 95 96 96 extern int add_efi_memmap; 97 + extern unsigned long x86_efi_facility; 97 98 extern void efi_set_executable(efi_memory_desc_t *md, bool executable); 98 99 extern int efi_memblock_x86_reserve_range(void); 99 100 extern void efi_call_phys_prelog(void);
+1 -1
arch/x86/include/asm/uv/uv.h
··· 16 16 extern const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask, 17 17 struct mm_struct *mm, 18 18 unsigned long start, 19 - unsigned end, 19 + unsigned long end, 20 20 unsigned int cpu); 21 21 22 22 #else /* X86_UV */
+3 -4
arch/x86/kernel/entry_64.S
··· 1781 1781 * Leave room for the "copied" frame 1782 1782 */ 1783 1783 subq $(5*8), %rsp 1784 + CFI_ADJUST_CFA_OFFSET 5*8 1784 1785 1785 1786 /* Copy the stack frame to the Saved frame */ 1786 1787 .rept 5 ··· 1864 1863 nmi_swapgs: 1865 1864 SWAPGS_UNSAFE_STACK 1866 1865 nmi_restore: 1867 - RESTORE_ALL 8 1868 - 1869 - /* Pop the extra iret frame */ 1870 - addq $(5*8), %rsp 1866 + /* Pop the extra iret frame at once */ 1867 + RESTORE_ALL 6*8 1871 1868 1872 1869 /* Clear the NMI executing stack variable */ 1873 1870 movq $0, 5*8(%rsp)
+7 -2
arch/x86/kernel/head_32.S
··· 300 300 leal -__PAGE_OFFSET(%ecx),%esp 301 301 302 302 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 + 303 309 /* 304 310 * New page tables may be in 4Mbyte page mode and may 305 311 * be using the global pages. ··· 370 364 */ 371 365 movl $pa(initial_page_table), %eax 372 366 movl %eax,%cr3 /* set the page table pointer.. */ 373 - movl %cr0,%eax 374 - orl $X86_CR0_PG,%eax 367 + movl $CR0_STATE,%eax 375 368 movl %eax,%cr0 /* ..and set paging (PG) bit */ 376 369 ljmp $__BOOT_CS,$1f /* Clear prefetch and normalize %eip */ 377 370 1:
+3
arch/x86/kernel/msr.c
··· 174 174 unsigned int cpu; 175 175 struct cpuinfo_x86 *c; 176 176 177 + if (!capable(CAP_SYS_RAWIO)) 178 + return -EPERM; 179 + 177 180 cpu = iminor(file->f_path.dentry->d_inode); 178 181 if (cpu >= nr_cpu_ids || !cpu_online(cpu)) 179 182 return -ENXIO; /* No such CPU */
+1 -1
arch/x86/kernel/pci-dma.c
··· 56 56 EXPORT_SYMBOL(x86_dma_fallback_dev); 57 57 58 58 /* Number of entries preallocated for DMA-API debugging */ 59 - #define PREALLOC_DMA_DEBUG_ENTRIES 32768 59 + #define PREALLOC_DMA_DEBUG_ENTRIES 65536 60 60 61 61 int dma_set_mask(struct device *dev, u64 mask) 62 62 {
+1 -1
arch/x86/kernel/reboot.c
··· 584 584 break; 585 585 586 586 case BOOT_EFI: 587 - if (efi_enabled) 587 + if (efi_enabled(EFI_RUNTIME_SERVICES)) 588 588 efi.reset_system(reboot_mode ? 589 589 EFI_RESET_WARM : 590 590 EFI_RESET_COLD,
+14 -14
arch/x86/kernel/setup.c
··· 807 807 #ifdef CONFIG_EFI 808 808 if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature, 809 809 "EL32", 4)) { 810 - efi_enabled = 1; 811 - efi_64bit = false; 810 + set_bit(EFI_BOOT, &x86_efi_facility); 812 811 } else if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature, 813 812 "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); 816 815 } 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(); 819 819 #endif 820 820 821 821 x86_init.oem.arch_setup(); ··· 888 888 889 889 finish_e820_parsing(); 890 890 891 - if (efi_enabled) 891 + if (efi_enabled(EFI_BOOT)) 892 892 efi_init(); 893 893 894 894 dmi_scan_machine(); ··· 971 971 * The EFI specification says that boot service code won't be called 972 972 * after ExitBootServices(). This is, in fact, a lie. 973 973 */ 974 - if (efi_enabled) 974 + if (efi_enabled(EFI_MEMMAP)) 975 975 efi_reserve_boot_services(); 976 976 977 977 /* preallocate 4k for mptable mpc */ ··· 1114 1114 1115 1115 #ifdef CONFIG_VT 1116 1116 #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)) 1118 1118 conswitchp = &vga_con; 1119 1119 #elif defined(CONFIG_DUMMY_CONSOLE) 1120 1120 conswitchp = &dummy_con; ··· 1131 1131 register_refined_jiffies(CLOCK_TICK_RATE); 1132 1132 1133 1133 #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. 1137 1137 */ 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)) { 1139 1140 pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n"); 1140 1141 efi_unmap_memmap(); 1141 - efi_enabled = 0; 1142 1142 } 1143 1143 #endif 1144 1144 }
+34 -23
arch/x86/platform/efi/efi.c
··· 51 51 52 52 #define EFI_DEBUG 1 53 53 54 - int efi_enabled; 55 - EXPORT_SYMBOL(efi_enabled); 56 - 57 54 struct efi __read_mostly efi = { 58 55 .mps = EFI_INVALID_TABLE_ADDR, 59 56 .acpi = EFI_INVALID_TABLE_ADDR, ··· 66 69 67 70 struct efi_memory_map memmap; 68 71 69 - bool efi_64bit; 70 - 71 72 static struct efi efi_phys __initdata; 72 73 static efi_system_table_t efi_systab __initdata; 73 74 74 75 static inline bool efi_is_native(void) 75 76 { 76 - return IS_ENABLED(CONFIG_X86_64) == efi_64bit; 77 + return IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT); 77 78 } 79 + 80 + unsigned long x86_efi_facility; 81 + 82 + /* 83 + * Returns 1 if 'facility' is enabled, 0 otherwise. 84 + */ 85 + int efi_enabled(int facility) 86 + { 87 + return test_bit(facility, &x86_efi_facility) != 0; 88 + } 89 + EXPORT_SYMBOL(efi_enabled); 78 90 79 91 static int __init setup_noefi(char *arg) 80 92 { 81 - efi_enabled = 0; 93 + clear_bit(EFI_BOOT, &x86_efi_facility); 82 94 return 0; 83 95 } 84 96 early_param("noefi", setup_noefi); ··· 432 426 433 427 void __init efi_unmap_memmap(void) 434 428 { 429 + clear_bit(EFI_MEMMAP, &x86_efi_facility); 435 430 if (memmap.map) { 436 431 early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size); 437 432 memmap.map = NULL; ··· 467 460 468 461 static int __init efi_systab_init(void *phys) 469 462 { 470 - if (efi_64bit) { 463 + if (efi_enabled(EFI_64BIT)) { 471 464 efi_system_table_64_t *systab64; 472 465 u64 tmp = 0; 473 466 ··· 559 552 void *config_tables, *tablep; 560 553 int i, sz; 561 554 562 - if (efi_64bit) 555 + if (efi_enabled(EFI_64BIT)) 563 556 sz = sizeof(efi_config_table_64_t); 564 557 else 565 558 sz = sizeof(efi_config_table_32_t); ··· 579 572 efi_guid_t guid; 580 573 unsigned long table; 581 574 582 - if (efi_64bit) { 575 + if (efi_enabled(EFI_64BIT)) { 583 576 u64 table64; 584 577 guid = ((efi_config_table_64_t *)tablep)->guid; 585 578 table64 = ((efi_config_table_64_t *)tablep)->table; ··· 691 684 if (boot_params.efi_info.efi_systab_hi || 692 685 boot_params.efi_info.efi_memmap_hi) { 693 686 pr_info("Table located above 4GB, disabling EFI.\n"); 694 - efi_enabled = 0; 695 687 return; 696 688 } 697 689 efi_phys.systab = (efi_system_table_t *)boot_params.efi_info.efi_systab; ··· 700 694 ((__u64)boot_params.efi_info.efi_systab_hi<<32)); 701 695 #endif 702 696 703 - if (efi_systab_init(efi_phys.systab)) { 704 - efi_enabled = 0; 697 + if (efi_systab_init(efi_phys.systab)) 705 698 return; 706 - } 699 + 700 + set_bit(EFI_SYSTEM_TABLES, &x86_efi_facility); 707 701 708 702 /* 709 703 * Show what we know for posterity ··· 721 715 efi.systab->hdr.revision >> 16, 722 716 efi.systab->hdr.revision & 0xffff, vendor); 723 717 724 - if (efi_config_init(efi.systab->tables, efi.systab->nr_tables)) { 725 - efi_enabled = 0; 718 + if (efi_config_init(efi.systab->tables, efi.systab->nr_tables)) 726 719 return; 727 - } 720 + 721 + set_bit(EFI_CONFIG_TABLES, &x86_efi_facility); 728 722 729 723 /* 730 724 * Note: We currently don't support runtime services on an EFI ··· 733 727 734 728 if (!efi_is_native()) 735 729 pr_info("No EFI runtime due to 32/64-bit mismatch with kernel\n"); 736 - else if (efi_runtime_init()) { 737 - efi_enabled = 0; 738 - return; 730 + else { 731 + if (efi_runtime_init()) 732 + return; 733 + set_bit(EFI_RUNTIME_SERVICES, &x86_efi_facility); 739 734 } 740 735 741 - if (efi_memmap_init()) { 742 - efi_enabled = 0; 736 + if (efi_memmap_init()) 743 737 return; 744 - } 738 + 739 + set_bit(EFI_MEMMAP, &x86_efi_facility); 740 + 745 741 #ifdef CONFIG_X86_32 746 742 if (efi_is_native()) { 747 743 x86_platform.get_wallclock = efi_get_time; ··· 976 968 { 977 969 efi_memory_desc_t *md; 978 970 void *p; 971 + 972 + if (!efi_enabled(EFI_MEMMAP)) 973 + return 0; 979 974 980 975 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { 981 976 md = p;
+7 -3
arch/x86/platform/uv/tlb_uv.c
··· 1034 1034 * globally purge translation cache of a virtual address or all TLB's 1035 1035 * @cpumask: mask of all cpu's in which the address is to be removed 1036 1036 * @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 1038 1039 * @cpu: the current cpu 1039 1040 * 1040 1041 * This is the entry point for initiating any UV global TLB shootdown. ··· 1057 1056 */ 1058 1057 const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask, 1059 1058 struct mm_struct *mm, unsigned long start, 1060 - unsigned end, unsigned int cpu) 1059 + unsigned long end, unsigned int cpu) 1061 1060 { 1062 1061 int locals = 0; 1063 1062 int remotes = 0; ··· 1114 1113 1115 1114 record_send_statistics(stat, locals, hubs, remotes, bau_desc); 1116 1115 1117 - bau_desc->payload.address = start; 1116 + if (!end || (end - start) <= PAGE_SIZE) 1117 + bau_desc->payload.address = start; 1118 + else 1119 + bau_desc->payload.address = TLB_FLUSH_ALL; 1118 1120 bau_desc->payload.sending_cpu = cpu; 1119 1121 /* 1120 1122 * uv_flush_send_and_wait returns 0 if all cpu's were messaged,
+1 -1
drivers/acpi/osl.c
··· 250 250 return acpi_rsdp; 251 251 #endif 252 252 253 - if (efi_enabled) { 253 + if (efi_enabled(EFI_CONFIG_TABLES)) { 254 254 if (efi.acpi20 != EFI_INVALID_TABLE_ADDR) 255 255 return efi.acpi20; 256 256 else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
+1 -1
drivers/firmware/dmi_scan.c
··· 471 471 char __iomem *p, *q; 472 472 int rc; 473 473 474 - if (efi_enabled) { 474 + if (efi_enabled(EFI_CONFIG_TABLES)) { 475 475 if (efi.smbios == EFI_INVALID_TABLE_ADDR) 476 476 goto error; 477 477
+2 -2
drivers/firmware/efivars.c
··· 1782 1782 printk(KERN_INFO "EFI Variables Facility v%s %s\n", EFIVARS_VERSION, 1783 1783 EFIVARS_DATE); 1784 1784 1785 - if (!efi_enabled) 1785 + if (!efi_enabled(EFI_RUNTIME_SERVICES)) 1786 1786 return 0; 1787 1787 1788 1788 /* For now we'll register the efi directory at /sys/firmware/efi */ ··· 1822 1822 static void __exit 1823 1823 efivars_exit(void) 1824 1824 { 1825 - if (efi_enabled) { 1825 + if (efi_enabled(EFI_RUNTIME_SERVICES)) { 1826 1826 unregister_efivars(&__efivars); 1827 1827 kobject_put(efi_kobj); 1828 1828 }
+1 -1
drivers/firmware/iscsi_ibft_find.c
··· 99 99 /* iBFT 1.03 section 1.4.3.1 mandates that UEFI machines will 100 100 * only use ACPI for this */ 101 101 102 - if (!efi_enabled) 102 + if (!efi_enabled(EFI_BOOT)) 103 103 find_ibft_in_mem(); 104 104 105 105 if (ibft_addr) {
+2 -1
drivers/gpu/drm/radeon/radeon_device.c
··· 429 429 { 430 430 uint32_t reg; 431 431 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) 433 434 return false; 434 435 435 436 /* first check CRTCs */
+1 -1
drivers/platform/x86/ibm_rtl.c
··· 244 244 if (force) 245 245 pr_warn("module loaded by force\n"); 246 246 /* 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)) 248 248 return -ENODEV; 249 249 250 250 /* Get the address for the Extended BIOS Data Area */
+4
drivers/platform/x86/samsung-laptop.c
··· 26 26 #include <linux/seq_file.h> 27 27 #include <linux/debugfs.h> 28 28 #include <linux/ctype.h> 29 + #include <linux/efi.h> 29 30 #include <acpi/video.h> 30 31 31 32 /* ··· 1544 1543 { 1545 1544 struct samsung_laptop *samsung; 1546 1545 int ret; 1546 + 1547 + if (efi_enabled(EFI_BOOT)) 1548 + return -ENODEV; 1547 1549 1548 1550 quirks = &samsung_unknown; 1549 1551 if (!force && !dmi_check_system(samsung_dmi_table))
+1 -1
drivers/scsi/isci/init.c
··· 633 633 return -ENOMEM; 634 634 pci_set_drvdata(pdev, pci_info); 635 635 636 - if (efi_enabled) 636 + if (efi_enabled(EFI_RUNTIME_SERVICES)) 637 637 orom = isci_get_efi_var(pdev); 638 638 639 639 if (!orom)
+18 -6
include/linux/efi.h
··· 618 618 #endif 619 619 620 620 /* 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. 623 623 */ 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 + 624 631 #ifdef CONFIG_EFI 625 632 # ifdef CONFIG_X86 626 - extern int efi_enabled; 627 - extern bool efi_64bit; 633 + extern int efi_enabled(int facility); 628 634 # else 629 - # define efi_enabled 1 635 + static inline int efi_enabled(int facility) 636 + { 637 + return 1; 638 + } 630 639 # endif 631 640 #else 632 - # define efi_enabled 0 641 + static inline int efi_enabled(int facility) 642 + { 643 + return 0; 644 + } 633 645 #endif 634 646 635 647 /*
+2 -2
init/main.c
··· 604 604 pidmap_init(); 605 605 anon_vma_init(); 606 606 #ifdef CONFIG_X86 607 - if (efi_enabled) 607 + if (efi_enabled(EFI_RUNTIME_SERVICES)) 608 608 efi_enter_virtual_mode(); 609 609 #endif 610 610 thread_info_cache_init(); ··· 632 632 acpi_early_init(); /* before LAPIC and SMP init */ 633 633 sfi_init_late(); 634 634 635 - if (efi_enabled) { 635 + if (efi_enabled(EFI_RUNTIME_SERVICES)) { 636 636 efi_late_init(); 637 637 efi_free_boot_services(); 638 638 }
+12 -1
kernel/smp.c
··· 33 33 struct call_single_data csd; 34 34 atomic_t refs; 35 35 cpumask_var_t cpumask; 36 + cpumask_var_t cpumask_ipi; 36 37 }; 37 38 38 39 static DEFINE_PER_CPU_SHARED_ALIGNED(struct call_function_data, cfd_data); ··· 57 56 if (!zalloc_cpumask_var_node(&cfd->cpumask, GFP_KERNEL, 58 57 cpu_to_node(cpu))) 59 58 return notifier_from_errno(-ENOMEM); 59 + if (!zalloc_cpumask_var_node(&cfd->cpumask_ipi, GFP_KERNEL, 60 + cpu_to_node(cpu))) 61 + return notifier_from_errno(-ENOMEM); 60 62 break; 61 63 62 64 #ifdef CONFIG_HOTPLUG_CPU ··· 69 65 case CPU_DEAD: 70 66 case CPU_DEAD_FROZEN: 71 67 free_cpumask_var(cfd->cpumask); 68 + free_cpumask_var(cfd->cpumask_ipi); 72 69 break; 73 70 #endif 74 71 }; ··· 531 526 return; 532 527 } 533 528 529 + /* 530 + * After we put an entry into the list, data->cpumask 531 + * may be cleared again when another CPU sends another IPI for 532 + * a SMP function call, so data->cpumask will be zero. 533 + */ 534 + cpumask_copy(data->cpumask_ipi, data->cpumask); 534 535 raw_spin_lock_irqsave(&call_function.lock, flags); 535 536 /* 536 537 * Place entry at the _HEAD_ of the list, so that any cpu still ··· 560 549 smp_mb(); 561 550 562 551 /* Send a message to all CPUs in the map */ 563 - arch_send_call_function_ipi_mask(data->cpumask); 552 + arch_send_call_function_ipi_mask(data->cpumask_ipi); 564 553 565 554 /* Optionally wait for the CPUs to complete */ 566 555 if (wait)