devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Sricharan R <sricharan@codeaurora.org>
Cc: linux-arm-kernel@lists.infradead.org,
	iommu@lists.linux-foundation.org, devicetree@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, robin.murphy@arm.com,
	robdclark@gmail.com, joro@8bytes.org,
	srinivas.kandagatla@linaro.org,
	laurent.pinchart@ideasonboard.com, stepanm@codeaurora.org,
	treding@nvidia.com
Subject: Re: [PATCH V2 4/5] iommu/msm: use generic ARMV7S short descriptor pagetable ops
Date: Tue, 26 Apr 2016 15:17:23 +0100	[thread overview]
Message-ID: <20160426141723.GA1793@arm.com> (raw)
In-Reply-To: <1459952975-1250-5-git-send-email-sricharan@codeaurora.org>

On Wed, Apr 06, 2016 at 07:59:34PM +0530, Sricharan R wrote:
> This iommu uses the armv7 short descriptor format. So use the
> generic ARMV7S pagetable ops instead of rewriting the same stuff
> in the driver.
> 
> Signed-off-by: Sricharan R <sricharan@codeaurora.org>
> ---
>  drivers/iommu/Kconfig     |   1 +
>  drivers/iommu/msm_iommu.c | 378 ++++++++++------------------------------------
>  2 files changed, 80 insertions(+), 299 deletions(-)

Nice diffstat!

> +static void __flush_iotlb(void *cookie)
>  {
> -	struct msm_priv *priv = to_msm_priv(domain);
> +	struct msm_priv *priv = cookie;
>  	struct msm_iommu_dev *iommu = NULL;
>  	struct msm_iommu_ctx_dev *master;
>  	int ret = 0;
>  
> -#ifndef CONFIG_IOMMU_PGTABLES_L2
> -	unsigned long *fl_table = priv->pgtable;
> -	int i;
> -
> -	if (!list_empty(&priv->list_attached)) {
> -		dmac_flush_range(fl_table, fl_table + SZ_16K);
> -
> -		for (i = 0; i < NUM_FL_PTE; i++)
> -			if ((fl_table[i] & 0x03) == FL_TYPE_TABLE) {
> -				void *sl_table = __va(fl_table[i] &
> -								FL_BASE_MASK);
> -				dmac_flush_range(sl_table, sl_table + SZ_4K);
> -			}
> -	}
> -#endif
> -
>  	list_for_each_entry(iommu, &priv->list_attached, dom_node) {
>  		ret = __enable_clocks(iommu);
>  		if (ret)
> @@ -162,9 +144,26 @@ static int __flush_iotlb(struct iommu_domain *domain)
>  		__disable_clocks(iommu);
>  	}
>  fail:
> -	return ret;
> +	return;
> +}
> +
> +static void __flush_iotlb_range(unsigned long iova, size_t size,
> +				size_t granule, bool leaf, void *cookie)
> +{
> +	__flush_iotlb(cookie);

Can you really not do better than this? __flush_iotlb does a TLBIALL afaict,
whereas you have the address range here and drivers/iommu/msm_iommu_hw-8xxx.h
has entries for things like TLBIVA[A]...

You might even be able to make SET_CTX_REG use writel_relaxed and stick
a DSB in the sync callback (assuming that's sufficient to complete
the maintenance on your device).

Will

  reply	other threads:[~2016-04-26 14:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-06 14:29 [PATCH V2 0/5] iommu/msm: Add DT adaptation and generic bindings support Sricharan R
2016-04-06 14:29 ` [PATCH V2 1/5] iommu/msm: Add DT adaptation Sricharan R
     [not found]   ` <1459952975-1250-2-git-send-email-sricharan-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2016-04-09 22:38     ` Laurent Pinchart
2016-04-12 15:27       ` Sricharan
2016-04-11 13:47     ` Rob Herring
2016-04-12 15:34       ` Sricharan
2016-04-06 14:29 ` [PATCH V2 2/5] iommu/msm: Move the contents from msm_iommu_dev.c to msm_iommu.c Sricharan R
2016-04-06 14:29 ` [PATCH V2 3/5] iommu/msm: Add support for generic master bindings Sricharan R
2016-04-06 14:29 ` [PATCH V2 4/5] iommu/msm: use generic ARMV7S short descriptor pagetable ops Sricharan R
2016-04-26 14:17   ` Will Deacon [this message]
2016-04-27  5:37     ` Sricharan
2016-04-06 14:29 ` [PATCH V2 5/5] iommu/msm: Remove driver BROKEN Sricharan R

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=20160426141723.GA1793@arm.com \
    --to=will.deacon@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=robdclark@gmail.com \
    --cc=robin.murphy@arm.com \
    --cc=sricharan@codeaurora.org \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=stepanm@codeaurora.org \
    --cc=treding@nvidia.com \
    /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).