Skip to contentSkip to conversation

xics-kvm: fix reset function

PATCH In review Alexey Kardashevskiy 2 participants 5 messages Feb 13, 2014 – Mar 12, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xics-kvm: fix reset function

Currently interrupt priorities are set to 0 (highest) at the very beginning of the guest execution which is not correct and makes the guest produce random interrupt error messages such as:
"Interrupt 0x1001 (real) is invalid, disabling it".
This also prevents interrupt states from correct migration.

This initializes priority to 0xFF as the emulated XICS does.

---
 hw/intc/xics_kvm.c | 9 +++++++++
 1 file changed, 9 insertions(+)
hw/intc/xics_kvm.c +9 -0
index c203646..eaf94d9 100644
@@ -269,6 +269,15 @@ static void ics_kvm_set_irq(void *opaque, int srcno, int val)
 
 static void ics_kvm_reset(DeviceState *dev)
 {
+    ICSState *ics = ICS(dev);
+    int i;
+
+    memset(ics->irqs, 0, sizeof(ICSIRQState) * ics->nr_irqs);
+    for (i = 0; i < ics->nr_irqs; i++) {
+        ics->irqs[i].priority = 0xff;
+        ics->irqs[i].saved_priority = 0xff;
+    }
+
     ics_set_kvm_state(ICS(dev), 1);
 }
 
Signature · 1 line
1.8.4.rc4
#1 lore raw
Quoted 7 lines · Alexey Kardashevskiy

Currently interrupt priorities are set to 0 (highest) at the very beginning of the guest execution which is not correct and makes the guest produce random interrupt error messages such as:
"Interrupt 0x1001 (real) is invalid, disabling it".
This also prevents interrupt states from correct migration.

This initializes priority to 0xFF as the emulated XICS does.

Ping? Pretty simple patch suggested by Paul Mackerras.

Quoted 26 lines
---
 hw/intc/xics_kvm.c | 9 +++++++++
 1 file changed, 9 insertions(+)
hw/intc/xics_kvm.c +9 -0
index c203646..eaf94d9 100644
@@ -269,6 +269,15 @@ static void ics_kvm_set_irq(void *opaque, int srcno, int val)
 
 static void ics_kvm_reset(DeviceState *dev)
 {
+    ICSState *ics = ICS(dev);
+    int i;
+
+    memset(ics->irqs, 0, sizeof(ICSIRQState) * ics->nr_irqs);
+    for (i = 0; i < ics->nr_irqs; i++) {
+        ics->irqs[i].priority = 0xff;
+        ics->irqs[i].saved_priority = 0xff;
+    }
+
     ics_set_kvm_state(ICS(dev), 1);
 }
 
Signature · 1 line
Alexey
#2 lore raw

Am 04.03.2014 08:03, schrieb Alexey Kardashevskiy:

Quoted 11 lines · Alexey Kardashevskiy
Quoted 7 lines

Currently interrupt priorities are set to 0 (highest) at the very beginning of the guest execution which is not correct and makes the guest produce random interrupt error messages such as:
"Interrupt 0x1001 (real) is invalid, disabling it".
This also prevents interrupt states from correct migration.

This initializes priority to 0xFF as the emulated XICS does.

Ping? Pretty simple patch suggested by Paul Mackerras.

Is this one still needed? Can we document a Suggested-by?

Andreas

Quoted 31 lines
Quoted 29 lines
---
 hw/intc/xics_kvm.c | 9 +++++++++
 1 file changed, 9 insertions(+)
hw/intc/xics_kvm.c +9 -0
index c203646..eaf94d9 100644
@@ -269,6 +269,15 @@ static void ics_kvm_set_irq(void *opaque, int srcno, int val)
 
 static void ics_kvm_reset(DeviceState *dev)
 {
+    ICSState *ics = ICS(dev);
+    int i;
+
+    memset(ics->irqs, 0, sizeof(ICSIRQState) * ics->nr_irqs);
+    for (i = 0; i < ics->nr_irqs; i++) {
+        ics->irqs[i].priority = 0xff;
+        ics->irqs[i].saved_priority = 0xff;
+    }
+
     ics_set_kvm_state(ICS(dev), 1);
 }
 
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#3 lore raw
Quoted 8 lines · Andreas Färber

Am 04.03.2014 08:03, schrieb Alexey Kardashevskiy:

Quoted 7 lines · Alexey Kardashevskiy
Quoted 6 lines

Currently interrupt priorities are set to 0 (highest) at the very beginning of the guest execution which is not correct and makes the guest produce random interrupt error messages such as:
"Interrupt 0x1001 (real) is invalid, disabling it".
This also prevents interrupt states from correct migration.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

This initializes priority to 0xFF as the emulated XICS does.

Ping? Pretty simple patch suggested by Paul Mackerras.

Is this one still needed? Can we document a Suggested-by?

Yes.

Quoted 35 lines

Andreas

Quoted 31 lines
Quoted 29 lines
---
 hw/intc/xics_kvm.c | 9 +++++++++
 1 file changed, 9 insertions(+)
hw/intc/xics_kvm.c +9 -0
index c203646..eaf94d9 100644
@@ -269,6 +269,15 @@ static void ics_kvm_set_irq(void *opaque, int srcno, int val)
 
 static void ics_kvm_reset(DeviceState *dev)
 {
+    ICSState *ics = ICS(dev);
+    int i;
+
+    memset(ics->irqs, 0, sizeof(ICSIRQState) * ics->nr_irqs);
+    for (i = 0; i < ics->nr_irqs; i++) {
+        ics->irqs[i].priority = 0xff;
+        ics->irqs[i].saved_priority = 0xff;
+    }
+
     ics_set_kvm_state(ICS(dev), 1);
 }
 
Signature · 1 line
Alexey
#4 lore raw

Am 13.03.2014 00:00, schrieb Alexey Kardashevskiy:

Quoted 12 lines · Andreas Färber
Quoted 11 lines

Am 04.03.2014 08:03, schrieb Alexey Kardashevskiy:

Quoted 10 lines · Alexey Kardashevskiy
Quoted 7 lines

Currently interrupt priorities are set to 0 (highest) at the very beginning of the guest execution which is not correct and makes the guest produce random interrupt error messages such as:
"Interrupt 0x1001 (real) is invalid, disabling it".
This also prevents interrupt states from correct migration.

This initializes priority to 0xFF as the emulated XICS does.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Ping? Pretty simple patch suggested by Paul Mackerras.

Is this one still needed? Can we document a Suggested-by?

Yes.

Thanks, queuing with optimization on my ppc-next:
https://github.com/afaerber/qemu-cpu/commits/ppc-next

hw/intc/xics_kvm.c +1 -1
index 04e4e61..c93dae0 100644
@@ -278,7 +278,7 @@ static void ics_kvm_reset(DeviceState *dev)
         ics->irqs[i].saved_priority = 0xff;
     }
 
-    ics_set_kvm_state(ICS(dev), 1);
+    ics_set_kvm_state(ics, 1);
 }
 
 static void ics_kvm_realize(DeviceState *dev, Error **errp)

Testing TBD.

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg