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

x86/cpufeature: Replace cpu_has_apic with boot_cpu_has() usage

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: iommu@lists.linux-foundation.org
Cc: linux-pm@vger.kernel.org
Cc: oprofile-list@lists.sf.net
Link: http://lkml.kernel.org/r/1459801503-15600-8-git-send-email-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Borislav Petkov and committed by
Ingo Molnar
93984fbd 59e21e3d

+32 -33
+1 -1
arch/x86/events/core.c
··· 1518 1518 1519 1519 static void __init pmu_check_apic(void) 1520 1520 { 1521 - if (cpu_has_apic) 1521 + if (boot_cpu_has(X86_FEATURE_APIC)) 1522 1522 return; 1523 1523 1524 1524 x86_pmu.apic = 0;
-1
arch/x86/include/asm/cpufeature.h
··· 118 118 set_bit(bit, (unsigned long *)cpu_caps_set); \ 119 119 } while (0) 120 120 121 - #define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC) 122 121 #define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR) 123 122 #define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE) 124 123 #define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)
+1 -1
arch/x86/include/asm/irq_work.h
··· 5 5 6 6 static inline bool arch_irq_work_has_interrupt(void) 7 7 { 8 - return cpu_has_apic; 8 + return boot_cpu_has(X86_FEATURE_APIC); 9 9 } 10 10 11 11 #endif /* _ASM_IRQ_WORK_H */
+4 -4
arch/x86/kernel/acpi/boot.c
··· 136 136 { 137 137 struct acpi_table_madt *madt = NULL; 138 138 139 - if (!cpu_has_apic) 139 + if (!boot_cpu_has(X86_FEATURE_APIC)) 140 140 return -EINVAL; 141 141 142 142 madt = (struct acpi_table_madt *)table; ··· 951 951 { 952 952 int count; 953 953 954 - if (!cpu_has_apic) 954 + if (!boot_cpu_has(X86_FEATURE_APIC)) 955 955 return -ENODEV; 956 956 957 957 /* ··· 979 979 int ret; 980 980 struct acpi_subtable_proc madt_proc[2]; 981 981 982 - if (!cpu_has_apic) 982 + if (!boot_cpu_has(X86_FEATURE_APIC)) 983 983 return -ENODEV; 984 984 985 985 /* ··· 1125 1125 if (acpi_disabled || acpi_noirq) 1126 1126 return -ENODEV; 1127 1127 1128 - if (!cpu_has_apic) 1128 + if (!boot_cpu_has(X86_FEATURE_APIC)) 1129 1129 return -ENODEV; 1130 1130 1131 1131 /*
+10 -10
arch/x86/kernel/apic/apic.c
··· 1085 1085 { 1086 1086 unsigned long flags; 1087 1087 1088 - if (!cpu_has_apic && !apic_from_smp_config()) 1088 + if (!boot_cpu_has(X86_FEATURE_APIC) && !apic_from_smp_config()) 1089 1089 return; 1090 1090 1091 1091 local_irq_save(flags); ··· 1134 1134 * Don't do the setup now if we have a SMP BIOS as the 1135 1135 * through-I/O-APIC virtual wire mode might be active. 1136 1136 */ 1137 - if (smp_found_config || !cpu_has_apic) 1137 + if (smp_found_config || !boot_cpu_has(X86_FEATURE_APIC)) 1138 1138 return; 1139 1139 1140 1140 /* ··· 1445 1445 { 1446 1446 u64 msr; 1447 1447 1448 - if (!cpu_has_apic) 1448 + if (!boot_cpu_has(X86_FEATURE_APIC)) 1449 1449 return; 1450 1450 1451 1451 rdmsrl(MSR_IA32_APICBASE, msr); ··· 1632 1632 */ 1633 1633 static int __init detect_init_APIC(void) 1634 1634 { 1635 - if (!cpu_has_apic) { 1635 + if (!boot_cpu_has(X86_FEATURE_APIC)) { 1636 1636 pr_info("No local APIC present\n"); 1637 1637 return -1; 1638 1638 } ··· 1711 1711 goto no_apic; 1712 1712 case X86_VENDOR_INTEL: 1713 1713 if (boot_cpu_data.x86 == 6 || boot_cpu_data.x86 == 15 || 1714 - (boot_cpu_data.x86 == 5 && cpu_has_apic)) 1714 + (boot_cpu_data.x86 == 5 && boot_cpu_has(X86_FEATURE_APIC))) 1715 1715 break; 1716 1716 goto no_apic; 1717 1717 default: 1718 1718 goto no_apic; 1719 1719 } 1720 1720 1721 - if (!cpu_has_apic) { 1721 + if (!boot_cpu_has(X86_FEATURE_APIC)) { 1722 1722 /* 1723 1723 * Over-ride BIOS and try to enable the local APIC only if 1724 1724 * "lapic" specified. ··· 2233 2233 return -1; 2234 2234 } 2235 2235 #ifdef CONFIG_X86_64 2236 - if (!cpu_has_apic) { 2236 + if (!boot_cpu_has(X86_FEATURE_APIC)) { 2237 2237 disable_apic = 1; 2238 2238 pr_info("Apic disabled by BIOS\n"); 2239 2239 return -1; 2240 2240 } 2241 2241 #else 2242 - if (!smp_found_config && !cpu_has_apic) 2242 + if (!smp_found_config && !boot_cpu_has(X86_FEATURE_APIC)) 2243 2243 return -1; 2244 2244 2245 2245 /* 2246 2246 * Complain if the BIOS pretends there is one. 2247 2247 */ 2248 - if (!cpu_has_apic && 2248 + if (!boot_cpu_has(X86_FEATURE_APIC) && 2249 2249 APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) { 2250 2250 pr_err("BIOS bug, local APIC 0x%x not detected!...\n", 2251 2251 boot_cpu_physical_apicid); ··· 2426 2426 static int __init init_lapic_sysfs(void) 2427 2427 { 2428 2428 /* XXX: remove suspend/resume procs if !apic_pm_state.active? */ 2429 - if (cpu_has_apic) 2429 + if (boot_cpu_has(X86_FEATURE_APIC)) 2430 2430 register_syscore_ops(&lapic_syscore_ops); 2431 2431 2432 2432 return 0;
+2 -2
arch/x86/kernel/apic/apic_noop.c
··· 100 100 101 101 static u32 noop_apic_read(u32 reg) 102 102 { 103 - WARN_ON_ONCE((cpu_has_apic && !disable_apic)); 103 + WARN_ON_ONCE(boot_cpu_has(X86_FEATURE_APIC) && !disable_apic); 104 104 return 0; 105 105 } 106 106 107 107 static void noop_apic_write(u32 reg, u32 v) 108 108 { 109 - WARN_ON_ONCE(cpu_has_apic && !disable_apic); 109 + WARN_ON_ONCE(boot_cpu_has(X86_FEATURE_APIC) && !disable_apic); 110 110 } 111 111 112 112 struct apic apic_noop = {
+1 -1
arch/x86/kernel/apic/io_apic.c
··· 1454 1454 ioapic_write_entry(ioapic_i8259.apic, ioapic_i8259.pin, entry); 1455 1455 } 1456 1456 1457 - if (cpu_has_apic || apic_from_smp_config()) 1457 + if (boot_cpu_has(X86_FEATURE_APIC) || apic_from_smp_config()) 1458 1458 disconnect_bsp_APIC(ioapic_i8259.pin != -1); 1459 1459 } 1460 1460
+1 -1
arch/x86/kernel/apic/ipi.c
··· 230 230 { 231 231 int apicid, cpuid; 232 232 233 - if (!cpu_has_apic) 233 + if (!boot_cpu_has(X86_FEATURE_APIC)) 234 234 return 0; 235 235 236 236 apicid = hard_smp_processor_id();
+1 -1
arch/x86/kernel/apic/vector.c
··· 943 943 print_PIC(); 944 944 945 945 /* don't print out if apic is not there */ 946 - if (!cpu_has_apic && !apic_from_smp_config()) 946 + if (!boot_cpu_has(X86_FEATURE_APIC) && !apic_from_smp_config()) 947 947 return 0; 948 948 949 949 print_local_APICs(show_lapic);
+2 -2
arch/x86/kernel/cpu/amd.c
··· 565 565 * can safely set X86_FEATURE_EXTD_APICID unconditionally for families 566 566 * after 16h. 567 567 */ 568 - if (cpu_has_apic && c->x86 > 0x16) { 568 + if (boot_cpu_has(X86_FEATURE_APIC) && c->x86 > 0x16) { 569 569 set_cpu_cap(c, X86_FEATURE_EXTD_APICID); 570 - } else if (cpu_has_apic && c->x86 >= 0xf) { 570 + } else if (boot_cpu_has(X86_FEATURE_APIC) && c->x86 >= 0xf) { 571 571 /* check CPU config space for extended APIC ID */ 572 572 unsigned int val; 573 573 val = read_pci_config(0, 24, 0, 0x68);
+1 -1
arch/x86/kernel/cpu/intel.c
··· 281 281 * integrated APIC (see 11AP erratum in "Pentium Processor 282 282 * Specification Update"). 283 283 */ 284 - if (cpu_has_apic && (c->x86<<8 | c->x86_model<<4) == 0x520 && 284 + if (boot_cpu_has(X86_FEATURE_APIC) && (c->x86<<8 | c->x86_model<<4) == 0x520 && 285 285 (c->x86_mask < 0x6 || c->x86_mask == 0xb)) 286 286 set_cpu_bug(c, X86_BUG_11AP); 287 287
+1 -1
arch/x86/kernel/cpu/mcheck/mce_intel.c
··· 84 84 */ 85 85 if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) 86 86 return 0; 87 - if (!cpu_has_apic || lapic_get_maxlvt() < 6) 87 + if (!boot_cpu_has(X86_FEATURE_APIC) || lapic_get_maxlvt() < 6) 88 88 return 0; 89 89 rdmsrl(MSR_IA32_MCG_CAP, cap); 90 90 *banks = min_t(unsigned, MAX_NR_BANKS, cap & 0xff);
+1 -1
arch/x86/kernel/cpu/mcheck/therm_throt.c
··· 447 447 /* Thermal monitoring depends on APIC, ACPI and clock modulation */ 448 448 static int intel_thermal_supported(struct cpuinfo_x86 *c) 449 449 { 450 - if (!cpu_has_apic) 450 + if (!boot_cpu_has(X86_FEATURE_APIC)) 451 451 return 0; 452 452 if (!cpu_has(c, X86_FEATURE_ACPI) || !cpu_has(c, X86_FEATURE_ACC)) 453 453 return 0;
+1 -1
arch/x86/kernel/devicetree.c
··· 151 151 return; 152 152 153 153 /* Did the boot loader setup the local APIC ? */ 154 - if (!cpu_has_apic) { 154 + if (!boot_cpu_has(X86_FEATURE_APIC)) { 155 155 if (apic_force_enable(r.start)) 156 156 return; 157 157 }
+1 -1
arch/x86/kernel/smpboot.c
··· 1231 1231 * If we couldn't find a local APIC, then get out of here now! 1232 1232 */ 1233 1233 if (APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid]) && 1234 - !cpu_has_apic) { 1234 + !boot_cpu_has(X86_FEATURE_APIC)) { 1235 1235 if (!disable_apic) { 1236 1236 pr_err("BIOS bug, local APIC #%d not detected!...\n", 1237 1237 boot_cpu_physical_apicid);
+1 -1
arch/x86/oprofile/nmi_int.c
··· 700 700 char *cpu_type = NULL; 701 701 int ret = 0; 702 702 703 - if (!cpu_has_apic) 703 + if (!boot_cpu_has(X86_FEATURE_APIC)) 704 704 return -ENODEV; 705 705 706 706 if (force_cpu_type == timer)
+1 -1
arch/x86/pci/xen.c
··· 445 445 uint32_t eax = cpuid_eax(xen_cpuid_base() + 4); 446 446 447 447 if (((eax & XEN_HVM_CPUID_X2APIC_VIRT) && x2apic_mode) || 448 - ((eax & XEN_HVM_CPUID_APIC_ACCESS_VIRT) && cpu_has_apic)) 448 + ((eax & XEN_HVM_CPUID_APIC_ACCESS_VIRT) && boot_cpu_has(X86_FEATURE_APIC))) 449 449 return; 450 450 } 451 451
+1 -1
drivers/cpufreq/longhaul.c
··· 945 945 } 946 946 #endif 947 947 #ifdef CONFIG_X86_IO_APIC 948 - if (cpu_has_apic) { 948 + if (boot_cpu_has(X86_FEATURE_APIC)) { 949 949 printk(KERN_ERR PFX "APIC detected. Longhaul is currently " 950 950 "broken in this configuration.\n"); 951 951 return -ENODEV;
+1 -1
drivers/iommu/irq_remapping.c
··· 36 36 * As this gets called during crash dump, keep this simple for 37 37 * now. 38 38 */ 39 - if (cpu_has_apic || apic_from_smp_config()) 39 + if (boot_cpu_has(X86_FEATURE_APIC) || apic_from_smp_config()) 40 40 disconnect_bsp_APIC(0); 41 41 } 42 42