aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-05-17 16:57:52 +0200
committerAndreas Färber <afaerber@suse.de>2013-06-11 00:09:48 +0200
commitc51a944b7505ba827adc897d5452d2b54dbf86bb (patch)
tree415722a4ad691fecf1ad2a985e64da0abf998549 /monitor.c
parent31ccdde298d98b08526dc23059071c9086dec6c2 (diff)
monitor: Simplify do_inject_mce() with qemu_get_cpu()
Avoids an open-coded CPU loop. Reviewed-by: liguang <lig.fnst@cn.fujitsu.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/monitor.c b/monitor.c
index 017411fcb0..70ae8f5b18 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2013,7 +2013,6 @@ static void do_acl_remove(Monitor *mon, const QDict *qdict)
static void do_inject_mce(Monitor *mon, const QDict *qdict)
{
X86CPU *cpu;
- CPUX86State *cenv;
CPUState *cs;
int cpu_index = qdict_get_int(qdict, "cpu_index");
int bank = qdict_get_int(qdict, "bank");
@@ -2026,14 +2025,11 @@ static void do_inject_mce(Monitor *mon, const QDict *qdict)
if (qdict_get_try_bool(qdict, "broadcast", 0)) {
flags |= MCE_INJECT_BROADCAST;
}
- for (cenv = first_cpu; cenv != NULL; cenv = cenv->next_cpu) {
- cpu = x86_env_get_cpu(cenv);
- cs = CPU(cpu);
- if (cs->cpu_index == cpu_index) {
- cpu_x86_inject_mce(mon, cpu, bank, status, mcg_status, addr, misc,
- flags);
- break;
- }
+ cs = qemu_get_cpu(cpu_index);
+ if (cs != NULL) {
+ cpu = X86_CPU(cs);
+ cpu_x86_inject_mce(mon, cpu, bank, status, mcg_status, addr, misc,
+ flags);
}
}
#endif