[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB5276D196F9BFB06D0E59AEF28C0AA@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Tue, 1 Aug 2023 07:03:31 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Lu Baolu <baolu.lu@...ux.intel.com>,
Joerg Roedel <joro@...tes.org>,
"Will Deacon" <will@...nel.org>,
Robin Murphy <robin.murphy@....com>,
"Jason Gunthorpe" <jgg@...pe.ca>,
Jean-Philippe Brucker <jean-philippe@...aro.org>,
Nicolin Chen <nicolinc@...dia.com>
CC: "Liu, Yi L" <yi.l.liu@...el.com>,
Jacob Pan <jacob.jun.pan@...ux.intel.com>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 1/2] iommu: Consolidate pasid dma ownership check
> From: Lu Baolu <baolu.lu@...ux.intel.com>
> Sent: Tuesday, August 1, 2023 2:31 PM
>
> When switching device DMA ownership, it is required that all the device's
> pasid DMA be disabled. This is done by checking if the pasid array of the
> group is empty. Consolidate all the open code into a single helper. No
> intentional functionality change.
...
> /**
> * iommu_device_use_default_domain() - Device driver wants to handle
> device
> * DMA through the kernel DMA API.
> @@ -3052,14 +3063,14 @@ int iommu_device_use_default_domain(struct
> device *dev)
>
> mutex_lock(&group->mutex);
> if (group->owner_cnt) {
> - if (group->owner || !iommu_is_default_domain(group) ||
> - !xa_empty(&group->pasid_array)) {
> + if (group->owner || !iommu_is_default_domain(group)) {
> ret = -EBUSY;
> goto unlock_out;
> }
> }
>
> group->owner_cnt++;
> + assert_pasid_dma_ownership(group);
Old code returns error if pasid_xrrary is not empty.
New code continues to take ownership with a warning.
this is a functional change. Is it intended or not?
Powered by blists - more mailing lists