RE: [PATCH v10 5/7] iommu/vt-d: Make prq draining code generic

From: Tian, Kevin
Date: Thu Jul 13 2023 - 23:49:08 EST


> From: Baolu Lu <baolu.lu@xxxxxxxxxxxxxxx>
> Sent: Friday, July 14, 2023 11:28 AM
>
> On 2023/7/13 15:49, Tian, Kevin wrote:
> >> From: Jacob Pan <jacob.jun.pan@xxxxxxxxxxxxxxx>
> >> Sent: Thursday, July 13, 2023 12:34 AM
> >>
> >> - /* Domain type specific cleanup: */
> >> domain = iommu_get_domain_for_dev_pasid(dev, pasid, 0);
> >> - if (domain) {
> >> - switch (domain->type) {
> >> - case IOMMU_DOMAIN_SVA:
> >> - intel_svm_remove_dev_pasid(dev, pasid);
> >> - break;
> >> - default:
> >> - /* should never reach here */
> >> - WARN_ON(1);
> >> - break;
> >> - }
> >> + if (!domain)
> >> + goto out_tear_down;
> >
> > WARN_ON()
>
> Why?
>
> My understanding is that remve_device_pasid could be call in any context
> including no domain attached.
>

oh I'm not aware of that. Can you elaborate the usage which uses a pasid
w/o domain? pasid needs to point to a page table. Presumably every
page table should be wrapped by a iommu domain...