On 2024/5/7 23:18, Jason Gunthorpe wrote:
On Tue, May 07, 2024 at 10:28:34AM +0800, Yi Liu wrote:
We still need something to do before we can safely remove this check.
All the domain allocation interfaces should eventually have the device
pointer as the input, and all domain attributions could be initialized
during domain allocation. In the attach paths, it should return -EINVAL
directly if the domain is not compatible with the iommu for the device.
Yes, and this is already true for PASID.
I'm not quite get why it is already true for PASID. I think Baolu's remark
is general to domains attached to either RID or PASID.
I feel we could reasonably insist that domanis used with PASID are
allocated with a non-NULL dev.
Any special reason for this disclaim?
If it makes the driver easier, why not?
yep.
PASID is special since PASID is barely used, we could insist that
new PASID users also use the new domian_alloc API.
Ok. I have one doubt on how to make it in iommufd core. Shall the iommufd
core call ops->domain_alloc_paging() directly or still call
ops->domain_alloc_user() while ops->domain_alloc_user() flows into the
paging domain allocation with non-null dev?
I agree implementing alloc_domain_paging() is the final solution to avoid
such dynamic modifications to domain's caps. If it's really needed for
PASID series now, I can add it in next version. :)
Well, if it is needed. If you can do this some other way that is
reasonable then sure
At first, I'd like to keep this agaw check here and remove it after
implementing the ops->domain_alloc_paging() and retire domain_alloc op
in intel iommu driver side. I have such thoughts as the RID and PASID
attach path have the same concern w.r.t. agaw and other caps :)
--
Regards,
Yi Liu