Re: [PATCH v3 1/6] ARM/dma-mapping: Add arm_iommu_release_device()

From: Jason Gunthorpe
Date: Thu Mar 09 2023 - 20:00:42 EST


On Mon, Mar 06, 2023 at 10:57:59AM +0800, Lu Baolu wrote:
> It is like arm_iommu_detach_device() except it handles the special case
> of being called under an iommu driver's release operation. In this case
> the driver must have already detached the device from any attached
> domain before calling this function.
>
> Replace arm_iommu_detach_device() with arm_iommu_release_device() in the
> release path of the ipmmu-vmsa driver.
>
> The bonus is that it also removes a obstacle of arm_iommu_detach_device()
> re-entering the iommu core during release_device. With this removed, the
> iommu core code could be simplified a lot.
>
> Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
> Signed-off-by: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
> ---
> arch/arm/include/asm/dma-iommu.h | 1 +
> arch/arm/mm/dma-mapping.c | 25 +++++++++++++++++++++++++
> drivers/iommu/ipmmu-vmsa.c | 15 +++++++++++++--
> 3 files changed, 39 insertions(+), 2 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

Jason