From: Borislav Petkov <borislav.petkov@xxxxxxx> Add a wbinvd helper for an arbitrary set of CPUs. Signed-off-by: Borislav Petkov <borislav.petkov@xxxxxxx> --- arch/x86/include/asm/smp.h | 4 +++- arch/x86/lib/cache-smp.c | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletions(-) diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h index 4c2f63c..f7805f1 100644 --- a/arch/x86/include/asm/smp.h +++ b/arch/x86/include/asm/smp.h @@ -141,6 +141,7 @@ void native_cpu_die(unsigned int cpu); void native_play_dead(void); void play_dead_common(void); void wbinvd_on_cpu(int cpu); +void wbinvd_on_cpus(const struct cpumask *); int wbinvd_on_all_cpus(void); void native_send_call_func_ipi(const struct cpumask *mask); @@ -155,7 +156,8 @@ static inline int num_booting_cpus(void) return cpumask_weight(cpu_callout_mask); } #else /* !CONFIG_SMP */ -#define wbinvd_on_cpu(cpu) wbinvd() +#define wbinvd_on_cpu(cpu) wbinvd() +#define wbinvd_on_cpus(mask) wbinvd() static inline int wbinvd_on_all_cpus(void) { wbinvd(); diff --git a/arch/x86/lib/cache-smp.c b/arch/x86/lib/cache-smp.c index a3c6688..7778d56 100644 --- a/arch/x86/lib/cache-smp.c +++ b/arch/x86/lib/cache-smp.c @@ -12,6 +12,18 @@ void wbinvd_on_cpu(int cpu) } EXPORT_SYMBOL(wbinvd_on_cpu); +void wbinvd_on_cpus(const struct cpumask *mask) +{ + int this_cpu = get_cpu(); + + if (cpumask_test_cpu(this_cpu, mask)) + wbinvd(); + + smp_call_function_many(mask, __wbinvd, NULL, 1); + put_cpu(); +} +EXPORT_SYMBOL(wbinvd_on_cpus); + int wbinvd_on_all_cpus(void) { return on_each_cpu(__wbinvd, NULL, 1); -- 1.7.3.1.50.g1e633 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html