[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <6ec3e7e0c70e85a804933f27bb4275d5363c044b.1521469118.git.rahul.lakkireddy@chelsio.com>
Date: Mon, 19 Mar 2018 19:50:35 +0530
From: Rahul Lakkireddy <rahul.lakkireddy@...lsio.com>
To: x86@...nel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org
Cc: tglx@...utronix.de, mingo@...hat.com, hpa@...or.com,
davem@...emloft.net, akpm@...ux-foundation.org,
torvalds@...ux-foundation.org, ganeshgr@...lsio.com,
nirranjan@...lsio.com, indranil@...lsio.com,
Rahul Lakkireddy <rahul.lakkireddy@...lsio.com>
Subject: [RFC PATCH 2/3] x86/io: implement 256-bit IO read and write
Use VMOVDQU AVX CPU instruction when available to do 256-bit
IO read and write.
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@...lsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@...lsio.com>
---
arch/x86/include/asm/io.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 56 insertions(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index 95e948627fd0..b04f417b3374 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -109,7 +109,62 @@ build_mmio_write(__writeq, "q", unsigned long, "r", )
#define readq readq
#define writeq writeq
-#endif
+#ifdef CONFIG_AS_AVX
+#include <asm/fpu/api.h>
+
+static inline u256 __readqq(const volatile void __iomem *addr)
+{
+ u256 ret;
+
+ kernel_fpu_begin();
+ asm volatile("vmovdqu %0, %%ymm0" :
+ : "m" (*(volatile u256 __force *)addr));
+ asm volatile("vmovdqu %%ymm0, %0" : "=m" (ret));
+ kernel_fpu_end();
+ return ret;
+}
+
+static inline u256 readqq(const volatile void __iomem *addr)
+{
+ u256 ret;
+
+ kernel_fpu_begin();
+ asm volatile("vmovdqu %0, %%ymm0" :
+ : "m" (*(volatile u256 __force *)addr));
+ asm volatile("vmovdqu %%ymm0, %0" : "=m" (ret) : : "memory");
+ kernel_fpu_end();
+ return ret;
+}
+
+#define __raw_readqq __readqq
+#define readqq_relaxed(a) __readqq(a)
+#define readqq readqq
+
+static inline void __writeqq(u256 val, volatile void __iomem *addr)
+{
+ kernel_fpu_begin();
+ asm volatile("vmovdqu %0, %%ymm0" : : "m" (val));
+ asm volatile("vmovdqu %%ymm0, %0"
+ : "=m" (*(volatile u256 __force *)addr));
+ kernel_fpu_end();
+}
+
+static inline void writeqq(u256 val, volatile void __iomem *addr)
+{
+ kernel_fpu_begin();
+ asm volatile("vmovdqu %0, %%ymm0" : : "m" (val));
+ asm volatile("vmovdqu %%ymm0, %0"
+ : "=m" (*(volatile u256 __force *)addr)
+ : : "memory");
+ kernel_fpu_end();
+}
+
+#define __raw_writeqq __writeqq
+#define writeqq_relaxed(a) __writeqq(a)
+#define writeqq writeqq
+#endif /* CONFIG_AS_AVX */
+
+#endif /* CONFIG_X86_64 */
#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
extern int valid_phys_addr_range(phys_addr_t addr, size_t size);
--
2.14.1
Powered by blists - more mailing lists