Linux IOMMU Development
 help / color / mirror / Atom feed
From: Rob Clark <robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	Jordan Crouse <jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Subject: [RFC 3/3] iommu/arm-smmu: Let fault handler return -EFAULT
Date: Tue,  3 Jan 2017 16:30:56 -0500	[thread overview]
Message-ID: <1483479056-15202-4-git-send-email-robdclark@gmail.com> (raw)
In-Reply-To: <1483479056-15202-1-git-send-email-robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Let the iommu user ask the iommu to terminate the transaction without
printing any error msg via -EFAULT return.

(Alternatively, look for -ENOSYS return instead to trigger the msg?)

Signed-off-by: Rob Clark <robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/iommu/arm-smmu.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index a8d9901..dc26c98 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -703,15 +703,23 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev)
 	flags = fsynr & FSYNR0_WNR ? IOMMU_FAULT_WRITE : IOMMU_FAULT_READ;
 
 	iova = readq_relaxed(cb_base + ARM_SMMU_CB_FAR);
-	if (!report_iommu_fault(domain, smmu->dev, iova, flags)) {
+
+	switch (report_iommu_fault(domain, smmu->dev, iova, flags)) {
+	case 0:
 		ret = IRQ_HANDLED;
 		resume = RESUME_RETRY;
-	} else {
+		break;
+	case -EFAULT:
+		ret = IRQ_HANDLED;
+		resume = RESUME_TERMINATE;
+		break;
+	default:
 		dev_err_ratelimited(smmu->dev,
 		    "Unhandled context fault: iova=0x%08lx, fsynr=0x%x, cb=%d\n",
 		    iova, fsynr, cfg->cbndx);
 		ret = IRQ_NONE;
 		resume = RESUME_TERMINATE;
+		break;
 	}
 
 	/* Clear the faulting FSR */
-- 
2.7.4

      parent reply	other threads:[~2017-01-03 21:30 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
     [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   ` Rob Clark [this message]

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=1483479056-15202-4-git-send-email-robdclark@gmail.com \
    --to=robdclark-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@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