aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-03-06 17:18:59 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-06 17:18:59 -0500
commit45763bf4bc1ebdf8eb95697607e1fd042a3e1221 (patch)
treec5b26c2d5d1190247b59d6d1fe68b8a247351362 /lib
parentda2577fe63f865cd9dc785a42c29c0071f567a35 (diff)
parent142a0f83b216a607aebed42e54a1be620765e28c (diff)
Merge tag 'char-misc-5.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver updates from Greg KH: "Here is the big char/misc driver patch pull request for 5.1-rc1. The largest thing by far is the new habanalabs driver for their AI accelerator chip. For now it is in the drivers/misc directory but will probably move to a new directory soon along with other drivers of this type. Other than that, just the usual set of individual driver updates and fixes. There's an "odd" merge in here from the DRM tree that they asked me to do as the MEI driver is starting to interact with the i915 driver, and it needed some coordination. All of those patches have been properly acked by the relevant subsystem maintainers. All of these have been in linux-next with no reported issues, most for quite some time" * tag 'char-misc-5.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (219 commits) habanalabs: adjust Kconfig to fix build errors habanalabs: use %px instead of %p in error print habanalabs: use do_div for 64-bit divisions intel_th: gth: Fix an off-by-one in output unassigning habanalabs: fix little-endian<->cpu conversion warnings habanalabs: use NULL to initialize array of pointers habanalabs: fix little-endian<->cpu conversion warnings habanalabs: soft-reset device if context-switch fails habanalabs: print pointer using %p habanalabs: fix memory leak with CBs with unaligned size habanalabs: return correct error code on MMU mapping failure habanalabs: add comments in uapi/misc/habanalabs.h habanalabs: extend QMAN0 job timeout habanalabs: set DMA0 completion to SOB 1007 habanalabs: fix validation of WREG32 to DMA completion habanalabs: fix mmu cache registers init habanalabs: disable CPU access on timeouts habanalabs: add MMU DRAM default page mapping habanalabs: Dissociate RAZWI info from event types misc/habanalabs: adjust Kconfig to fix build errors ...
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig.debug1
-rw-r--r--lib/iomap.c140
2 files changed, 136 insertions, 5 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index e6a7b01932e6..b19cc9c36475 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1682,7 +1682,6 @@ if RUNTIME_TESTING_MENU
1682config LKDTM 1682config LKDTM
1683 tristate "Linux Kernel Dump Test Tool Module" 1683 tristate "Linux Kernel Dump Test Tool Module"
1684 depends on DEBUG_FS 1684 depends on DEBUG_FS
1685 depends on BLOCK
1686 help 1685 help
1687 This module enables testing of the different dumping mechanisms by 1686 This module enables testing of the different dumping mechanisms by
1688 inducing system failures at predefined crash points. 1687 inducing system failures at predefined crash points.
diff --git a/lib/iomap.c b/lib/iomap.c
index 541d926da95e..e909ab71e995 100644
--- a/lib/iomap.c
+++ b/lib/iomap.c
@@ -65,8 +65,9 @@ static void bad_io_access(unsigned long port, const char *access)
65#endif 65#endif
66 66
67#ifndef mmio_read16be 67#ifndef mmio_read16be
68#define mmio_read16be(addr) be16_to_cpu(__raw_readw(addr)) 68#define mmio_read16be(addr) swab16(readw(addr))
69#define mmio_read32be(addr) be32_to_cpu(__raw_readl(addr)) 69#define mmio_read32be(addr) swab32(readl(addr))
70#define mmio_read64be(addr) swab64(readq(addr))
70#endif 71#endif
71 72
72unsigned int ioread8(void __iomem *addr) 73unsigned int ioread8(void __iomem *addr)
@@ -100,14 +101,89 @@ EXPORT_SYMBOL(ioread16be);
100EXPORT_SYMBOL(ioread32); 101EXPORT_SYMBOL(ioread32);
101EXPORT_SYMBOL(ioread32be); 102EXPORT_SYMBOL(ioread32be);
102 103
104#ifdef readq
105static u64 pio_read64_lo_hi(unsigned long port)
106{
107 u64 lo, hi;
108
109 lo = inl(port);
110 hi = inl(port + sizeof(u32));
111
112 return lo | (hi << 32);
113}
114
115static u64 pio_read64_hi_lo(unsigned long port)
116{
117 u64 lo, hi;
118
119 hi = inl(port + sizeof(u32));
120 lo = inl(port);
121
122 return lo | (hi << 32);
123}
124
125static u64 pio_read64be_lo_hi(unsigned long port)
126{
127 u64 lo, hi;
128
129 lo = pio_read32be(port + sizeof(u32));
130 hi = pio_read32be(port);
131
132 return lo | (hi << 32);
133}
134
135static u64 pio_read64be_hi_lo(unsigned long port)
136{
137 u64 lo, hi;
138
139 hi = pio_read32be(port);
140 lo = pio_read32be(port + sizeof(u32));
141
142 return lo | (hi << 32);
143}
144
145u64 ioread64_lo_hi(void __iomem *addr)
146{
147 IO_COND(addr, return pio_read64_lo_hi(port), return readq(addr));
148 return 0xffffffffffffffffULL;
149}
150
151u64 ioread64_hi_lo(void __iomem *addr)
152{
153 IO_COND(addr, return pio_read64_hi_lo(port), return readq(addr));
154 return 0xffffffffffffffffULL;
155}
156
157u64 ioread64be_lo_hi(void __iomem *addr)
158{
159 IO_COND(addr, return pio_read64be_lo_hi(port),
160 return mmio_read64be(addr));
161 return 0xffffffffffffffffULL;
162}
163
164u64 ioread64be_hi_lo(void __iomem *addr)
165{
166 IO_COND(addr, return pio_read64be_hi_lo(port),
167 return mmio_read64be(addr));
168 return 0xffffffffffffffffULL;
169}
170
171EXPORT_SYMBOL(ioread64_lo_hi);
172EXPORT_SYMBOL(ioread64_hi_lo);
173EXPORT_SYMBOL(ioread64be_lo_hi);
174EXPORT_SYMBOL(ioread64be_hi_lo);
175
176#endif /* readq */
177
103#ifndef pio_write16be 178#ifndef pio_write16be
104#define pio_write16be(val,port) outw(swab16(val),port) 179#define pio_write16be(val,port) outw(swab16(val),port)
105#define pio_write32be(val,port) outl(swab32(val),port) 180#define pio_write32be(val,port) outl(swab32(val),port)
106#endif 181#endif
107 182
108#ifndef mmio_write16be 183#ifndef mmio_write16be
109#define mmio_write16be(val,port) __raw_writew(be16_to_cpu(val),port) 184#define mmio_write16be(val,port) writew(swab16(val),port)
110#define mmio_write32be(val,port) __raw_writel(be32_to_cpu(val),port) 185#define mmio_write32be(val,port) writel(swab32(val),port)
186#define mmio_write64be(val,port) writeq(swab64(val),port)
111#endif 187#endif
112 188
113void iowrite8(u8 val, void __iomem *addr) 189void iowrite8(u8 val, void __iomem *addr)
@@ -136,6 +212,62 @@ EXPORT_SYMBOL(iowrite16be);
136EXPORT_SYMBOL(iowrite32); 212EXPORT_SYMBOL(iowrite32);
137EXPORT_SYMBOL(iowrite32be); 213EXPORT_SYMBOL(iowrite32be);
138 214
215#ifdef writeq
216static void pio_write64_lo_hi(u64 val, unsigned long port)
217{
218 outl(val, port);
219 outl(val >> 32, port + sizeof(u32));
220}
221
222static void pio_write64_hi_lo(u64 val, unsigned long port)
223{
224 outl(val >> 32, port + sizeof(u32));
225 outl(val, port);
226}
227
228static void pio_write64be_lo_hi(u64 val, unsigned long port)
229{
230 pio_write32be(val, port + sizeof(u32));
231 pio_write32be(val >> 32, port);
232}
233
234static void pio_write64be_hi_lo(u64 val, unsigned long port)
235{
236 pio_write32be(val >> 32, port);
237 pio_write32be(val, port + sizeof(u32));
238}
239
240void iowrite64_lo_hi(u64 val, void __iomem *addr)
241{
242 IO_COND(addr, pio_write64_lo_hi(val, port),
243 writeq(val, addr));
244}
245
246void iowrite64_hi_lo(u64 val, void __iomem *addr)
247{
248 IO_COND(addr, pio_write64_hi_lo(val, port),
249 writeq(val, addr));
250}
251
252void iowrite64be_lo_hi(u64 val, void __iomem *addr)
253{
254 IO_COND(addr, pio_write64be_lo_hi(val, port),
255 mmio_write64be(val, addr));
256}
257
258void iowrite64be_hi_lo(u64 val, void __iomem *addr)
259{
260 IO_COND(addr, pio_write64be_hi_lo(val, port),
261 mmio_write64be(val, addr));
262}
263
264EXPORT_SYMBOL(iowrite64_lo_hi);
265EXPORT_SYMBOL(iowrite64_hi_lo);
266EXPORT_SYMBOL(iowrite64be_lo_hi);
267EXPORT_SYMBOL(iowrite64be_hi_lo);
268
269#endif /* readq */
270
139/* 271/*
140 * These are the "repeat MMIO read/write" functions. 272 * These are the "repeat MMIO read/write" functions.
141 * Note the "__raw" accesses, since we don't want to 273 * Note the "__raw" accesses, since we don't want to