On Wed, Aug 04, 2021 at 06:15:53PM +0100, Robin Murphy wrote:
Allocating and enabling a flush queue is in fact something we can
reasonably do while a DMA domain is active, without having to rebuild it
from scratch. Thus we can allow a strict -> non-strict transition from
sysfs without requiring to unbind the device's driver, which is of
particular interest to users who want to make selective relaxations to
critical devices like the one serving their root filesystem.
Disabling and draining a queue also seems technically possible to
achieve without rebuilding the whole domain, but would certainly be more
involved. Furthermore there's not such a clear use-case for tightening
up security *after* the device may already have done whatever it is that
you don't trust it not to do, so we only consider the relaxation case.
CC: Sai Praneeth Prakhya <sai.praneeth.prakhya@xxxxxxxxx>
Signed-off-by: Robin Murphy <robin.murphy@xxxxxxx>
---
v3: Actually think about concurrency, rework most of the fq data
accesses to be (hopefully) safe and comment it all
---
drivers/iommu/dma-iommu.c | 25 ++++++++++++++++++-------
drivers/iommu/iommu.c | 16 ++++++++++++----
drivers/iommu/iova.c | 9 ++++++---
3 files changed, 36 insertions(+), 14 deletions(-)
I failed to break this, so hopefully you've caught everything now.
Only thing I wasn't sure of is why we still need the smp_wmb() in
init_iova_flush_queue(). Can we remove it now that we have one before
assigning into the cookie?