|
|
902636 |
From e4631c00d8e9ee3608ef3196cbe8bec4841ee988 Mon Sep 17 00:00:00 2001
|
|
|
902636 |
From: Peter Xu <peterx@redhat.com>
|
|
|
902636 |
Date: Wed, 8 Jan 2020 15:04:57 +0000
|
|
|
902636 |
Subject: [PATCH 2/5] vfio/pci: Don't remove irqchip notifier if not registered
|
|
|
902636 |
|
|
|
902636 |
RH-Author: Peter Xu <peterx@redhat.com>
|
|
|
902636 |
Message-id: <20200108150457.12324-2-peterx@redhat.com>
|
|
|
902636 |
Patchwork-id: 93291
|
|
|
902636 |
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 1/1] vfio/pci: Don't remove irqchip notifier if not registered
|
|
|
902636 |
Bugzilla: 1782678
|
|
|
902636 |
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>
|
|
|
902636 |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
902636 |
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
|
|
|
902636 |
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
|
|
|
902636 |
|
|
|
902636 |
The kvm irqchip notifier is only registered if the device supports
|
|
|
902636 |
INTx, however it's unconditionally removed. If the assigned device
|
|
|
902636 |
does not support INTx, this will cause QEMU to crash when unplugging
|
|
|
902636 |
the device from the system. Change it to conditionally remove the
|
|
|
902636 |
notifier only if the notify hook is setup.
|
|
|
902636 |
|
|
|
902636 |
CC: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
902636 |
CC: David Gibson <david@gibson.dropbear.id.au>
|
|
|
902636 |
CC: Alex Williamson <alex.williamson@redhat.com>
|
|
|
902636 |
Cc: qemu-stable@nongnu.org # v4.2
|
|
|
902636 |
Reported-by: yanghliu@redhat.com
|
|
|
902636 |
Debugged-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
902636 |
Fixes: c5478fea27ac ("vfio/pci: Respond to KVM irqchip change notifier")
|
|
|
902636 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1782678
|
|
|
902636 |
Signed-off-by: Peter Xu <peterx@redhat.com>
|
|
|
902636 |
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
|
|
|
902636 |
Reviewed-by: Greg Kurz <groug@kaod.org>
|
|
|
902636 |
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
|
|
|
902636 |
(cherry picked from commit 0446f8121723b134ca1d1ed0b73e96d4a0a8689d)
|
|
|
902636 |
Signed-off-by: Peter Xu <peterx@redhat.com>
|
|
|
902636 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
902636 |
---
|
|
|
902636 |
hw/vfio/pci.c | 4 +++-
|
|
|
902636 |
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
902636 |
|
|
|
902636 |
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
|
|
|
902636 |
index 309535f..d717520 100644
|
|
|
902636 |
--- a/hw/vfio/pci.c
|
|
|
902636 |
+++ b/hw/vfio/pci.c
|
|
|
902636 |
@@ -3100,7 +3100,9 @@ static void vfio_exitfn(PCIDevice *pdev)
|
|
|
902636 |
vfio_unregister_req_notifier(vdev);
|
|
|
902636 |
vfio_unregister_err_notifier(vdev);
|
|
|
902636 |
pci_device_set_intx_routing_notifier(&vdev->pdev, NULL);
|
|
|
902636 |
- kvm_irqchip_remove_change_notifier(&vdev->irqchip_change_notifier);
|
|
|
902636 |
+ if (vdev->irqchip_change_notifier.notify) {
|
|
|
902636 |
+ kvm_irqchip_remove_change_notifier(&vdev->irqchip_change_notifier);
|
|
|
902636 |
+ }
|
|
|
902636 |
vfio_disable_interrupts(vdev);
|
|
|
902636 |
if (vdev->intx.mmap_timer) {
|
|
|
902636 |
timer_free(vdev->intx.mmap_timer);
|
|
|
902636 |
--
|
|
|
902636 |
1.8.3.1
|
|
|
902636 |
|