9ae3a8
From cc5b2c1e8ea83b1d1e377993c302322beb37bc50 Mon Sep 17 00:00:00 2001
9ae3a8
From: Alex Williamson <alex.williamson@redhat.com>
9ae3a8
Date: Thu, 7 Aug 2014 21:03:20 +0200
9ae3a8
Subject: [PATCH 7/7] vfio: Don't cache MSIMessage
9ae3a8
9ae3a8
Message-id: <20140807210320.11689.35203.stgit@gimli.home>
9ae3a8
Patchwork-id: 60483
9ae3a8
O-Subject: [RHEL7.0/z qemu-kvm PATCH v2 6/6] vfio: Don't cache MSIMessage
9ae3a8
Bugzilla: 1098976
9ae3a8
RH-Acked-by: Bandan Das <bsd@redhat.com>
9ae3a8
RH-Acked-by: Amos Kong <akong@redhat.com>
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
9ae3a8
Commit 40509f7f added a test to avoid updating KVM MSI routes when the
9ae3a8
MSIMessage is unchanged and f4d45d47 switched to relying on this
9ae3a8
rather than doing our own comparison.  Our cached msg is effectively
9ae3a8
unused now.  Remove it.
9ae3a8
9ae3a8
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 hw/misc/vfio.c | 8 ++------
9ae3a8
 1 file changed, 2 insertions(+), 6 deletions(-)
9ae3a8
9ae3a8
diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
9ae3a8
index 688e2ef..abaa4c1 100644
9ae3a8
--- a/hw/misc/vfio.c
9ae3a8
+++ b/hw/misc/vfio.c
9ae3a8
@@ -131,7 +131,6 @@ typedef struct VFIOMSIVector {
9ae3a8
     EventNotifier interrupt;
9ae3a8
     EventNotifier kvm_interrupt;
9ae3a8
     struct VFIODevice *vdev; /* back pointer to device */
9ae3a8
-    MSIMessage msg; /* cache the MSI message so we know when it changes */
9ae3a8
     int virq;
9ae3a8
     bool use;
9ae3a8
 } VFIOMSIVector;
9ae3a8
@@ -725,7 +724,6 @@ static void vfio_add_kvm_msi_virq(VFIOMSIVector *vector, MSIMessage *msg,
9ae3a8
         return;
9ae3a8
     }
9ae3a8
 
9ae3a8
-    vector->msg = *msg;
9ae3a8
     vector->virq = virq;
9ae3a8
 }
9ae3a8
 
9ae3a8
@@ -741,7 +739,6 @@ static void vfio_remove_kvm_msi_virq(VFIOMSIVector *vector)
9ae3a8
 static void vfio_update_kvm_msi_virq(VFIOMSIVector *vector, MSIMessage msg)
9ae3a8
 {
9ae3a8
     kvm_irqchip_update_msi_route(kvm_state, vector->virq, msg);
9ae3a8
-    vector->msg = msg;
9ae3a8
 }
9ae3a8
 
9ae3a8
 static int vfio_msix_vector_do_use(PCIDevice *pdev, unsigned int nr,
9ae3a8
@@ -920,6 +917,7 @@ retry:
9ae3a8
 
9ae3a8
     for (i = 0; i < vdev->nr_vectors; i++) {
9ae3a8
         VFIOMSIVector *vector = &vdev->msi_vectors[i];
9ae3a8
+        MSIMessage msg = msi_get_message(&vdev->pdev, i);
9ae3a8
 
9ae3a8
         vector->vdev = vdev;
9ae3a8
         vector->virq = -1;
9ae3a8
@@ -932,13 +930,11 @@ retry:
9ae3a8
         qemu_set_fd_handler(event_notifier_get_fd(&vector->interrupt),
9ae3a8
                             vfio_msi_interrupt, NULL, vector);
9ae3a8
 
9ae3a8
-        vector->msg = msi_get_message(&vdev->pdev, i);
9ae3a8
-
9ae3a8
         /*
9ae3a8
          * Attempt to enable route through KVM irqchip,
9ae3a8
          * default to userspace handling if unavailable.
9ae3a8
          */
9ae3a8
-        vfio_add_kvm_msi_virq(vector, &vector->msg, false);
9ae3a8
+        vfio_add_kvm_msi_virq(vector, &msg, false);
9ae3a8
     }
9ae3a8
 
9ae3a8
     /* Set interrupt type prior to possible interrupts */
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8