On 2026-07-02 11:28 PM, Narayana Murty N wrote: > Add helper support for sPAPR TCE v2 DMA windows in the VFIO selftest > library. > > Track the platform default DMA window separately from selftest-created > dynamic DMA windows. The default window is discovered with > VFIO_IOMMU_SPAPR_TCE_GET_INFO and is not removed during cleanup. > > Add helpers to create and remove DDWs, return the active IOVA range, and > register/unregister memory around DMA map/unmap operations. Window > selection is done before IOVA allocation; the map path only validates, > registers memory, and calls VFIO_IOMMU_MAP_DMA. > > Signed-off-by: Narayana Murty N <[email protected]> > --- > .../vfio/lib/include/libvfio/iommu.h | 18 ++ > tools/testing/selftests/vfio/lib/iommu.c | 273 +++++++++++++++++- > tools/testing/selftests/vfio/lib/libvfio.c | 2 -
Let's move all the spapr code to its own .c file under lib and only compile it on powerpc, and a new header file so that the code in iommu.c can call into it as needed. Please also avoid adding ifdefs within function bodies. The generic code in iommu.c should unconditionally call spapr routines and those routines should be stubbed out on non-powerpc architectures.

