Establish a post-load notification for the MSI subsystem so that KVM can refresh its IRQ routing after vmload. Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> --- hw/msi.c | 13 +++++++++++++ hw/msi.h | 1 + hw/pci.c | 2 ++ 3 files changed, 16 insertions(+), 0 deletions(-) diff --git a/hw/msi.c b/hw/msi.c index 18f683b..0cbff17 100644 --- a/hw/msi.c +++ b/hw/msi.c @@ -453,3 +453,16 @@ unsigned int msi_nr_vectors_allocated(const PCIDevice *dev) uint16_t flags = pci_get_word(dev->config + msi_flags_off(dev)); return msi_nr_vectors(flags); } + +void msi_post_load(PCIDevice *dev) +{ + uint16_t flags = pci_get_word(dev->config + msi_flags_off(dev)); + + if (kvm_enabled() && kvm_irqchip_in_kernel()) { + kvm_msi_free(dev); + + if (flags & PCI_MSI_FLAGS_ENABLE) { + kvm_msi_update(dev); + } + } +} diff --git a/hw/msi.h b/hw/msi.h index 5766018..6ff0607 100644 --- a/hw/msi.h +++ b/hw/msi.h @@ -32,6 +32,7 @@ void msi_reset(PCIDevice *dev); void msi_notify(PCIDevice *dev, unsigned int vector); void msi_write_config(PCIDevice *dev, uint32_t addr, uint32_t val, int len); unsigned int msi_nr_vectors_allocated(const PCIDevice *dev); +void msi_post_load(PCIDevice *dev); static inline bool msi_present(const PCIDevice *dev) { diff --git a/hw/pci.c b/hw/pci.c index 82e0300..07ec4f9 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -34,6 +34,7 @@ #include "device-assignment.h" #include "qemu-objects.h" #include "range.h" +#include "msi.h" //#define DEBUG_PCI #ifdef DEBUG_PCI @@ -342,6 +343,7 @@ static int get_pci_config_device(QEMUFile *f, void *pv, size_t size) memcpy(s->config, config, size); pci_update_mappings(s); + msi_post_load(s); qemu_free(config); return 0; -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html