On 10/31/25 11:49 AM, Shameer Kolothum wrote:
> 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 <nicolinc@nvidia.com>
> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
> Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
> Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
> Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Eric
> ---
> hw/arm/smmuv3-accel.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
> index 550a0496fe..a1d672208f 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/iommu.h"
> #include "hw/pci/pci_bridge.h"
> #include "hw/pci-host/gpex.h"
> #include "hw/vfio/pci.h"
> @@ -119,9 +120,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)