Re: [PATCH 16/18] iommu: remove DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE

From
Robin Murphy <robin.murphy@arm.com>
Date
2021-03-30 13:20:46
Also in
dri-devel, kvm, linux-arm-kernel, linux-arm-msm, linux-iommu, linuxppc-dev, netdev
Reply to
Will Deacon, 2021-03-30
On 2021-03-30 14:11, Will Deacon wrote:
On Tue, Mar 16, 2021 at 04:38:22PM +0100, Christoph Hellwig wrote:
quoted
From: Robin Murphy <robin.murphy@arm.com>

Instead make the global iommu_dma_strict paramete in iommu.c canonical by
exporting helpers to get and set it and use those directly in the drivers.

This make sure that the iommu.strict parameter also works for the AMD and
Intel IOMMU drivers on x86.  As those default to lazy flushing a new
IOMMU_CMD_LINE_STRICT is used to turn the value into a tristate to
represent the default if not overriden by an explicit parameter.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>.
[ported on top of the other iommu_attr changes and added a few small
  missing bits]
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
  drivers/iommu/amd/iommu.c                   | 23 +-------
  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 50 +---------------
  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h |  1 -
  drivers/iommu/arm/arm-smmu/arm-smmu.c       | 27 +--------
  drivers/iommu/dma-iommu.c                   |  9 +--
  drivers/iommu/intel/iommu.c                 | 64 ++++-----------------
  drivers/iommu/iommu.c                       | 27 ++++++---
  include/linux/iommu.h                       |  4 +-
  8 files changed, 40 insertions(+), 165 deletions(-)
I really like this cleanup, but I can't help wonder if it's going in the
wrong direction. With SoCs often having multiple IOMMU instances and a
distinction between "trusted" and "untrusted" devices, then having the
flush-queue enabled on a per-IOMMU or per-domain basis doesn't sound
unreasonable to me, but this change makes it a global property.
The intent here was just to streamline the existing behaviour of stuffing a global property into a domain attribute then pulling it out again in the illusion that it was in any way per-domain. We're still checking dev_is_untrusted() before making an actual decision, and it's not like we can't add more factors at that point if we want to.
For example, see the recent patch from Lu Baolu:

https://lore.kernel.org/r/20210225061454.2864009-1-baolu.lu@linux.intel.com (local)
Erm, this patch is based on that one, it's right there in the context :/

Thanks,
Robin.
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Thread (51 messages) 51 messages, 3 authors, last reply 2021-04-01
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help