pci/msix: Fix msix pba read vector poll end calculation
authorNicholas Piggin <npiggin@gmail.com>
Thu, 12 Dec 2024 12:04:02 +0000 (22:04 +1000)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 15 Jan 2025 18:06:41 +0000 (13:06 -0500)
The end vector calculation has a bug that results in polling fewer
than required vectors when reading at a non-zero offset in PBA memory.

Fixes: bbef882cc193 ("msi: add API to get notified about pending bit poll")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Message-Id: <20241212120402.1475053-1-npiggin@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/pci/msix.c

index d8a55a64741468d3d63c794cfe63081611fff76d..57ec7084a475b7f257b6621721baebb543097865 100644 (file)
@@ -250,7 +250,7 @@ static uint64_t msix_pba_mmio_read(void *opaque, hwaddr addr,
     PCIDevice *dev = opaque;
     if (dev->msix_vector_poll_notifier) {
         unsigned vector_start = addr * 8;
-        unsigned vector_end = MIN(addr + size * 8, dev->msix_entries_nr);
+        unsigned vector_end = MIN((addr + size) * 8, dev->msix_entries_nr);
         dev->msix_vector_poll_notifier(dev, vector_start, vector_end);
     }