Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'asm-generic-6.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic

Pull asm-generic updates from Arnd Bergmann:
"This is mainly set of cleanups of asm-generic/io.h, resolving problems
with inconsistent semantics of ioread64/iowrite64 that were causing
runtime and build issues.

The "GENERIC_IOMAP" version that switches between inb()/outb() and
readb()/writeb() style accessors is now only used on architectures
that have PC-style ISA devices that are not memory mapped (x86, uml,
m68k-q40 and powerpc-powernv), while alpha and parisc use a more
complicated variant and everything else just maps the ioread
interfaces to plan MMIO (readb/writeb etc).

In addition there are two small changes from Raag Jadav to simplify
the asm-generic/io.h indirect inclusions and from Jann Horn to fix a
corner case with read_word_at_a_time"

* tag 'asm-generic-6.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
rwonce: fix crash by removing READ_ONCE() for unaligned read
rwonce: handle KCSAN like KASAN in read_word_at_a_time()
m68k: coldfire: select PCI_IOMAP for PCI
mips: export pci_iounmap()
mips: fix PCI_IOBASE definition
m68k/nommu: stop using GENERIC_IOMAP
mips: drop GENERIC_IOMAP wrapper
powerpc: asm/io.h: remove split ioread64/iowrite64 helpers
parisc: stop using asm-generic/iomap.h
sh: remove duplicate ioread/iowrite helpers
alpha: stop using asm-generic/iomap.h
io.h: drop unused headers
drm/draw: include missing headers
asm-generic/io.h: rework split ioread64/iowrite64 helpers

