From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Subject: [PATCH kvm-unit-tests v2 1/8] arm/arm64: smp: give on_cpus an argument Date: Tue, 13 Jun 2017 11:21:50 +0200 Message-ID: <20170613092157.32049-2-drjones@redhat.com> References: <20170613092157.32049-1-drjones@redhat.com> Cc: rkrcmar@redhat.com, pbonzini@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:52022 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752266AbdFMJWC (ORCPT ); Tue, 13 Jun 2017 05:22:02 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 93BDE723A7 for ; Tue, 13 Jun 2017 09:22:01 +0000 (UTC) In-Reply-To: <20170613092157.32049-1-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: Andrew Jones --- arm/gic.c | 4 ++-- arm/selftest.c | 4 ++-- arm/spinlock-test.c | 4 ++-- lib/arm/asm/smp.h | 2 +- lib/arm/smp.c | 9 ++++----- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/arm/gic.c b/arm/gic.c index 2c5832100e0e..a945f7ab8385 100644 --- a/arm/gic.c +++ b/arm/gic.c @@ -240,7 +240,7 @@ static void ipi_recv(void) wfi(); } -static void ipi_test(void) +static void ipi_test(void *data __unused) { if (smp_processor_id() == IPI_SENDER) ipi_send(); @@ -327,7 +327,7 @@ int main(int argc, char **argv) if (strcmp(argv[1], "ipi") == 0) { report_prefix_push(argv[1]); nr_cpu_check(2); - on_cpus(ipi_test); + on_cpus(ipi_test, NULL); } else if (strcmp(argv[1], "active") == 0) { run_active_clear_test(); } else { diff --git a/arm/selftest.c b/arm/selftest.c index 1ad2e7120248..ea5101ef7217 100644 --- a/arm/selftest.c +++ b/arm/selftest.c @@ -308,7 +308,7 @@ static bool psci_check(void) return true; } -static void cpu_report(void) +static void cpu_report(void *data __unused) { uint64_t mpidr = get_mpidr(); int cpu = smp_processor_id(); @@ -342,7 +342,7 @@ int main(int argc, char **argv) } else if (strcmp(argv[1], "smp") == 0) { report("PSCI version", psci_check()); - on_cpus(cpu_report); + on_cpus(cpu_report, NULL); } else { printf("Unknown subtest\n"); diff --git a/arm/spinlock-test.c b/arm/spinlock-test.c index cd03f81c5fae..d55471bc0aa3 100644 --- a/arm/spinlock-test.c +++ b/arm/spinlock-test.c @@ -43,7 +43,7 @@ static void none_unlock(int *lock_var) static int global_a, global_b; static int global_lock; -static void test_spinlock(void) +static void test_spinlock(void *data __unused) { int i, errors = 0; int cpu = smp_processor_id(); @@ -80,7 +80,7 @@ int main(int argc, char **argv) lock_ops.unlock = none_unlock; } - on_cpus(test_spinlock); + on_cpus(test_spinlock, NULL); return report_summary(); } diff --git a/lib/arm/asm/smp.h b/lib/arm/asm/smp.h index 62d14b07bc51..077afde85520 100644 --- a/lib/arm/asm/smp.h +++ b/lib/arm/asm/smp.h @@ -52,6 +52,6 @@ typedef void (*secondary_entry_fn)(void); extern void smp_boot_secondary(int cpu, secondary_entry_fn entry); extern void on_cpu_async(int cpu, void (*func)(void *data), void *data); extern void on_cpu(int cpu, void (*func)(void *data), void *data); -extern void on_cpus(void (*func)(void)); +extern void on_cpus(void (*func)(void *data), void *data); #endif /* _ASMARM_SMP_H_ */ diff --git a/lib/arm/smp.c b/lib/arm/smp.c index 5a6209ebcbfd..3c4e307489b2 100644 --- a/lib/arm/smp.c +++ b/lib/arm/smp.c @@ -72,9 +72,8 @@ void smp_boot_secondary(int cpu, secondary_entry_fn entry) spin_unlock(&lock); } -typedef void (*on_cpu_func)(void *); struct on_cpu_info { - on_cpu_func func; + void (*func)(void *data); void *data; cpumask_t waiters; }; @@ -180,16 +179,16 @@ void on_cpu(int cpu, void (*func)(void *data), void *data) cpu_wait(cpu); } -void on_cpus(void (*func)(void)) +void on_cpus(void (*func)(void *data), void *data) { int cpu, me = smp_processor_id(); for_each_present_cpu(cpu) { if (cpu == me) continue; - on_cpu_async(cpu, (on_cpu_func)func, NULL); + on_cpu_async(cpu, func, data); } - func(); + func(data); for_each_present_cpu(cpu) { if (cpu == me) -- 2.9.4