|
@@ -23,7 +23,6 @@
|
|
#include "qapi/error.h"
|
|
#include "qapi/error.h"
|
|
#include "qemu/module.h"
|
|
#include "qemu/module.h"
|
|
#include "migration/vmstate.h"
|
|
#include "migration/vmstate.h"
|
|
-#include "monitor/monitor.h"
|
|
|
|
#include "hw/intc/intc.h"
|
|
#include "hw/intc/intc.h"
|
|
#include "hw/intc/ioapic.h"
|
|
#include "hw/intc/ioapic.h"
|
|
#include "hw/intc/ioapic_internal.h"
|
|
#include "hw/intc/ioapic_internal.h"
|
|
@@ -59,59 +58,62 @@ static bool ioapic_get_statistics(InterruptStatsProvider *obj,
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
-static void ioapic_irr_dump(Monitor *mon, const char *name, uint32_t bitmap)
|
|
|
|
|
|
+static void ioapic_irr_dump(GString *buf, const char *name, uint32_t bitmap)
|
|
{
|
|
{
|
|
int i;
|
|
int i;
|
|
|
|
|
|
- monitor_printf(mon, "%-10s ", name);
|
|
|
|
|
|
+ g_string_append_printf(buf, "%-10s ", name);
|
|
if (bitmap == 0) {
|
|
if (bitmap == 0) {
|
|
- monitor_printf(mon, "(none)\n");
|
|
|
|
|
|
+ g_string_append_printf(buf, "(none)\n");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
for (i = 0; i < IOAPIC_NUM_PINS; i++) {
|
|
for (i = 0; i < IOAPIC_NUM_PINS; i++) {
|
|
if (bitmap & (1 << i)) {
|
|
if (bitmap & (1 << i)) {
|
|
- monitor_printf(mon, "%-2u ", i);
|
|
|
|
|
|
+ g_string_append_printf(buf, "%-2u ", i);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- monitor_printf(mon, "\n");
|
|
|
|
|
|
+ g_string_append_c(buf, '\n');
|
|
}
|
|
}
|
|
|
|
|
|
-static void ioapic_print_redtbl(Monitor *mon, IOAPICCommonState *s)
|
|
|
|
|
|
+static void ioapic_print_redtbl(GString *buf, IOAPICCommonState *s)
|
|
{
|
|
{
|
|
static const char *delm_str[] = {
|
|
static const char *delm_str[] = {
|
|
"fixed", "lowest", "SMI", "...", "NMI", "INIT", "...", "extINT"};
|
|
"fixed", "lowest", "SMI", "...", "NMI", "INIT", "...", "extINT"};
|
|
uint32_t remote_irr = 0;
|
|
uint32_t remote_irr = 0;
|
|
int i;
|
|
int i;
|
|
|
|
|
|
- monitor_printf(mon, "ioapic0: ver=0x%x id=0x%02x sel=0x%02x",
|
|
|
|
- s->version, s->id, s->ioregsel);
|
|
|
|
|
|
+ g_string_append_printf(buf, "ioapic0: ver=0x%x id=0x%02x sel=0x%02x",
|
|
|
|
+ s->version, s->id, s->ioregsel);
|
|
if (s->ioregsel) {
|
|
if (s->ioregsel) {
|
|
- monitor_printf(mon, " (redir[%u])\n",
|
|
|
|
- (s->ioregsel - IOAPIC_REG_REDTBL_BASE) >> 1);
|
|
|
|
|
|
+ g_string_append_printf(buf, " (redir[%u])\n",
|
|
|
|
+ (s->ioregsel - IOAPIC_REG_REDTBL_BASE) >> 1);
|
|
} else {
|
|
} else {
|
|
- monitor_printf(mon, "\n");
|
|
|
|
|
|
+ g_string_append_c(buf, '\n');
|
|
}
|
|
}
|
|
for (i = 0; i < IOAPIC_NUM_PINS; i++) {
|
|
for (i = 0; i < IOAPIC_NUM_PINS; i++) {
|
|
uint64_t entry = s->ioredtbl[i];
|
|
uint64_t entry = s->ioredtbl[i];
|
|
uint32_t delm = (uint32_t)((entry & IOAPIC_LVT_DELIV_MODE) >>
|
|
uint32_t delm = (uint32_t)((entry & IOAPIC_LVT_DELIV_MODE) >>
|
|
IOAPIC_LVT_DELIV_MODE_SHIFT);
|
|
IOAPIC_LVT_DELIV_MODE_SHIFT);
|
|
- monitor_printf(mon, " pin %-2u 0x%016"PRIx64" dest=%"PRIx64
|
|
|
|
- " vec=%-3"PRIu64" %s %-5s %-6s %-6s %s\n",
|
|
|
|
- i, entry,
|
|
|
|
- (entry >> IOAPIC_LVT_DEST_SHIFT) &
|
|
|
|
- (entry & IOAPIC_LVT_DEST_MODE ? 0xff : 0xf),
|
|
|
|
- entry & IOAPIC_VECTOR_MASK,
|
|
|
|
- entry & IOAPIC_LVT_POLARITY ? "active-lo" : "active-hi",
|
|
|
|
- entry & IOAPIC_LVT_TRIGGER_MODE ? "level" : "edge",
|
|
|
|
- entry & IOAPIC_LVT_MASKED ? "masked" : "",
|
|
|
|
- delm_str[delm],
|
|
|
|
- entry & IOAPIC_LVT_DEST_MODE ? "logical" : "physical");
|
|
|
|
|
|
+ g_string_append_printf(buf, " pin %-2u 0x%016"PRIx64" dest=%"PRIx64
|
|
|
|
+ " vec=%-3"PRIu64" %s %-5s %-6s %-6s %s\n",
|
|
|
|
+ i, entry,
|
|
|
|
+ (entry >> IOAPIC_LVT_DEST_SHIFT) &
|
|
|
|
+ (entry & IOAPIC_LVT_DEST_MODE ? 0xff : 0xf),
|
|
|
|
+ entry & IOAPIC_VECTOR_MASK,
|
|
|
|
+ entry & IOAPIC_LVT_POLARITY
|
|
|
|
+ ? "active-lo" : "active-hi",
|
|
|
|
+ entry & IOAPIC_LVT_TRIGGER_MODE
|
|
|
|
+ ? "level" : "edge",
|
|
|
|
+ entry & IOAPIC_LVT_MASKED ? "masked" : "",
|
|
|
|
+ delm_str[delm],
|
|
|
|
+ entry & IOAPIC_LVT_DEST_MODE
|
|
|
|
+ ? "logical" : "physical");
|
|
|
|
|
|
remote_irr |= entry & IOAPIC_LVT_TRIGGER_MODE ?
|
|
remote_irr |= entry & IOAPIC_LVT_TRIGGER_MODE ?
|
|
(entry & IOAPIC_LVT_REMOTE_IRR ? (1 << i) : 0) : 0;
|
|
(entry & IOAPIC_LVT_REMOTE_IRR ? (1 << i) : 0) : 0;
|
|
}
|
|
}
|
|
- ioapic_irr_dump(mon, " IRR", s->irr);
|
|
|
|
- ioapic_irr_dump(mon, " Remote IRR", remote_irr);
|
|
|
|
|
|
+ ioapic_irr_dump(buf, " IRR", s->irr);
|
|
|
|
+ ioapic_irr_dump(buf, " Remote IRR", remote_irr);
|
|
}
|
|
}
|
|
|
|
|
|
void ioapic_reset_common(DeviceState *dev)
|
|
void ioapic_reset_common(DeviceState *dev)
|
|
@@ -171,13 +173,12 @@ static void ioapic_common_realize(DeviceState *dev, Error **errp)
|
|
ioapic_no++;
|
|
ioapic_no++;
|
|
}
|
|
}
|
|
|
|
|
|
-static void ioapic_print_info(InterruptStatsProvider *obj,
|
|
|
|
- Monitor *mon)
|
|
|
|
|
|
+static void ioapic_print_info(InterruptStatsProvider *obj, GString *buf)
|
|
{
|
|
{
|
|
IOAPICCommonState *s = IOAPIC_COMMON(obj);
|
|
IOAPICCommonState *s = IOAPIC_COMMON(obj);
|
|
|
|
|
|
ioapic_dispatch_pre_save(s);
|
|
ioapic_dispatch_pre_save(s);
|
|
- ioapic_print_redtbl(mon, s);
|
|
|
|
|
|
+ ioapic_print_redtbl(buf, s);
|
|
}
|
|
}
|
|
|
|
|
|
static const VMStateDescription vmstate_ioapic_common = {
|
|
static const VMStateDescription vmstate_ioapic_common = {
|