x86/cpufeature: Replace cpu_has_apic with boot_cpu_has() usage
authorBorislav Petkov <bp@suse.de>
Mon, 4 Apr 2016 20:25:00 +0000 (22:25 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 13 Apr 2016 09:37:41 +0000 (11:37 +0200)
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>
19 files changed:
arch/x86/events/core.c
arch/x86/include/asm/cpufeature.h
arch/x86/include/asm/irq_work.h
arch/x86/kernel/acpi/boot.c
arch/x86/kernel/apic/apic.c
arch/x86/kernel/apic/apic_noop.c
arch/x86/kernel/apic/io_apic.c
arch/x86/kernel/apic/ipi.c
arch/x86/kernel/apic/vector.c
arch/x86/kernel/cpu/amd.c
arch/x86/kernel/cpu/intel.c
arch/x86/kernel/cpu/mcheck/mce_intel.c
arch/x86/kernel/cpu/mcheck/therm_throt.c
arch/x86/kernel/devicetree.c
arch/x86/kernel/smpboot.c
arch/x86/oprofile/nmi_int.c
arch/x86/pci/xen.c
drivers/cpufreq/longhaul.c
drivers/iommu/irq_remapping.c

index 041e442a3e2806ed884584758cb8e62abd809e36..54c17455600efa11fdbd3abad732482892acc01e 100644 (file)
@@ -1518,7 +1518,7 @@ x86_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
 
 static void __init pmu_check_apic(void)
 {
-       if (cpu_has_apic)
+       if (boot_cpu_has(X86_FEATURE_APIC))
                return;
 
        x86_pmu.apic = 0;
index 8f58cd215f6d4d069cb6437899a9ec397bfc42f2..c532961c7439de6d76820d70de5a85cf054b38a6 100644 (file)
@@ -118,7 +118,6 @@ extern const char * const x86_bug_flags[NBUGINTS*32];
        set_bit(bit, (unsigned long *)cpu_caps_set);    \
 } while (0)
 
-#define cpu_has_apic           boot_cpu_has(X86_FEATURE_APIC)
 #define cpu_has_fxsr           boot_cpu_has(X86_FEATURE_FXSR)
 #define cpu_has_xsave          boot_cpu_has(X86_FEATURE_XSAVE)
 #define cpu_has_xsaves         boot_cpu_has(X86_FEATURE_XSAVES)
index d0afb05c84fc1ffd434e85f6267326b9091d2595..f70604125286b90d820bc14be0b65ecccb4f7a44 100644 (file)
@@ -5,7 +5,7 @@
 
 static inline bool arch_irq_work_has_interrupt(void)
 {
-       return cpu_has_apic;
+       return boot_cpu_has(X86_FEATURE_APIC);
 }
 
 #endif /* _ASM_IRQ_WORK_H */
index 8c2f1ef6ca236ea16b9ae25a390b32d33ef566d4..2522e564269e240604dc4af7cf5a20fc8c86e175 100644 (file)
@@ -136,7 +136,7 @@ static int __init acpi_parse_madt(struct acpi_table_header *table)
 {
        struct acpi_table_madt *madt = NULL;
 
-       if (!cpu_has_apic)
+       if (!boot_cpu_has(X86_FEATURE_APIC))
                return -EINVAL;
 
        madt = (struct acpi_table_madt *)table;
@@ -951,7 +951,7 @@ static int __init early_acpi_parse_madt_lapic_addr_ovr(void)
 {
        int count;
 
-       if (!cpu_has_apic)
+       if (!boot_cpu_has(X86_FEATURE_APIC))
                return -ENODEV;
 
        /*
@@ -979,7 +979,7 @@ static int __init acpi_parse_madt_lapic_entries(void)
        int ret;
        struct acpi_subtable_proc madt_proc[2];
 
-       if (!cpu_has_apic)
+       if (!boot_cpu_has(X86_FEATURE_APIC))
                return -ENODEV;
 
        /*
@@ -1125,7 +1125,7 @@ static int __init acpi_parse_madt_ioapic_entries(void)
        if (acpi_disabled || acpi_noirq)
                return -ENODEV;
 
-       if (!cpu_has_apic)
+       if (!boot_cpu_has(X86_FEATURE_APIC))
                return -ENODEV;
 
        /*
index 0b6509f1a4fe99216390c2721f74a5ac531c739c..60078a67d7e36064e667abfd679ed569db3a8173 100644 (file)
@@ -1085,7 +1085,7 @@ void lapic_shutdown(void)
 {
        unsigned long flags;
 
-       if (!cpu_has_apic && !apic_from_smp_config())
+       if (!boot_cpu_has(X86_FEATURE_APIC) && !apic_from_smp_config())
                return;
 
        local_irq_save(flags);
@@ -1134,7 +1134,7 @@ void __init init_bsp_APIC(void)
         * Don't do the setup now if we have a SMP BIOS as the
         * through-I/O-APIC virtual wire mode might be active.
         */
-       if (smp_found_config || !cpu_has_apic)
+       if (smp_found_config || !boot_cpu_has(X86_FEATURE_APIC))
                return;
 
        /*
@@ -1445,7 +1445,7 @@ static void __x2apic_disable(void)
 {
        u64 msr;
 
-       if (!cpu_has_apic)
+       if (!boot_cpu_has(X86_FEATURE_APIC))
                return;
 
        rdmsrl(MSR_IA32_APICBASE, msr);
@@ -1632,7 +1632,7 @@ void __init enable_IR_x2apic(void)
  */
 static int __init detect_init_APIC(void)
 {
-       if (!cpu_has_apic) {
+       if (!boot_cpu_has(X86_FEATURE_APIC)) {
                pr_info("No local APIC present\n");
                return -1;
        }
@@ -1711,14 +1711,14 @@ static int __init detect_init_APIC(void)
                goto no_apic;
        case X86_VENDOR_INTEL:
                if (boot_cpu_data.x86 == 6 || boot_cpu_data.x86 == 15 ||
-                   (boot_cpu_data.x86 == 5 && cpu_has_apic))
+                   (boot_cpu_data.x86 == 5 && boot_cpu_has(X86_FEATURE_APIC)))
                        break;
                goto no_apic;
        default:
                goto no_apic;
        }
 
-       if (!cpu_has_apic) {
+       if (!boot_cpu_has(X86_FEATURE_APIC)) {
                /*
                 * Over-ride BIOS and try to enable the local APIC only if
                 * "lapic" specified.
@@ -2233,19 +2233,19 @@ int __init APIC_init_uniprocessor(void)
                return -1;
        }
 #ifdef CONFIG_X86_64
-       if (!cpu_has_apic) {
+       if (!boot_cpu_has(X86_FEATURE_APIC)) {
                disable_apic = 1;
                pr_info("Apic disabled by BIOS\n");
                return -1;
        }
 #else
-       if (!smp_found_config && !cpu_has_apic)
+       if (!smp_found_config && !boot_cpu_has(X86_FEATURE_APIC))
                return -1;
 
        /*
         * Complain if the BIOS pretends there is one.
         */
-       if (!cpu_has_apic &&
+       if (!boot_cpu_has(X86_FEATURE_APIC) &&
            APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) {
                pr_err("BIOS bug, local APIC 0x%x not detected!...\n",
                        boot_cpu_physical_apicid);
@@ -2426,7 +2426,7 @@ static void apic_pm_activate(void)
 static int __init init_lapic_sysfs(void)
 {
        /* XXX: remove suspend/resume procs if !apic_pm_state.active? */
-       if (cpu_has_apic)
+       if (boot_cpu_has(X86_FEATURE_APIC))
                register_syscore_ops(&lapic_syscore_ops);
 
        return 0;
index 331a7a07c48fefe0313f3089c1bb497dc48cd7e4..13d19ed585142eae225625bd808c1c1acba0b790 100644 (file)
@@ -100,13 +100,13 @@ static void noop_vector_allocation_domain(int cpu, struct cpumask *retmask,
 
 static u32 noop_apic_read(u32 reg)
 {
-       WARN_ON_ONCE((cpu_has_apic && !disable_apic));
+       WARN_ON_ONCE(boot_cpu_has(X86_FEATURE_APIC) && !disable_apic);
        return 0;
 }
 
 static void noop_apic_write(u32 reg, u32 v)
 {
-       WARN_ON_ONCE(cpu_has_apic && !disable_apic);
+       WARN_ON_ONCE(boot_cpu_has(X86_FEATURE_APIC) && !disable_apic);
 }
 
 struct apic apic_noop = {
index fdb0fbfb1197a4cf4e485c4f330b3a399b3a6d5f..84e33ff5a6d595693c3718477f168f20d5546316 100644 (file)
@@ -1454,7 +1454,7 @@ void native_disable_io_apic(void)
                ioapic_write_entry(ioapic_i8259.apic, ioapic_i8259.pin, entry);
        }
 
-       if (cpu_has_apic || apic_from_smp_config())
+       if (boot_cpu_has(X86_FEATURE_APIC) || apic_from_smp_config())
                disconnect_bsp_APIC(ioapic_i8259.pin != -1);
 }
 
index 28bde88b0085d2284947016aae114574958428ed..2a0f225afebd5925d66decbba2060b2781837b39 100644 (file)
@@ -230,7 +230,7 @@ int safe_smp_processor_id(void)
 {
        int apicid, cpuid;
 
-       if (!cpu_has_apic)
+       if (!boot_cpu_has(X86_FEATURE_APIC))
                return 0;
 
        apicid = hard_smp_processor_id();
index ad59d70bcb1a6109742773e5f69a7235bca712f5..26d3ccc63e407de0bea0d5f79752e361138b0b08 100644 (file)
@@ -943,7 +943,7 @@ static int __init print_ICs(void)
        print_PIC();
 
        /* don't print out if apic is not there */
-       if (!cpu_has_apic && !apic_from_smp_config())
+       if (!boot_cpu_has(X86_FEATURE_APIC) && !apic_from_smp_config())
                return 0;
 
        print_local_APICs(show_lapic);
index 19d7dcfc8b3e16dea94e689c71d8411edbe974d2..54f7b44dcf01f794229fa59e71c1887905fe91fb 100644 (file)
@@ -565,9 +565,9 @@ static void early_init_amd(struct cpuinfo_x86 *c)
         * can safely set X86_FEATURE_EXTD_APICID unconditionally for families
         * after 16h.
         */
-       if (cpu_has_apic && c->x86 > 0x16) {
+       if (boot_cpu_has(X86_FEATURE_APIC) && c->x86 > 0x16) {
                set_cpu_cap(c, X86_FEATURE_EXTD_APICID);
-       } else if (cpu_has_apic && c->x86 >= 0xf) {
+       } else if (boot_cpu_has(X86_FEATURE_APIC) && c->x86 >= 0xf) {
                /* check CPU config space for extended APIC ID */
                unsigned int val;
                val = read_pci_config(0, 24, 0, 0x68);
index f71a34944b560e35489ba35eea94a68d56429ad7..1d5582259b20b6f0279b8fe2777771dab659975a 100644 (file)
@@ -281,7 +281,7 @@ static void intel_workarounds(struct cpuinfo_x86 *c)
         * integrated APIC (see 11AP erratum in "Pentium Processor
         * Specification Update").
         */
-       if (cpu_has_apic && (c->x86<<8 | c->x86_model<<4) == 0x520 &&
+       if (boot_cpu_has(X86_FEATURE_APIC) && (c->x86<<8 | c->x86_model<<4) == 0x520 &&
            (c->x86_mask < 0x6 || c->x86_mask == 0xb))
                set_cpu_bug(c, X86_BUG_11AP);
 
index 1e8bb6c94f14c0e639339a518f2c8949cf7143ca..1defb8ea882c09033461728596f5e65aa73fba51 100644 (file)
@@ -84,7 +84,7 @@ static int cmci_supported(int *banks)
         */
        if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
                return 0;
-       if (!cpu_has_apic || lapic_get_maxlvt() < 6)
+       if (!boot_cpu_has(X86_FEATURE_APIC) || lapic_get_maxlvt() < 6)
                return 0;
        rdmsrl(MSR_IA32_MCG_CAP, cap);
        *banks = min_t(unsigned, MAX_NR_BANKS, cap & 0xff);
index 0b445c2ff735d44fedc469fd8ce0c1b8b1f1633b..615793321c4934e005bbeb16157d778f9fb9bc81 100644 (file)
@@ -447,7 +447,7 @@ asmlinkage __visible void smp_trace_thermal_interrupt(struct pt_regs *regs)
 /* Thermal monitoring depends on APIC, ACPI and clock modulation */
 static int intel_thermal_supported(struct cpuinfo_x86 *c)
 {
-       if (!cpu_has_apic)
+       if (!boot_cpu_has(X86_FEATURE_APIC))
                return 0;
        if (!cpu_has(c, X86_FEATURE_ACPI) || !cpu_has(c, X86_FEATURE_ACC))
                return 0;
index 1f4acd68b98bccb7bf4032bc6ff2bde3f4efecdb..3fe45f84ced4463b147bcb907feedca94c07cab0 100644 (file)
@@ -151,7 +151,7 @@ static void __init dtb_lapic_setup(void)
                return;
 
        /* Did the boot loader setup the local APIC ? */
-       if (!cpu_has_apic) {
+       if (!boot_cpu_has(X86_FEATURE_APIC)) {
                if (apic_force_enable(r.start))
                        return;
        }
index a2065d3b3b396f4503f4e4f42acc2af2bd4b307b..1fe4130b14d924fa07f6dda1640cae2e10fddefe 100644 (file)
@@ -1231,7 +1231,7 @@ static int __init smp_sanity_check(unsigned max_cpus)
         * If we couldn't find a local APIC, then get out of here now!
         */
        if (APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid]) &&
-           !cpu_has_apic) {
+           !boot_cpu_has(X86_FEATURE_APIC)) {
                if (!disable_apic) {
                        pr_err("BIOS bug, local APIC #%d not detected!...\n",
                                boot_cpu_physical_apicid);
index 25171e9595f7408a542f47086fc179224768630d..28c04123b6ddaebce73e967644cf589a0b524ac2 100644 (file)
@@ -700,7 +700,7 @@ int __init op_nmi_init(struct oprofile_operations *ops)
        char *cpu_type = NULL;
        int ret = 0;
 
-       if (!cpu_has_apic)
+       if (!boot_cpu_has(X86_FEATURE_APIC))
                return -ENODEV;
 
        if (force_cpu_type == timer)
index beac4dfdade6c05c02591e924fd913d5db53abcd..4bd08b0fc8ea1b1c9badf0128920858ef8d41336 100644 (file)
@@ -445,7 +445,7 @@ void __init xen_msi_init(void)
                uint32_t eax = cpuid_eax(xen_cpuid_base() + 4);
 
                if (((eax & XEN_HVM_CPUID_X2APIC_VIRT) && x2apic_mode) ||
-                   ((eax & XEN_HVM_CPUID_APIC_ACCESS_VIRT) && cpu_has_apic))
+                   ((eax & XEN_HVM_CPUID_APIC_ACCESS_VIRT) && boot_cpu_has(X86_FEATURE_APIC)))
                        return;
        }
 
index 0f6b229afcb9e621eb116f6ce805a619ddfe96b3..247bfa8eaddbf3659daec2949561129e4a1a4db1 100644 (file)
@@ -945,7 +945,7 @@ static int __init longhaul_init(void)
        }
 #endif
 #ifdef CONFIG_X86_IO_APIC
-       if (cpu_has_apic) {
+       if (boot_cpu_has(X86_FEATURE_APIC)) {
                printk(KERN_ERR PFX "APIC detected. Longhaul is currently "
                                "broken in this configuration.\n");
                return -ENODEV;
index 8adaaeae32681d863c568eddbfd9af5e12bdc205..49721b4e1975c3c1b038665aa9f18749d95e06e6 100644 (file)
@@ -36,7 +36,7 @@ static void irq_remapping_disable_io_apic(void)
         * As this gets called during crash dump, keep this simple for
         * now.
         */
-       if (cpu_has_apic || apic_from_smp_config())
+       if (boot_cpu_has(X86_FEATURE_APIC) || apic_from_smp_config())
                disconnect_bsp_APIC(0);
 }