aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2025-01-18 03:28:40 +1000
committerMichael S. Tsirkin <mst@redhat.com>2025-02-21 07:18:03 -0500
commit44ed44aefec571041fe3b3a8b6849613a74b520a (patch)
treeac0c4033da0a2ddc0c5ded56d9761ec34a6ba0d3
parent9e837c961a883392f8c4707a8d3d2e6c6aa793b6 (diff)
downloadqemu-44ed44aefec571041fe3b3a8b6849613a74b520a.zip
qemu-44ed44aefec571041fe3b3a8b6849613a74b520a.tar.gz
qemu-44ed44aefec571041fe3b3a8b6849613a74b520a.tar.bz2
hw/pci/msix: Warn on PBA writes
Of the MSI-X PBA pending bits, the PCI Local Bus Specification says: Software should never write, and should only read Pending Bits. If software writes to Pending Bits, the result is undefined. Log a GUEST_ERROR message if the PBA is written to by software. Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com> Cc: Dmitry Fleytman <dmitry.fleytman@gmail.com> Cc: Sriram Yagnaraman <sriram.yagnaraman@ericsson.com> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Message-Id: <20250117172842.406338-2-npiggin@gmail.com> Reviewed-by: Phil Dennis-Jordan <phil@philjordan.eu> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--hw/pci/msix.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/pci/msix.c b/hw/pci/msix.c
index 57ec708..66f27b9 100644
--- a/hw/pci/msix.c
+++ b/hw/pci/msix.c
@@ -15,6 +15,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "hw/pci/msi.h"
#include "hw/pci/msix.h"
#include "hw/pci/pci.h"
@@ -260,6 +261,14 @@ static uint64_t msix_pba_mmio_read(void *opaque, hwaddr addr,
static void msix_pba_mmio_write(void *opaque, hwaddr addr,
uint64_t val, unsigned size)
{
+ PCIDevice *dev = opaque;
+
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "PCI [%s:%02x:%02x.%x] attempt to write to MSI-X "
+ "PBA at 0x%" FMT_PCIBUS ", ignoring.\n",
+ pci_root_bus_path(dev), pci_dev_bus_num(dev),
+ PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn),
+ addr);
}
static const MemoryRegionOps msix_pba_mmio_ops = {