yeahuh / rpms / qemu-kvm

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