[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 2/9] vfio: move re-enabling INTX out of the common helper
From: |
Longpeng(Mike) |
Subject: |
[PATCH v2 2/9] vfio: move re-enabling INTX out of the common helper |
Date: |
Thu, 9 Sep 2021 14:06:06 +0800 |
Move re-enabling INTX out, and the callers should decide to
re-enable it or not.
Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
---
hw/vfio/pci.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index f7a3a13..1e6797f 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -690,7 +690,6 @@ retry:
static void vfio_msi_disable_common(VFIOPCIDevice *vdev)
{
- Error *err = NULL;
int i;
for (i = 0; i < vdev->nr_vectors; i++) {
@@ -709,15 +708,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);
@@ -738,6 +733,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));
@@ -747,8 +746,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);
}
--
1.8.3.1
- [PATCH v2 0/9] optimize the downtime for vfio migration, Longpeng(Mike), 2021/09/09
- [PATCH v2 5/9] msix: reset poll_notifier to NULL if fail to set notifiers, Longpeng(Mike), 2021/09/09
- [PATCH v2 6/9] kvm: irqchip: extract kvm_irqchip_add_deferred_msi_route, Longpeng(Mike), 2021/09/09
- [PATCH v2 8/9] Revert "vfio: Avoid disabling and enabling vectors repeatedly in VFIO migration", Longpeng(Mike), 2021/09/09
- [PATCH v2 1/9] vfio: simplify the conditional statements in vfio_msi_enable, Longpeng(Mike), 2021/09/09
- [PATCH v2 2/9] vfio: move re-enabling INTX out of the common helper,
Longpeng(Mike) <=
- [PATCH v2 4/9] msix: simplify the conditional in msix_set/unset_vector_notifiers, Longpeng(Mike), 2021/09/09
- [PATCH v2 3/9] vfio: simplify the failure path in vfio_msi_enable, Longpeng(Mike), 2021/09/09
- [PATCH v2 9/9] vfio: defer to commit kvm irq routing when enable msi/msix, Longpeng(Mike), 2021/09/09
- [PATCH v2 7/9] vfio: add infrastructure to commit the deferred kvm routing, Longpeng(Mike), 2021/09/09
- Re: [PATCH v2 0/9] optimize the downtime for vfio migration, Longpeng (Mike, Cloud Infrastructure Service Product Dept.), 2021/09/20