Commit 28b82352 authored by Dave Hansen's avatar Dave Hansen
Browse files

x86/apic: Wrap IPI calls into helper functions



Move them to one place so the static call conversion gets simpler.

No functional change.

[ dhansen: merge against recent x86/apic changes ]

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 54271fb0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ static bool __initdata hv_pvspin = true;

static void hv_qlock_kick(int cpu)
{
	apic->send_IPI(cpu, X86_PLATFORM_IPI_VECTOR);
	__apic_send_IPI(cpu, X86_PLATFORM_IPI_VECTOR);
}

static void hv_qlock_wait(u8 *byte, u8 val)
+30 −0
Original line number Diff line number Diff line
@@ -401,6 +401,36 @@ static __always_inline void apic_icr_write(u32 low, u32 high)
	apic->icr_write(low, high);
}

static __always_inline void __apic_send_IPI(int cpu, int vector)
{
	apic->send_IPI(cpu, vector);
}

static __always_inline void __apic_send_IPI_mask(const struct cpumask *mask, int vector)
{
	apic->send_IPI_mask(mask, vector);
}

static __always_inline void __apic_send_IPI_mask_allbutself(const struct cpumask *mask, int vector)
{
	apic->send_IPI_mask_allbutself(mask, vector);
}

static __always_inline void __apic_send_IPI_allbutself(int vector)
{
	apic->send_IPI_allbutself(vector);
}

static __always_inline void __apic_send_IPI_all(int vector)
{
	apic->send_IPI_all(vector);
}

static __always_inline void __apic_send_IPI_self(int vector)
{
	apic->send_IPI_self(vector);
}

static __always_inline void apic_wait_icr_idle(void)
{
	if (apic->wait_icr_idle)
+1 −1
Original line number Diff line number Diff line
@@ -502,7 +502,7 @@ static int lapic_timer_set_oneshot(struct clock_event_device *evt)
static void lapic_timer_broadcast(const struct cpumask *mask)
{
#ifdef CONFIG_SMP
	apic->send_IPI_mask(mask, LOCAL_TIMER_VECTOR);
	__apic_send_IPI_mask(mask, LOCAL_TIMER_VECTOR);
#endif
}

+3 −1
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@
#include <linux/init.h>
#include <linux/delay.h>

#include "local.h"

#ifdef CONFIG_HARDLOCKUP_DETECTOR_PERF
u64 hw_nmi_get_sample_period(int watchdog_thresh)
{
@@ -31,7 +33,7 @@ u64 hw_nmi_get_sample_period(int watchdog_thresh)
#ifdef arch_trigger_cpumask_backtrace
static void nmi_raise_cpu_backtrace(cpumask_t *mask)
{
	apic->send_IPI_mask(mask, NMI_VECTOR);
	__apic_send_IPI_mask(mask, NMI_VECTOR);
}

void arch_trigger_cpumask_backtrace(const cpumask_t *mask, bool exclude_self)
+8 −8
Original line number Diff line number Diff line
@@ -54,9 +54,9 @@ void apic_send_IPI_allbutself(unsigned int vector)
		return;

	if (static_branch_likely(&apic_use_ipi_shorthand))
		apic->send_IPI_allbutself(vector);
		__apic_send_IPI_allbutself(vector);
	else
		apic->send_IPI_mask_allbutself(cpu_online_mask, vector);
		__apic_send_IPI_mask_allbutself(cpu_online_mask, vector);
}

/*
@@ -70,12 +70,12 @@ void native_smp_send_reschedule(int cpu)
		WARN(1, "sched: Unexpected reschedule of offline CPU#%d!\n", cpu);
		return;
	}
	apic->send_IPI(cpu, RESCHEDULE_VECTOR);
	__apic_send_IPI(cpu, RESCHEDULE_VECTOR);
}

void native_send_call_func_single_ipi(int cpu)
{
	apic->send_IPI(cpu, CALL_FUNCTION_SINGLE_VECTOR);
	__apic_send_IPI(cpu, CALL_FUNCTION_SINGLE_VECTOR);
}

void native_send_call_func_ipi(const struct cpumask *mask)
@@ -87,14 +87,14 @@ void native_send_call_func_ipi(const struct cpumask *mask)
			goto sendmask;

		if (cpumask_test_cpu(cpu, mask))
			apic->send_IPI_all(CALL_FUNCTION_VECTOR);
			__apic_send_IPI_all(CALL_FUNCTION_VECTOR);
		else if (num_online_cpus() > 1)
			apic->send_IPI_allbutself(CALL_FUNCTION_VECTOR);
			__apic_send_IPI_allbutself(CALL_FUNCTION_VECTOR);
		return;
	}

sendmask:
	apic->send_IPI_mask(mask, CALL_FUNCTION_VECTOR);
	__apic_send_IPI_mask(mask, CALL_FUNCTION_VECTOR);
}

#endif /* CONFIG_SMP */
@@ -221,7 +221,7 @@ void default_send_IPI_mask_allbutself_phys(const struct cpumask *mask,
 */
void default_send_IPI_single(int cpu, int vector)
{
	apic->send_IPI_mask(cpumask_of(cpu), vector);
	__apic_send_IPI_mask(cpumask_of(cpu), vector);
}

void default_send_IPI_allbutself(int vector)
Loading