aboutsummaryrefslogtreecommitdiff
path: root/hw/ppc/spapr_hcall.c
diff options
context:
space:
mode:
authorSam Bobroff <sam.bobroff@au1.ibm.com>2017-08-03 16:28:27 +1000
committerDavid Gibson <david@gibson.dropbear.id.au>2017-08-09 14:04:28 +1000
commitf57467e3b326c7736f8e481fd6b680f30e575c87 (patch)
tree6940dae5815c1cf83a403b2c5445267662c4627e /hw/ppc/spapr_hcall.c
parent325837ca3851d7e6761649a44ea3c111e2e1757f (diff)
spapr: Fix bug in h_signal_sys_reset()
The unicast case in h_signal_sys_reset() seems to be broken: rather than selecting the target CPU, it looks like it will pick either the first CPU or fail to find one at all. Fix it by using the search function rather than open coding the search. This was found by inspection; the code appears to be unused because the Linux kernel only uses the broadcast target. Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com> Reviewed-by: Greg Kurz <groug@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc/spapr_hcall.c')
-rw-r--r--hw/ppc/spapr_hcall.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index 72ea5a8247..07b3da8dc4 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -1431,11 +1431,10 @@ static target_ulong h_signal_sys_reset(PowerPCCPU *cpu,
} else {
/* Unicast */
- CPU_FOREACH(cs) {
- if (cpu->cpu_dt_id == target) {
- run_on_cpu(cs, spapr_do_system_reset_on_cpu, RUN_ON_CPU_NULL);
- return H_SUCCESS;
- }
+ cs = CPU(ppc_get_vcpu_by_dt_id(target));
+ if (cs) {
+ run_on_cpu(cs, spapr_do_system_reset_on_cpu, RUN_ON_CPU_NULL);
+ return H_SUCCESS;
}
return H_PARAMETER;
}