Commit 3af1e415 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Dave Hansen
Browse files

x86/apic: Provide common init infrastructure



In preparation for converting the hotpath APIC callbacks to static keys,
provide common initialization infrastructure.

Lift apic_install_drivers() from probe_64.c and convert all places which
switch the apic instance by storing the pointer to use apic_install_driver()
as a first step.

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: default avatarMichael Kelley <mikelley@microsoft.com>
Tested-by: default avatarSohil Mehta <sohil.mehta@intel.com>
Tested-by: Juergen Gross <jgross@suse.com> # Xen PV (dom0 and unpriv. guest)
parent 0fa07576
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -344,6 +344,8 @@ extern int lapic_can_unplug_cpu(void);

#ifdef CONFIG_X86_LOCAL_APIC

void __init apic_install_driver(struct apic *driver);

static inline u32 apic_read(u32 reg)
{
	return apic->read(reg);
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
# In particualr, smp_apic_timer_interrupt() is called in random places.
KCOV_INSTRUMENT		:= n

obj-$(CONFIG_X86_LOCAL_APIC)	+= apic.o apic_common.o apic_noop.o ipi.o vector.o
obj-$(CONFIG_X86_LOCAL_APIC)	+= apic.o apic_common.o apic_noop.o ipi.o vector.o init.o
obj-y				+= hw_nmi.o

obj-$(CONFIG_X86_IO_APIC)	+= io_apic.o
+1 −30
Original line number Diff line number Diff line
@@ -236,8 +236,7 @@ static int modern_apic(void)
 */
static void __init apic_disable(void)
{
	pr_info("APIC: switched to apic NOOP\n");
	apic = &apic_noop;
	apic_install_driver(&apic_noop);
}

void native_apic_icr_write(u32 low, u32 id)
@@ -2486,34 +2485,6 @@ u32 x86_msi_msg_get_destid(struct msi_msg *msg, bool extid)
}
EXPORT_SYMBOL_GPL(x86_msi_msg_get_destid);

#ifdef CONFIG_X86_64
void __init acpi_wake_cpu_handler_update(wakeup_cpu_handler handler)
{
	struct apic **drv;

	for (drv = __apicdrivers; drv < __apicdrivers_end; drv++)
		(*drv)->wakeup_secondary_cpu_64 = handler;
}
#endif

/*
 * Override the generic EOI implementation with an optimized version.
 * Only called during early boot when only one CPU is active and with
 * interrupts disabled, so we know this does not race with actual APIC driver
 * use.
 */
void __init apic_set_eoi_cb(void (*eoi)(void))
{
	struct apic **drv;

	for (drv = __apicdrivers; drv < __apicdrivers_end; drv++) {
		/* Should happen once for each apic */
		WARN_ON((*drv)->eoi == eoi);
		(*drv)->native_eoi = (*drv)->eoi;
		(*drv)->eoi = eoi;
	}
}

static void __init apic_bsp_up_setup(void)
{
#ifdef CONFIG_X86_64
+1 −5
Original line number Diff line number Diff line
@@ -143,11 +143,7 @@ static int physflat_acpi_madt_oem_check(char *oem_id, char *oem_table_id)

static int physflat_probe(void)
{
	if (apic == &apic_physflat || num_possible_cpus() > 8 ||
	    jailhouse_paravirt())
		return 1;

	return 0;
	return apic == &apic_physflat || num_possible_cpus() > 8 || jailhouse_paravirt();
}

static struct apic apic_physflat __ro_after_init = {
+2 −4
Original line number Diff line number Diff line
@@ -119,10 +119,8 @@ bool __init apic_bigsmp_possible(bool cmdline_override)

void __init apic_bigsmp_force(void)
{
	if (apic != &apic_bigsmp) {
		apic = &apic_bigsmp;
		pr_info("Overriding APIC driver with bigsmp\n");
	}
	if (apic != &apic_bigsmp)
		apic_install_driver(&apic_bigsmp);
}

apic_driver(apic_bigsmp);
Loading