Fix some bugs on RV32 build fail and issue
Subsystems (2)
v4 cover Fix some bugs on RV32 build fail and issue
This patches contain the modificaion as follows:
1. Fix up the building fail on RV32.
2. Add umoddi3 and udivmoddi4 functions for RV32.
3. Fix ioremap problem on RV32.
Thanks all for review these code and modify the copyright description.
Changes in v4:
- Retain the complete copyright description.
- Modify commit message.
- Rebase upstream code.
Changes in v3:
- Change the copyright notices to GPLv2 from gcc 4.2.1.
Changes in v2:
- Retain the copyright notices from libgcc in umoddi3.c and udivmoddi4.c.
Vincent Chen (1):
RISC-V: Avoid corrupting the upper 32-bit of phys_addr_t in ioremap
Zong Li (4):
RISC-V: Build tishift only on 64-bit
RISC-V: Add preprocessor directive for swiotlb
lib: Add umoddi3 and udivmoddi4 of GCC library routines
RISC-V: Select GENERIC_LIB_UMODDI3 on RV32
arch/riscv/Kconfig | 1 + arch/riscv/kernel/setup.c | 3 + arch/riscv/lib/Makefile | 3 +- arch/riscv/mm/ioremap.c | 2 +- lib/Kconfig | 3 + lib/Makefile | 1 + lib/udivmoddi4.c | 326 ++++++++++++++++++++++++++++++++++++++++++++++ lib/umoddi3.c | 48 +++++++ 8 files changed, 385 insertions(+), 2 deletions(-) create mode 100644 lib/udivmoddi4.c create mode 100644 lib/umoddi3.c
Signature · 1 line
2.7.4
PATCH v4 1/5 RISC-V: Build tishift only on 64-bit
Only RV64 supports 128 integer size.
--- arch/riscv/lib/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/riscv/lib/Makefile +2 -1
@@ -2,6 +2,7 @@ lib-y += delay.o lib-y += memcpy.o lib-y += memset.o lib-y += uaccess.o -lib-y += tishift.o + +lib-(CONFIG_64BIT) += tishift.o lib-$(CONFIG_32BIT) += udivdi3.o
Signature · 1 line
2.7.4
PATCH v4 2/5 RISC-V: Add preprocessor directive for swiotlb
In reply to Zong LiOn RV32, it doesn't select the SWIOTLB, only RV64 support swiotlb now.
--- arch/riscv/kernel/setup.c | 3 +++ 1 file changed, 3 insertions(+)
arch/riscv/kernel/setup.c +3 -0
@@ -227,7 +227,10 @@ void __init setup_arch(char **cmdline_p)setup_bootmem ();paging_init ();unflatten_device_tree (); + +#ifdef CONFIG_SWIOTLB swiotlb_init (1 ); +#endif #ifdef CONFIG_SMP setup_smp ();
Signature · 1 line
2.7.4
PATCH v4 3/5 lib: Add umoddi3 and udivmoddi4 of GCC library routines
In reply to Zong LiAdd umoddi3 and udivmoddi4 support for 32-bit.
The RV32 need the umoddi3 to do modulo when the operands are long long type, like other libraries implementation such as ucmpdi2, lshrdi3 and so on.
I encounter the undefined reference 'umoddi3' when I use the in house dma driver, although it is in house driver, but I think that umoddi3 is a common function for RV32.
The udivmoddi4 and umoddi3 are copies from libgcc in gcc 4.2.1. There are other functions use the udivmoddi4 in libgcc, so I separate the umoddi3 and udivmoddi4 for flexible extension in the future.
--- lib/Kconfig | 3 + lib/Makefile | 1 + lib/udivmoddi4.c | 326 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/umoddi3.c | 48 ++++++++ 4 files changed, 378 insertions(+) create mode 100644 lib/udivmoddi4.c create mode 100644 lib/umoddi3.c
lib/Kconfig +3 -0
@@ -621,3 +621,6 @@ config GENERIC_LIB_CMPDI2 config GENERIC_LIB_UCMPDI2 bool + +config GENERIC_LIB_UMODDI3 + bool
lib/Makefile +1 -0
@@ -271,3 +271,4 @@ obj-$(CONFIG_GENERIC_LIB_LSHRDI3) += lshrdi3.o obj-$(CONFIG_GENERIC_LIB_MULDI3) += muldi3.o obj-$(CONFIG_GENERIC_LIB_CMPDI2) += cmpdi2.o obj-$(CONFIG_GENERIC_LIB_UCMPDI2) += ucmpdi2.o +obj-$(CONFIG_GENERIC_LIB_UMODDI3) += umoddi3.o udivmoddi4.o
lib/udivmoddi4.c new file +326 -0
326 lines not on this page · raw message
lib/umoddi3.c new file +48 -0
48 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v4 4/5 RISC-V: Select GENERIC_LIB_UMODDI3 on RV32
In reply to Zong LiOn RV32, it will use the __umoddi3. Select GENERIC_LIB_UMODDI3 to avoid undefined reference.
--- arch/riscv/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/riscv/Kconfig +1 -0
@@ -108,6 +108,7 @@ config ARCH_RV32I select GENERIC_LIB_ASHRDI3 select GENERIC_LIB_LSHRDI3 select GENERIC_LIB_UCMPDI2 + select GENERIC_LIB_UMODDI3 config ARCH_RV64I bool "RV64I"
Signature · 1 line
2.7.4
PATCH v4 5/5 RISC-V: Avoid corrupting the upper 32-bit of phys_addr_t in ioremap
In reply to Zong LiFrom: Vincent Chen <[email protected]>
For 32bit, the upper 32-bit of phys_addr_t will be flushed to zero after AND with PAGE_MASK because the data type of PAGE_MASK is unsigned long. To fix this problem, the page alignment is done by subtracting the page offset instead of AND with PAGE_MASK.
--- arch/riscv/mm/ioremap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/mm/ioremap.c +1 -1
@@ -42,7 +42,7 @@ static void __iomem *__ioremap_caller(phys_addr_t addr, size_t size,/* Page-align mappings */ offset = addr & (~PAGE_MASK ); - addr &=PAGE_MASK ; + addr -= offset; size =PAGE_ALIGN (size + offset); area =get_vm_area_caller (size,VM_IOREMAP , caller);
Signature · 1 line
2.7.4
Zong Li <[email protected]> ? 2018?10?3? ?? ??11:12???
Quoted 40 lines
This patches contain the modificaion as follows:
1. Fix up the building fail on RV32.
2. Add umoddi3 and udivmoddi4 functions for RV32.
3. Fix ioremap problem on RV32.Thanks all for review these code and modify the copyright description.
Changes in v4:
- Retain the complete copyright description.
- Modify commit message.
- Rebase upstream code.Changes in v3:
- Change the copyright notices to GPLv2 from gcc 4.2.1.Changes in v2:
- Retain the copyright notices from libgcc inumoddi3.candudivmoddi4.c.Vincent Chen (1):
RISC-V: Avoid corrupting the upper 32-bit ofphys_addr_tin ioremapZong Li (4):
RISC-V: Build tishift only on 64-bit
RISC-V: Add preprocessor directive for swiotlb
lib: Add umoddi3 and udivmoddi4 of GCC library routines
RISC-V: SelectGENERIC_LIB_UMODDI3on RV32arch/riscv/Kconfig | 1 + arch/riscv/kernel/setup.c | 3 + arch/riscv/lib/Makefile | 3 +- arch/riscv/mm/ioremap.c | 2 +- lib/Kconfig | 3 + lib/Makefile | 1 + lib/udivmoddi4.c | 326 ++++++++++++++++++++++++++++++++++++++++++++++ lib/umoddi3.c | 48 +++++++ 8 files changed, 385 insertions(+), 2 deletions(-) create mode 100644 lib/udivmoddi4.c create mode 100644 lib/umoddi3.c
Quoted 3 lines
--
2.7.4
ping
Quoted 41 lines · zongbox at gmail.com
Zong Li <[email protected]> ? 2018?10?3? ?? ??11:12???
Quoted 40 lines
This patches contain the modificaion as follows:
1. Fix up the building fail on RV32.
2. Add umoddi3 and udivmoddi4 functions for RV32.
3. Fix ioremap problem on RV32.Thanks all for review these code and modify the copyright description.
Changes in v4:
- Retain the complete copyright description.
- Modify commit message.
- Rebase upstream code.Changes in v3:
- Change the copyright notices to GPLv2 from gcc 4.2.1.Changes in v2:
- Retain the copyright notices from libgcc inumoddi3.candudivmoddi4.c.Vincent Chen (1):
RISC-V: Avoid corrupting the upper 32-bit ofphys_addr_tin ioremapZong Li (4):
RISC-V: Build tishift only on 64-bit
RISC-V: Add preprocessor directive for swiotlb
lib: Add umoddi3 and udivmoddi4 of GCC library routines
RISC-V: SelectGENERIC_LIB_UMODDI3on RV32arch/riscv/Kconfig | 1 + arch/riscv/kernel/setup.c | 3 + arch/riscv/lib/Makefile | 3 +- arch/riscv/mm/ioremap.c | 2 +- lib/Kconfig | 3 + lib/Makefile | 1 + lib/udivmoddi4.c | 326 ++++++++++++++++++++++++++++++++++++++++++++++ lib/umoddi3.c | 48 +++++++ 8 files changed, 385 insertions(+), 2 deletions(-) create mode 100644 lib/udivmoddi4.c create mode 100644 lib/umoddi3.c
Quoted 5 lines
Quoted 3 lines
--
2.7.4ping
Oh, sorry about that -- I took them into my local tree but they didn't make it to kernel.org. They should be in for-next now.