OSDN Git Service

pci-assign: sync MSI/MSI-X cap and table with PCIDevice
authorPeter Xu <peterx@redhat.com>
Fri, 25 Nov 2016 02:55:22 +0000 (10:55 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 28 Nov 2016 14:11:17 +0000 (15:11 +0100)
commit64e184e2608d3c93dda1bba8ae6dc2185b5228fb
tree287c8e4b8d7500b7b7498569e696c675292776ff
parent9e55d58806feedca9341a63243304fbbeaac741d
pci-assign: sync MSI/MSI-X cap and table with PCIDevice

Since commit e1d4fb2d ("kvm-irqchip: x86: add msi route notify fn"),
kvm_irqchip_add_msi_route() starts to use pci_get_msi_message() to fetch
MSI info. This requires that we setup MSI related fields in PCIDevice.
For most devices, that won't be a problem, as long as we are using
general interfaces like msi_init()/msix_init().

However, for pci-assign devices, MSI/MSI-X is treated differently - PCI
assign devices are maintaining its own MSI table and cap information in
AssignedDevice struct. however that's not synced up with PCIDevice's
fields. That will leads to pci_get_msi_message() failed to find correct
MSI capability, even with an NULL msix_table.

A quick fix is to sync up the two places: both the capability bits and
table address for MSI/MSI-X.

Reported-by: Changlimin <changlimin@h3c.com>
Tested-by: Changlimin <changlimin@h3c.com>
Cc: qemu-stable@nongnu.org
Fixes: e1d4fb2d ("kvm-irqchip: x86: add msi route notify fn")
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <1480042522-16551-1-git-send-email-peterx@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/i386/kvm/pci-assign.c