Linux IOMMU Development
 help / color / mirror / Atom feed
From: Jordan Crouse <jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
To: Rob Clark <robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
Subject: Re: [RFC 2/3] iommu/arm-smmu: Add qcom implementation
Date: Tue, 3 Jan 2017 15:28:33 -0700	[thread overview]
Message-ID: <20170103222832.GA19199@jcrouse-lnx.qualcomm.com> (raw)
In-Reply-To: <1483479056-15202-3-git-send-email-robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Tue, Jan 03, 2017 at 04:30:55PM -0500, Rob Clark wrote:
> At least on the db820c I have, with the firmware I have, I'm not seeing
> the SS bit set, even though the iommu is in a stalled state.  So for
> this implementation ignore not having SS bit set.

The SS bit gets set if SCTLR.CFCFG is set to 1. It works in the downstream
kernel because the GPU driver writes directly to SCTLR in the IOMMU hardware
(which of course is a crime against humanity but that is one of the many reasons
why it is a *downstream* driver).

My understanding is that SCTLR.CFCFG == 0 should automatically terminate the
transaction so I don't understand why we need to write to RESUME. I'm not
doubting Rob's patch, I'm doubting why we need it in the first place. It seems
that if we have to write it regardless of the value of CFCFG then we should
probably just do that instead of relying on the SS bit.

The public spec doesn't give any indication to me that any of this behavior is
implementation specific but I only have one implementation to base that
assumption on. Perhaps the default value of SCTLR is implementation specific?

If other implementations do expect SS (and CFCFG) to be set by default then we
would indeed need to set up a quirk. The other possibility would be to force
set CFCFG for all targets, but I would be hesitant to do that on the GPU iommu
because if we stall the GPU for too long then hang detect will fire.

Jordan

