diff options
author | Subrata Banik <subrata.banik@intel.com> | 2018-04-24 13:45:30 +0530 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2018-05-14 08:39:42 +0000 |
commit | 3337497d2a1995614afd4a554747d86e4bcd8d31 (patch) | |
tree | d633ef07da222f54c90057d0e9b179c785f2a948 /src/cpu | |
parent | 223fb436fe89a265f4ddbe7f8fe38a35b47a8253 (diff) | |
download | coreboot-3337497d2a1995614afd4a554747d86e4bcd8d31.tar.xz |
cpu/x86: Add support to run function with argument over APs
This patch ensures that user can pass a function with given argument
list to execute over APs.
BUG=b:74436746
BRANCH=none
TEST=Able to run functions over APs with argument.
Change-Id: I668b36752f6b21cb99cd1416c385d53e96117213
Signed-off-by: Subrata Banik <subrata.banik@intel.com>
Reviewed-on: https://review.coreboot.org/25725
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'src/cpu')
-rw-r--r-- | src/cpu/x86/mp_init.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c index f7cf0b418d..ef576ec26d 100644 --- a/src/cpu/x86/mp_init.c +++ b/src/cpu/x86/mp_init.c @@ -41,7 +41,8 @@ #define MAX_APIC_IDS 256 struct mp_callback { - void (*func)(void); + void (*func)(void *); + void *arg; }; /* @@ -191,7 +192,7 @@ static void ap_do_flight_plan(void) } } -static void park_this_cpu(void) +static void park_this_cpu(void *unused) { stop_this_cpu(); } @@ -222,7 +223,7 @@ static void asmlinkage ap_init(unsigned int cpu) ap_do_flight_plan(); /* Park the AP. */ - park_this_cpu(); + park_this_cpu(NULL); } static void setup_default_sipi_vector_params(struct sipi_params *sp) @@ -941,21 +942,22 @@ static void ap_wait_for_instruction(void) memcpy(&lcb, cb, sizeof(lcb)); mfence(); store_callback(per_cpu_slot, NULL); - lcb.func(); + lcb.func(lcb.arg); } } -int mp_run_on_aps(void (*func)(void), long expire_us) +int mp_run_on_aps(void (*func)(void *), void *arg, long expire_us) { - struct mp_callback lcb = { .func = func }; + struct mp_callback lcb = { .func = func, .arg = arg }; return run_ap_work(&lcb, expire_us); } -int mp_run_on_all_cpus(void (*func)(void), long expire_us) +int mp_run_on_all_cpus(void (*func)(void *), void *arg, long expire_us) { /* Run on BSP first. */ - func(); - return mp_run_on_aps(func, expire_us); + func(arg); + + return mp_run_on_aps(func, arg, expire_us); } int mp_park_aps(void) @@ -966,7 +968,7 @@ int mp_park_aps(void) stopwatch_init(&sw); - ret = mp_run_on_aps(park_this_cpu, 250 * USECS_PER_MSEC); + ret = mp_run_on_aps(park_this_cpu, NULL, 250 * USECS_PER_MSEC); duration_msecs = stopwatch_duration_msecs(&sw); |