Skip to contentSkip to conversation

kvm/ioapic: some tiny tweaks

PATCH Applied Peter Xu 2 participants 5 messages Feb 3, 2017

lore
Share & tools
lore

Peter Xu

author
#0 lore raw

cover kvm/ioapic: some tiny tweaks

This series fixes the issue pointed out by PMM in thread:

https://lists.gnu.org/archive/html/qemu-devel/2017-01/msg06323.html

Along with other two patches to make the version more accurate. Thanks,

Peter Xu (3):
kvm/ioapic: dump real object instead of a fake one
ioapic: fix error report value of def version kvm/ioapic: correct kvm ioapic version

 hw/i386/kvm/ioapic.c | 13 +++++++++----
 hw/intc/ioapic.c     |  6 ++++--
 2 files changed, 13 insertions(+), 6 deletions(-)
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/3 kvm/ioapic: dump real object instead of a fake one

When we do "info ioapic" for kvm ioapic, we were building up a temporary ioapic object. Let's fetch the real one and update correspond to the real object as well.

This fixes printing uninitialized version field in ioapic_print_redtbl().

---
 hw/i386/kvm/ioapic.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/i386/kvm/ioapic.c +4 -4
index 8eb2c7a..716d59a 100644
@@ -114,11 +114,11 @@ static void kvm_ioapic_put(IOAPICCommonState *s)
 
 void kvm_ioapic_dump_state(Monitor *mon, const QDict *qdict)
 {
-    IOAPICCommonState s;
+    IOAPICCommonState *s = IOAPIC_COMMON(object_resolve_path("ioapic", NULL));
 
-    kvm_ioapic_get(&s);
-
-    ioapic_print_redtbl(mon, &s);
+    assert(s);
+    kvm_ioapic_get(s);
+    ioapic_print_redtbl(mon, s);
 }
 
 static void kvm_ioapic_reset(DeviceState *dev)
Signature · 1 line
2.7.4
author
#2 lore raw

PATCH 2/3 ioapic: fix error report value of def version

In reply to Peter Xu

It should be 0x20, rather than 0x11.

---
 hw/intc/ioapic.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
hw/intc/ioapic.c +4 -2
index 9047b89..37c4386 100644
@@ -408,13 +408,15 @@ static void ioapic_machine_done_notify(Notifier *notifier, void *data)
 #endif
 }
 
+#define IOAPIC_VER_DEF 0x20
+
 static void ioapic_realize(DeviceState *dev, Error **errp)
 {
     IOAPICCommonState *s = IOAPIC_COMMON(dev);
 
     if (s->version != 0x11 && s->version != 0x20) {
         error_report("IOAPIC only supports version 0x11 or 0x20 "
-                     "(default: 0x11).");
+                     "(default: 0x%x).", IOAPIC_VER_DEF);
         exit(1);
     }
 
@@ -429,7 +431,7 @@ static void ioapic_realize(DeviceState *dev, Error **errp)
 }
 
 static Property ioapic_properties[] = {
-    DEFINE_PROP_UINT8("version", IOAPICCommonState, version, 0x20),
+    DEFINE_PROP_UINT8("version", IOAPICCommonState, version, IOAPIC_VER_DEF),
     DEFINE_PROP_END_OF_LIST(),
 };
 
Signature · 1 line
2.7.4
author
#3 lore raw

PATCH 3/3 kvm/ioapic: correct kvm ioapic version

In reply to Peter Xu
---
 hw/i386/kvm/ioapic.c | 5 +++++
 1 file changed, 5 insertions(+)
hw/i386/kvm/ioapic.c +5 -0
index 716d59a..98ca480 100644
@@ -143,6 +143,11 @@ static void kvm_ioapic_realize(DeviceState *dev, Error **errp)
     IOAPICCommonState *s = IOAPIC_COMMON(dev);
 
     memory_region_init_reservation(&s->io_memory, NULL, "kvm-ioapic", 0x1000);
+    /*
+     * KVM ioapic only supports 0x11 now. This will only be used when
+     * we want to dump ioapic version.
+     */
+    s->version = 0x11;
 
     qdev_init_gpio_in(dev, kvm_ioapic_set_irq, IOAPIC_NUM_PINS);
 }
Signature · 1 line
2.7.4
#4 lore raw
In reply to Peter Xu
Quoted 6 lines · Peter Xu

This series fixes the issue pointed out by PMM in thread:

https://lists.gnu.org/archive/html/qemu-devel/2017-01/msg06323.html

Along with other two patches to make the version more accurate. Thanks,

Quoted 9 lines

Peter Xu (3):
kvm/ioapic: dump real object instead of a fake one
ioapic: fix error report value of def version kvm/ioapic: correct kvm ioapic version

 hw/i386/kvm/ioapic.c | 13 +++++++++----
 hw/intc/ioapic.c     |  6 ++++--
 2 files changed, 13 insertions(+), 6 deletions(-)

Queued, thanks.

Paolo