Messages in this thread | | | Date | Tue, 15 Mar 2022 20:05:49 -0300 | From | Jason Gunthorpe <> | Subject | Re: [PATCH v2 5/8] iommu: Add PASID support for DMA mapping API users |
| |
On Tue, Mar 15, 2022 at 09:38:10AM -0700, Jacob Pan wrote: > > > +int iommu_enable_pasid_dma(struct device *dev, ioasid_t *pasid) > > > +{ > > > + struct iommu_domain *dom; > > > + ioasid_t id, max; > > > + int ret; > > > + > > > + dom = iommu_get_domain_for_dev(dev); > > > + if (!dom || !dom->ops || !dom->ops->attach_dev_pasid) > > > + return -ENODEV; > > > > Given the purpose of this API I think it should assert that the device > > has the DMA API in-use using the machinery from the other series. > > > > ie this should not be used to clone non-DMA API iommu_domains.. > > > Let me try to confirm the specific here. I should check domain type and > rejects all others except IOMMU_DOMAIN_DMA type, right? Should also allow > IOMMU_DOMAIN_IDENTITY. > > That makes sense.
That is one way, the other is to check the new group data that Lu's patch added.
Jason
| |