[PATCH v4 05/14] iommufd/hw_pagetable: Enforce cache invalidation op on vIOMMU-based hwpt_nested
Nicolin Chen
nicolinc at nvidia.com
Mon Oct 21 17:20:14 PDT 2024
A vIOMMU-based hwpt_nested requires a cache invalidation op too, either
using the one in iommu_domain_ops or the one in viommu_ops. Enforce that
upon the allocated hwpt_nested.
Signed-off-by: Nicolin Chen <nicolinc at nvidia.com>
---
drivers/iommu/iommufd/hw_pagetable.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/iommufd/hw_pagetable.c b/drivers/iommu/iommufd/hw_pagetable.c
index 5314cd486ddb..7af6cbe6dbf2 100644
--- a/drivers/iommu/iommufd/hw_pagetable.c
+++ b/drivers/iommu/iommufd/hw_pagetable.c
@@ -300,7 +300,9 @@ iommufd_hwpt_nested_alloc_for_viommu(struct iommufd_viommu *viommu,
}
hwpt->domain->owner = viommu->iommu_dev->ops;
- if (WARN_ON_ONCE(hwpt->domain->type != IOMMU_DOMAIN_NESTED)) {
+ if (WARN_ON_ONCE(hwpt->domain->type != IOMMU_DOMAIN_NESTED ||
+ (!viommu->ops->cache_invalidate &&
+ !hwpt->domain->ops->cache_invalidate_user))) {
rc = -EINVAL;
goto out_abort;
}
--
2.43.0
More information about the linux-arm-kernel
mailing list