dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Robin Murphy <robin.murphy@arm.com>
Cc: freedreno@lists.freedesktop.org, kvm@vger.kernel.org,
	Michael Ellerman <mpe@ellerman.id.au>,
	Joerg Roedel <joro@8bytes.org>,
	linuxppc-dev@lists.ozlabs.org, dri-devel@lists.freedesktop.org,
	Li Yang <leoyang.li@nxp.com>,
	iommu@lists.linux-foundation.org, netdev@vger.kernel.org,
	linux-arm-msm@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	David Woodhouse <dwmw2@infradead.org>,
	Christoph Hellwig <hch@lst.de>,
	linux-arm-kernel@lists.infradead.org,
	Lu Baolu <baolu.lu@linux.intel.com>
Subject: Re: [PATCH 16/18] iommu: remove DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE
Date: Tue, 30 Mar 2021 14:58:02 +0100	[thread overview]
Message-ID: <20210330135801.GA6187@willie-the-truck> (raw)
In-Reply-To: <a6952aa7-4d7e-54f0-339e-e15f88596dcc@arm.com>

On Tue, Mar 30, 2021 at 02:19:38PM +0100, Robin Murphy wrote:
> On 2021-03-30 14:11, Will Deacon wrote:
> > On Tue, Mar 16, 2021 at 04:38:22PM +0100, Christoph Hellwig wrote:
> > > 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.

Like I say, the cleanup is great. I'm just wondering whether there's a
better way to express the complicated logic to decide whether or not to use
the flush queue than what we end up with:

	if (!cookie->fq_domain && (!dev || !dev_is_untrusted(dev)) &&
	    domain->ops->flush_iotlb_all && !iommu_get_dma_strict())

which is mixing up globals, device properties and domain properties. The
result is that the driver code ends up just using the global to determine
whether or not to pass IO_PGTABLE_QUIRK_NON_STRICT to the page-table code,
which is a departure from the current way of doing things.

> > For example, see the recent patch from Lu Baolu:
> > 
> > https://lore.kernel.org/r/20210225061454.2864009-1-baolu.lu@linux.intel.com
> 
> Erm, this patch is based on that one, it's right there in the context :/

Ah, sorry, I didn't spot that! I was just trying to illustrate that this
is per-device.

Will
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2021-03-30 13:58 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210316153825.135976-1-hch@lst.de>
     [not found] ` <20210316153825.135976-2-hch@lst.de>
2021-03-30 12:04   ` [PATCH 01/18] iommu: remove the unused domain_window_disable method Will Deacon
     [not found] ` <20210316153825.135976-3-hch@lst.de>
2021-03-30 12:10   ` [PATCH 02/18] iommu/fsl_pamu: remove fsl_pamu_get_domain_attr Will Deacon
     [not found] ` <20210316153825.135976-4-hch@lst.de>
2021-03-30 12:15   ` [PATCH 03/18] iommu/fsl_pamu: remove support for setting DOMAIN_ATTR_GEOMETRY Will Deacon
     [not found] ` <20210316153825.135976-5-hch@lst.de>
2021-03-30 12:17   ` [PATCH 04/18] iommu/fsl_pamu: merge iommu_alloc_dma_domain into fsl_pamu_domain_alloc Will Deacon
     [not found] ` <20210316153825.135976-6-hch@lst.de>
2021-03-30 12:22   ` [PATCH 05/18] iommu/fsl_pamu: remove support for multiple windows Will Deacon
     [not found] ` <20210316153825.135976-7-hch@lst.de>
2021-03-30 12:40   ` [PATCH 06/18] iommu/fsl_pamu: remove ->domain_window_enable Will Deacon
     [not found] ` <20210316153825.135976-8-hch@lst.de>
2021-03-30 12:44   ` [PATCH 07/18] iommu/fsl_pamu: replace DOMAIN_ATTR_FSL_PAMU_STASH with a direct call Will Deacon
     [not found] ` <20210316153825.135976-9-hch@lst.de>
2021-03-30 12:46   ` [PATCH 08/18] iommu/fsl_pamu: merge pamu_set_liodn and map_liodn Will Deacon
     [not found] ` <20210316153825.135976-10-hch@lst.de>
2021-03-30 12:48   ` [PATCH 09/18] iommu/fsl_pamu: merge handle_attach_device into fsl_pamu_attach_device Will Deacon
     [not found] ` <20210316153825.135976-11-hch@lst.de>
2021-03-30 12:53   ` [PATCH 10/18] iommu/fsl_pamu: enable the liodn when attaching a device Will Deacon
     [not found] ` <20210316153825.135976-12-hch@lst.de>
2021-03-30 12:58   ` [PATCH 11/18] iommu/fsl_pamu: remove the snoop_id field Will Deacon
     [not found] ` <20210316153825.135976-13-hch@lst.de>
2021-03-30 12:58   ` [PATCH 12/18] iommu: remove DOMAIN_ATTR_PAGING Will Deacon
     [not found] ` <20210316153825.135976-14-hch@lst.de>
2021-03-30 13:00   ` [PATCH 13/18] iommu: remove DOMAIN_ATTR_GEOMETRY Will Deacon
     [not found] ` <20210316153825.135976-15-hch@lst.de>
2021-03-30 13:04   ` [PATCH 14/18] iommu: remove DOMAIN_ATTR_NESTING Will Deacon
     [not found] ` <20210316153825.135976-16-hch@lst.de>
2021-03-30 13:05   ` [PATCH 15/18] iommu: remove iommu_set_cmd_line_dma_api and iommu_cmd_line_dma_api Will Deacon
     [not found] ` <20210316153825.135976-18-hch@lst.de>
2021-03-30 13:14   ` [PATCH 17/18] iommu: remove DOMAIN_ATTR_IO_PGTABLE_CFG Will Deacon
     [not found] ` <20210316153825.135976-19-hch@lst.de>
2021-03-30 13:16   ` [PATCH 18/18] iommu: remove iommu_domain_{get,set}_attr Will Deacon
     [not found] ` <20210316153825.135976-17-hch@lst.de>
2021-03-30 13:11   ` [PATCH 16/18] iommu: remove DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE Will Deacon
2021-03-30 13:19     ` Robin Murphy
2021-03-30 13:58       ` Will Deacon [this message]
2021-03-30 16:28         ` Robin Murphy
2021-03-31 11:49           ` Will Deacon
2021-03-31 13:09             ` Robin Murphy
2021-03-31 15:32               ` Will Deacon
2021-03-31 16:05                 ` Robin Murphy
     [not found]                   ` <20210401095945.GA6726@lst.de>
2021-04-01 13:26                     ` Will Deacon
2021-03-31 16:07   ` Robin Murphy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210330135801.GA6187@willie-the-truck \
    --to=will@kernel.org \
    --cc=baolu.lu@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=dwmw2@infradead.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=leoyang.li@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=netdev@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).