> Signed-off-by: Rob Clark <robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  drivers/iommu/arm-smmu.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> index a71cb8f..a8d9901 100644
> --- a/drivers/iommu/arm-smmu.c
> +++ b/drivers/iommu/arm-smmu.c
> @@ -298,6 +298,7 @@ enum arm_smmu_implementation {
>  	GENERIC_SMMU,
>  	ARM_MMU500,
>  	CAVIUM_SMMUV2,
> +	QCOM_SMMUV2,
>  };
>  
>  struct arm_smmu_s2cr {
> @@ -716,6 +717,9 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev)
>  	/* Clear the faulting FSR */
>  	writel(fsr, cb_base + ARM_SMMU_CB_FSR);
>  
> +	if (smmu->model == QCOM_SMMUV2)
> +		fsr |= FSR_SS;
> +
>  	/* Retry or terminate any stalled transactions */
>  	if (fsr & FSR_SS) {
>  		/* Should we care about ending up w/ a stalled transaction
> @@ -1991,6 +1995,7 @@ ARM_SMMU_MATCH_DATA(smmu_generic_v2, ARM_SMMU_V2, GENERIC_SMMU);
>  ARM_SMMU_MATCH_DATA(arm_mmu401, ARM_SMMU_V1_64K, GENERIC_SMMU);
>  ARM_SMMU_MATCH_DATA(arm_mmu500, ARM_SMMU_V2, ARM_MMU500);
>  ARM_SMMU_MATCH_DATA(cavium_smmuv2, ARM_SMMU_V2, CAVIUM_SMMUV2);
> +ARM_SMMU_MATCH_DATA(qcom_smmuv2, ARM_SMMU_V2, QCOM_SMMUV2);
>  
>  static const struct of_device_id arm_smmu_of_match[] = {
>  	{ .compatible = "arm,smmu-v1", .data = &smmu_generic_v1 },
> @@ -1999,6 +2004,7 @@ static const struct of_device_id arm_smmu_of_match[] = {
>  	{ .compatible = "arm,mmu-401", .data = &arm_mmu401 },
>  	{ .compatible = "arm,mmu-500", .data = &arm_mmu500 },
>  	{ .compatible = "cavium,smmu-v2", .data = &cavium_smmuv2 },
> +	{ .compatible = "qcom,smmu-v2", .data = &qcom_smmuv2 },
>  	{ },
>  };
>  MODULE_DEVICE_TABLE(of, arm_smmu_of_match);
> -- 
> 2.7.4
> 

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

  parent reply	other threads:[~2017-01-03 22:28 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-03 21:30 [RFC 0/3] iommu/arm-smmu: patches for adreno Rob Clark
     [not found] ` <1483479056-15202-1-git-send-email-robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-03 21:30   ` [RFC 1/3] iommu/arm-smmu: Add support to opt-in to stalling Rob Clark
     [not found]     ` <1483479056-15202-2-git-send-email-robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-05 11:55       ` Will Deacon
2017-01-05 12:08         ` Mark Rutland
2017-01-05 14:00           ` Will Deacon
     [not found]             ` <20170105140005.GJ679-5wv7dgnIgG8@public.gmane.org>
2017-01-05 14:07               ` Mark Rutland
2017-01-05 14:47                 ` Will Deacon
     [not found]                   ` <20170105144742.GK679-5wv7dgnIgG8@public.gmane.org>
2017-01-05 15:32                     ` Robin Murphy
2017-01-05 16:07                       ` Will Deacon
     [not found]                         ` <20170105160755.GN679-5wv7dgnIgG8@public.gmane.org>
2017-01-05 17:03                           ` Robin Murphy
     [not found]                             ` <611575f4-3e37-1f4d-ef29-94e6f65baf66-5wv7dgnIgG8@public.gmane.org>
2017-01-05 17:25                               ` Will Deacon
2017-01-06 16:36                                 ` Rob Clark
     [not found]         ` <20170105115528.GG679-5wv7dgnIgG8@public.gmane.org>
2017-01-05 15:27           ` Rob Clark
     [not found]             ` <CAF6AEGsUdZALAQTozmxPV8Os=3pG7ay=1Oqtctx99FV9_4SX7Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-05 15:49               ` Will Deacon
     [not found]                 ` <20170105154950.GM679-5wv7dgnIgG8@public.gmane.org>
2017-01-06 16:26                   ` Rob Clark
2017-01-10 17:52                     ` Will Deacon
     [not found]                       ` <20170110175219.GK527-5wv7dgnIgG8@public.gmane.org>
2017-01-10 19:20                         ` Rob Clark
     [not found]                           ` <CAF6AEGsCJ6L-wmBHFYy2jfQ1bfq_d2wmiWVUXno344US9ikLVA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-11  9:36                             ` Will Deacon
     [not found]                               ` <20170111093606.GA12388-5wv7dgnIgG8@public.gmane.org>
2017-01-11 20:59                                 ` Rob Clark
2017-01-12 15:17                                   ` Will Deacon
     [not found]                                     ` <20170112151717.GB13843-5wv7dgnIgG8@public.gmane.org>
2017-01-30 20:51                                       ` Rob Clark
2017-01-03 21:30   ` [RFC 2/3] iommu/arm-smmu: Add qcom implementation Rob Clark
     [not found]     ` <1483479056-15202-3-git-send-email-robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-03 22:28       ` Jordan Crouse [this message]
     [not found]         ` <20170103222832.GA19199-9PYrDHPZ2Orvke4nUoYGnHL1okKdlPRT@public.gmane.org>
2017-01-04 13:33           ` Sricharan
2017-01-04 14:31             ` Rob Clark
     [not found]               ` <CAF6AEGuT_qq-UJK3sdvtVqxfsLBH-_jZVKz1vF383tOYVQpraw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-04 17:16                 ` Rob Clark
2017-01-03 21:30   ` [RFC 3/3] iommu/arm-smmu: Let fault handler return -EFAULT Rob Clark

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=20170103222832.GA19199@jcrouse-lnx.qualcomm.com \
    --to=jcrouse-sgv2jx0feol9jmxxk+q4oq@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=will.deacon-5wv7dgnIgG8@public.gmane.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