Skip to content

Commit

Permalink
hmp: allow apic-id for "info lapic"
Browse files Browse the repository at this point in the history
Add [apic-id] support for hmp command "info lapic", which is
useful when debugging ipi and so on. Current behavior is not
changed when the parameter isn't specified.

Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
Signed-off-by: Yun Liu <liu.yunh@zte.com.cn>
Message-Id: <1501049917-4701-3-git-send-email-wang.yi59@zte.com.cn>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
  • Loading branch information
Yi Wang authored and ehabkost committed Sep 1, 2017
1 parent 5ce46cb commit 1bef228
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
7 changes: 4 additions & 3 deletions hmp-commands-info.hx
Expand Up @@ -115,9 +115,10 @@ ETEXI
#if defined(TARGET_I386)
{
.name = "lapic",
.args_type = "",
.params = "",
.help = "show local apic state",
.args_type = "apic-id:i?",
.params = "[apic-id]",
.help = "show local apic state (apic-id: local apic to read, default is which of current CPU)",

.cmd = hmp_info_local_apic,
},
#endif
Expand Down
10 changes: 9 additions & 1 deletion target/i386/monitor.c
Expand Up @@ -632,7 +632,15 @@ const MonitorDef *target_monitor_defs(void)

void hmp_info_local_apic(Monitor *mon, const QDict *qdict)
{
CPUState *cs = mon_get_cpu();
CPUState *cs;

if (qdict_haskey(qdict, "apic-id")) {
int id = qdict_get_try_int(qdict, "apic-id", 0);
cs = cpu_by_arch_id(id);
} else {
cs = mon_get_cpu();
}


if (!cs) {
monitor_printf(mon, "No CPU available\n");
Expand Down

0 comments on commit 1bef228

Please sign in to comment.