On Thu, Nov 20, 2025 at 07:55:04AM +0000, Tian, Kevin wrote:
From: Jason Gunthorpe jgg@nvidia.com Sent: Saturday, November 8, 2025 12:50 AM
@@ -2031,7 +2155,10 @@ int iopt_pages_rw_access(struct iopt_pages *pages, unsigned long start_byte, if ((flags & IOMMUFD_ACCESS_RW_WRITE) && !pages->writable) return -EPERM;
- if (pages->type == IOPT_ADDRESS_FILE)
- if (iopt_is_dmabuf(pages))
return -EINVAL;probably also add helpers for other types, e.g.:
iopt_is_user() iopt_is_memfd()
The helper was to integrate the IS_ENABLED() check for DMABUF, there are not so many others uses, I think leave it to not bloat the patch.
- if (pages->type != IOPT_ADDRESS_USER) return iopt_pages_rw_slow(pages, start_index, last_index, start_byte % PAGE_SIZE, data,
length, flags); --
then the following WARN_ON() becomes useless:
if (IS_ENABLED(CONFIG_IOMMUFD_TEST) && WARN_ON(pages->type != IOPT_ADDRESS_USER)) return -EINVAL;
Yep
Thanks, Jason
linaro-mm-sig@lists.linaro.org