lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190129154102.17655-1-vladimir.kondratiev@linux.intel.com>
Date:   Tue, 29 Jan 2019 17:41:02 +0200
From:   Vladimir Kondratiev <vladimir.kondratiev@...ux.intel.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     linux-kernel@...r.kernel.org,
        Vladimir Kondratiev <vladimir.kondratiev@...ux.intel.com>
Subject: [PATCH] lib: 64bit IO

implement missing io{read|write}64

For 64-bit platforms, these 64-bit io functions are defined in
include/asm-generic/iomap.h,
but actual implementation missing. Provide it.

Signed-off-by: Vladimir Kondratiev <vladimir.kondratiev@...ux.intel.com>
---
 lib/iomap.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/lib/iomap.c b/lib/iomap.c
index 541d926da95e..5e2b0bcc5561 100644
--- a/lib/iomap.c
+++ b/lib/iomap.c
@@ -62,11 +62,17 @@ static void bad_io_access(unsigned long port, const char *access)
 #ifndef pio_read16be
 #define pio_read16be(port) swab16(inw(port))
 #define pio_read32be(port) swab32(inl(port))
+#ifdef CONFIG_64BIT
+#define pio_read64be(port) swab64(inq(port))
+#endif
 #endif
 
 #ifndef mmio_read16be
 #define mmio_read16be(addr) be16_to_cpu(__raw_readw(addr))
 #define mmio_read32be(addr) be32_to_cpu(__raw_readl(addr))
+#ifdef CONFIG_64BIT
+#define mmio_read64be(addr) be64_to_cpu(__raw_readq(addr))
+#endif
 #endif
 
 unsigned int ioread8(void __iomem *addr)
@@ -100,14 +106,38 @@ EXPORT_SYMBOL(ioread16be);
 EXPORT_SYMBOL(ioread32);
 EXPORT_SYMBOL(ioread32be);
 
+#ifdef CONFIG_64BIT
+
+u64 ioread64(void __iomem *addr)
+{
+	IO_COND(addr, return inq(port), return readq(addr));
+	return 0xffffffffffffffffULL;
+}
+EXPORT_SYMBOL(ioread64);
+
+u64 ioread64be(void __iomem *addr)
+{
+	IO_COND(addr, return pio_read64be(port), return mmio_read64be(addr));
+	return 0xffffffffffffffffULL;
+}
+EXPORT_SYMBOL(ioread64be);
+
+#endif /* CONFIG_64BIT */
+
 #ifndef pio_write16be
 #define pio_write16be(val,port) outw(swab16(val),port)
 #define pio_write32be(val,port) outl(swab32(val),port)
+#ifdef CONFIG_64BIT
+#define pio_write64be(val, port) outq(swab64(val), port)
+#endif
 #endif
 
 #ifndef mmio_write16be
 #define mmio_write16be(val,port) __raw_writew(be16_to_cpu(val),port)
 #define mmio_write32be(val,port) __raw_writel(be32_to_cpu(val),port)
+#ifdef CONFIG_64BIT
+#define mmio_write64be(val, port) __raw_writeq(be64_to_cpu(val), port)
+#endif
 #endif
 
 void iowrite8(u8 val, void __iomem *addr)
@@ -136,6 +166,22 @@ EXPORT_SYMBOL(iowrite16be);
 EXPORT_SYMBOL(iowrite32);
 EXPORT_SYMBOL(iowrite32be);
 
+#ifdef CONFIG_64BIT
+
+void iowrite64(u64 val, void __iomem *addr)
+{
+	IO_COND(addr, outq(val, port), writeq(val, addr));
+}
+EXPORT_SYMBOL(iowrite64);
+
+void iowrite64be(u64 val, void __iomem *addr)
+{
+	IO_COND(addr, pio_write64be(val, port), mmio_write64be(val, addr));
+}
+EXPORT_SYMBOL(iowrite64be);
+
+#endif /* CONFIG_64BIT */
+
 /*
  * These are the "repeat MMIO read/write" functions.
  * Note the "__raw" accesses, since we don't want to
-- 
2.19.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