Skip to content

Commit 3600ceb

Browse files
KAGA-KOKOhansendc
authored andcommitted
x86/apic/noop: Tidy up the code
First of all apic_noop can't be probed because it's not registered. So there is no point for implementing a probe callback. The machine is rightfully to die when that is invoked. Remove the gunk and tidy up the other space consuming dummy callbacks. This gunk should simply die. Nothing should ever invoke APIC callbacks once this is installed, But that's a differrent story for another round of cleanups. The comment on top of this file which was intentionally left in place tells exactly why this is needed: voodoo programming. In fact the kernel of today should just outright refuse to boot on a system with no (functional) local APIC. That would spare tons of #ifdeffery and other nonsense. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Tested-by: Michael Kelley <mikelley@microsoft.com> Tested-by: Sohil Mehta <sohil.mehta@intel.com> Tested-by: Juergen Gross <jgross@suse.com> # Xen PV (dom0 and unpriv. guest)
1 parent 1fddf1d commit 3600ceb

1 file changed

Lines changed: 8 additions & 30 deletions

File tree

arch/x86/kernel/apic/apic_noop.c

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
* Though in case if apic is disabled (for some reason) we try
99
* to not uglify the caller's code and allow to call (some) apic routines
1010
* like self-ipi, etc...
11+
*
12+
* FIXME: Remove this gunk. The above argument which was intentionally left
13+
* in place is silly to begin with because none of the callbacks except for
14+
* APIC::read/write() have a WARN_ON_ONCE() in them. Sigh...
1115
*/
1216
#include <linux/cpumask.h>
1317
#include <linux/thread_info.h>
@@ -21,35 +25,10 @@ static void noop_send_IPI_allbutself(int vector) { }
2125
static void noop_send_IPI_all(int vector) { }
2226
static void noop_send_IPI_self(int vector) { }
2327
static void noop_apic_icr_write(u32 low, u32 id) { }
24-
25-
static int noop_wakeup_secondary_cpu(int apicid, unsigned long start_eip)
26-
{
27-
return -1;
28-
}
29-
30-
static u64 noop_apic_icr_read(void)
31-
{
32-
return 0;
33-
}
34-
35-
static int noop_phys_pkg_id(int cpuid_apic, int index_msb)
36-
{
37-
return 0;
38-
}
39-
40-
static unsigned int noop_get_apic_id(unsigned long x)
41-
{
42-
return 0;
43-
}
44-
45-
static int noop_probe(void)
46-
{
47-
/*
48-
* NOOP apic should not ever be
49-
* enabled via probe routine
50-
*/
51-
return 0;
52-
}
28+
static int noop_wakeup_secondary_cpu(int apicid, unsigned long start_eip) { return -1; }
29+
static u64 noop_apic_icr_read(void) { return 0; }
30+
static int noop_phys_pkg_id(int cpuid_apic, int index_msb) { return 0; }
31+
static unsigned int noop_get_apic_id(unsigned long x) { return 0; }
5332

5433
static u32 noop_apic_read(u32 reg)
5534
{
@@ -64,7 +43,6 @@ static void noop_apic_write(u32 reg, u32 val)
6443

6544
struct apic apic_noop __ro_after_init = {
6645
.name = "noop",
67-
.probe = noop_probe,
6846

6947
.delivery_mode = APIC_DELIVERY_MODE_FIXED,
7048
.dest_mode_logical = true,

0 commit comments

Comments
 (0)