Re: [PATCH 1/1] iommu/vt-d: Enable PASID during iommu device probe

From: Ethan Zhao
Date: Thu Sep 15 2022 - 22:40:20 EST



在 2022/9/15 11:00, Baolu Lu 写道:


On 9/14/22 4:59 PM, Ethan Zhao wrote:
What the error path would be if this code runs on some old platforms don't

support PASID, would you print out "this platform doesn't suppor PASID" and

give users an interface function to query if the PASID cap of iommu is enabled

and if not why ?

It's not an error case if the IOMMU doesn't support PASID. But it's an
error case if any device drivers call PASID related IOMMU interfaces
(for example, iommu_domain_attach/detach_dev_pasid()). The corresponding
error code will be returned to the drivers.

So iommu driver withdraws the flexibility/rights from device driver about the

ability to enable PASID, looks much more *integrated* iommu works as relation

No. This patch doesn't withdraw anything. It's just a code refactoring.


controller in device-iommu-domain by enabling PASID in iommu probe stage

by default -- iommu decides to enable PASID or not though device-iommu-

domain might not work ? or they should work because they are hard-wired

together (device - iommu) even device is hotpluged later.


I may not get you exactly. :-) Some IOMMU features reply on PASID
capabilities on both IOMMU and device. The IOMMU drivers enumerate the
capabilities and enable them if they are supported.
I might not express it straightforward,  I mean with this patch iommu deals with

the complexity of enabling PASID (globally?)  or not at probing stage , instead

of other device driver side decision to request IOMMU PASID enabling during

their setup state.  if so you move the decision to iommu probe stage. hmmm...

Pros,  iommu driver controls everything about PASID enabling.

Cons,  iommu driver handles all possible complexity about capability matching

etc.


Thanks,

Ethan


Best regards,
baolu

--
"firm, enduring, strong, and long-lived"