On 19/05/26 8:17 PM, Pierrick Bouvier wrote:
On 5/19/2026 5:33 AM, Narayana Murty N wrote:
Split spapr_pci_vfio.c into two files to separate concerns:
- spapr_pci_vfio.c: Contains general VFIO routines
- spapr_pci_vfio_eeh.c: Contains EEH-specific routines

Additionally, consolidate VFIO EEH function declarations into a new
header file (spapr_vfio.h) to improve modularity and reduce header
dependencies.

Changes:
- Split VFIO functionality: keep general VFIO routines in
   spapr_pci_vfio.c and move EEH routines to spapr_pci_vfio_eeh.c
- Created include/hw/ppc/spapr_vfio.h with forward declarations
   to avoid pulling in full spapr headers and libfdt dependencies
- Introduced stubs/spapr_pci_vfio-stubs.c to consolidate all VFIO,
   VFIO EEH stub functions in one place
- Updated hw/ppc/spapr_pci.c to include new spapr_vfio.h header
- Updated stubs/meson.build to reference new stub file

This improves code organization by separating VFIO and EEH concerns,
and enhances build system modularity by making it easier to maintain
VFIO-related code separately from core sPAPR PCI code.

Signed-off-by: Narayana Murty N <[email protected]>
---
  hw/ppc/Kconfig               |   2 +-
  hw/ppc/meson.build           |   1 +
  hw/ppc/spapr_pci.c           |   3 +-
  hw/ppc/spapr_pci_vfio.c      | 367 +----------------------------------
  hw/ppc/spapr_pci_vfio_eeh.c  | 346 +++++++++++++++++++++++++++++++++
  include/hw/pci-host/spapr.h  |  44 +----
  include/hw/ppc/spapr_vfio.h  |  28 +++
  stubs/meson.build            |   1 +
  stubs/spapr_phb_vfio-stubs.c |  52 +++++
  9 files changed, 433 insertions(+), 411 deletions(-)
  create mode 100644 hw/ppc/spapr_pci_vfio_eeh.c
  create mode 100644 include/hw/ppc/spapr_vfio.h
  create mode 100644 stubs/spapr_phb_vfio-stubs.c

diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig
index 347dcce690..1fb191fe83 100644
--- a/hw/ppc/Kconfig
+++ b/hw/ppc/Kconfig
@@ -6,7 +6,7 @@ config PSERIES
      imply PCI_DEVICES
      imply TEST_DEVICES
      imply VIRTIO_VGA
-    imply VFIO_PCI if LINUX   # needed by spapr_pci_vfio.c
+    imply VFIO_PCI if LINUX   # needed by spapr_pci_vfio.c and 
spapr_pci_vfio_eeh.c
      select NVDIMM
      select DIMM
      select PCI
diff --git a/hw/ppc/meson.build b/hw/ppc/meson.build
index 37aa535db2..97e4be0dc9 100644
--- a/hw/ppc/meson.build
+++ b/hw/ppc/meson.build
@@ -36,6 +36,7 @@ ppc_ss.add(when: 'CONFIG_SPAPR_RNG', if_true: 
files('spapr_rng.c'))
  if host_os == 'linux'
    ppc_ss.add(when: 'CONFIG_PSERIES', if_true: files(
      'spapr_pci_vfio.c',
+    'spapr_pci_vfio_eeh.c',
    ))
  endif
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index b00f71d92a..221d05e5c5 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -33,6 +33,7 @@
  #include "hw/pci/msix.h"
  #include "hw/pci/pci_host.h"
  #include "hw/ppc/spapr.h"
+#include "hw/ppc/spapr_vfio.h"
  #include "hw/pci-host/spapr.h"
  #include <libfdt.h>
  #include "trace.h"
@@ -718,7 +719,7 @@ static int 
parse_and_verify_recovered_special_event(target_ulong param_buf,
  static int parse_and_verify_corrupted_page(target_ulong param_buf,
                                             uint64_t *addr) {
      *addr = ((uint64_t)rtas_ld(param_buf, 0) << 32) | rtas_ld(param_buf, 1);
-    qemu_log("RTAS: corrupted-page: addr=0x%lx\n", *addr);
+    qemu_log("RTAS: corrupted-page: addr=0x%llx\n", *addr);
      return (*addr) ? RTAS_OUT_SUCCESS : RTAS_OUT_PARAM_ERROR;
  }
See build failures for this change:
https://github.com/p-b-o/qemu-ci/actions/runs/26094993976
If we want to change something, the proper way is %"PRIx64".

...

Rest of the patch looks ok to me.
Thanks reviewing. I have corrected the gitlab CI build failure issue in patch and
another test case failure on gitlab. corrected V3 patches are posted at
https://lore.kernel.org/all/[email protected]/
Please take a look and let me know if any further review comments.

Thanks
Narayana Murty
Regards,
Pierrick



Reply via email to