Skip to contentSkip to conversation

iommu/vt-d: use lo_hi_readq() / lo_hi_writeq()

PATCH In review Andy Shevchenko 1 participant 2 messages Nov 19, 2015 – Jan 28, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 iommu/vt-d: use lo_hi_readq() / lo_hi_writeq()

There is already helper functions to do 64-bit I/O on 32-bit machines or buses, thus we don't need to reinvent the wheel.

---
Cahngelog v2:
- rebase on top of recent linux-next

 include/linux/intel-iommu.h | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)
include/linux/intel-iommu.h +2 -16
index 821273c..34066ee 100644
@@ -29,6 +29,8 @@
 #include <linux/dma_remapping.h>
 #include <linux/mmu_notifier.h>
 #include <linux/list.h>
+#include <linux/io-64-nonatomic-lo-hi.h>
+
 #include <asm/cacheflush.h>
 #include <asm/iommu.h>
 
@@ -71,24 +73,8 @@
 
 #define OFFSET_STRIDE		(9)
 
-#ifdef CONFIG_64BIT
 #define dmar_readq(a) readq(a)
 #define dmar_writeq(a,v) writeq(v,a)
-#else
-static inline u64 dmar_readq(void __iomem *addr)
-{
-	u32 lo, hi;
-	lo = readl(addr);
-	hi = readl(addr + 4);
-	return (((u64) hi) << 32) + lo;
-}
-
-static inline void dmar_writeq(void __iomem *addr, u64 val)
-{
-	writel((u32)val, addr);
-	writel((u32)(val >> 32), addr + 4);
-}
-#endif
 
 #define DMAR_VER_MAJOR(v)		(((v) & 0xf0) >> 4)
 #define DMAR_VER_MINOR(v)		((v) & 0x0f)
Signature · 1 line
2.6.2
#1 lore raw
Quoted 4 lines · Andy Shevchenko

There is already helper functions to do 64-bit I/O on 32-bit machines or buses,
thus we don't need to reinvent the wheel.

Any comment on this?

Quoted 46 lines

---
Cahngelog v2:
- rebase on top of recent linux-next include/linux/intel-iommu.h | 18 ++----------------

 1 file changed, 2 insertions(+), 16 deletions(-)
include/linux/intel- renamed from include/linux/intel-iommu.h +0 -0

iommu.h
index 821273c..34066ee 100644

include/linux/intel-iommu.h +2 -0
@@ -29,6 +29,8 @@
  #include <linux/dma_remapping.h>
  #include <linux/mmu_notifier.h>
  #include <linux/list.h>
+#include <linux/io-64-nonatomic-lo-hi.h>
+
  #include <asm/cacheflush.h>
  #include <asm/iommu.h>

include/linux/intel-iommu.h +0 -0
@@ -71,24 +73,8 @@


 #define OFFSET_STRIDE (9)

-#ifdef CONFIG_64BIT
 #define dmar_readq(a) readq(a)
 #define dmar_writeq(a,v) writeq(v,a)

include/linux/intel-iommu.h +0 -15
-#else
-static inline u64 dmar_readq(void __iomem *addr)
-{
-	u32 lo, hi;
-	lo = readl(addr);
-	hi = readl(addr + 4);
-	return (((u64) hi) << 32) + lo;
-}
-
-static inline void dmar_writeq(void __iomem *addr, u64 val)
-{
-	writel((u32)val, addr);
-	writel((u32)(val >> 32), addr + 4);
-}
-#endif


 #define DMAR_VER_MAJOR(v) (((v) & 0xf0) >> 4)
 #define DMAR_VER_MINOR(v) ((v) & 0x0f)

Signature · 7 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu