1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
29844ab11SCyrill Gorcunov /*
39844ab11SCyrill Gorcunov * NOOP APIC driver.
49844ab11SCyrill Gorcunov *
59844ab11SCyrill Gorcunov * Does almost nothing and should be substituted by a real apic driver via
69844ab11SCyrill Gorcunov * probe routine.
79844ab11SCyrill Gorcunov *
89844ab11SCyrill Gorcunov * Though in case if apic is disabled (for some reason) we try
99844ab11SCyrill Gorcunov * to not uglify the caller's code and allow to call (some) apic routines
10f88f2b4fSCyrill Gorcunov * like self-ipi, etc...
113600ceb0SThomas Gleixner *
123600ceb0SThomas Gleixner * FIXME: Remove this gunk. The above argument which was intentionally left
133600ceb0SThomas Gleixner * in place is silly to begin with because none of the callbacks except for
143600ceb0SThomas Gleixner * APIC::read/write() have a WARN_ON_ONCE() in them. Sigh...
159844ab11SCyrill Gorcunov */
169844ab11SCyrill Gorcunov #include <linux/cpumask.h>
170cd39f46SPeter Zijlstra #include <linux/thread_info.h>
18521b82feSThomas Gleixner
199844ab11SCyrill Gorcunov #include <asm/apic.h>
209844ab11SCyrill Gorcunov
noop_send_IPI(int cpu,int vector)214727da2eSThomas Gleixner static void noop_send_IPI(int cpu, int vector) { }
noop_send_IPI_mask(const struct cpumask * cpumask,int vector)22f88f2b4fSCyrill Gorcunov static void noop_send_IPI_mask(const struct cpumask *cpumask, int vector) { }
noop_send_IPI_mask_allbutself(const struct cpumask * cpumask,int vector)23f88f2b4fSCyrill Gorcunov static void noop_send_IPI_mask_allbutself(const struct cpumask *cpumask, int vector) { }
noop_send_IPI_allbutself(int vector)24f88f2b4fSCyrill Gorcunov static void noop_send_IPI_allbutself(int vector) { }
noop_send_IPI_all(int vector)25f88f2b4fSCyrill Gorcunov static void noop_send_IPI_all(int vector) { }
noop_send_IPI_self(int vector)26f88f2b4fSCyrill Gorcunov static void noop_send_IPI_self(int vector) { }
noop_apic_icr_write(u32 low,u32 id)27f88f2b4fSCyrill Gorcunov static void noop_apic_icr_write(u32 low, u32 id) { }
noop_wakeup_secondary_cpu(int apicid,unsigned long start_eip)283600ceb0SThomas Gleixner static int noop_wakeup_secondary_cpu(int apicid, unsigned long start_eip) { return -1; }
noop_apic_icr_read(void)293600ceb0SThomas Gleixner static u64 noop_apic_icr_read(void) { return 0; }
noop_phys_pkg_id(int cpuid_apic,int index_msb)303600ceb0SThomas Gleixner static int noop_phys_pkg_id(int cpuid_apic, int index_msb) { return 0; }
noop_get_apic_id(unsigned long x)313600ceb0SThomas Gleixner static unsigned int noop_get_apic_id(unsigned long x) { return 0; }
noop_apic_eoi(void)32*185c8f33SThomas Gleixner static void noop_apic_eoi(void) { }
339844ab11SCyrill Gorcunov
noop_apic_read(u32 reg)349844ab11SCyrill Gorcunov static u32 noop_apic_read(u32 reg)
359844ab11SCyrill Gorcunov {
3649062454SThomas Gleixner WARN_ON_ONCE(boot_cpu_has(X86_FEATURE_APIC) && !apic_is_disabled);
379844ab11SCyrill Gorcunov return 0;
389844ab11SCyrill Gorcunov }
399844ab11SCyrill Gorcunov
noop_apic_write(u32 reg,u32 val)4049062454SThomas Gleixner static void noop_apic_write(u32 reg, u32 val)
41f88f2b4fSCyrill Gorcunov {
4249062454SThomas Gleixner WARN_ON_ONCE(boot_cpu_has(X86_FEATURE_APIC) && !apic_is_disabled);
43f88f2b4fSCyrill Gorcunov }
44f88f2b4fSCyrill Gorcunov
45404f6aacSKees Cook struct apic apic_noop __ro_after_init = {
469844ab11SCyrill Gorcunov .name = "noop",
479844ab11SCyrill Gorcunov
4872161299SThomas Gleixner .delivery_mode = APIC_DELIVERY_MODE_FIXED,
498c44963bSThomas Gleixner .dest_mode_logical = true,
509844ab11SCyrill Gorcunov
519844ab11SCyrill Gorcunov .disable_esr = 0,
52e57d04e5SThomas Gleixner
534c59f3e6SDavid Rientjes .check_apicid_used = default_check_apicid_used,
547abc0753SCyrill Gorcunov .ioapic_phys_id_map = default_ioapic_phys_id_map,
559844ab11SCyrill Gorcunov .cpu_present_to_apicid = default_cpu_present_to_apicid,
569844ab11SCyrill Gorcunov
57f88f2b4fSCyrill Gorcunov .phys_pkg_id = noop_phys_pkg_id,
589844ab11SCyrill Gorcunov
59d92e5e7cSThomas Gleixner .max_apic_id = 0xFE,
609844ab11SCyrill Gorcunov .get_apic_id = noop_get_apic_id,
619844ab11SCyrill Gorcunov
629f9e3bb1SThomas Gleixner .calc_dest_apicid = apic_flat_calc_apicid,
639844ab11SCyrill Gorcunov
644727da2eSThomas Gleixner .send_IPI = noop_send_IPI,
659844ab11SCyrill Gorcunov .send_IPI_mask = noop_send_IPI_mask,
669844ab11SCyrill Gorcunov .send_IPI_mask_allbutself = noop_send_IPI_mask_allbutself,
679844ab11SCyrill Gorcunov .send_IPI_allbutself = noop_send_IPI_allbutself,
689844ab11SCyrill Gorcunov .send_IPI_all = noop_send_IPI_all,
699844ab11SCyrill Gorcunov .send_IPI_self = noop_send_IPI_self,
709844ab11SCyrill Gorcunov
719844ab11SCyrill Gorcunov .wakeup_secondary_cpu = noop_wakeup_secondary_cpu,
729844ab11SCyrill Gorcunov
739844ab11SCyrill Gorcunov .read = noop_apic_read,
749844ab11SCyrill Gorcunov .write = noop_apic_write,
75*185c8f33SThomas Gleixner .eoi = noop_apic_eoi,
769844ab11SCyrill Gorcunov .icr_read = noop_apic_icr_read,
779844ab11SCyrill Gorcunov .icr_write = noop_apic_icr_write,
789844ab11SCyrill Gorcunov };
79