+167 -355
+17 -14
arch/alpha/include/asm/io.h
··· 10 10 #include <asm/machvec.h> 11 11 #include <asm/hwrpb.h> 12 12 13 - /* The generic header contains only prototypes. Including it ensures that 14 - the implementation we have here matches that interface. */ 15 - #include <asm-generic/iomap.h> 16 - 17 13 /* 18 14 * Virtual -> physical identity mapping starts at this offset 19 15 */ ··· 272 276 #define __raw_writel __raw_writel 273 277 #define __raw_writeq __raw_writeq 274 278 275 - /* 276 - * Mapping from port numbers to __iomem space is pretty easy. 277 - */ 279 + extern unsigned int ioread8(const void __iomem *); 280 + extern unsigned int ioread16(const void __iomem *); 281 + extern unsigned int ioread32(const void __iomem *); 282 + extern u64 ioread64(const void __iomem *); 278 283 279 - /* These two have to be extern inline because of the extern prototype from 280 - <asm-generic/iomap.h>. It is not legal to mix "extern" and "static" for 281 - the same declaration. */ 284 + extern void iowrite8(u8, void __iomem *); 285 + extern void iowrite16(u16, void __iomem *); 286 + extern void iowrite32(u32, void __iomem *); 287 + extern void iowrite64(u64, void __iomem *); 288 + 289 + extern void ioread8_rep(const void __iomem *port, void *buf, unsigned long count); 290 + extern void ioread16_rep(const void __iomem *port, void *buf, unsigned long count); 291 + extern void ioread32_rep(const void __iomem *port, void *buf, unsigned long count); 292 + 293 + extern void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count); 294 + extern void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count); 295 + extern void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count); 296 + 282 297 extern inline void __iomem *ioport_map(unsigned long port, unsigned int size) 283 298 { 284 299 return IO_CONCAT(__IO_PREFIX,ioportmap) (port); ··· 636 629 #define RTC_PORT(x) (0x70 + (x)) 637 630 #define RTC_ALWAYS_BCD 0 638 631 639 - /* 640 - * These get provided from <asm-generic/iomap.h> since alpha does not 641 - * select GENERIC_IOMAP. 642 - */ 643 632 #define ioread64 ioread64 644 633 #define iowrite64 iowrite64 645 634 #define ioread8_rep ioread8_rep
+2 -1
arch/m68k/Kconfig
··· 18 18 select DMA_DIRECT_REMAP if M68K_NONCOHERENT_DMA && !COLDFIRE 19 19 select GENERIC_ATOMIC64 20 20 select GENERIC_CPU_DEVICES 21 - select GENERIC_IOMAP if HAS_IOPORT 21 + select GENERIC_IOMAP if HAS_IOPORT && MMU && !COLDFIRE 22 22 select GENERIC_IRQ_SHOW 23 23 select GENERIC_LIB_ASHLDI3 24 24 select GENERIC_LIB_ASHRDI3 25 25 select GENERIC_LIB_LSHRDI3 26 26 select GENERIC_LIB_MULDI3 27 + select GENERIC_PCI_IOMAP if PCI 27 28 select HAS_IOPORT if PCI || ISA || ATARI_ROM_ISA 28 29 select HAVE_ARCH_LIBGCC_H 29 30 select HAVE_ARCH_SECCOMP
-4
arch/m68k/include/asm/io_no.h
··· 123 123 #define PCI_IO_SIZE 0x00010000 /* 64k */ 124 124 #define PCI_IO_MASK (PCI_IO_SIZE - 1) 125 125 126 - #define HAVE_ARCH_PIO_SIZE 127 - #define PIO_OFFSET 0 128 - #define PIO_MASK 0xffff 129 - #define PIO_RESERVED 0x10000 130 126 #define PCI_IOBASE ((void __iomem *) PCI_IO_PA) 131 127 #define PCI_SPACE_LIMIT PCI_IO_MASK 132 128 #endif /* CONFIG_PCI */
+1 -1
arch/mips/Kconfig
··· 38 38 select GENERIC_CMOS_UPDATE 39 39 select GENERIC_CPU_AUTOPROBE 40 40 select GENERIC_GETTIMEOFDAY 41 - select GENERIC_IOMAP 42 41 select GENERIC_IRQ_PROBE 43 42 select GENERIC_IRQ_SHOW 44 43 select GENERIC_ISA_DMA if EISA ··· 46 47 select GENERIC_LIB_CMPDI2 47 48 select GENERIC_LIB_LSHRDI3 48 49 select GENERIC_LIB_UCMPDI2 50 + select GENERIC_PCI_IOMAP 49 51 select GENERIC_SCHED_CLOCK if !CAVIUM_OCTEON_SOC 50 52 select GENERIC_SMP_IDLE_THREAD 51 53 select GENERIC_IDLE_POLL_SETUP
+12 -13
arch/mips/include/asm/io.h
··· 67 67 } 68 68 69 69 /* 70 - * Provide the necessary definitions for generic iomap. We make use of 71 - * mips_io_port_base for iomap(), but we don't reserve any low addresses for 72 - * use with I/O ports. 73 - */ 74 - 75 - #define HAVE_ARCH_PIO_SIZE 76 - #define PIO_OFFSET mips_io_port_base 77 - #define PIO_MASK IO_SPACE_LIMIT 78 - #define PIO_RESERVED 0x0UL 79 - 80 - /* 81 70 * Enforce in-order execution of data I/O. In the MIPS architecture 82 71 * these are equivalent to corresponding platform-specific memory 83 72 * barriers defined in <asm/barrier.h>. API pinched from PowerPC, ··· 386 397 } \ 387 398 } \ 388 399 \ 389 - static inline void reads##bwlq(volatile void __iomem *mem, void *addr, \ 390 - unsigned int count) \ 400 + static inline void reads##bwlq(const volatile void __iomem *mem, \ 401 + void *addr, unsigned int count) \ 391 402 { \ 392 403 volatile type *__addr = addr; \ 393 404 \ ··· 543 554 #define outsl outsl 544 555 545 556 void __ioread64_copy(void *to, const void __iomem *from, size_t count); 557 + 558 + #if defined(CONFIG_PCI) && defined(CONFIG_PCI_DRIVERS_LEGACY) 559 + struct pci_dev; 560 + void pci_iounmap(struct pci_dev *dev, void __iomem *addr); 561 + #define pci_iounmap pci_iounmap 562 + #endif 563 + 564 + #ifndef PCI_IOBASE 565 + #define PCI_IOBASE ((void __iomem *)mips_io_port_base) 566 + #endif 546 567 547 568 #include <asm-generic/io.h> 548 569
+3 -2
arch/mips/include/asm/mach-loongson64/spaces.h
··· 7 7 #endif /* CONFIG_64BIT */ 8 8 9 9 /* Skip 128k to trap NULL pointer dereferences */ 10 - #define PCI_IOBASE _AC(0xc000000000000000 + SZ_128K, UL) 10 + #define PCI_PORT_BASE _AC(0xc000000000000000 + SZ_128K, UL) 11 + #define PCI_IOBASE (void __iomem *)PCI_PORT_BASE 11 12 #define PCI_IOSIZE SZ_16M 12 - #define MAP_BASE (PCI_IOBASE + PCI_IOSIZE) 13 + #define MAP_BASE (PCI_PORT_BASE + PCI_IOSIZE) 13 14 14 15 #define IO_SPACE_LIMIT (PCI_IOSIZE - 1) 15 16
+1 -1
arch/mips/include/asm/mach-ralink/spaces.h
··· 2 2 #ifndef __ASM_MACH_RALINK_SPACES_H_ 3 3 #define __ASM_MACH_RALINK_SPACES_H_ 4 4 5 - #define PCI_IOBASE mips_io_port_base 5 + #define PCI_IOBASE (void __iomem *)mips_io_port_base 6 6 #define PCI_IOSIZE SZ_64K 7 7 #define IO_SPACE_LIMIT (PCI_IOSIZE - 1) 8 8
+10
arch/mips/lib/iomap-pci.c
··· 43 43 return (void __iomem *) (ctrl->io_map_base + port); 44 44 } 45 45 46 + void pci_iounmap(struct pci_dev *dev, void __iomem *addr) 47 + { 48 + struct pci_controller *ctrl = dev->bus->sysdata; 49 + void __iomem *base = (void __iomem *)ctrl->io_map_base; 50 + 51 + if (addr < base || addr > (base + resource_size(ctrl->io_resource))) 52 + iounmap(addr); 53 + } 54 + EXPORT_SYMBOL(pci_iounmap); 55 + 46 56 #endif /* CONFIG_PCI_DRIVERS_LEGACY */
+2 -2
arch/mips/loongson64/init.c
··· 128 128 } 129 129 130 130 /* init base address of io space */ 131 - set_io_port_base(PCI_IOBASE); 131 + set_io_port_base((unsigned long)PCI_IOBASE); 132 132 133 133 if (loongson_sysconf.early_config) 134 134 loongson_sysconf.early_config(); ··· 178 178 return -EINVAL; 179 179 } 180 180 181 - vaddr = PCI_IOBASE + range->io_start; 181 + vaddr = (unsigned long)PCI_IOBASE + range->io_start; 182 182 183 183 vmap_page_range(vaddr, vaddr + size, hw_start, pgprot_device(PAGE_KERNEL)); 184 184
+27 -9
arch/parisc/include/asm/io.h
··· 227 227 #define F_EXTEND(x) ((unsigned long)((x) | (0xffffffff00000000ULL))) 228 228 229 229 #ifdef CONFIG_64BIT 230 - #define ioread64 ioread64 231 - #define ioread64be ioread64be 232 - #define iowrite64 iowrite64 233 - #define iowrite64be iowrite64be 234 230 extern u64 ioread64(const void __iomem *addr); 235 231 extern u64 ioread64be(const void __iomem *addr); 232 + #define ioread64 ioread64 233 + #define ioread64be ioread64be 234 + 236 235 extern void iowrite64(u64 val, void __iomem *addr); 237 236 extern void iowrite64be(u64 val, void __iomem *addr); 237 + #define iowrite64 iowrite64 238 + #define iowrite64be iowrite64be 238 239 #endif 239 240 240 - #include <asm-generic/iomap.h> 241 - /* 242 - * These get provided from <asm-generic/iomap.h> since parisc does not 243 - * select GENERIC_IOMAP. 244 - */ 241 + extern void __iomem *ioport_map(unsigned long port, unsigned int nr); 242 + extern void ioport_unmap(void __iomem *); 245 243 #define ioport_map ioport_map 246 244 #define ioport_unmap ioport_unmap 245 + 246 + extern unsigned int ioread8(const void __iomem *); 247 + extern unsigned int ioread16(const void __iomem *); 248 + extern unsigned int ioread16be(const void __iomem *); 249 + extern unsigned int ioread32(const void __iomem *); 250 + extern unsigned int ioread32be(const void __iomem *); 247 251 #define ioread8 ioread8 248 252 #define ioread16 ioread16 249 253 #define ioread32 ioread32 250 254 #define ioread16be ioread16be 251 255 #define ioread32be ioread32be 256 + 257 + extern void iowrite8(u8, void __iomem *); 258 + extern void iowrite16(u16, void __iomem *); 259 + extern void iowrite16be(u16, void __iomem *); 260 + extern void iowrite32(u32, void __iomem *); 261 + extern void iowrite32be(u32, void __iomem *); 252 262 #define iowrite8 iowrite8 253 263 #define iowrite16 iowrite16 254 264 #define iowrite32 iowrite32 255 265 #define iowrite16be iowrite16be 256 266 #define iowrite32be iowrite32be 267 + 268 + extern void ioread8_rep(const void __iomem *port, void *buf, unsigned long count); 269 + extern void ioread16_rep(const void __iomem *port, void *buf, unsigned long count); 270 + extern void ioread32_rep(const void __iomem *port, void *buf, unsigned long count); 257 271 #define ioread8_rep ioread8_rep 258 272 #define ioread16_rep ioread16_rep 259 273 #define ioread32_rep ioread32_rep 274 + 275 + extern void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count); 276 + extern void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count); 277 + extern void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count); 260 278 #define iowrite8_rep iowrite8_rep 261 279 #define iowrite16_rep iowrite16_rep 262 280 #define iowrite32_rep iowrite32_rep
-48
arch/powerpc/include/asm/io.h
··· 738 738 #define ioread32be ioread32be 739 739 740 740 #ifdef __powerpc64__ 741 - static inline u64 ioread64_lo_hi(const void __iomem *addr) 742 - { 743 - return readq(addr); 744 - } 745 - #define ioread64_lo_hi ioread64_lo_hi 746 - 747 - static inline u64 ioread64_hi_lo(const void __iomem *addr) 748 - { 749 - return readq(addr); 750 - } 751 - #define ioread64_hi_lo ioread64_hi_lo 752 - 753 741 static inline u64 ioread64be(const void __iomem *addr) 754 742 { 755 743 return readq_be(addr); 756 744 } 757 745 #define ioread64be ioread64be 758 - 759 - static inline u64 ioread64be_lo_hi(const void __iomem *addr) 760 - { 761 - return readq_be(addr); 762 - } 763 - #define ioread64be_lo_hi ioread64be_lo_hi 764 - 765 - static inline u64 ioread64be_hi_lo(const void __iomem *addr) 766 - { 767 - return readq_be(addr); 768 - } 769 - #define ioread64be_hi_lo ioread64be_hi_lo 770 746 #endif /* __powerpc64__ */ 771 747 772 748 static inline void iowrite16be(u16 val, void __iomem *addr) ··· 758 782 #define iowrite32be iowrite32be 759 783 760 784 #ifdef __powerpc64__ 761 - static inline void iowrite64_lo_hi(u64 val, void __iomem *addr) 762 - { 763 - writeq(val, addr); 764 - } 765 - #define iowrite64_lo_hi iowrite64_lo_hi 766 - 767 - static inline void iowrite64_hi_lo(u64 val, void __iomem *addr) 768 - { 769 - writeq(val, addr); 770 - } 771 - #define iowrite64_hi_lo iowrite64_hi_lo 772 - 773 785 static inline void iowrite64be(u64 val, void __iomem *addr) 774 786 { 775 787 writeq_be(val, addr); 776 788 } 777 789 #define iowrite64be iowrite64be 778 - 779 - static inline void iowrite64be_lo_hi(u64 val, void __iomem *addr) 780 - { 781 - writeq_be(val, addr); 782 - } 783 - #define iowrite64be_lo_hi iowrite64be_lo_hi 784 - 785 - static inline void iowrite64be_hi_lo(u64 val, void __iomem *addr) 786 - { 787 - writeq_be(val, addr); 788 - } 789 - #define iowrite64be_hi_lo iowrite64be_hi_lo 790 790 #endif /* __powerpc64__ */ 791 791 792 792 struct pci_dev;
+5 -25
arch/sh/include/asm/io.h
··· 19 19 #include <asm/machvec.h> 20 20 #include <asm/page.h> 21 21 #include <linux/pgtable.h> 22 - #include <asm-generic/iomap.h> 23 22 24 23 #define __IO_PREFIX generic 25 24 #include <asm/io_generic.h> ··· 99 100 } \ 100 101 } \ 101 102 \ 102 - static inline void pfx##reads##bwlq(volatile void __iomem *mem, \ 103 + static inline void pfx##reads##bwlq(const volatile void __iomem *mem, \ 103 104 void *addr, unsigned int count) \ 104 105 { \ 105 106 volatile type *__addr = addr; \ ··· 113 114 __BUILD_MEMORY_STRING(__raw_, b, u8) 114 115 __BUILD_MEMORY_STRING(__raw_, w, u16) 115 116 116 - void __raw_writesl(void __iomem *addr, const void *data, int longlen); 117 - void __raw_readsl(const void __iomem *addr, void *data, int longlen); 117 + void __raw_writesl(void volatile __iomem *addr, const void *data, int longlen); 118 + void __raw_readsl(const volatile void __iomem *addr, void *data, int longlen); 118 119 119 120 __BUILD_MEMORY_STRING(__raw_, q, u64) 120 121 121 122 #define ioport_map ioport_map 122 - #define ioport_unmap ioport_unmap 123 123 #define pci_iounmap pci_iounmap 124 124 125 - #define ioread8 ioread8 126 - #define ioread16 ioread16 127 - #define ioread16be ioread16be 128 - #define ioread32 ioread32 129 - #define ioread32be ioread32be 130 - 131 - #define iowrite8 iowrite8 132 - #define iowrite16 iowrite16 133 - #define iowrite16be iowrite16be 134 - #define iowrite32 iowrite32 135 - #define iowrite32be iowrite32be 136 - 137 - #define ioread8_rep ioread8_rep 138 - #define ioread16_rep ioread16_rep 139 - #define ioread32_rep ioread32_rep 140 - 141 - #define iowrite8_rep iowrite8_rep 142 - #define iowrite16_rep iowrite16_rep 143 - #define iowrite32_rep iowrite32_rep 144 - 145 125 #ifdef CONFIG_HAS_IOPORT_MAP 126 + 127 + extern void __iomem *ioport_map(unsigned long port, unsigned int nr); 146 128 147 129 /* 148 130 * Slowdown I/O port space accesses for antique hardware.
-3
arch/sh/kernel/Makefile
··· 21 21 syscalls_32.o time.o topology.o traps.o \ 22 22 traps_32.o unwinder.o 23 23 24 - ifndef CONFIG_GENERIC_IOMAP 25 - obj-y += iomap.o 26 24 obj-$(CONFIG_HAS_IOPORT_MAP) += ioport.o 27 - endif 28 25 29 26 obj-y += sys_sh32.o 30 27 obj-y += cpu/
-162
arch/sh/kernel/iomap.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * arch/sh/kernel/iomap.c 4 - * 5 - * Copyright (C) 2000 Niibe Yutaka 6 - * Copyright (C) 2005 - 2007 Paul Mundt 7 - */ 8 - #include <linux/module.h> 9 - #include <linux/io.h> 10 - 11 - unsigned int ioread8(const void __iomem *addr) 12 - { 13 - return readb(addr); 14 - } 15 - EXPORT_SYMBOL(ioread8); 16 - 17 - unsigned int ioread16(const void __iomem *addr) 18 - { 19 - return readw(addr); 20 - } 21 - EXPORT_SYMBOL(ioread16); 22 - 23 - unsigned int ioread16be(const void __iomem *addr) 24 - { 25 - return be16_to_cpu(__raw_readw(addr)); 26 - } 27 - EXPORT_SYMBOL(ioread16be); 28 - 29 - unsigned int ioread32(const void __iomem *addr) 30 - { 31 - return readl(addr); 32 - } 33 - EXPORT_SYMBOL(ioread32); 34 - 35 - unsigned int ioread32be(const void __iomem *addr) 36 - { 37 - return be32_to_cpu(__raw_readl(addr)); 38 - } 39 - EXPORT_SYMBOL(ioread32be); 40 - 41 - void iowrite8(u8 val, void __iomem *addr) 42 - { 43 - writeb(val, addr); 44 - } 45 - EXPORT_SYMBOL(iowrite8); 46 - 47 - void iowrite16(u16 val, void __iomem *addr) 48 - { 49 - writew(val, addr); 50 - } 51 - EXPORT_SYMBOL(iowrite16); 52 - 53 - void iowrite16be(u16 val, void __iomem *addr) 54 - { 55 - __raw_writew(cpu_to_be16(val), addr); 56 - } 57 - EXPORT_SYMBOL(iowrite16be); 58 - 59 - void iowrite32(u32 val, void __iomem *addr) 60 - { 61 - writel(val, addr); 62 - } 63 - EXPORT_SYMBOL(iowrite32); 64 - 65 - void iowrite32be(u32 val, void __iomem *addr) 66 - { 67 - __raw_writel(cpu_to_be32(val), addr); 68 - } 69 - EXPORT_SYMBOL(iowrite32be); 70 - 71 - /* 72 - * These are the "repeat MMIO read/write" functions. 73 - * Note the "__raw" accesses, since we don't want to 74 - * convert to CPU byte order. We write in "IO byte 75 - * order" (we also don't have IO barriers). 76 - */ 77 - static inline void mmio_insb(const void __iomem *addr, u8 *dst, int count) 78 - { 79 - while (--count >= 0) { 80 - u8 data = __raw_readb(addr); 81 - *dst = data; 82 - dst++; 83 - } 84 - } 85 - 86 - static inline void mmio_insw(const void __iomem *addr, u16 *dst, int count) 87 - { 88 - while (--count >= 0) { 89 - u16 data = __raw_readw(addr); 90 - *dst = data; 91 - dst++; 92 - } 93 - } 94 - 95 - static inline void mmio_insl(const void __iomem *addr, u32 *dst, int count) 96 - { 97 - while (--count >= 0) { 98 - u32 data = __raw_readl(addr); 99 - *dst = data; 100 - dst++; 101 - } 102 - } 103 - 104 - static inline void mmio_outsb(void __iomem *addr, const u8 *src, int count) 105 - { 106 - while (--count >= 0) { 107 - __raw_writeb(*src, addr); 108 - src++; 109 - } 110 - } 111 - 112 - static inline void mmio_outsw(void __iomem *addr, const u16 *src, int count) 113 - { 114 - while (--count >= 0) { 115 - __raw_writew(*src, addr); 116 - src++; 117 - } 118 - } 119 - 120 - static inline void mmio_outsl(void __iomem *addr, const u32 *src, int count) 121 - { 122 - while (--count >= 0) { 123 - __raw_writel(*src, addr); 124 - src++; 125 - } 126 - } 127 - 128 - void ioread8_rep(const void __iomem *addr, void *dst, unsigned long count) 129 - { 130 - mmio_insb(addr, dst, count); 131 - } 132 - EXPORT_SYMBOL(ioread8_rep); 133 - 134 - void ioread16_rep(const void __iomem *addr, void *dst, unsigned long count) 135 - { 136 - mmio_insw(addr, dst, count); 137 - } 138 - EXPORT_SYMBOL(ioread16_rep); 139 - 140 - void ioread32_rep(const void __iomem *addr, void *dst, unsigned long count) 141 - { 142 - mmio_insl(addr, dst, count); 143 - } 144 - EXPORT_SYMBOL(ioread32_rep); 145 - 146 - void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) 147 - { 148 - mmio_outsb(addr, src, count); 149 - } 150 - EXPORT_SYMBOL(iowrite8_rep); 151 - 152 - void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) 153 - { 154 - mmio_outsw(addr, src, count); 155 - } 156 - EXPORT_SYMBOL(iowrite16_rep); 157 - 158 - void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) 159 - { 160 - mmio_outsl(addr, src, count); 161 - } 162 - EXPORT_SYMBOL(iowrite32_rep);
-5
arch/sh/kernel/ioport.c
··· 23 23 return (void __iomem *)(port + sh_io_port_base); 24 24 } 25 25 EXPORT_SYMBOL(ioport_map); 26 - 27 - void ioport_unmap(void __iomem *addr) 28 - { 29 - } 30 - EXPORT_SYMBOL(ioport_unmap);
+2 -2
arch/sh/lib/io.c
··· 11 11 #include <linux/module.h> 12 12 #include <linux/io.h> 13 13 14 - void __raw_readsl(const void __iomem *addr, void *datap, int len) 14 + void __raw_readsl(const volatile void __iomem *addr, void *datap, int len) 15 15 { 16 16 u32 *data; 17 17 ··· 60 60 } 61 61 EXPORT_SYMBOL(__raw_readsl); 62 62 63 - void __raw_writesl(void __iomem *addr, const void *data, int len) 63 + void __raw_writesl(volatile void __iomem *addr, const void *data, int len) 64 64 { 65 65 if (likely(len != 0)) { 66 66 int tmp1;
+2
drivers/gpu/drm/drm_draw.c
··· 5 5 */ 6 6 7 7 #include <linux/bits.h> 8 + #include <linux/bug.h> 9 + #include <linux/export.h> 8 10 #include <linux/iosys-map.h> 9 11 #include <linux/types.h> 10 12
+14 -11
drivers/sh/clk/cpg.c
··· 26 26 return ioread32(clk->mapped_reg); 27 27 } 28 28 29 + static unsigned int sh_clk_read_status(struct clk *clk) 30 + { 31 + void __iomem *mapped_status = (phys_addr_t)clk->status_reg - 32 + (phys_addr_t)clk->enable_reg + clk->mapped_reg; 33 + 34 + if (clk->flags & CLK_ENABLE_REG_8BIT) 35 + return ioread8(mapped_status); 36 + else if (clk->flags & CLK_ENABLE_REG_16BIT) 37 + return ioread16(mapped_status); 38 + 39 + return ioread32(mapped_status); 40 + } 41 + 29 42 static void sh_clk_write(int value, struct clk *clk) 30 43 { 31 44 if (clk->flags & CLK_ENABLE_REG_8BIT) ··· 53 40 { 54 41 sh_clk_write(sh_clk_read(clk) & ~(1 << clk->enable_bit), clk); 55 42 if (clk->status_reg) { 56 - unsigned int (*read)(const void __iomem *addr); 57 43 int i; 58 - void __iomem *mapped_status = (phys_addr_t)clk->status_reg - 59 - (phys_addr_t)clk->enable_reg + clk->mapped_reg; 60 - 61 - if (clk->flags & CLK_ENABLE_REG_8BIT) 62 - read = ioread8; 63 - else if (clk->flags & CLK_ENABLE_REG_16BIT) 64 - read = ioread16; 65 - else 66 - read = ioread32; 67 44 68 45 for (i = 1000; 69 - (read(mapped_status) & (1 << clk->enable_bit)) && i; 46 + (sh_clk_read_status(clk) & (1 << clk->enable_bit)) && i; 70 47 i--) 71 48 cpu_relax(); 72 49 if (!i) {
+8 -28
include/asm-generic/iomap.h
··· 31 31 extern unsigned int ioread16be(const void __iomem *); 32 32 extern unsigned int ioread32(const void __iomem *); 33 33 extern unsigned int ioread32be(const void __iomem *); 34 - #ifdef CONFIG_64BIT 35 - extern u64 ioread64(const void __iomem *); 36 - extern u64 ioread64be(const void __iomem *); 37 - #endif 38 34 39 - #ifdef readq 40 - #define ioread64_lo_hi ioread64_lo_hi 41 - #define ioread64_hi_lo ioread64_hi_lo 42 - #define ioread64be_lo_hi ioread64be_lo_hi 43 - #define ioread64be_hi_lo ioread64be_hi_lo 44 - extern u64 ioread64_lo_hi(const void __iomem *addr); 45 - extern u64 ioread64_hi_lo(const void __iomem *addr); 46 - extern u64 ioread64be_lo_hi(const void __iomem *addr); 47 - extern u64 ioread64be_hi_lo(const void __iomem *addr); 48 - #endif 35 + extern u64 __ioread64_lo_hi(const void __iomem *addr); 36 + extern u64 __ioread64_hi_lo(const void __iomem *addr); 37 + extern u64 __ioread64be_lo_hi(const void __iomem *addr); 38 + extern u64 __ioread64be_hi_lo(const void __iomem *addr); 49 39 50 40 extern void iowrite8(u8, void __iomem *); 51 41 extern void iowrite16(u16, void __iomem *); 52 42 extern void iowrite16be(u16, void __iomem *); 53 43 extern void iowrite32(u32, void __iomem *); 54 44 extern void iowrite32be(u32, void __iomem *); 55 - #ifdef CONFIG_64BIT 56 - extern void iowrite64(u64, void __iomem *); 57 - extern void iowrite64be(u64, void __iomem *); 58 - #endif 59 45 60 - #ifdef writeq 61 - #define iowrite64_lo_hi iowrite64_lo_hi 62 - #define iowrite64_hi_lo iowrite64_hi_lo 63 - #define iowrite64be_lo_hi iowrite64be_lo_hi 64 - #define iowrite64be_hi_lo iowrite64be_hi_lo 65 - extern void iowrite64_lo_hi(u64 val, void __iomem *addr); 66 - extern void iowrite64_hi_lo(u64 val, void __iomem *addr); 67 - extern void iowrite64be_lo_hi(u64 val, void __iomem *addr); 68 - extern void iowrite64be_hi_lo(u64 val, void __iomem *addr); 69 - #endif 46 + extern void __iowrite64_lo_hi(u64 val, void __iomem *addr); 47 + extern void __iowrite64_hi_lo(u64 val, void __iomem *addr); 48 + extern void __iowrite64be_lo_hi(u64 val, void __iomem *addr); 49 + extern void __iowrite64be_hi_lo(u64 val, void __iomem *addr); 70 50 71 51 /* 72 52 * "string" versions of the above. Note that they
+9 -1
include/asm-generic/rwonce.h
··· 79 79 (typeof(x))__read_once_word_nocheck(&(x)); \ 80 80 }) 81 81 82 - static __no_kasan_or_inline 82 + static __no_sanitize_or_inline 83 83 unsigned long read_word_at_a_time(const void *addr) 84 84 { 85 + /* open-coded instrument_read(addr, 1) */ 85 86 kasan_check_read(addr, 1); 87 + kcsan_check_read(addr, 1); 88 + 89 + /* 90 + * This load can race with concurrent stores to out-of-bounds memory, 91 + * but READ_ONCE() can't be used because it requires higher alignment 92 + * than plain loads in arm64 builds with LTO. 93 + */ 86 94 return *(unsigned long *)addr; 87 95 } 88 96
+16
include/linux/io-64-nonatomic-hi-lo.h
··· 101 101 102 102 #ifndef ioread64 103 103 #define ioread64_is_nonatomic 104 + #if defined(CONFIG_GENERIC_IOMAP) && defined(CONFIG_64BIT) 105 + #define ioread64 __ioread64_hi_lo 106 + #else 104 107 #define ioread64 ioread64_hi_lo 108 + #endif 105 109 #endif 106 110 107 111 #ifndef iowrite64 108 112 #define iowrite64_is_nonatomic 113 + #if defined(CONFIG_GENERIC_IOMAP) && defined(CONFIG_64BIT) 114 + #define iowrite64 __iowrite64_hi_lo 115 + #else 109 116 #define iowrite64 iowrite64_hi_lo 117 + #endif 110 118 #endif 111 119 112 120 #ifndef ioread64be 113 121 #define ioread64be_is_nonatomic 122 + #if defined(CONFIG_GENERIC_IOMAP) && defined(CONFIG_64BIT) 123 + #define ioread64be __ioread64be_hi_lo 124 + #else 114 125 #define ioread64be ioread64be_hi_lo 126 + #endif 115 127 #endif 116 128 117 129 #ifndef iowrite64be 118 130 #define iowrite64be_is_nonatomic 131 + #if defined(CONFIG_GENERIC_IOMAP) && defined(CONFIG_64BIT) 132 + #define iowrite64be __iowrite64be_hi_lo 133 + #else 119 134 #define iowrite64be iowrite64be_hi_lo 135 + #endif 120 136 #endif 121 137 122 138 #endif /* _LINUX_IO_64_NONATOMIC_HI_LO_H_ */
+16
include/linux/io-64-nonatomic-lo-hi.h
··· 101 101 102 102 #ifndef ioread64 103 103 #define ioread64_is_nonatomic 104 + #if defined(CONFIG_GENERIC_IOMAP) && defined(CONFIG_64BIT) 105 + #define ioread64 __ioread64_lo_hi 106 + #else 104 107 #define ioread64 ioread64_lo_hi 108 + #endif 105 109 #endif 106 110 107 111 #ifndef iowrite64 108 112 #define iowrite64_is_nonatomic 113 + #if defined(CONFIG_GENERIC_IOMAP) && defined(CONFIG_64BIT) 114 + #define iowrite64 __iowrite64_lo_hi 115 + #else 109 116 #define iowrite64 iowrite64_lo_hi 117 + #endif 110 118 #endif 111 119 112 120 #ifndef ioread64be 113 121 #define ioread64be_is_nonatomic 122 + #if defined(CONFIG_GENERIC_IOMAP) && defined(CONFIG_64BIT) 123 + #define ioread64be __ioread64be_lo_hi 124 + #else 114 125 #define ioread64be ioread64be_lo_hi 126 + #endif 115 127 #endif 116 128 117 129 #ifndef iowrite64be 118 130 #define iowrite64be_is_nonatomic 131 + #if defined(CONFIG_GENERIC_IOMAP) && defined(CONFIG_64BIT) 132 + #define iowrite64be __iowrite64be_lo_hi 133 + #else 119 134 #define iowrite64be iowrite64be_lo_hi 135 + #endif 120 136 #endif 121 137 122 138 #endif /* _LINUX_IO_64_NONATOMIC_LO_HI_H_ */
-3
include/linux/io.h
··· 9 9 #include <linux/sizes.h> 10 10 #include <linux/types.h> 11 11 #include <linux/init.h> 12 - #include <linux/bug.h> 13 - #include <linux/err.h> 14 12 #include <asm/io.h> 15 13 #include <asm/page.h> 16 14 17 15 struct device; 18 - struct resource; 19 16 20 17 #ifndef __iowrite32_copy 21 18 void __iowrite32_copy(void __iomem *to, const void *from, size_t count);
+20 -20
lib/iomap.c
··· 111 111 EXPORT_SYMBOL(ioread32); 112 112 EXPORT_SYMBOL(ioread32be); 113 113 114 - #ifdef readq 114 + #ifdef CONFIG_64BIT 115 115 static u64 pio_read64_lo_hi(unsigned long port) 116 116 { 117 117 u64 lo, hi; ··· 153 153 } 154 154 155 155 __no_kmsan_checks 156 - u64 ioread64_lo_hi(const void __iomem *addr) 156 + u64 __ioread64_lo_hi(const void __iomem *addr) 157 157 { 158 158 IO_COND(addr, return pio_read64_lo_hi(port), return readq(addr)); 159 159 return 0xffffffffffffffffULL; 160 160 } 161 161 162 162 __no_kmsan_checks 163 - u64 ioread64_hi_lo(const void __iomem *addr) 163 + u64 __ioread64_hi_lo(const void __iomem *addr) 164 164 { 165 165 IO_COND(addr, return pio_read64_hi_lo(port), return readq(addr)); 166 166 return 0xffffffffffffffffULL; 167 167 } 168 168 169 169 __no_kmsan_checks 170 - u64 ioread64be_lo_hi(const void __iomem *addr) 170 + u64 __ioread64be_lo_hi(const void __iomem *addr) 171 171 { 172 172 IO_COND(addr, return pio_read64be_lo_hi(port), 173 173 return mmio_read64be(addr)); ··· 175 175 } 176 176 177 177 __no_kmsan_checks 178 - u64 ioread64be_hi_lo(const void __iomem *addr) 178 + u64 __ioread64be_hi_lo(const void __iomem *addr) 179 179 { 180 180 IO_COND(addr, return pio_read64be_hi_lo(port), 181 181 return mmio_read64be(addr)); 182 182 return 0xffffffffffffffffULL; 183 183 } 184 184 185 - EXPORT_SYMBOL(ioread64_lo_hi); 186 - EXPORT_SYMBOL(ioread64_hi_lo); 187 - EXPORT_SYMBOL(ioread64be_lo_hi); 188 - EXPORT_SYMBOL(ioread64be_hi_lo); 185 + EXPORT_SYMBOL(__ioread64_lo_hi); 186 + EXPORT_SYMBOL(__ioread64_hi_lo); 187 + EXPORT_SYMBOL(__ioread64be_lo_hi); 188 + EXPORT_SYMBOL(__ioread64be_hi_lo); 189 189 190 - #endif /* readq */ 190 + #endif /* CONFIG_64BIT */ 191 191 192 192 #ifndef pio_write16be 193 193 #define pio_write16be(val,port) outw(swab16(val),port) ··· 236 236 EXPORT_SYMBOL(iowrite32); 237 237 EXPORT_SYMBOL(iowrite32be); 238 238 239 - #ifdef writeq 239 + #ifdef CONFIG_64BIT 240 240 static void pio_write64_lo_hi(u64 val, unsigned long port) 241 241 { 242 242 outl(val, port); ··· 261 261 pio_write32be(val, port + sizeof(u32)); 262 262 } 263 263 264 - void iowrite64_lo_hi(u64 val, void __iomem *addr) 264 + void __iowrite64_lo_hi(u64 val, void __iomem *addr) 265 265 { 266 266 /* Make sure uninitialized memory isn't copied to devices. */ 267 267 kmsan_check_memory(&val, sizeof(val)); ··· 269 269 writeq(val, addr)); 270 270 } 271 271 272 - void iowrite64_hi_lo(u64 val, void __iomem *addr) 272 + void __iowrite64_hi_lo(u64 val, void __iomem *addr) 273 273 { 274 274 /* Make sure uninitialized memory isn't copied to devices. */ 275 275 kmsan_check_memory(&val, sizeof(val)); ··· 277 277 writeq(val, addr)); 278 278 } 279 279 280 - void iowrite64be_lo_hi(u64 val, void __iomem *addr) 280 + void __iowrite64be_lo_hi(u64 val, void __iomem *addr) 281 281 { 282 282 /* Make sure uninitialized memory isn't copied to devices. */ 283 283 kmsan_check_memory(&val, sizeof(val)); ··· 285 285 mmio_write64be(val, addr)); 286 286 } 287 287 288 - void iowrite64be_hi_lo(u64 val, void __iomem *addr) 288 + void __iowrite64be_hi_lo(u64 val, void __iomem *addr) 289 289 { 290 290 /* Make sure uninitialized memory isn't copied to devices. */ 291 291 kmsan_check_memory(&val, sizeof(val)); ··· 293 293 mmio_write64be(val, addr)); 294 294 } 295 295 296 - EXPORT_SYMBOL(iowrite64_lo_hi); 297 - EXPORT_SYMBOL(iowrite64_hi_lo); 298 - EXPORT_SYMBOL(iowrite64be_lo_hi); 299 - EXPORT_SYMBOL(iowrite64be_hi_lo); 296 + EXPORT_SYMBOL(__iowrite64_lo_hi); 297 + EXPORT_SYMBOL(__iowrite64_hi_lo); 298 + EXPORT_SYMBOL(__iowrite64be_lo_hi); 299 + EXPORT_SYMBOL(__iowrite64be_hi_lo); 300 300 301 - #endif /* readq */ 301 + #endif /* CONFIG_64BIT */ 302 302 303 303 /* 304 304 * These are the "repeat MMIO read/write" functions.