Skip to content

Commit

Permalink
vfio: move re-enabling INTX out of the common helper
Browse files Browse the repository at this point in the history
Move re-enabling INTX out, and the callers should decide to
re-enable it or not.

Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
Link: https://lore.kernel.org/r/20220326060226.1892-3-longpeng2@huawei.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
  • Loading branch information
Longpeng(Mike) authored and awilliam committed May 6, 2022
1 parent a6f5770 commit be4a46e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions hw/vfio/pci.c
Expand Up @@ -693,7 +693,6 @@ static void vfio_msi_enable(VFIOPCIDevice *vdev)

static void vfio_msi_disable_common(VFIOPCIDevice *vdev)
{
Error *err = NULL;
int i;

for (i = 0; i < vdev->nr_vectors; i++) {
Expand All @@ -712,15 +711,11 @@ static void vfio_msi_disable_common(VFIOPCIDevice *vdev)
vdev->msi_vectors = NULL;
vdev->nr_vectors = 0;
vdev->interrupt = VFIO_INT_NONE;

vfio_intx_enable(vdev, &err);
if (err) {
error_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name);
}
}

static void vfio_msix_disable(VFIOPCIDevice *vdev)
{
Error *err = NULL;
int i;

msix_unset_vector_notifiers(&vdev->pdev);
Expand All @@ -741,6 +736,10 @@ static void vfio_msix_disable(VFIOPCIDevice *vdev)
}

vfio_msi_disable_common(vdev);
vfio_intx_enable(vdev, &err);
if (err) {
error_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name);
}

memset(vdev->msix->pending, 0,
BITS_TO_LONGS(vdev->msix->entries) * sizeof(unsigned long));
Expand All @@ -750,8 +749,14 @@ static void vfio_msix_disable(VFIOPCIDevice *vdev)

static void vfio_msi_disable(VFIOPCIDevice *vdev)
{
Error *err = NULL;

vfio_disable_irqindex(&vdev->vbasedev, VFIO_PCI_MSI_IRQ_INDEX);
vfio_msi_disable_common(vdev);
vfio_intx_enable(vdev, &err);
if (err) {
error_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name);
}

trace_vfio_msi_disable(vdev->vbasedev.name);
}
Expand Down

0 comments on commit be4a46e

Please sign in to comment.