linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v8 4/7] iommu/io-pgtable-arm: Add support for non-strict mode
Date: Fri, 28 Sep 2018 13:17:38 +0100	[thread overview]
Message-ID: <20180928121738.GA1577@brain-police> (raw)
In-Reply-To: <9a666d63a96ab97dc53df2a64b3a8d22a0986423.1537458163.git.robin.murphy@arm.com>

On Thu, Sep 20, 2018 at 05:10:24PM +0100, Robin Murphy wrote:
> From: Zhen Lei <thunder.leizhen@huawei.com>
> 
> Non-strict mode is simply a case of skipping 'regular' leaf TLBIs, since
> the sync is already factored out into ops->iotlb_sync at the core API
> level. Non-leaf invalidations where we change the page table structure
> itself still have to be issued synchronously in order to maintain walk
> caches correctly.
> 
> To save having to reason about it too much, make sure the invalidation
> in arm_lpae_split_blk_unmap() just performs its own unconditional sync
> to minimise the window in which we're technically violating the break-
> before-make requirement on a live mapping. This might work out redundant
> with an outer-level sync for strict unmaps, but we'll never be splitting
> blocks on a DMA fastpath anyway.
> 
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> [rm: tweak comment, commit message, split_blk_unmap logic and barriers]
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
> 
> v8: Add barrier for the fiddly cross-cpu flush case
> 
>  drivers/iommu/io-pgtable-arm.c | 14 ++++++++++++--
>  drivers/iommu/io-pgtable.h     |  5 +++++
>  2 files changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c
> index 2f79efd16a05..237cacd4a62b 100644
> --- a/drivers/iommu/io-pgtable-arm.c
> +++ b/drivers/iommu/io-pgtable-arm.c
> @@ -576,6 +576,7 @@ static size_t arm_lpae_split_blk_unmap(struct arm_lpae_io_pgtable *data,
>  		tablep = iopte_deref(pte, data);
>  	} else if (unmap_idx >= 0) {
>  		io_pgtable_tlb_add_flush(&data->iop, iova, size, size, true);
> +		io_pgtable_tlb_sync(&data->iop);
>  		return size;
>  	}
>  
> @@ -609,6 +610,13 @@ static size_t __arm_lpae_unmap(struct arm_lpae_io_pgtable *data,
>  			io_pgtable_tlb_sync(iop);
>  			ptep = iopte_deref(pte, data);
>  			__arm_lpae_free_pgtable(data, lvl + 1, ptep);
> +		} else if (iop->cfg.quirks & IO_PGTABLE_QUIRK_NON_STRICT) {
> +			/*
> +			 * Order the PTE update against queueing the IOVA, to
> +			 * guarantee that a flush callback from a different CPU
> +			 * has observed it before the TLBIALL can be issued.
> +			 */
> +			smp_wmb();

Looks good to me. In the case that everything happens on the same CPU, are
we relying on the TLB invalidation code in the SMMU driver(s) to provide the
DSB for pushing the new entry out to the walker?

Will

  reply	other threads:[~2018-09-28 12:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-20 16:10 [PATCH v8 0/7] Add non-strict mode support for iommu-dma Robin Murphy
2018-09-20 16:10 ` [PATCH v8 1/7] iommu/arm-smmu-v3: Implement flush_iotlb_all hook Robin Murphy
2018-09-20 16:10 ` [PATCH v8 2/7] iommu/dma: Add support for non-strict mode Robin Murphy
2018-09-20 16:10 ` [PATCH v8 3/7] iommu: Add "iommu.strict" command line option Robin Murphy
2018-09-28 12:51   ` Will Deacon
2018-09-28 14:25     ` Robin Murphy
2018-09-20 16:10 ` [PATCH v8 4/7] iommu/io-pgtable-arm: Add support for non-strict mode Robin Murphy
2018-09-28 12:17   ` Will Deacon [this message]
2018-09-20 16:10 ` [PATCH v8 5/7] iommu/arm-smmu-v3: " Robin Murphy
2018-09-28 12:19   ` Will Deacon
2018-09-28 12:26     ` Robin Murphy
2018-09-28 12:47       ` Will Deacon
2018-09-28 13:55         ` Will Deacon
2018-09-28 14:01           ` Robin Murphy
2018-09-20 16:10 ` [PATCH v8 6/7] iommu/io-pgtable-arm-v7s: " Robin Murphy
2018-09-20 16:10 ` [PATCH v8 7/7] iommu/arm-smmu: Support " Robin Murphy
2018-09-21  9:20 ` [PATCH v8 0/7] Add non-strict mode support for iommu-dma John Garry
2018-09-21  9:29   ` Robin Murphy
2018-09-21 11:03     ` Robin Murphy
2018-09-24 14:35       ` John Garry
2018-09-28 13:36 ` Will Deacon
2018-09-28 13:42   ` 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=20180928121738.GA1577@brain-police \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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).