pcie: don't skip multi-mask events
authorMichael S. Tsirkin <mst@redhat.com>
Thu, 20 Jun 2019 17:44:32 +0000 (13:44 -0400)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 1 Jul 2019 13:11:02 +0000 (09:11 -0400)
If we are trying to set multiple bits at once, testing that just one of
them is already set gives a false positive. As a result we won't
interrupt guest if e.g. presence detection change and attention button
press are both set. This happens with multi-function device removal.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
hw/pci/pcie.c

index 88c30ff74c620ac27eb0e6ad005337037535dcf2..b22527000d2309501f99bb9381ad62c8b4d3ed80 100644 (file)
@@ -383,7 +383,7 @@ static void pcie_cap_slot_event(PCIDevice *dev, PCIExpressHotPlugEvent event)
 {
     /* Minor optimization: if nothing changed - no event is needed. */
     if (pci_word_test_and_set_mask(dev->config + dev->exp.exp_cap +
-                                   PCI_EXP_SLTSTA, event)) {
+                                   PCI_EXP_SLTSTA, event) == event) {
         return;
     }
     hotplug_event_notify(dev);