parisc: Remove memcpy_fromio
Subsystems (2)
PATCH 1/1 parisc: Remove memcpy_fromio
Fully migrate parisc to the IO functions from lib/iomem_copy.c. In a recent patch the functions memset_io and memcpy_toio were removed, but the memcpy_fromio was kept, because for very short sequences it does half word accesses, whereas the functions in lib/iomem_copy.c do byte accesses until the memory is naturally aligned and then do machine word accesses. But I don't think the single half-word access merits keeping the arch specific implementation, so, remove it as well.
--- arch/parisc/include/asm/io.h | 3 -- arch/parisc/kernel/parisc_ksyms.c | 1 - arch/parisc/lib/io.c | 61 ------------------------------- 3 files changed, 65 deletions(-)
arch/parisc/include/asm/io.h +0 -3
@@ -135,9 +135,6 @@ static inline void gsc_writeq(unsigned long long val, unsigned long addr)#define pci_iounmap pci_iounmap -void memcpy_fromio (void *dst,const volatile void __iomem *src,int count); -#define memcpy_fromio memcpy_fromio -/* Port-space IO */ #define inb_p inb
arch/parisc/kernel/parisc_ksyms.c +0 -1
@@ -43,7 +43,6 @@ EXPORT_SYMBOL($global$);#endif #include <asm/io.h> -EXPORT_SYMBOL (memcpy_fromio);extern void $$divI (void );extern void $$divU (void );
arch/parisc/lib/io.c +0 -61
67 lines not on this page · raw message
Signature · 1 line
2.34.1
Quoted 9 lines · Julian Vetter
Fully migrate parisc to the IO functions from
lib/iomem_copy.c. In a recent patch the functionsmemset_ioandmemcpy_toiowere removed, but thememcpy_fromiowas kept, because for very short sequences it does half word accesses, whereas the functions inlib/iomem_copy.cdo byte accesses until the memory is naturally aligned and then do machine word accesses. But I don't think the single half-word access merits keeping the arch specific implementation, so, remove it as well.Signed-off-by Julian Vetter <[email protected]>
This one looks fairly obvious. It might be nice to also clean up the {in,out}s{b,w,l} helper functions in the same file, but I don't understand why those are special in the first place.
Those functions have been unchanged since before the git history and there are some comments that I don't find helpful. One thing they do is to deal with unaligned memory buffers, which the generic ones don't, but that could be easily added using get_unaligned/put_unaligned, expecting the compiler to optimize the memory side of the transfer.
Arnd
Quoted 9 lines · Arnd Bergmann
Quoted 8 lines · Julian Vetter
Fully migrate parisc to the IO functions from
lib/iomem_copy.c. In a recent patch the functionsmemset_ioandmemcpy_toiowere removed, but thememcpy_fromiowas kept, because for very short sequences it does half word accesses, whereas the functions inlib/iomem_copy.cdo byte accesses until the memory is naturally aligned and then do machine word accesses. But I don't think the single half-word access merits keeping the arch specific implementation, so, remove it as well.
Quoted 9 lines
Quoted 1 line
Signed-off-by Julian Vetter <[email protected]>Acked-by Arnd Bergmann <[email protected]>This one looks fairly obvious. It might be nice to also clean up the {in,out}s{b,w,l} helper functions in the same file, but I don't understand why those are special in the first place.
Not sure, either. But some comments contain: "just using the inlined version of the inw() breaks things". This is clear, and what you point out below already, these parisc specific functions deal with unaligned buffers, so using, e.g., the generic "inw()" will surely break things.
Quoted 6 lines
Those functions have been unchanged since before the git history and there are some comments that I don't find helpful. One thing they do is to deal with unaligned memory buffers, which the generic ones don't, but that could be easily added using get_unaligned/put_unaligned, expecting the compiler to optimize the memory side of the transfer.
I'm not sure what you suggest. Do you mean adding get_unaligned/put_unaligned in the generic include/asm-generic/io.h functions, or just adding get_unaligned/put_unaligned to the body of the parisc specific functions? Instead of all the "switch... case 0x2..." code?
Julian
Quoted 2 lines
Arnd
Arnd Bergmann
maintainerQuoted 8 lines · Julian Vetter
Quoted 6 lines · Arnd Bergmann
Those functions have been unchanged since before the git history and there are some comments that I don't find helpful. One thing they do is to deal with unaligned memory buffers, which the generic ones don't, but that could be easily added using get_unaligned/put_unaligned, expecting the compiler to optimize the memory side of the transfer.
Quoted 4 lines
I'm not sure what you suggest. Do you mean adding get_unaligned/put_unaligned in the generic
include/asm-generic/io.hfunctions, or just adding get_unaligned/put_unaligned to the body of the parisc specific functions? Instead of all the "switch... case0x2..." code?
I meant adding put_unaligned/get_unaligned like this:
include/asm-generic/io.h +2 -1
@@ -422,7 +422,8 @@ static inline void readsw(const volatile void __iomem *addr, void *buffer,do {u16 x =__raw_readw (addr); - *buf++ = x; +put_unaligned (x, buf); + buf++; }while (--count); } }
This has no effect on architectures that can handle unaligned load/store on memory, and should behave the same way as the parisc code otherwise. On powerpc and possibly others, there needs to be a barrier (eieio() on powerpc) inside of the loop, according to Segher's earlier comments.
Arnd
Helge Deller
maintainerQuoted 9 lines · Arnd Bergmann
Quoted 8 lines · Julian Vetter
Fully migrate parisc to the IO functions from
lib/iomem_copy.c. In a recent patch the functionsmemset_ioandmemcpy_toiowere removed, but thememcpy_fromiowas kept, because for very short sequences it does half word accesses, whereas the functions inlib/iomem_copy.cdo byte accesses until the memory is naturally aligned and then do machine word accesses. But I don't think the single half-word access merits keeping the arch specific implementation, so, remove it as well.
Quoted 3 lines
Quoted 1 line
Signed-off-by Julian Vetter <[email protected]>Acked-by Arnd Bergmann <[email protected]>
Thanks!
I've added the patch to the parisc git tree.
Helge