Re: [PATCH v3 7/7] dmaengine/idxd: Re-enable kernel workqueue under DMA API

From: Jason Gunthorpe
Date: Wed Apr 05 2023 - 08:15:23 EST


On Fri, Mar 31, 2023 at 04:11:37PM -0700, Jacob Pan wrote:
> static void idxd_disable_system_pasid(struct idxd_device *idxd)
> {
> + struct pci_dev *pdev = idxd->pdev;
> + struct device *dev = &pdev->dev;
> + struct iommu_domain *domain;
> + union gencfg_reg gencfg;
> +
> + domain = iommu_get_domain_for_dev(dev);
> + if (!domain || domain->type == IOMMU_DOMAIN_BLOCKED)
> + return;
> +
> + iommu_detach_device_pasid(domain, dev, idxd->pasid);

This sequence is kinda weird, we shouldn't pass in domain to
detach_device_pasid, IMHO. We already know the domain because we store
it in an xarray, it just creates weirdness if the user passes in the
wrong domain.

Jason