On Thu, Mar 20, 2025 at 08:48:49PM +0800, Yi Liu wrote: > On 2025/3/20 01:58, Nicolin Chen wrote: > > On Thu, Mar 13, 2025 at 05:47:52AM -0700, Yi Liu wrote: > > > PASID usage requires PASID support in both device and IOMMU. Since the > > > iommu drivers always enable the PASID capability for the device if it > > > is supported, this extends the IOMMU_GET_HW_INFO to report the PASID > > > capability to userspace. Also, enhances the selftest accordingly. > > > > Overall, I am a bit confused by the out_capabilities field in the > > IOMMU_GET_HW_INFO. Why these capabilities cannot be reported via > > the driver specific data structure? > > > > E.g. we don't report the "NESTING" capability in out_capabilities > > at all and that works fine since the iommu driver would reject if > > it doesn't support. > > NESTING is a bit different. Userspace needs to know underlying PASID > cap and further expose it to guest if it wants. While NESTING is not > from this angle. It's just for the use of userspace. So a try and fail > is ok. Hmm, would you please elaborate the difference more? Also, what's that "further expose"? > > Mind elaborate the reason for these two new capabilities? What is > > the benefit from keeping them in the core v.s. driver level? > > I view the PASID cap is generic just like the DIRTY_TRACKING cap. Well, I actually don't get the DIRTY_TRACKING cap either. Based on what I see from Zhenzhong's implementation in the QEMU, it totally could be a vendor-specific cap: we can just add another PCIIOMMUOps op for QEMU core to ask the IOMMU device model to get hw_info and allocate a DIRTY_TRACKING-enabled HWPT to return that to the core, instead of core detecting the out_capabilities in the common path. In that regard, honestly, I don't quite get this out_capabilities. > Reporting them in the driver-specific part is fine, but I doubt > if it is better since PASID cap is generic to all vendors. The argument could be that NESTING is generic to all vendors too, yet we don't have that in out_capabilities :-/ Thanks Nicolin