Commit f57467e3 authored by Sam Bobroff's avatar Sam Bobroff Committed by David Gibson
Browse files

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: default avatarSam Bobroff <sam.bobroff@au1.ibm.com>
Reviewed-by: default avatarGreg Kurz <groug@kaod.org>
Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
parent 325837ca
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -1431,12 +1431,11 @@ static target_ulong h_signal_sys_reset(PowerPCCPU *cpu,

    } else {
        /* Unicast */
        CPU_FOREACH(cs) {
            if (cpu->cpu_dt_id == target) {
        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;
    }
}