lkml.org 
[lkml]   [2023]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH 1/2] iommu: Consolidate pasid dma ownership check
Date
> From: Lu Baolu <baolu.lu@linux.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?

\
 
 \ /
  Last update: 2023-08-01 09:05    [W:1.695 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site