Message ID | 20221009103114.149036-11-bhe@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | mm: ioremap: Convert architectures to take GENERIC_IOREMAP way | expand |
Hi Baoquan, I love your patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on next-20221007] [cannot apply to akpm-mm/mm-everything openrisc/for-next deller-parisc/for-next s390/features v6.0] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Baoquan-He/mm-ioremap-Convert-architectures-to-take-GENERIC_IOREMAP-way/20221009-183524 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git a6afa4199d3d038fbfdff5511f7523b0e30cb774 config: sh-randconfig-r006-20221009 compiler: sh4-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/d6334f02fba0914418e82a36f13ab79d94126454 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Baoquan-He/mm-ioremap-Convert-architectures-to-take-GENERIC_IOREMAP-way/20221009-183524 git checkout d6334f02fba0914418e82a36f13ab79d94126454 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh prepare If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): In file included from arch/sh/include/asm/io.h:293, from include/linux/io.h:13, from include/linux/irq.h:20, from include/asm-generic/hardirq.h:17, from arch/sh/include/asm/hardirq.h:9, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from include/linux/kernel_stat.h:9, from include/linux/cgroup.h:26, from include/linux/memcontrol.h:13, from include/linux/swap.h:9, from include/linux/suspend.h:5, from arch/sh/kernel/asm-offsets.c:16: >> include/asm-generic/io.h:636:15: error: redefinition of 'inb_p' 636 | #define inb_p inb_p | ^~~~~ include/asm-generic/io.h:637:18: note: in expansion of macro 'inb_p' 637 | static inline u8 inb_p(unsigned long addr) | ^~~~~ arch/sh/include/asm/io.h:185:25: note: previous definition of 'inb_p' with type 'u8(long unsigned int)' {aka 'unsigned char(long unsigned int)'} 185 | static inline type pfx##in##bwlq##p(unsigned long port) \ | ^~ arch/sh/include/asm/io.h:199:9: note: in expansion of macro '__BUILD_IOPORT_SINGLE' 199 | __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO) | ^~~~~~~~~~~~~~~~~~~~~ arch/sh/include/asm/io.h:202:9: note: in expansion of macro '__BUILD_IOPORT_PFX' 202 | __BUILD_IOPORT_PFX(, bwlq, type) | ^~~~~~~~~~~~~~~~~~ arch/sh/include/asm/io.h:204:1: note: in expansion of macro 'BUILDIO_IOPORT' 204 | BUILDIO_IOPORT(b, u8) | ^~~~~~~~~~~~~~ >> include/asm-generic/io.h:644:15: error: redefinition of 'inw_p' 644 | #define inw_p inw_p | ^~~~~ include/asm-generic/io.h:645:19: note: in expansion of macro 'inw_p' 645 | static inline u16 inw_p(unsigned long addr) | ^~~~~ arch/sh/include/asm/io.h:185:25: note: previous definition of 'inw_p' with type 'u16(long unsigned int)' {aka 'short unsigned int(long unsigned int)'} 185 | static inline type pfx##in##bwlq##p(unsigned long port) \ | ^~ arch/sh/include/asm/io.h:199:9: note: in expansion of macro '__BUILD_IOPORT_SINGLE' 199 | __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO) | ^~~~~~~~~~~~~~~~~~~~~ arch/sh/include/asm/io.h:202:9: note: in expansion of macro '__BUILD_IOPORT_PFX' 202 | __BUILD_IOPORT_PFX(, bwlq, type) | ^~~~~~~~~~~~~~~~~~ arch/sh/include/asm/io.h:205:1: note: in expansion of macro 'BUILDIO_IOPORT' 205 | BUILDIO_IOPORT(w, u16) | ^~~~~~~~~~~~~~ >> include/asm-generic/io.h:652:15: error: redefinition of 'inl_p' 652 | #define inl_p inl_p | ^~~~~ include/asm-generic/io.h:653:19: note: in expansion of macro 'inl_p' 653 | static inline u32 inl_p(unsigned long addr) | ^~~~~ arch/sh/include/asm/io.h:185:25: note: previous definition of 'inl_p' with type 'u32(long unsigned int)' {aka 'unsigned int(long unsigned int)'} 185 | static inline type pfx##in##bwlq##p(unsigned long port) \ | ^~ arch/sh/include/asm/io.h:199:9: note: in expansion of macro '__BUILD_IOPORT_SINGLE' 199 | __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO) | ^~~~~~~~~~~~~~~~~~~~~ arch/sh/include/asm/io.h:202:9: note: in expansion of macro '__BUILD_IOPORT_PFX' 202 | __BUILD_IOPORT_PFX(, bwlq, type) | ^~~~~~~~~~~~~~~~~~ arch/sh/include/asm/io.h:206:1: note: in expansion of macro 'BUILDIO_IOPORT' 206 | BUILDIO_IOPORT(l, u32) | ^~~~~~~~~~~~~~ >> include/asm-generic/io.h:660:16: error: redefinition of 'outb_p' 660 | #define outb_p outb_p | ^~~~~~ include/asm-generic/io.h:661:20: note: in expansion of macro 'outb_p' 661 | static inline void outb_p(u8 value, unsigned long addr) | ^~~~~~ arch/sh/include/asm/io.h:176:25: note: previous definition of 'outb_p' with type 'void(u8, long unsigned int)' {aka 'void(unsigned char, long unsigned int)'} 176 | static inline void pfx##out##bwlq##p(type val, unsigned long port) \ | ^~~ arch/sh/include/asm/io.h:199:9: note: in expansion of macro '__BUILD_IOPORT_SINGLE' 199 | __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO) | ^~~~~~~~~~~~~~~~~~~~~ arch/sh/include/asm/io.h:202:9: note: in expansion of macro '__BUILD_IOPORT_PFX' 202 | __BUILD_IOPORT_PFX(, bwlq, type) | ^~~~~~~~~~~~~~~~~~ arch/sh/include/asm/io.h:204:1: note: in expansion of macro 'BUILDIO_IOPORT' 204 | BUILDIO_IOPORT(b, u8) | ^~~~~~~~~~~~~~ >> include/asm-generic/io.h:668:16: error: redefinition of 'outw_p' 668 | #define outw_p outw_p | ^~~~~~ include/asm-generic/io.h:669:20: note: in expansion of macro 'outw_p' 669 | static inline void outw_p(u16 value, unsigned long addr) | ^~~~~~ arch/sh/include/asm/io.h:176:25: note: previous definition of 'outw_p' with type 'void(u16, long unsigned int)' {aka 'void(short unsigned int, long unsigned int)'} 176 | static inline void pfx##out##bwlq##p(type val, unsigned long port) \ | ^~~ arch/sh/include/asm/io.h:199:9: note: in expansion of macro '__BUILD_IOPORT_SINGLE' 199 | __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO) | ^~~~~~~~~~~~~~~~~~~~~ arch/sh/include/asm/io.h:202:9: note: in expansion of macro '__BUILD_IOPORT_PFX' 202 | __BUILD_IOPORT_PFX(, bwlq, type) | ^~~~~~~~~~~~~~~~~~ arch/sh/include/asm/io.h:205:1: note: in expansion of macro 'BUILDIO_IOPORT' 205 | BUILDIO_IOPORT(w, u16) | ^~~~~~~~~~~~~~ >> include/asm-generic/io.h:676:16: error: redefinition of 'outl_p' 676 | #define outl_p outl_p | ^~~~~~ include/asm-generic/io.h:677:20: note: in expansion of macro 'outl_p' 677 | static inline void outl_p(u32 value, unsigned long addr) | ^~~~~~ arch/sh/include/asm/io.h:176:25: note: previous definition of 'outl_p' with type 'void(u32, long unsigned int)' {aka 'void(unsigned int, long unsigned int)'} 176 | static inline void pfx##out##bwlq##p(type val, unsigned long port) \ | ^~~ arch/sh/include/asm/io.h:199:9: note: in expansion of macro '__BUILD_IOPORT_SINGLE' 199 | __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO) | ^~~~~~~~~~~~~~~~~~~~~ arch/sh/include/asm/io.h:202:9: note: in expansion of macro '__BUILD_IOPORT_PFX' 202 | __BUILD_IOPORT_PFX(, bwlq, type) | ^~~~~~~~~~~~~~~~~~ arch/sh/include/asm/io.h:206:1: note: in expansion of macro 'BUILDIO_IOPORT' 206 | BUILDIO_IOPORT(l, u32) | ^~~~~~~~~~~~~~ >> include/asm-generic/io.h:689:14: error: redefinition of 'insb' 689 | #define insb insb | ^~~~ include/asm-generic/io.h:690:20: note: in expansion of macro 'insb' 690 | static inline void insb(unsigned long addr, void *buffer, unsigned int count) | ^~~~ arch/sh/include/asm/io.h:222:20: note: previous definition of 'insb' with type 'void(long unsigned int, void *, unsigned int)' 222 | static inline void ins##bwlq(unsigned long port, void *addr, \ | ^~~ arch/sh/include/asm/io.h:233:1: note: in expansion of macro '__BUILD_IOPORT_STRING' 233 | __BUILD_IOPORT_STRING(b, u8) | ^~~~~~~~~~~~~~~~~~~~~ >> include/asm-generic/io.h:697:14: error: redefinition of 'insw' 697 | #define insw insw | ^~~~ include/asm-generic/io.h:698:20: note: in expansion of macro 'insw' 698 | static inline void insw(unsigned long addr, void *buffer, unsigned int count) | ^~~~ arch/sh/include/asm/io.h:222:20: note: previous definition of 'insw' with type 'void(long unsigned int, void *, unsigned int)' 222 | static inline void ins##bwlq(unsigned long port, void *addr, \ | ^~~ arch/sh/include/asm/io.h:234:1: note: in expansion of macro '__BUILD_IOPORT_STRING' 234 | __BUILD_IOPORT_STRING(w, u16) | ^~~~~~~~~~~~~~~~~~~~~ >> include/asm-generic/io.h:705:14: error: redefinition of 'insl' 705 | #define insl insl | ^~~~ include/asm-generic/io.h:706:20: note: in expansion of macro 'insl' 706 | static inline void insl(unsigned long addr, void *buffer, unsigned int count) | ^~~~ arch/sh/include/asm/io.h:222:20: note: previous definition of 'insl' with type 'void(long unsigned int, void *, unsigned int)' 222 | static inline void ins##bwlq(unsigned long port, void *addr, \ | ^~~ arch/sh/include/asm/io.h:235:1: note: in expansion of macro '__BUILD_IOPORT_STRING' 235 | __BUILD_IOPORT_STRING(l, u32) | ^~~~~~~~~~~~~~~~~~~~~ >> include/asm-generic/io.h:713:15: error: redefinition of 'outsb' 713 | #define outsb outsb | ^~~~~ include/asm-generic/io.h:714:20: note: in expansion of macro 'outsb' 714 | static inline void outsb(unsigned long addr, const void *buffer, | ^~~~~ arch/sh/include/asm/io.h:211:20: note: previous definition of 'outsb' with type 'void(long unsigned int, const void *, unsigned int)' 211 | static inline void outs##bwlq(unsigned long port, const void *addr, \ | ^~~~ arch/sh/include/asm/io.h:233:1: note: in expansion of macro '__BUILD_IOPORT_STRING' 233 | __BUILD_IOPORT_STRING(b, u8) | ^~~~~~~~~~~~~~~~~~~~~ >> include/asm-generic/io.h:722:15: error: redefinition of 'outsw' 722 | #define outsw outsw | ^~~~~ include/asm-generic/io.h:723:20: note: in expansion of macro 'outsw' 723 | static inline void outsw(unsigned long addr, const void *buffer, | ^~~~~ arch/sh/include/asm/io.h:211:20: note: previous definition of 'outsw' with type 'void(long unsigned int, const void *, unsigned int)' 211 | static inline void outs##bwlq(unsigned long port, const void *addr, \ | ^~~~ arch/sh/include/asm/io.h:234:1: note: in expansion of macro '__BUILD_IOPORT_STRING' 234 | __BUILD_IOPORT_STRING(w, u16) | ^~~~~~~~~~~~~~~~~~~~~ >> include/asm-generic/io.h:731:15: error: redefinition of 'outsl' 731 | #define outsl outsl | ^~~~~ include/asm-generic/io.h:732:20: note: in expansion of macro 'outsl' 732 | static inline void outsl(unsigned long addr, const void *buffer, | ^~~~~ arch/sh/include/asm/io.h:211:20: note: previous definition of 'outsl' with type 'void(long unsigned int, const void *, unsigned int)' 211 | static inline void outs##bwlq(unsigned long port, const void *addr, \ | ^~~~ arch/sh/include/asm/io.h:235:1: note: in expansion of macro '__BUILD_IOPORT_STRING' 235 | __BUILD_IOPORT_STRING(l, u32) | ^~~~~~~~~~~~~~~~~~~~~ >> include/asm-generic/io.h:1134:20: error: static declaration of 'ioport_map' follows non-static declaration 1134 | #define ioport_map ioport_map | ^~~~~~~~~~ include/asm-generic/io.h:1135:29: note: in expansion of macro 'ioport_map' 1135 | static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) | ^~~~~~~~~~ In file included from arch/sh/include/asm/io.h:22: include/asm-generic/iomap.h:92:22: note: previous declaration of 'ioport_map' with type 'void *(long unsigned int, unsigned int)' 92 | extern void __iomem *ioport_map(unsigned long port, unsigned int nr); | ^~~~~~~~~~ >> include/asm-generic/io.h:1144:22: error: static declaration of 'ioport_unmap' follows non-static declaration 1144 | #define ioport_unmap ioport_unmap | ^~~~~~~~~~~~ include/asm-generic/io.h:1145:20: note: in expansion of macro 'ioport_unmap' 1145 | static inline void ioport_unmap(void __iomem *p) | ^~~~~~~~~~~~ include/asm-generic/iomap.h:93:13: note: previous declaration of 'ioport_unmap' with type 'void(void *)' 93 | extern void ioport_unmap(void __iomem *); | ^~~~~~~~~~~~ make[2]: *** [scripts/Makefile.build:118: arch/sh/kernel/asm-offsets.s] Error 1 make[2]: Target '__build' not remade because of errors. make[1]: *** [Makefile:1276: prepare0] Error 2 make[1]: Target 'prepare' not remade because of errors. make: *** [Makefile:231: __sub-make] Error 2 make: Target 'prepare' not remade because of errors. vim +/inb_p +636 include/asm-generic/io.h f009c89df79abe John Garry 2020-03-28 634 9216efafc52ff9 Thierry Reding 2014-10-01 635 #ifndef inb_p 9216efafc52ff9 Thierry Reding 2014-10-01 @636 #define inb_p inb_p 9216efafc52ff9 Thierry Reding 2014-10-01 637 static inline u8 inb_p(unsigned long addr) 9216efafc52ff9 Thierry Reding 2014-10-01 638 { 9216efafc52ff9 Thierry Reding 2014-10-01 639 return inb(addr); 9216efafc52ff9 Thierry Reding 2014-10-01 640 } 9216efafc52ff9 Thierry Reding 2014-10-01 641 #endif 9216efafc52ff9 Thierry Reding 2014-10-01 642 9216efafc52ff9 Thierry Reding 2014-10-01 643 #ifndef inw_p 9216efafc52ff9 Thierry Reding 2014-10-01 @644 #define inw_p inw_p 9216efafc52ff9 Thierry Reding 2014-10-01 645 static inline u16 inw_p(unsigned long addr) 9216efafc52ff9 Thierry Reding 2014-10-01 646 { 9216efafc52ff9 Thierry Reding 2014-10-01 647 return inw(addr); 9216efafc52ff9 Thierry Reding 2014-10-01 648 } 9216efafc52ff9 Thierry Reding 2014-10-01 649 #endif 9216efafc52ff9 Thierry Reding 2014-10-01 650 9216efafc52ff9 Thierry Reding 2014-10-01 651 #ifndef inl_p 9216efafc52ff9 Thierry Reding 2014-10-01 @652 #define inl_p inl_p 9216efafc52ff9 Thierry Reding 2014-10-01 653 static inline u32 inl_p(unsigned long addr) 9216efafc52ff9 Thierry Reding 2014-10-01 654 { 9216efafc52ff9 Thierry Reding 2014-10-01 655 return inl(addr); 9216efafc52ff9 Thierry Reding 2014-10-01 656 } 9216efafc52ff9 Thierry Reding 2014-10-01 657 #endif 9216efafc52ff9 Thierry Reding 2014-10-01 658 9216efafc52ff9 Thierry Reding 2014-10-01 659 #ifndef outb_p 9216efafc52ff9 Thierry Reding 2014-10-01 @660 #define outb_p outb_p 9216efafc52ff9 Thierry Reding 2014-10-01 661 static inline void outb_p(u8 value, unsigned long addr) 9216efafc52ff9 Thierry Reding 2014-10-01 662 { 9216efafc52ff9 Thierry Reding 2014-10-01 663 outb(value, addr); 9216efafc52ff9 Thierry Reding 2014-10-01 664 } 9216efafc52ff9 Thierry Reding 2014-10-01 665 #endif 9216efafc52ff9 Thierry Reding 2014-10-01 666 9216efafc52ff9 Thierry Reding 2014-10-01 667 #ifndef outw_p 9216efafc52ff9 Thierry Reding 2014-10-01 @668 #define outw_p outw_p 9216efafc52ff9 Thierry Reding 2014-10-01 669 static inline void outw_p(u16 value, unsigned long addr) 9216efafc52ff9 Thierry Reding 2014-10-01 670 { 9216efafc52ff9 Thierry Reding 2014-10-01 671 outw(value, addr); 9216efafc52ff9 Thierry Reding 2014-10-01 672 } 9216efafc52ff9 Thierry Reding 2014-10-01 673 #endif 9216efafc52ff9 Thierry Reding 2014-10-01 674 9216efafc52ff9 Thierry Reding 2014-10-01 675 #ifndef outl_p 9216efafc52ff9 Thierry Reding 2014-10-01 @676 #define outl_p outl_p 9216efafc52ff9 Thierry Reding 2014-10-01 677 static inline void outl_p(u32 value, unsigned long addr) 9216efafc52ff9 Thierry Reding 2014-10-01 678 { 9216efafc52ff9 Thierry Reding 2014-10-01 679 outl(value, addr); 9216efafc52ff9 Thierry Reding 2014-10-01 680 } 9216efafc52ff9 Thierry Reding 2014-10-01 681 #endif 9216efafc52ff9 Thierry Reding 2014-10-01 682 9ab3a7a0d2b417 Thierry Reding 2014-07-04 683 /* 9ab3a7a0d2b417 Thierry Reding 2014-07-04 684 * {in,out}s{b,w,l}{,_p}() are variants of the above that repeatedly access a 9ab3a7a0d2b417 Thierry Reding 2014-07-04 685 * single I/O port multiple times. 9ab3a7a0d2b417 Thierry Reding 2014-07-04 686 */ 9ab3a7a0d2b417 Thierry Reding 2014-07-04 687 9ab3a7a0d2b417 Thierry Reding 2014-07-04 688 #ifndef insb 9ab3a7a0d2b417 Thierry Reding 2014-07-04 @689 #define insb insb 9ab3a7a0d2b417 Thierry Reding 2014-07-04 @690 static inline void insb(unsigned long addr, void *buffer, unsigned int count) 9ab3a7a0d2b417 Thierry Reding 2014-07-04 691 { 9ab3a7a0d2b417 Thierry Reding 2014-07-04 692 readsb(PCI_IOBASE + addr, buffer, count); 9ab3a7a0d2b417 Thierry Reding 2014-07-04 693 } 9ab3a7a0d2b417 Thierry Reding 2014-07-04 694 #endif 9ab3a7a0d2b417 Thierry Reding 2014-07-04 695 9ab3a7a0d2b417 Thierry Reding 2014-07-04 696 #ifndef insw 9ab3a7a0d2b417 Thierry Reding 2014-07-04 @697 #define insw insw 9ab3a7a0d2b417 Thierry Reding 2014-07-04 @698 static inline void insw(unsigned long addr, void *buffer, unsigned int count) 9ab3a7a0d2b417 Thierry Reding 2014-07-04 699 { 9ab3a7a0d2b417 Thierry Reding 2014-07-04 700 readsw(PCI_IOBASE + addr, buffer, count); 9ab3a7a0d2b417 Thierry Reding 2014-07-04 701 } 9ab3a7a0d2b417 Thierry Reding 2014-07-04 702 #endif 9ab3a7a0d2b417 Thierry Reding 2014-07-04 703 9ab3a7a0d2b417 Thierry Reding 2014-07-04 704 #ifndef insl 9ab3a7a0d2b417 Thierry Reding 2014-07-04 @705 #define insl insl 9ab3a7a0d2b417 Thierry Reding 2014-07-04 @706 static inline void insl(unsigned long addr, void *buffer, unsigned int count) 9ab3a7a0d2b417 Thierry Reding 2014-07-04 707 { 9ab3a7a0d2b417 Thierry Reding 2014-07-04 708 readsl(PCI_IOBASE + addr, buffer, count); 9ab3a7a0d2b417 Thierry Reding 2014-07-04 709 } 9ab3a7a0d2b417 Thierry Reding 2014-07-04 710 #endif 9ab3a7a0d2b417 Thierry Reding 2014-07-04 711 9ab3a7a0d2b417 Thierry Reding 2014-07-04 712 #ifndef outsb 9ab3a7a0d2b417 Thierry Reding 2014-07-04 @713 #define outsb outsb 9ab3a7a0d2b417 Thierry Reding 2014-07-04 @714 static inline void outsb(unsigned long addr, const void *buffer, 9ab3a7a0d2b417 Thierry Reding 2014-07-04 715 unsigned int count) 9ab3a7a0d2b417 Thierry Reding 2014-07-04 716 { 9ab3a7a0d2b417 Thierry Reding 2014-07-04 717 writesb(PCI_IOBASE + addr, buffer, count); 9ab3a7a0d2b417 Thierry Reding 2014-07-04 718 } 9ab3a7a0d2b417 Thierry Reding 2014-07-04 719 #endif 9ab3a7a0d2b417 Thierry Reding 2014-07-04 720 9ab3a7a0d2b417 Thierry Reding 2014-07-04 721 #ifndef outsw 9ab3a7a0d2b417 Thierry Reding 2014-07-04 @722 #define outsw outsw 9ab3a7a0d2b417 Thierry Reding 2014-07-04 @723 static inline void outsw(unsigned long addr, const void *buffer, 9ab3a7a0d2b417 Thierry Reding 2014-07-04 724 unsigned int count) 9ab3a7a0d2b417 Thierry Reding 2014-07-04 725 { 9ab3a7a0d2b417 Thierry Reding 2014-07-04 726 writesw(PCI_IOBASE + addr, buffer, count); 9ab3a7a0d2b417 Thierry Reding 2014-07-04 727 } 9ab3a7a0d2b417 Thierry Reding 2014-07-04 728 #endif 9ab3a7a0d2b417 Thierry Reding 2014-07-04 729 9ab3a7a0d2b417 Thierry Reding 2014-07-04 730 #ifndef outsl 9ab3a7a0d2b417 Thierry Reding 2014-07-04 @731 #define outsl outsl 9ab3a7a0d2b417 Thierry Reding 2014-07-04 @732 static inline void outsl(unsigned long addr, const void *buffer, 9ab3a7a0d2b417 Thierry Reding 2014-07-04 733 unsigned int count) 9ab3a7a0d2b417 Thierry Reding 2014-07-04 734 { 9ab3a7a0d2b417 Thierry Reding 2014-07-04 735 writesl(PCI_IOBASE + addr, buffer, count); 9ab3a7a0d2b417 Thierry Reding 2014-07-04 736 } 9ab3a7a0d2b417 Thierry Reding 2014-07-04 737 #endif 9ab3a7a0d2b417 Thierry Reding 2014-07-04 738
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 5f220e903e5a..b63ad4698cf8 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig @@ -25,6 +25,7 @@ config SUPERH select GENERIC_SCHED_CLOCK select GENERIC_SMP_IDLE_THREAD select GUP_GET_PTE_LOW_HIGH if X2TLB + select GENERIC_IOREMAP if MMU select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_KGDB select HAVE_ARCH_SECCOMP_FILTER diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h index fba90e670ed4..f3edd92a8869 100644 --- a/arch/sh/include/asm/io.h +++ b/arch/sh/include/asm/io.h @@ -119,6 +119,26 @@ void __raw_readsl(const void __iomem *addr, void *data, int longlen); __BUILD_MEMORY_STRING(__raw_, q, u64) +#define ioread8 ioread8 +#define ioread16 ioread16 +#define ioread16be ioread16be +#define ioread32 ioread32 +#define ioread32be ioread32be + +#define iowrite8 iowrite8 +#define iowrite16 iowrite16 +#define iowrite16be iowrite16be +#define iowrite32 iowrite32 +#define iowrite32be iowrite32be + +#define ioread8_rep ioread8_rep +#define ioread16_rep ioread16_rep +#define ioread32_rep ioread32_rep + +#define iowrite8_rep iowrite8_rep +#define iowrite16_rep iowrite16_rep +#define iowrite32_rep iowrite32_rep + #ifdef CONFIG_HAS_IOPORT_MAP /* @@ -225,6 +245,9 @@ __BUILD_IOPORT_STRING(q, u64) #define IO_SPACE_LIMIT 0xffffffff /* We really want to try and get these to memcpy etc */ +#define memset_io memset_io +#define memcpy_fromio memcpy_fromio +#define memcpy_toio memcpy_toio void memcpy_fromio(void *, const volatile void __iomem *, unsigned long); void memcpy_toio(volatile void __iomem *, const void *, unsigned long); void memset_io(volatile void __iomem *, int, unsigned long); @@ -243,40 +266,20 @@ unsigned long long poke_real_address_q(unsigned long long addr, #endif #ifdef CONFIG_MMU -void iounmap(void __iomem *addr); -void __iomem *__ioremap_caller(phys_addr_t offset, unsigned long size, - pgprot_t prot, void *caller); - -static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size) -{ - return __ioremap_caller(offset, size, PAGE_KERNEL_NOCACHE, - __builtin_return_address(0)); -} - -static inline void __iomem * -ioremap_cache(phys_addr_t offset, unsigned long size) -{ - return __ioremap_caller(offset, size, PAGE_KERNEL, - __builtin_return_address(0)); -} -#define ioremap_cache ioremap_cache +/* + * I/O memory mapping functions. + */ +void __iomem * +arch_ioremap(phys_addr_t *paddr, size_t size, unsigned long *prot_val); +#define arch_ioremap arch_ioremap -#ifdef CONFIG_HAVE_IOREMAP_PROT -static inline void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size, - unsigned long flags) -{ - return __ioremap_caller(offset, size, __pgprot(flags), - __builtin_return_address(0)); -} -#endif /* CONFIG_HAVE_IOREMAP_PROT */ +bool arch_iounmap(void __iomem *addr); +#define arch_iounmap arch_iounmap -#else /* CONFIG_MMU */ -static inline void __iomem *ioremap(phys_addr_t offset, size_t size) -{ - return (void __iomem *)(unsigned long)offset; -} +#define _PAGE_IOREMAP pgprot_val(PAGE_KERNEL_NOCACHE) -static inline void iounmap(volatile void __iomem *addr) { } +#define ioremap_cache(addr, size) \ + ioremap_prot((addr), (size), pgprot_val(PAGE_KERNEL)) #endif /* CONFIG_MMU */ #define ioremap_uc ioremap @@ -287,6 +290,8 @@ static inline void iounmap(volatile void __iomem *addr) { } */ #define xlate_dev_mem_ptr(p) __va(p) +#include <asm-generic/io.h> + #define ARCH_HAS_VALID_PHYS_ADDR_RANGE int valid_phys_addr_range(phys_addr_t addr, size_t size); int valid_mmap_phys_addr_range(unsigned long pfn, size_t size); diff --git a/arch/sh/include/asm/io_noioport.h b/arch/sh/include/asm/io_noioport.h index f7938fe0f911..5ba4116b4265 100644 --- a/arch/sh/include/asm/io_noioport.h +++ b/arch/sh/include/asm/io_noioport.h @@ -53,6 +53,13 @@ static inline void ioport_unmap(void __iomem *addr) #define outw_p(x, addr) outw((x), (addr)) #define outl_p(x, addr) outl((x), (addr)) +#define insb insb +#define insw insw +#define insl insl +#define outsb outsb +#define outsw outsw +#define outsl outsl + static inline void insb(unsigned long port, void *dst, unsigned long count) { BUG(); diff --git a/arch/sh/mm/ioremap.c b/arch/sh/mm/ioremap.c index 21342581144d..4b20f00a3ca3 100644 --- a/arch/sh/mm/ioremap.c +++ b/arch/sh/mm/ioremap.c @@ -72,22 +72,12 @@ __ioremap_29bit(phys_addr_t offset, unsigned long size, pgprot_t prot) #define __ioremap_29bit(offset, size, prot) NULL #endif /* CONFIG_29BIT */ -/* - * Remap an arbitrary physical address space into the kernel virtual - * address space. Needed when the kernel wants to access high addresses - * directly. - * - * NOTE! We need to allow non-page-aligned mappings too: we will obviously - * have to convert them into an offset in a page-aligned mapping, but the - * caller shouldn't need to know that small detail. - */ void __iomem * __ref -__ioremap_caller(phys_addr_t phys_addr, unsigned long size, - pgprot_t pgprot, void *caller) +arch_ioremap(phys_addr_t *paddr, size_t size, unsigned long *prot_val) { - struct vm_struct *area; - unsigned long offset, last_addr, addr, orig_addr; + unsigned long last_addr, phys_addr = *paddr; void __iomem *mapped; + pgprot_t pgprot = __pgprot(*prot_val); mapped = __ioremap_trapped(phys_addr, size); if (mapped) @@ -100,7 +90,7 @@ __ioremap_caller(phys_addr_t phys_addr, unsigned long size, /* Don't allow wraparound or zero size */ last_addr = phys_addr + size - 1; if (!size || last_addr < phys_addr) - return NULL; + return IOMEM_ERR_PTR(-EINVAL); /* * If we can't yet use the regular approach, go the fixmap route. @@ -112,34 +102,13 @@ __ioremap_caller(phys_addr_t phys_addr, unsigned long size, * First try to remap through the PMB. * PMB entries are all pre-faulted. */ - mapped = pmb_remap_caller(phys_addr, size, pgprot, caller); + mapped = pmb_remap_caller(phys_addr, size, pgprot, + __builtin_return_address(0)); if (mapped && !IS_ERR(mapped)) return mapped; - /* - * Mappings have to be page-aligned - */ - offset = phys_addr & ~PAGE_MASK; - phys_addr &= PAGE_MASK; - size = PAGE_ALIGN(last_addr+1) - phys_addr; - - /* - * Ok, go for it.. - */ - area = get_vm_area_caller(size, VM_IOREMAP, caller); - if (!area) - return NULL; - area->phys_addr = phys_addr; - orig_addr = addr = (unsigned long)area->addr; - - if (ioremap_page_range(addr, addr + size, phys_addr, pgprot)) { - vunmap((void *)orig_addr); - return NULL; - } - - return (void __iomem *)(offset + (char *)orig_addr); + return NULL; } -EXPORT_SYMBOL(__ioremap_caller); /* * Simple checks for non-translatable mappings. @@ -158,35 +127,27 @@ static inline int iomapping_nontranslatable(unsigned long offset) return 0; } -void iounmap(void __iomem *addr) +bool arch_iounmap(void __iomem *addr) { unsigned long vaddr = (unsigned long __force)addr; - struct vm_struct *p; /* * Nothing to do if there is no translatable mapping. */ if (iomapping_nontranslatable(vaddr)) - return; + return false; /* * There's no VMA if it's from an early fixed mapping. */ if (iounmap_fixed(addr) == 0) - return; + return false; /* * If the PMB handled it, there's nothing else to do. */ if (pmb_unmap(addr) == 0) - return; - - p = remove_vm_area((void *)(vaddr & PAGE_MASK)); - if (!p) { - printk(KERN_ERR "%s: bad address %p\n", __func__, addr); - return; - } + return false; - kfree(p); + return true; } -EXPORT_SYMBOL(iounmap);
By taking GENERIC_IOREMAP method, the generic ioremap_prot() and iounmap() are visible and available to arch. Arch only needs to provide implementation of arch_ioremap() or arch_iounmap() if there's arch specific handling needed in its ioremap() or iounmap(). This change will simplify implementation by removing duplicated codes with generic ioremap() and iounmap(), and has the equivalent functioality as before. For SuperH, add hook arch_ioremap() and arch_iounmap for sh's special operation when ioremap() and iounmap(), then ioremap_cache() is converted to use ioremap_prot() from GENERIC_IOREMAP. Meanwhile, add macro definitions for port|mm io functions since SuperH has its own implementation in arch/sh/kernel/iomap.c and arch/sh/include/asm/io_noioport.h. These will conflict with the port|mm io function definitions in include/asm-generic/io.h to cause compiling errors like below: ==== CC arch/sh/kernel/asm-offsets.s In file included from ./arch/sh/include/asm/io.h:294, from ./include/linux/io.h:13, ...... from arch/sh/kernel/asm-offsets.c:16: ./include/asm-generic/io.h:792:17: error: conflicting types for ‘ioread8’ 792 | #define ioread8 ioread8 | ^~~~~~~ ./include/asm-generic/io.h:793:18: note: in expansion of macro ‘ioread8’ 793 | static inline u8 ioread8(const volatile void __iomem *addr) | ^~~~~~~ In file included from ./arch/sh/include/asm/io.h:22, from ./include/linux/io.h:13, ...... from arch/sh/kernel/asm-offsets.c:16: ./include/asm-generic/iomap.h:29:21: note: previous declaration of ‘ioread8’ was here 29 | extern unsigned int ioread8(const void __iomem *); ==== Signed-off-by: Baoquan He <bhe@redhat.com> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Cc: Rich Felker <dalias@libc.org> Cc: linux-sh@vger.kernel.org --- v2->v3: - Add macro definitions for mem io operations to avoid the repeated definitions of them in include/asm-generic/io.h. arch/sh/Kconfig | 1 + arch/sh/include/asm/io.h | 67 +++++++++++++++++-------------- arch/sh/include/asm/io_noioport.h | 7 ++++ arch/sh/mm/ioremap.c | 63 ++++++----------------------- 4 files changed, 56 insertions(+), 82 deletions(-)