public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Safonov <dima@arista.com>
To: linux-kernel@vger.kernel.org
Cc: 0x7f454c46@gmail.com, Dmitry Safonov <dima@arista.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Ingo Molnar <mingo@kernel.org>, Joerg Roedel <joro@8bytes.org>,
	Lu Baolu <baolu.lu@linux.intel.com>,
	iommu@lists.linux-foundation.org
Subject: [PATCHv2 3/6] iommu/intel: Introduce clear_primary_faults() helper
Date: Mon, 12 Feb 2018 16:48:22 +0000	[thread overview]
Message-ID: <20180212164825.22421-4-dima@arista.com> (raw)
In-Reply-To: <20180212164825.22421-1-dima@arista.com>

To my mind it's a bit more readable - and I will re-use it in the next
patch.

Signed-off-by: Dmitry Safonov <dima@arista.com>
---
 drivers/iommu/dmar.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index accf58388bdb..33fb4244e438 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -1611,6 +1611,15 @@ static int dmar_fault_do_one(struct intel_iommu *iommu, int type,
 	return 0;
 }
 
+static void clear_primary_faults(struct intel_iommu *iommu)
+{
+	volatile void __iomem *fsts = iommu->reg + DMAR_FSTS_REG;
+
+	assert_raw_spin_locked(&iommu->register_lock);
+
+	writel(DMA_FSTS_PFO | DMA_FSTS_PPF | DMA_FSTS_PRO, fsts);
+}
+
 #define PRIMARY_FAULT_REG_LEN (16)
 irqreturn_t dmar_fault(int irq, void *dev_id)
 {
@@ -1679,8 +1688,7 @@ irqreturn_t dmar_fault(int irq, void *dev_id)
 		raw_spin_lock_irqsave(&iommu->register_lock, flag);
 	}
 
-	writel(DMA_FSTS_PFO | DMA_FSTS_PPF | DMA_FSTS_PRO,
-	       iommu->reg + DMAR_FSTS_REG);
+	clear_primary_faults(iommu);
 
 unlock_exit:
 	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
-- 
2.13.6

  parent reply	other threads:[~2018-02-12 16:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-12 16:48 [PATCHv2 0/6] iommu/intel: Handle DMAR faults in a wq Dmitry Safonov
2018-02-12 16:48 ` [PATCHv2 1/6] iommu/intel: Add __init for dmar_register_bus_notifier() Dmitry Safonov
2018-02-12 16:48 ` [PATCHv2 2/6] iommu/intel: Clean/document fault status flags Dmitry Safonov
2018-02-12 16:48 ` Dmitry Safonov [this message]
2018-02-12 16:48 ` [PATCHv2 4/6] iommu/intel: Handle DMAR faults on workqueue Dmitry Safonov
2018-02-13 16:35   ` Joerg Roedel
2018-02-13 17:38     ` Dmitry Safonov
2018-02-15 19:09       ` Dmitry Safonov
2018-02-12 16:48 ` [PATCHv2 5/6] iommu/intel: Rename dmar_fault() => dmar_serve_faults() Dmitry Safonov
2018-02-12 16:48 ` [PATCHv2 6/6] iommu/intel: Ratelimit each dmar fault printing Dmitry Safonov
2018-02-12 17:26   ` [PATCHv3 " Dmitry Safonov
2018-02-13 16:44 ` [PATCHv2 0/6] iommu/intel: Handle DMAR faults in a wq Joerg Roedel

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=20180212164825.22421-4-dima@arista.com \
    --to=dima@arista.com \
    --cc=0x7f454c46@gmail.com \
    --cc=alex.williamson@redhat.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.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