From: Shameer Kolothum Date: Thu, 29 Jan 2026 13:32:04 +0000 (+0000) Subject: hw/arm/smmuv3: Implement get_viommu_cap() callback X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc6dafb98cec0905fca61c15eb8287de75af2230;p=thirdparty%2Fqemu.git hw/arm/smmuv3: Implement get_viommu_cap() callback For accelerated SMMUv3, we need nested parent domain creation. Add the callback support so that VFIO can create a nested parent. Reviewed-by: Nicolin Chen Reviewed-by: Jonathan Cameron Signed-off-by: Shameer Kolothum Tested-by: Zhangfei Gao Reviewed-by: Eric Auger Tested-by: Eric Auger Signed-off-by: Shameer Kolothum Message-id: 20260126104342.253965-12-skolothumtho@nvidia.com Signed-off-by: Peter Maydell --- diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c index 2fcd301322..be09cf8b73 100644 --- a/hw/arm/smmuv3-accel.c +++ b/hw/arm/smmuv3-accel.c @@ -10,6 +10,7 @@ #include "qemu/error-report.h" #include "hw/arm/smmuv3.h" +#include "hw/core/iommu.h" #include "hw/pci/pci_bridge.h" #include "hw/pci-host/gpex.h" #include "hw/vfio/pci.h" @@ -129,9 +130,21 @@ static AddressSpace *smmuv3_accel_find_add_as(PCIBus *bus, void *opaque, } } +static uint64_t smmuv3_accel_get_viommu_flags(void *opaque) +{ + /* + * We return VIOMMU_FLAG_WANT_NESTING_PARENT to inform VFIO core to create a + * nesting parent which is required for accelerated SMMUv3 support. + * The real HW nested support should be reported from host SMMUv3 and if + * it doesn't, the nesting parent allocation will fail anyway in VFIO core. + */ + return VIOMMU_FLAG_WANT_NESTING_PARENT; +} + static const PCIIOMMUOps smmuv3_accel_ops = { .supports_address_space = smmuv3_accel_supports_as, .get_address_space = smmuv3_accel_find_add_as, + .get_viommu_flags = smmuv3_accel_get_viommu_flags, }; static void smmuv3_accel_as_init(SMMUv3State *s)