[PATCH v6 00/10] tests/qtest: pci and MSI-X fixes

Jishnu Warrier <[email protected]>
Newsgroups gmane.comp.emulators.qemu
Message-ID <[email protected]>
To: [email protected]
Cc: Nicholas Piggin <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Cc: Fabiano Rosas <[email protected]>
Cc: Akihiko Odaki <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: Marcel Apfelbaum <[email protected]>
Cc: David Gibson <[email protected]>
Cc: Aditya Gupta <[email protected]>
Cc: Harsh Prateek Bora <[email protected]>
Cc: Amit Machhiwal <[email protected]>

This series fixes a number of issues in the pci and MSI-X qtest
infrastructure, and adds new functionality.

Nicholas Piggin is the original author of all patches in this series.
This submission takes his v5 posting forward, with the additional
changes described below.

It was originally posted as v5 in May 2025 but was not merged.

Changes since v5
(https://lore.kernel.org/qemu-devel/[email protected]/):

- Use sizeof(data) instead of literal 4 in qtest_memread/qtest_memset
  calls inside qpci_msix_test_interrupt() [Akihiko Odaki]

- Fix MSI-X capitalisation in the qpci_msix_test_interrupt() doc
  comment (was "msix", now "MSI-X" throughout) [Akihiko Odaki]

- Replace the per-device boolean flags (pci_enabled in AHCIQState,
  enabled in QVirtioPCIDevice) with a bool mapped field on QPCIBar
  itself. qpci_iounmap() is now a graceful no-op when called on a
  bar that was never mapped, removing the need for guards in callers.
  [Akihiko Odaki]

- Remove missed qpci_check_buggy_msi() guard in nvme-test.c

- Fix off-by-one bound check: use barno < QPCI_NUM_REGIONS instead of
  barno <= QPCI_NUM_REGIONS in qpci_bar_reg() and qpci_iomap(); the
  previous condition allowed barno == 6 which is one past the end of
  the 6-element array [Amit Machhiwal]

- Remove redundant memset(&dev->bars_mapped[i], ...) in qpci_iounmap()
  that immediately followed dev->bars_mapped[i] = false [Amit Machhiwal]

- Add explanatory comment before the msix_addr/msix_data != 0
  assertions in qpci_msix_test_interrupt() clarifying that 0 is a
  libqos-internal sentinel value [Amit Machhiwal]

- Remove always-true g_assert_cmpint(entry, >=, 0) assertions on
  uint16_t parameters in qpci_msix_set_entry(), qpci_msix_pending(),
  qpci_msix_masked(), and qpci_msix_set_masked() [Amit Machhiwal]

Nicholas Piggin (10):
  tests/qtest: Enforce zero for the "un-fired" MSI-X message value
  tests/qtest: Fix virtio MSI-X message endianness
  tests/qtest: Add libqos function for testing MSI-X interrupt status
  tests/qtest: Enable spapr dma with linear iommu map
  tests/qtest/ahci: unmap pci bar before reusing device
  tests/qtest/ahci: don't unmap pci bar if it wasn't mapped
  tests/qtest/libquos/pci: Add migration fixup helper for pci devices
  qtest/libqos/pci: Enforce balanced iomap/unmap
  qtest/libqos/pci: Fix qpci_msix_enable sharing bar0
  qtest/libqos/pci: Factor MSI-X entry helpers into pci common code

 hw/ppc/spapr_iommu.c                   |  10 +-
 tests/qtest/ahci-test.c                |   8 +
 tests/qtest/e1000e-test.c              |  21 ---
 tests/qtest/igb-test.c                 |  21 ---
 tests/qtest/libqos/ahci.c              |  12 ++
 tests/qtest/libqos/ahci.h              |   2 +
 tests/qtest/libqos/generic-pcihost.c   |   1 -
 tests/qtest/libqos/pci-pc.c            |   3 -
 tests/qtest/libqos/pci-spapr.c         |   7 +-
 tests/qtest/libqos/pci.c               | 215 ++++++++++++++++++++++---
 tests/qtest/libqos/pci.h               |  21 ++-
 tests/qtest/libqos/virtio-pci-modern.c |  30 +---
 tests/qtest/libqos/virtio-pci.c        |  86 ++--------
 tests/qtest/nvme-test.c                |   4 -
 tests/qtest/vhost-user-blk-test.c      |   6 -
 tests/qtest/virtio-blk-test.c          |  12 --
 16 files changed, 262 insertions(+), 197 deletions(-)

-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.