VFIO and vhost IOMMU notifiers currently support only the Non-secure
system-memory path. Reject notifier registration for non-NS devices
instead of allowing an unsupported configuration.

Signed-off-by: Tao Tang <[email protected]>
---
 hw/arm/smmuv3.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
index a755f1ebd69..2375b7a17a0 100644
--- a/hw/arm/smmuv3.c
+++ b/hw/arm/smmuv3.c
@@ -2932,6 +2932,13 @@ static int smmuv3_notify_flag_changed(IOMMUMemoryRegion 
*iommu,
     SMMUv3State *s3 = sdev->smmu;
     SMMUState *s = &(s3->smmu_state);
 
+    if (new != IOMMU_NOTIFIER_NONE && sdev->sec_sid != SMMU_SEC_SID_NS) {
+        error_setg(errp,
+                   "SMMUv3 does not support IOMMU notifiers for "
+                   "secure devices");
+        return -EINVAL;
+    }
+
     if (new & IOMMU_NOTIFIER_DEVIOTLB_UNMAP) {
         error_setg(errp, "SMMUv3 does not support dev-iotlb yet");
         return -EINVAL;
-- 
2.34.1


Reply via email to