lkml.org 
[lkml]   [2018]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/5] iommu/intel: Introduce clear_primary_faults() helper
Date
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
\
 
 \ /
  Last update: 2018-01-24 14:20    [W:0.068 / U:0.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site