[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <07b7a01f-8a0d-6eca-e436-df5135d679cb@linux.intel.com>
Date: Sat, 1 Apr 2023 21:39:32 +0800
From: Baolu Lu <baolu.lu@...ux.intel.com>
To: Jacob Pan <jacob.jun.pan@...ux.intel.com>,
LKML <linux-kernel@...r.kernel.org>, iommu@...ts.linux.dev,
Robin Murphy <robin.murphy@....com>,
Jason Gunthorpe <jgg@...dia.com>,
Joerg Roedel <joro@...tes.org>, dmaengine@...r.kernel.org,
vkoul@...nel.org
Cc: baolu.lu@...ux.intel.com, Will Deacon <will@...nel.org>,
David Woodhouse <dwmw2@...radead.org>,
Raj Ashok <ashok.raj@...el.com>,
"Tian, Kevin" <kevin.tian@...el.com>, Yi Liu <yi.l.liu@...el.com>,
"Yu, Fenghua" <fenghua.yu@...el.com>,
Dave Jiang <dave.jiang@...el.com>,
Tony Luck <tony.luck@...el.com>,
"Zanussi, Tom" <tom.zanussi@...el.com>
Subject: Re: [PATCH v3 7/7] dmaengine/idxd: Re-enable kernel workqueue under
DMA API
On 2023/4/1 7:11, 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;
Out of curiosity, why do you need to check the domain type? And, in
which case could the domain for the device be changed to a blocking one?
Once a driver is bound to the device, the driver "owns" the DMA of the
device. No one else could change the domain except the driver itself.
> +
> + iommu_detach_device_pasid(domain, dev, idxd->pasid);
> + iommu_free_global_pasid(idxd->pasid);
>
> - iommu_sva_unbind_device(idxd->sva);
> + gencfg.bits = ioread32(idxd->reg_base + IDXD_GENCFG_OFFSET);
> + gencfg.user_int_en = 0;
> + iowrite32(gencfg.bits, idxd->reg_base + IDXD_GENCFG_OFFSET);
> idxd->sva = NULL;
> + idxd->pasid = IOMMU_PASID_INVALID;
> }
Best regards,
baolu
Powered by blists - more mailing lists