summaryrefslogtreecommitdiff
path: root/kvm_mdb.c
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@joyent.com>2011-05-03 13:48:06 -0700
committerRobert Mustacchi <rm@joyent.com>2011-05-03 13:48:06 -0700
commita39dc6ab642c9f60de7e04618ba6ebc5528085f1 (patch)
treed1039833a29da28aa39d83ce22b93bf7d25092ec /kvm_mdb.c
parent179c51103387dc3314e7bcced9d891282646abfd (diff)
downloadillumos-kvm-a39dc6ab642c9f60de7e04618ba6ebc5528085f1.tar.gz
HVM-151 want dcmd for dumping the GSI routes
Diffstat (limited to 'kvm_mdb.c')
-rw-r--r--kvm_mdb.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/kvm_mdb.c b/kvm_mdb.c
index 015a6b8..3fab364 100644
--- a/kvm_mdb.c
+++ b/kvm_mdb.c
@@ -219,9 +219,48 @@ kvm_mdb_gpa2qva(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
return (DCMD_OK);
}
+static int
+kvm_mdb_gsiroutes(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
+{
+ struct kvm kvm;
+ struct kvm_irq_routing_table *table;
+ int ii, jj;
+
+ if (argc > 1)
+ return (DCMD_USAGE);
+
+ if (mdb_vread(&kvm, sizeof (struct kvm), addr) == -1) {
+ mdb_warn("couldn't read kvm at %p", addr);
+ return (DCMD_ERR);
+ }
+
+ table = mdb_alloc(sizeof (struct kvm_irq_routing_table),
+ UM_SLEEP | UM_GC);
+
+ if (mdb_vread(table, sizeof (struct kvm_irq_routing_table),
+ (uintptr_t)kvm.irq_routing) == -1) {
+ mdb_warn("couldn't read kvm irq routing table at %p",
+ kvm.irq_routing);
+ return (DCMD_ERR);
+ }
+
+ if (DCMD_HDRSPEC(flags))
+ mdb_printf("%s %7s %5s\n", "CHIP", "PORT", "GSI");
+
+ for (ii = 0; ii < KVM_NR_IRQCHIPS; ii++) {
+ for (jj = 0; jj < KVM_IOAPIC_NUM_PINS; jj++)
+ mdb_printf("%3d %7d 0x%x\n", ii, jj,
+ table->chip[ii][jj]);
+ }
+
+ return (DCMD_OK);
+}
+
static const mdb_dcmd_t dcmds[] = {
{ "kvm_gpa2qva", "?[address of kvm]", "translate a guest physical "
"to a QEMU virtual address", kvm_mdb_gpa2qva },
+ { "kvm_gsiroutes", NULL, "print out the global system "
+ "interrupt (GSI) routing table", kvm_mdb_gsiroutes },
{ NULL }
};