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

Configure Feed

Select the types of activity you want to include in your feed.

arm64: Use new fallback IO memcpy/memset

Use the new fallback memcpy_{from,to}io and memset_io functions from
lib/iomem_copy.c on the arm64 processor architecture.

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Yann Sionneau <ysionneau@kalrayinc.com>
Signed-off-by: Julian Vetter <jvetter@kalrayinc.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

authored by

Julian Vetter and committed by
Arnd Bergmann
0110feaa b660d0a2

-98
-11
arch/arm64/include/asm/io.h
··· 129 129 #define PCI_IOBASE ((void __iomem *)PCI_IO_START) 130 130 131 131 /* 132 - * String version of I/O memory access operations. 133 - */ 134 - extern void __memcpy_fromio(void *, const volatile void __iomem *, size_t); 135 - extern void __memcpy_toio(volatile void __iomem *, const void *, size_t); 136 - extern void __memset_io(volatile void __iomem *, int, size_t); 137 - 138 - #define memset_io(c,v,l) __memset_io((c),(v),(l)) 139 - #define memcpy_fromio(a,c,l) __memcpy_fromio((a),(c),(l)) 140 - #define memcpy_toio(c,a,l) __memcpy_toio((c),(a),(l)) 141 - 142 - /* 143 132 * The ARM64 iowrite implementation is intended to support drivers that want to 144 133 * use write combining. For instance PCI drivers using write combining with a 64 145 134 * byte __iowrite64_copy() expect to get a 64 byte MemWr TLP on the PCIe bus.
-87
arch/arm64/kernel/io.c
··· 10 10 #include <linux/io.h> 11 11 12 12 /* 13 - * Copy data from IO memory space to "real" memory space. 14 - */ 15 - void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count) 16 - { 17 - while (count && !IS_ALIGNED((unsigned long)from, 8)) { 18 - *(u8 *)to = __raw_readb(from); 19 - from++; 20 - to++; 21 - count--; 22 - } 23 - 24 - while (count >= 8) { 25 - *(u64 *)to = __raw_readq(from); 26 - from += 8; 27 - to += 8; 28 - count -= 8; 29 - } 30 - 31 - while (count) { 32 - *(u8 *)to = __raw_readb(from); 33 - from++; 34 - to++; 35 - count--; 36 - } 37 - } 38 - EXPORT_SYMBOL(__memcpy_fromio); 39 - 40 - /* 41 13 * This generates a memcpy that works on a from/to address which is aligned to 42 14 * bits. Count is in terms of the number of bits sized quantities to copy. It 43 15 * optimizes to use the STR groupings when possible so that it is WC friendly. ··· 50 78 dgh(); 51 79 } 52 80 EXPORT_SYMBOL(__iowrite32_copy_full); 53 - 54 - /* 55 - * Copy data from "real" memory space to IO memory space. 56 - */ 57 - void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count) 58 - { 59 - while (count && !IS_ALIGNED((unsigned long)to, 8)) { 60 - __raw_writeb(*(u8 *)from, to); 61 - from++; 62 - to++; 63 - count--; 64 - } 65 - 66 - while (count >= 8) { 67 - __raw_writeq(*(u64 *)from, to); 68 - from += 8; 69 - to += 8; 70 - count -= 8; 71 - } 72 - 73 - while (count) { 74 - __raw_writeb(*(u8 *)from, to); 75 - from++; 76 - to++; 77 - count--; 78 - } 79 - } 80 - EXPORT_SYMBOL(__memcpy_toio); 81 - 82 - /* 83 - * "memset" on IO memory space. 84 - */ 85 - void __memset_io(volatile void __iomem *dst, int c, size_t count) 86 - { 87 - u64 qc = (u8)c; 88 - 89 - qc |= qc << 8; 90 - qc |= qc << 16; 91 - qc |= qc << 32; 92 - 93 - while (count && !IS_ALIGNED((unsigned long)dst, 8)) { 94 - __raw_writeb(c, dst); 95 - dst++; 96 - count--; 97 - } 98 - 99 - while (count >= 8) { 100 - __raw_writeq(qc, dst); 101 - dst += 8; 102 - count -= 8; 103 - } 104 - 105 - while (count) { 106 - __raw_writeb(c, dst); 107 - dst++; 108 - count--; 109 - } 110 - } 111 - EXPORT_SYMBOL(__memset_io);