Re: [PATCH v2] iommu/arm-smmu-v3-iommufd: Allow attaching nested domain for GBPA cases
From: Shuai Xue
Date: Wed Nov 12 2025 - 23:58:17 EST
在 2025/11/4 01:27, Nicolin Chen 写道:
A vDEVICE has been a hard requirement for attaching a nested domain to the
device. This makes sense when installing a guest STE, since a vSID must be
present and given to the kernel during the vDEVICE allocation.
But, when CR0.SMMUEN is disabled, VM doesn't really need a vSID to program
the vSMMU behavior as GBPA will take effect, in which case the vSTE in the
nested domain could have carried the bypass or abort configuration in GBPA
register. Thus, having such a hard requirement doesn't work well for GBPA.
Skip vmaster allocation in arm_smmu_attach_prepare_vmaster() for an abort
or bypass vSTE. Note that device on this attachment won't report vevents.
Update the uAPI doc accordingly.
Tested-by: Shameer Kolothum <skolothumtho@xxxxxxxxxx>
Signed-off-by: Nicolin Chen <nicolinc@xxxxxxxxxx>
---
I've tested this patch and can confirm it resolves the GBPA hwpt
attachment issue.
Without this patch, IOMMUFD fails to attach bypass hwpt with the
following error:
smmu_reset_exit
qemu-system-aarch64: [iommufd=303] error attach 0008:01:00.0 (304) to id=6: No such file or directory
Failed to attach GBPA hwpt id 6 for dev id 1
With this patch applied, the attachment succeeds:
smmu_reset_exit
iommufd_cdev_attach_ioas_hwpt [iommufd=303] Successfully attached device 0008:01:00.0 (304) to id=6
Testing was performed on top of Shameer's vSMMU v5 series:
https://patchew.org/QEMU/20251031105005.24618-1-skolothumtho@xxxxxxxxxx/
Tested-by: Shuai Xue <xueshuai@xxxxxxxxxxxxxxxxx>
Thanks.
Shuai