Skip to contentSkip to conversation

spapr/xive: Mask the EAS when allocating an IRQ

PATCH In review Cédric Le Goater 3 participants 4 messages Aug 13, 2019 – Aug 14, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spapr/xive: Mask the EAS when allocating an IRQ

If an IRQ is allocated and not configured, such as a MSI requested by a PCI driver, it can be saved in its default state and possibly later on restored using the same state. If not initially MASKED, KVM will try to find a matching priority/target tuple for the interrupt and fail to restore the VM because 0/0 is not a valid target.

When allocating a IRQ number, the EAS should be set to a sane default :
VALID and MASKED.

---

David, this fixes a "virsh save/restore" issue in certain configurations of CPU topology which never showed up before :/

Peter, I was busy on a KVM/passthru issue and lacked the time to investigate all ... you decide.

 hw/intc/spapr_xive.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
hw/intc/spapr_xive.c +4 -1
index 3ae311d9ff7f..1f9c624df13d 100644
@@ -534,7 +534,10 @@ bool spapr_xive_irq_claim(SpaprXive *xive, uint32_t lisn, bool lsi)
         return false;
     }
 
-    xive->eat[lisn].w |= cpu_to_be64(EAS_VALID);
+    /*
+     * Set default values when allocating an IRQ number
+     */
+    xive->eat[lisn].w |= cpu_to_be64(EAS_VALID | EAS_MASKED);
     if (lsi) {
         xive_source_irq_set_lsi(xsrc, lisn);
     }
Signature · 1 line
2.21.0
#1 lore raw
Quoted 12 lines · Cédric Le Goater

If an IRQ is allocated and not configured, such as a MSI requested by a PCI driver, it can be saved in its default state and possibly later on restored using the same state. If not initially MASKED, KVM will try to find a matching priority/target tuple for the interrupt and fail to restore the VM because 0/0 is not a valid target.

When allocating a IRQ number, the EAS should be set to a sane default :
VALID and MASKED.

Quoted 7 lines

---

David, this fixes a "virsh save/restore" issue in certain configurations of CPU topology which never showed up before :/

Peter, I was busy on a KVM/passthru issue and lacked the time to investigate all ... you decide.

rc5 has been tagged so this is definitely too late for 4.1.

thanks
-- PMM

#2 lore raw
Quoted 15 lines · Peter Maydell
Quoted 14 lines · Cédric Le Goater

If an IRQ is allocated and not configured, such as a MSI requested by a PCI driver, it can be saved in its default state and possibly later on restored using the same state. If not initially MASKED, KVM will try to find a matching priority/target tuple for the interrupt and fail to restore the VM because 0/0 is not a valid target.

When allocating a IRQ number, the EAS should be set to a sane default :
VALID and MASKED.

---

Quoted 7 lines
Quoted 5 lines

David, this fixes a "virsh save/restore" issue in certain configurations of CPU topology which never showed up before :/

Peter, I was busy on a KVM/passthru issue and lacked the time to investigate all ... you decide.

rc5 has been tagged so this is definitely too late for 4.1.

This is nothing too invasive which will be difficult to backport.

Thanks,

C.

#3 lore raw
In reply to Peter Maydell
Quoted 15 lines · Peter Maydell
Quoted 14 lines · Cédric Le Goater

If an IRQ is allocated and not configured, such as a MSI requested by a PCI driver, it can be saved in its default state and possibly later on restored using the same state. If not initially MASKED, KVM will try to find a matching priority/target tuple for the interrupt and fail to restore the VM because 0/0 is not a valid target.

When allocating a IRQ number, the EAS should be set to a sane default :
VALID and MASKED.

---

Quoted 7 lines
Quoted 5 lines

David, this fixes a "virsh save/restore" issue in certain configurations of CPU topology which never showed up before :/

Peter, I was busy on a KVM/passthru issue and lacked the time to investigate all ... you decide.

rc5 has been tagged so this is definitely too late for 4.1.

Understood. It's unfortunate, but I've merged this for 4.2, and I'll look into stable branch and downstream backports.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson