Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1207022 > unrolled thread

[PATCH 0/9] iommu: Fix some static checker warnings

Started byJoerg Roedel <joro@8bytes.org>
First post2015-08-13 19:40 +0200
Last post2015-08-13 19:40 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/9] iommu: Fix some static checker warnings Joerg Roedel <joro@8bytes.org> - 2015-08-13 19:40 +0200
    [PATCH 7/9] iommu/vt-d: Access iomem correctly Joerg Roedel <joro@8bytes.org> - 2015-08-13 19:40 +0200

#1207022 — [PATCH 0/9] iommu: Fix some static checker warnings

FromJoerg Roedel <joro@8bytes.org>
Date2015-08-13 19:40 +0200
Subject[PATCH 0/9] iommu: Fix some static checker warnings
Message-ID<pX4DV-1Gi-15@gated-at.bofh.it>
Hi,

here are some patches to fix various static checker warnings
I have seen through testing other code. Main intention
behind these is to reduce the noise. In particular I used
these checkers:

	* coccinelle scripts in the kernel tree
	* smatch
	* sparse

Please review.

Thanks,

	Joerg

Joerg Roedel (9):
  iommu/amd: Simplify allocation in irq_remapping_alloc()
  iommu/amd: Make a symbol static
  iommu/amd: Use BUG_ON instead of if () BUG()
  iommu/vt-d: Return false instead of 0 in irq_remapping_cap()
  iommu/vt-d: Use BUG_ON instead of if () BUG()
  iommu/vt-d: Make two functions static
  iommu/vt-d: Access iomem correctly
  iommu/msm: Use BUG_ON instead of if () BUG()
  iommu/io-pgtable-arm: Move init-fn declarations to io-pgtable.h

 drivers/iommu/amd_iommu.c           | 21 ++++++++-------------
 drivers/iommu/amd_iommu_init.c      |  2 +-
 drivers/iommu/amd_iommu_v2.c        |  4 ++--
 drivers/iommu/intel-iommu.c         | 26 ++++++++++++++------------
 drivers/iommu/intel_irq_remapping.c |  4 ++--
 drivers/iommu/io-pgtable.c          |  5 -----
 drivers/iommu/io-pgtable.h          |  5 +++++
 drivers/iommu/irq_remapping.c       |  2 +-
 drivers/iommu/msm_iommu.c           |  4 ++--
 9 files changed, 35 insertions(+), 38 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1207024 — [PATCH 7/9] iommu/vt-d: Access iomem correctly

FromJoerg Roedel <joro@8bytes.org>
Date2015-08-13 19:40 +0200
Subject[PATCH 7/9] iommu/vt-d: Access iomem correctly
Message-ID<pX4DX-1Gi-67@gated-at.bofh.it>
In reply to#1207022
From: Joerg Roedel <jroedel@suse.de>

This fixes wrong accesses to iomem introduced by the kdump
fixing code.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
 drivers/iommu/intel-iommu.c         | 15 +++++++++------
 drivers/iommu/intel_irq_remapping.c |  4 ++--
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 93f16aa..a85077d 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2799,15 +2799,18 @@ static void intel_iommu_init_qi(struct intel_iommu *iommu)
 }
 
 static int copy_context_table(struct intel_iommu *iommu,
-			      struct root_entry *old_re,
+			      struct root_entry __iomem *old_re,
 			      struct context_entry **tbl,
 			      int bus, bool ext)
 {
-	struct context_entry *old_ce = NULL, *new_ce = NULL, ce;
 	int tbl_idx, pos = 0, idx, devfn, ret = 0, did;
+	struct context_entry __iomem *old_ce = NULL;
+	struct context_entry *new_ce = NULL, ce;
+	struct root_entry re;
 	phys_addr_t old_ce_phys;
 
 	tbl_idx = ext ? bus * 2 : bus;
+	memcpy_fromio(&re, old_re, sizeof(re));
 
 	for (devfn = 0; devfn < 256; devfn++) {
 		/* First calculate the correct index */
@@ -2827,9 +2830,9 @@ static int copy_context_table(struct intel_iommu *iommu,
 
 			ret = 0;
 			if (devfn < 0x80)
-				old_ce_phys = root_entry_lctp(old_re);
+				old_ce_phys = root_entry_lctp(&re);
 			else
-				old_ce_phys = root_entry_uctp(old_re);
+				old_ce_phys = root_entry_uctp(&re);
 
 			if (!old_ce_phys) {
 				if (ext && devfn == 0) {
@@ -2854,7 +2857,7 @@ static int copy_context_table(struct intel_iommu *iommu,
 		}
 
 		/* Now copy the context entry */
-		ce = old_ce[idx];
+		memcpy_fromio(&ce, old_ce + idx, sizeof(ce));
 
 		if (!__context_present(&ce))
 			continue;
@@ -2898,8 +2901,8 @@ out:
 
 static int copy_translation_tables(struct intel_iommu *iommu)
 {
+	struct root_entry __iomem *old_rt;
 	struct context_entry **ctxt_tbls;
-	struct root_entry *old_rt;
 	phys_addr_t old_rt_phys;
 	int ctxt_table_entries;
 	unsigned long flags;
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c
index 27cdfa8..9ec4e0d 100644
--- a/drivers/iommu/intel_irq_remapping.c
+++ b/drivers/iommu/intel_irq_remapping.c
@@ -384,7 +384,7 @@ static int set_msi_sid(struct irte *irte, struct pci_dev *dev)
 
 static int iommu_load_old_irte(struct intel_iommu *iommu)
 {
-	struct irte *old_ir_table;
+	struct irte __iomem *old_ir_table;
 	phys_addr_t irt_phys;
 	unsigned int i;
 	size_t size;
@@ -413,7 +413,7 @@ static int iommu_load_old_irte(struct intel_iommu *iommu)
 		return -ENOMEM;
 
 	/* Copy data over */
-	memcpy(iommu->ir_table->base, old_ir_table, size);
+	memcpy_fromio(iommu->ir_table->base, old_ir_table, size);
 
 	__iommu_flush_cache(iommu, iommu->ir_table->base, size);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web