Skip to content

Commit

Permalink
vfio: Don't cache MSIMessage
Browse files Browse the repository at this point in the history
Commit 40509f7 added a test to avoid updating KVM MSI routes when the
MSIMessage is unchanged and f4d45d4 switched to relying on this
rather than doing our own comparison.  Our cached msg is effectively
unused now.  Remove it.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
  • Loading branch information
awilliam committed Aug 5, 2014
1 parent c048be5 commit 9b3af4c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions hw/misc/vfio.c
Expand Up @@ -132,7 +132,6 @@ typedef struct VFIOMSIVector {
EventNotifier interrupt;
EventNotifier kvm_interrupt;
struct VFIODevice *vdev; /* back pointer to device */
MSIMessage msg; /* cache the MSI message so we know when it changes */
int virq;
bool use;
} VFIOMSIVector;
Expand Down Expand Up @@ -744,7 +743,6 @@ static void vfio_add_kvm_msi_virq(VFIOMSIVector *vector, MSIMessage *msg,
return;
}

vector->msg = *msg;
vector->virq = virq;
}

Expand All @@ -760,7 +758,6 @@ static void vfio_remove_kvm_msi_virq(VFIOMSIVector *vector)
static void vfio_update_kvm_msi_virq(VFIOMSIVector *vector, MSIMessage msg)
{
kvm_irqchip_update_msi_route(kvm_state, vector->virq, msg);
vector->msg = msg;
}

static int vfio_msix_vector_do_use(PCIDevice *pdev, unsigned int nr,
Expand Down Expand Up @@ -939,6 +936,7 @@ static void vfio_enable_msi(VFIODevice *vdev)

for (i = 0; i < vdev->nr_vectors; i++) {
VFIOMSIVector *vector = &vdev->msi_vectors[i];
MSIMessage msg = msi_get_message(&vdev->pdev, i);

vector->vdev = vdev;
vector->virq = -1;
Expand All @@ -951,13 +949,11 @@ static void vfio_enable_msi(VFIODevice *vdev)
qemu_set_fd_handler(event_notifier_get_fd(&vector->interrupt),
vfio_msi_interrupt, NULL, vector);

vector->msg = msi_get_message(&vdev->pdev, i);

/*
* Attempt to enable route through KVM irqchip,
* default to userspace handling if unavailable.
*/
vfio_add_kvm_msi_virq(vector, &vector->msg, false);
vfio_add_kvm_msi_virq(vector, &msg, false);
}

/* Set interrupt type prior to possible interrupts */
Expand Down

0 comments on commit 9b3af4c

Please sign in to comment.