Patchwork [6/6] pci-assign: Use msi_get_message()

login
register
mail settings
Submitter Alex Williamson
Date Oct. 2, 2012, 7:22 p.m.
Message ID <20121002192213.31100.86057.stgit@bling.home>
Download mbox | patch
Permalink /patch/188639/
State New
Headers show

Comments

Alex Williamson - Oct. 2, 2012, 7:22 p.m.
pci-assign only uses a subset of the flexibility msi_get_message()
provides, but it's still worthwhile to use it.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---

 hw/kvm/pci-assign.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Patch

diff --git a/hw/kvm/pci-assign.c b/hw/kvm/pci-assign.c
index ddde573..d76b1bd 100644
--- a/hw/kvm/pci-assign.c
+++ b/hw/kvm/pci-assign.c
@@ -1008,12 +1008,9 @@  static void assigned_dev_update_msi(PCIDevice *pci_dev)
     }
 
     if (ctrl_byte & PCI_MSI_FLAGS_ENABLE) {
-        uint8_t *pos = pci_dev->config + pci_dev->msi_cap;
-        MSIMessage msg;
+        MSIMessage msg = msi_get_message(pci_dev, 0);
         int virq;
 
-        msg.address = pci_get_long(pos + PCI_MSI_ADDRESS_LO);
-        msg.data = pci_get_word(pos + PCI_MSI_DATA_32);
         virq = kvm_irqchip_add_msi_route(kvm_state, msg);
         if (virq < 0) {
             perror("assigned_dev_update_msi: kvm_irqchip_add_msi_route");