[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180212164825.22421-4-dima@arista.com>
Date: Mon, 12 Feb 2018 16:48:22 +0000
From: Dmitry Safonov <dima@...sta.com>
To: linux-kernel@...r.kernel.org
Cc: 0x7f454c46@...il.com, Dmitry Safonov <dima@...sta.com>,
Alex Williamson <alex.williamson@...hat.com>,
David Woodhouse <dwmw2@...radead.org>,
Ingo Molnar <mingo@...nel.org>, Joerg Roedel <joro@...tes.org>,
Lu Baolu <baolu.lu@...ux.intel.com>,
iommu@...ts.linux-foundation.org
Subject: [PATCHv2 3/6] iommu/intel: Introduce clear_primary_faults() helper
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@...sta.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
Powered by blists - more mailing lists