Skip to contentSkip to conversation

Add RISC-V 32 NOMMU support

PATCH Applied Jesse Taube 7 participants 28 messages Mar 1, 2023 – Mar 28, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover Add RISC-V 32 NOMMU support

This patch-set aims to add NOMMU support to RV32. Many people want to build simple emulators or HDL models of RISC-V this patch makes it possible to run linux on them.

Yimin Gu is the original author of this set. Submitted here:
https://lists.buildroot.org/pipermail/buildroot/2022-November/656134.html

Though Jesse T rewrote the Dconf.

The new set:
https://lists.buildroot.org/pipermail/buildroot/2022-December/658258.html
---
V1->V2:
- Add Conor's clock patch for implicit div64
- Fix typo in commit title 3/3
- Fix typo in commit description 2/3
V2->V3
- Change from defconfig file to a PHONY config
---

Conor Dooley (1):
clk: k210: remove an implicit 64-bit division

Jesse Taube (1):
riscv: configs: Add nommu PHONY defconfig for RV32

Yimin Gu (1):
riscv: Kconfig: Allow RV32 to build with no MMU

 arch/riscv/Kconfig     | 5 ++---
 arch/riscv/Makefile    | 4 ++++
 drivers/clk/clk-k210.c | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)
Signature · 1 line
2.39.0
#1 lore raw

PATCH v3 1/3 clk: k210: remove an implicit 64-bit division

From: Conor Dooley <[email protected]>

The K210 clock driver depends on SOC_CANAAN, which is only selectable when !MMU on RISC-V. !MMU is not possible on 32-bit yet, but patches have been sent for its enabling. The kernel test robot reported this implicit 64-bit division there.

Replace the implicit division with an explicit one.

---
V1->V2:
- new commit
V2->V3:
- No change

---
 drivers/clk/clk-k210.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-k210.c +1 -1
index 67a7cb3503c3..4eed667eddaf 100644
@@ -495,7 +495,7 @@ static unsigned long k210_pll_get_rate(struct clk_hw *hw,
 	f = FIELD_GET(K210_PLL_CLKF, reg) + 1;
 	od = FIELD_GET(K210_PLL_CLKOD, reg) + 1;
 
-	return (u64)parent_rate * f / (r * od);
+	return div_u64((u64)parent_rate * f, r * od);
 }
 
 static const struct clk_ops k210_pll_ops = {
Signature · 1 line
2.39.0
Reviewed-by on v3 1/3
#2 lore raw

Re: [PATCH v3 1/3] clk: k210: remove an implicit 64-bit division

Quoted 7 lines · Jesse Taube

From: Conor Dooley <[email protected]>

The K210 clock driver depends on SOC_CANAAN, which is only selectable when !MMU on RISC-V. !MMU is not possible on 32-bit yet, but patches have been sent for its enabling. The kernel test robot reported this implicit 64-bit division there.

Quoted 6 lines

Replace the implicit division with an explicit one.

Looks OK to me.

Signature · 8 lines
Damien Le Moal
Western Digital Research


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
maintainer
#3 lore raw

Re: [PATCH v3 1/3] clk: k210: remove an implicit 64-bit division

In reply to Jesse Taube

Quoting Jesse Taube (2023-02-28 16:26:55)

drivers/clk/clk-k210.c static unsigned long k210_pll_get_rate(struct clk_hw *hw, · line 498

Quoted 10 lines
drivers/clk/clk-k210.c +1 -1
index 67a7cb3503c3..4eed667eddaf 100644
@@ -495,7 +495,7 @@ static unsigned long k210_pll_get_rate(struct clk_hw *hw,
        f = FIELD_GET(K210_PLL_CLKF, reg) + 1;
        od = FIELD_GET(K210_PLL_CLKOD, reg) + 1;
 
-       return (u64)parent_rate * f / (r * od);
+       return div_u64((u64)parent_rate * f, r * od);

The equation 'r * od' can't overflow 32-bits, right?

#4 lore raw

Re: [PATCH v3 1/3] clk: k210: remove an implicit 64-bit division

Quoted 9 lines · Stephen Boyd

Quoting Jesse Taube (2023-02-28 16:26:55)

Quoted 8 lines
drivers/clk/clk-k210.c +0 -0
index 67a7cb3503c3..4eed667eddaf 100644
@@ -495,7 +495,7 @@ static unsigned long k210_pll_get_rate(struct clk_hw *hw,
        f = FIELD_GET(K210_PLL_CLKF, reg) + 1;
        od = FIELD_GET(K210_PLL_CLKOD, reg) + 1;
 
Quoted 4 lines

drivers/clk/clk-k210.c static unsigned long k210_pll_get_rate(struct clk_hw *hw, · line 498

Quoted 2 lines
drivers/clk/clk-k210.c +1 -1
-       return (u64)parent_rate * f / (r * od);
+       return div_u64((u64)parent_rate * f, r * od);

The equation 'r * od' can't overflow 32-bits, right?

Yah, I checked that when writing the patch. They're 4-bit fields:

Quoted 6 lines

/*
* PLL control register bits.
*/
#define K210_PLL_CLKR GENMASK(3, 0)
#define K210_PLL_CLKF GENMASK(9, 4)
#define K210_PLL_CLKOD GENMASK(13, 10)

Cheers,
Conor.

maintainer
#5 lore raw

Re: [PATCH v3 1/3] clk: k210: remove an implicit 64-bit division

Quoting Conor Dooley (2023-03-06 14:35:01)

Quoted 10 lines · Stephen Boyd
Quoted 9 lines

Quoting Jesse Taube (2023-02-28 16:26:55)

Quoted 8 lines
drivers/clk/clk-k210.c +0 -0
index 67a7cb3503c3..4eed667eddaf 100644
@@ -495,7 +495,7 @@ static unsigned long k210_pll_get_rate(struct clk_hw *hw,
        f = FIELD_GET(K210_PLL_CLKF, reg) + 1;
        od = FIELD_GET(K210_PLL_CLKOD, reg) + 1;
 
Quoted 6 lines
Quoted 4 lines

drivers/clk/clk-k210.c static unsigned long k210_pll_get_rate(struct clk_hw *hw, · line 498

Quoted 2 lines
drivers/clk/clk-k210.c +1 -1
-       return (u64)parent_rate * f / (r * od);
+       return div_u64((u64)parent_rate * f, r * od);

The equation 'r * od' can't overflow 32-bits, right?

Yah, I checked that when writing the patch. They're 4-bit fields:

Awesome

maintainer Applied
#6 lore raw

Re: [PATCH v3 1/3] clk: k210: remove an implicit 64-bit division

In reply to Jesse Taube

Quoting Jesse Taube (2023-02-28 16:26:55)

Quoted 7 lines

From: Conor Dooley <[email protected]>

The K210 clock driver depends on SOC_CANAAN, which is only selectable when !MMU on RISC-V. !MMU is not possible on 32-bit yet, but patches have been sent for its enabling. The kernel test robot reported this implicit 64-bit division there.

Quoted 7 lines

Replace the implicit division with an explicit one.

---

Seems better to merge this one-liner earlier to unblock 32-bit.

Applied to clk-fixes

maintainer
#7 lore raw

Re: [PATCH v3 1/3] clk: k210: remove an implicit 64-bit division

Quoted 16 lines · On Mon, 06 Mar 2023 14:41:11 PST (-0800), [email protected] wrote:

Quoting Jesse Taube (2023-02-28 16:26:55)

Quoted 7 lines

From: Conor Dooley <[email protected]>

The K210 clock driver depends on SOC_CANAAN, which is only selectable when !MMU on RISC-V. !MMU is not possible on 32-bit yet, but patches have been sent for its enabling. The kernel test robot reported this implicit 64-bit division there.

Quoted 7 lines

Replace the implicit division with an explicit one.

---

Quoted 3 lines

Seems better to merge this one-liner earlier to unblock 32-bit.

Applied to clk-fixes

Thanks!

#8 lore raw

PATCH v3 2/3 riscv: Kconfig: Allow RV32 to build with no MMU

In reply to Jesse Taube

From: Yimin Gu <[email protected]>

Some RISC-V 32bit cores do not have an MMU, and the kernel should be able to build for them. This patch enables the RV32 to be built with no MMU support.

---
V1->V2:
- Fix typo in commit description
V2->V3:
- No change

---
 arch/riscv/Kconfig | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/riscv/Kconfig +2 -3
index c5e42cc37604..d1f661425790 100644
@@ -177,8 +177,8 @@ config MMU
 
 config PAGE_OFFSET
 	hex
-	default 0xC0000000 if 32BIT
-	default 0x80000000 if 64BIT && !MMU
+	default 0xC0000000 if 32BIT && MMU
+	default 0x80000000 if !MMU
 	default 0xff60000000000000 if 64BIT
 
 config KASAN_SHADOW_OFFSET
@@ -279,7 +279,6 @@ config ARCH_RV32I
 	select GENERIC_LIB_ASHRDI3
 	select GENERIC_LIB_LSHRDI3
 	select GENERIC_LIB_UCMPDI2
-	select MMU
 
 config ARCH_RV64I
 	bool "RV64I"
Signature · 1 line
2.39.0
Reviewed-by on v3 2/3
#9 lore raw

Re: [PATCH v3 2/3] riscv: Kconfig: Allow RV32 to build with no MMU

Quoted 10 lines · Jesse Taube

From: Yimin Gu <[email protected]>

Some RISC-V 32bit cores do not have an MMU, and the kernel should be able to build for them. This patch enables the RV32 to be built with no MMU support.

Looks OK.

Signature · 8 lines
Damien Le Moal
Western Digital Research


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#10 lore raw

PATCH v3 3/3 riscv: configs: Add nommu PHONY defconfig for RV32

In reply to Jesse Taube

32bit risc-v can be configured to run without MMU. Introduce rv32_nommu_virt_defconfig .PHONY target, that is based on nommu_virt_defconfig. This is similar to how rv32_defconfig is based on "defconfig".

---
V1->V2:
- Fix typo in commit title
V2->V3:
- Change from defconfig file to a PHONY config

---
 arch/riscv/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
arch/riscv/Makefile +4 -0
index 6203c3378922..1b276f62f22b 100644
@@ -174,3 +174,7 @@ rv64_randconfig:
 PHONY += rv32_defconfig
 rv32_defconfig:
 	$(Q)$(MAKE) -f $(srctree)/Makefile defconfig 32-bit.config
+
+PHONY += rv32_nommu_virt_defconfig
+rv32_nommu_virt_defconfig:
+	$(Q)$(MAKE) -f $(srctree)/Makefile nommu_virt_defconfig 32-bit.config
Signature · 1 line
2.39.0
#11 lore raw
In reply to Jesse Taube

Hi--

Quoted 10 lines · Jesse Taube

This patch-set aims to add NOMMU support to RV32. Many people want to build simple emulators or HDL models of RISC-V this patch makes it possible to run linux on them.

Yimin Gu is the original author of this set. Submitted here:
https://lists.buildroot.org/pipermail/buildroot/2022-November/656134.html

Though Jesse T rewrote the Dconf.

Dconf?

Quoted 11 lines

The new set:
https://lists.buildroot.org/pipermail/buildroot/2022-December/658258.html
---
V1->V2:
- Add Conor's clock patch for implicit div64
- Fix typo in commit title 3/3
- Fix typo in commit description 2/3
V2->V3
- Change from defconfig file to a PHONY config
---

Is this 'rv32_nommu_virt_defconfig' target the only build target that is supported?

I ask because I applied the 3 patches and did 25 randconfig builds. 5 of them failed the same way:

riscv32-linux-ld: drivers/soc/canaan/k210-sysctl.o: in function `k210_soc_early_init':
k210-sysctl.c:(.init.text+0x78): undefined reference to `k210_clk_early_init'

because
# CONFIG_COMMON_CLK_K210 is not set

Maybe SOC_CANAAN needs some more selects for required code?

Quoted 14 lines

Conor Dooley (1):
clk: k210: remove an implicit 64-bit division

Jesse Taube (1):
riscv: configs: Add nommu PHONY defconfig for RV32

Yimin Gu (1):
riscv: Kconfig: Allow RV32 to build with no MMU

 arch/riscv/Kconfig     | 5 ++---
 arch/riscv/Makefile    | 4 ++++
 drivers/clk/clk-k210.c | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)
Signature · 1 line
~Randy
#12 lore raw
Quoted 28 lines · Randy Dunlap

Hi--

Quoted 10 lines · Jesse Taube

This patch-set aims to add NOMMU support to RV32. Many people want to build simple emulators or HDL models of RISC-V this patch makes it possible to run linux on them.

Yimin Gu is the original author of this set. Submitted here:
https://lists.buildroot.org/pipermail/buildroot/2022-November/656134.html

Though Jesse T rewrote the Dconf.

Dconf?

Quoted 11 lines

The new set:
https://lists.buildroot.org/pipermail/buildroot/2022-December/658258.html
---
V1->V2:
- Add Conor's clock patch for implicit div64
- Fix typo in commit title 3/3
- Fix typo in commit description 2/3
V2->V3
- Change from defconfig file to a PHONY config
---

Quoted 8 lines

Is this 'rv32_nommu_virt_defconfig' target the only build target that is supported?

I ask because I applied the 3 patches and did 25 randconfig builds. 5 of them failed the same way:

riscv32-linux-ld: drivers/soc/canaan/k210-sysctl.o: in function `k210_soc_early_init':
k210-sysctl.c:(.init.text+0x78): undefined reference to `k210_clk_early_init'

Arg. Forgot about that. k210 is rv64 only and while the clk driver could still compile test with rv32 (or any arch), that driver provides the k210_clk_early_init() function which is called very early in the boot process from k210_soc_early_init(), which is an SOC_EARLY_INIT_DECLARE() call. The problem may be there. Probably should be disabled for rv32 if no SoC need that sort of early init call.

Quoted 22 lines

because
# CONFIG_COMMON_CLK_K210 is not set

Maybe SOC_CANAAN needs some more selects for required code?

Quoted 14 lines

Conor Dooley (1):
clk: k210: remove an implicit 64-bit division

Jesse Taube (1):
riscv: configs: Add nommu PHONY defconfig for RV32

Yimin Gu (1):
riscv: Kconfig: Allow RV32 to build with no MMU

 arch/riscv/Kconfig     | 5 ++---
 arch/riscv/Makefile    | 4 ++++
 drivers/clk/clk-k210.c | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)
Signature · 2 lines
Damien Le Moal
Western Digital Research
#13 lore raw
Quoted 29 lines · Damien Le Moal
Quoted 28 lines · Randy Dunlap

Hi--

Quoted 10 lines · Jesse Taube

This patch-set aims to add NOMMU support to RV32. Many people want to build simple emulators or HDL models of RISC-V this patch makes it possible to run linux on them.

Yimin Gu is the original author of this set. Submitted here:
https://lists.buildroot.org/pipermail/buildroot/2022-November/656134.html

Though Jesse T rewrote the Dconf.

Dconf?

Quoted 11 lines

The new set:
https://lists.buildroot.org/pipermail/buildroot/2022-December/658258.html
---
V1->V2:
- Add Conor's clock patch for implicit div64
- Fix typo in commit title 3/3
- Fix typo in commit description 2/3
V2->V3
- Change from defconfig file to a PHONY config
---

Quoted 8 lines
Quoted 8 lines

Is this 'rv32_nommu_virt_defconfig' target the only build target that is supported?

I ask because I applied the 3 patches and did 25 randconfig builds. 5 of them failed the same way:

riscv32-linux-ld: drivers/soc/canaan/k210-sysctl.o: in function `k210_soc_early_init':
k210-sysctl.c:(.init.text+0x78): undefined reference to `k210_clk_early_init'

I can not recreate this error.
can you send me the .config you used.

Thanks,
Jesse Taube

Quoted 31 lines

Arg. Forgot about that. k210 is rv64 only and while the clk driver could still compile test with rv32 (or any arch), that driver provides the k210_clk_early_init() function which is called very early in the boot process from k210_soc_early_init(), which is an SOC_EARLY_INIT_DECLARE() call. The problem may be there. Probably should be disabled for rv32 if no SoC need that sort of early init call.

Quoted 22 lines

because
# CONFIG_COMMON_CLK_K210 is not set

Maybe SOC_CANAAN needs some more selects for required code?

Quoted 14 lines

Conor Dooley (1):
clk: k210: remove an implicit 64-bit division

Jesse Taube (1):
riscv: configs: Add nommu PHONY defconfig for RV32

Yimin Gu (1):
riscv: Kconfig: Allow RV32 to build with no MMU

  arch/riscv/Kconfig     | 5 ++---
  arch/riscv/Makefile    | 4 ++++
  drivers/clk/clk-k210.c | 2 +-
  3 files changed, 7 insertions(+), 4 deletions(-)
#14 lore raw

Hi--

Quoted 38 lines · Jesse Taube
Quoted 35 lines · Damien Le Moal
Quoted 34 lines · Randy Dunlap

Hi--

Quoted 10 lines · Jesse Taube

This patch-set aims to add NOMMU support to RV32. Many people want to build simple emulators or HDL models of RISC-V this patch makes it possible to run linux on them.

Yimin Gu is the original author of this set. Submitted here:
https://lists.buildroot.org/pipermail/buildroot/2022-November/656134.html

Though Jesse T rewrote the Dconf.

Dconf?

Quoted 11 lines

The new set:
https://lists.buildroot.org/pipermail/buildroot/2022-December/658258.html
---
V1->V2:
  - Add Conor's clock patch for implicit div64
  - Fix typo in commit title 3/3
  - Fix typo in commit description 2/3 V2->V3
  - Change from defconfig file to a PHONY config
---

Is this 'rv32_nommu_virt_defconfig' target the only build target that is supported?

I ask because I applied the 3 patches and did 25 randconfig builds. 5 of them failed the same way:

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

riscv32-linux-ld: drivers/soc/canaan/k210-sysctl.o: in function `k210_soc_early_init':
k210-sysctl.c:(.init.text+0x78): undefined reference to `k210_clk_early_init'

I can not recreate this error.
can you send me the .config you used.

Thanks,
Jesse Taube

Sure, it's attached.

Quoted 30 lines
Quoted 30 lines

Arg. Forgot about that. k210 is rv64 only and while the clk driver could still compile test with rv32 (or any arch), that driver provides the k210_clk_early_init() function which is called very early in the boot process from k210_soc_early_init(), which is an SOC_EARLY_INIT_DECLARE() call. The problem may be there. Probably should be disabled for rv32 if no SoC need that sort of early init call.

Quoted 22 lines

because
# CONFIG_COMMON_CLK_K210 is not set

Maybe SOC_CANAAN needs some more selects for required code?

Quoted 14 lines

Conor Dooley (1):
   clk: k210: remove an implicit 64-bit division

Jesse Taube (1):
   riscv: configs: Add nommu PHONY defconfig for RV32

Yimin Gu (1):
   riscv: Kconfig: Allow RV32 to build with no MMU

  arch/riscv/Kconfig     | 5 ++---
  arch/riscv/Makefile    | 4 ++++
  drivers/clk/clk-k210.c | 2 +-

  3 files changed, 7 insertions(+), 4 deletions(-)
Signature · 1 line
~Randy
#15 lore raw
Quoted 43 lines · Randy Dunlap

Hi--

Quoted 40 lines · Jesse Taube
Quoted 37 lines · Damien Le Moal
Quoted 36 lines · Randy Dunlap

Hi--

Quoted 10 lines · Jesse Taube

This patch-set aims to add NOMMU support to RV32. Many people want to build simple emulators or HDL models of RISC-V this patch makes it possible to run linux on them.

Yimin Gu is the original author of this set. Submitted here:
https://lists.buildroot.org/pipermail/buildroot/2022-November/656134.html

Though Jesse T rewrote the Dconf.

Dconf?

Quoted 11 lines

The new set:
https://lists.buildroot.org/pipermail/buildroot/2022-December/658258.html
---
V1->V2:
  - Add Conor's clock patch for implicit div64
  - Fix typo in commit title 3/3
  - Fix typo in commit description 2/3
V2->V3
  - Change from defconfig file to a PHONY config
---

Is this 'rv32_nommu_virt_defconfig' target the only build target that is supported?

I ask because I applied the 3 patches and did 25 randconfig builds. 5 of them failed the same way:

riscv32-linux-ld: drivers/soc/canaan/k210-sysctl.o: in function `k210_soc_early_init':
k210-sysctl.c:(.init.text+0x78): undefined reference to `k210_clk_early_init'

Quoted 7 lines
Quoted 5 lines

I can not recreate this error.
can you send me the .config you used.

Thanks,
Jesse Taube

Sure, it's attached.

Hmmm, it links fine for me.

objdump -x vmlinux | grep k210_clk_early_init
81e40124 g F .init.text 00000088 k210_clk_early_init

gcc version 11.3.0 (Buildroot 2022.11-361-g1be0d438f7) GNU assembler version 2.38 (riscv32-buildroot-linux-uclibc) GNU ld (GNU Binutils) 2.38

what gcc version are you using?

Thanks,
Jesse Taube

Quoted 32 lines
Quoted 31 lines
Quoted 31 lines

Arg. Forgot about that. k210 is rv64 only and while the clk driver could still compile test with rv32 (or any arch), that driver provides the k210_clk_early_init() function which is called very early in the boot process from k210_soc_early_init(), which is an SOC_EARLY_INIT_DECLARE() call. The problem may be there. Probably should be disabled for rv32 if no SoC need that sort of early init call.

Quoted 22 lines

because
# CONFIG_COMMON_CLK_K210 is not set

Maybe SOC_CANAAN needs some more selects for required code?

Quoted 14 lines

Conor Dooley (1):
   clk: k210: remove an implicit 64-bit division

Jesse Taube (1):
   riscv: configs: Add nommu PHONY defconfig for RV32

Yimin Gu (1):
   riscv: Kconfig: Allow RV32 to build with no MMU

   arch/riscv/Kconfig     | 5 ++---
   arch/riscv/Makefile    | 4 ++++
   drivers/clk/clk-k210.c | 2 +-
   3 files changed, 7 insertions(+), 4 deletions(-)
#16 lore raw
Quoted 56 lines · Jesse Taube
Quoted 43 lines · Randy Dunlap

Hi--

Quoted 40 lines · Jesse Taube
Quoted 37 lines · Damien Le Moal
Quoted 36 lines · Randy Dunlap

Hi--

Quoted 10 lines · Jesse Taube

This patch-set aims to add NOMMU support to RV32. Many people want to build simple emulators or HDL models of RISC-V this patch makes it possible to run linux on them.

Yimin Gu is the original author of this set. Submitted here:
https://lists.buildroot.org/pipermail/buildroot/2022-November/656134.html

Though Jesse T rewrote the Dconf.

Dconf?

Quoted 11 lines

The new set:
https://lists.buildroot.org/pipermail/buildroot/2022-December/658258.html
---
V1->V2:
   - Add Conor's clock patch for implicit div64
   - Fix typo in commit title 3/3
   - Fix typo in commit description 2/3 V2->V3
   - Change from defconfig file to a PHONY config
---

Is this 'rv32_nommu_virt_defconfig' target the only build target that is supported?

I ask because I applied the 3 patches and did 25 randconfig builds. 5 of them failed the same way:

riscv32-linux-ld: drivers/soc/canaan/k210-sysctl.o: in function `k210_soc_early_init':
k210-sysctl.c:(.init.text+0x78): undefined reference to `k210_clk_early_init'

Quoted 7 lines
Quoted 5 lines

I can not recreate this error.
can you send me the .config you used.

Thanks,
Jesse Taube

Sure, it's attached.

Hmmm, it links fine for me.

Quoted 8 lines

objdump -x vmlinux | grep k210_clk_early_init 81e40124 g     F .init.text     00000088 k210_clk_early_init

gcc version 11.3.0 (Buildroot 2022.11-361-g1be0d438f7) GNU assembler version 2.38 (riscv32-buildroot-linux-uclibc) GNU ld (GNU Binutils) 2.38

what gcc version are you using?

gcc (SUSE Linux) 12.2.1 20230124 [revision 193f7e62815b4089dfaed4c2bd34fd4f10209e27] from opensuse Tumbleweed.

I'll try it on a current tree...

Quoted 32 lines
Quoted 32 lines
Quoted 31 lines
Quoted 31 lines

Arg. Forgot about that. k210 is rv64 only and while the clk driver could still compile test with rv32 (or any arch), that driver provides the k210_clk_early_init() function which is called very early in the boot process from k210_soc_early_init(), which is an SOC_EARLY_INIT_DECLARE() call. The problem may be there. Probably should be disabled for rv32 if no SoC need that sort of early init call.

Quoted 22 lines

because
# CONFIG_COMMON_CLK_K210 is not set

Maybe SOC_CANAAN needs some more selects for required code?

Quoted 14 lines

Conor Dooley (1):
    clk: k210: remove an implicit 64-bit division

Jesse Taube (1):
    riscv: configs: Add nommu PHONY defconfig for RV32

Yimin Gu (1):
    riscv: Kconfig: Allow RV32 to build with no MMU

   arch/riscv/Kconfig     | 5 ++---
   arch/riscv/Makefile    | 4 ++++
   drivers/clk/clk-k210.c | 2 +-

   3 files changed, 7 insertions(+), 4 deletions(-)
Signature · 1 line
~Randy
#17 lore raw
Quoted 66 lines · Randy Dunlap
Quoted 63 lines · Jesse Taube
Quoted 43 lines · Randy Dunlap

Hi--

Quoted 40 lines · Jesse Taube
Quoted 37 lines · Damien Le Moal
Quoted 36 lines · Randy Dunlap

Hi--

Quoted 10 lines · Jesse Taube

This patch-set aims to add NOMMU support to RV32. Many people want to build simple emulators or HDL models of RISC-V this patch makes it possible to run linux on them.

Yimin Gu is the original author of this set. Submitted here:
https://lists.buildroot.org/pipermail/buildroot/2022-November/656134.html

Though Jesse T rewrote the Dconf.

Dconf?

Quoted 11 lines

The new set:
https://lists.buildroot.org/pipermail/buildroot/2022-December/658258.html
---
V1->V2:
   - Add Conor's clock patch for implicit div64
   - Fix typo in commit title 3/3
   - Fix typo in commit description 2/3 V2->V3
   - Change from defconfig file to a PHONY config
---

Is this 'rv32_nommu_virt_defconfig' target the only build target that is supported?

I ask because I applied the 3 patches and did 25 randconfig builds. 5 of them failed the same way:

riscv32-linux-ld: drivers/soc/canaan/k210-sysctl.o: in function `k210_soc_early_init':
k210-sysctl.c:(.init.text+0x78): undefined reference to `k210_clk_early_init'

Quoted 7 lines
Quoted 5 lines

I can not recreate this error.
can you send me the .config you used.

Thanks,
Jesse Taube

Sure, it's attached.

Hmmm, it links fine for me.

objdump -x vmlinux | grep k210_clk_early_init 81e40124 g     F .init.text     00000088 k210_clk_early_init

gcc version 11.3.0 (Buildroot 2022.11-361-g1be0d438f7) GNU assembler version 2.38 (riscv32-buildroot-linux-uclibc) GNU ld (GNU Binutils) 2.38

Quoted 7 lines
Quoted 1 line

what gcc version are you using?

gcc (SUSE Linux) 12.2.1 20230124 [revision 193f7e62815b4089dfaed4c2bd34fd4f10209e27] from opensuse Tumbleweed.

I'll try it on a current tree...

OK, I don't know how it happened. I cannot reproduce it now. The failing .config files has CONFIG_MMU is not set (for RV32I), which appears to be impossible.

Sorry to bother you.

Thanks.

Quoted 33 lines
Quoted 32 lines
Quoted 32 lines
Quoted 31 lines
Quoted 31 lines

Arg. Forgot about that. k210 is rv64 only and while the clk driver could still compile test with rv32 (or any arch), that driver provides the k210_clk_early_init() function which is called very early in the boot process from k210_soc_early_init(), which is an SOC_EARLY_INIT_DECLARE() call. The problem may be there. Probably should be disabled for rv32 if no SoC need that sort of early init call.

Quoted 22 lines

because
# CONFIG_COMMON_CLK_K210 is not set

Maybe SOC_CANAAN needs some more selects for required code?

Quoted 14 lines

Conor Dooley (1):
    clk: k210: remove an implicit 64-bit division

Jesse Taube (1):
    riscv: configs: Add nommu PHONY defconfig for RV32

Yimin Gu (1):
    riscv: Kconfig: Allow RV32 to build with no MMU

   arch/riscv/Kconfig     | 5 ++---
   arch/riscv/Makefile    | 4 ++++
   drivers/clk/clk-k210.c | 2 +-

   3 files changed, 7 insertions(+), 4 deletions(-)
Signature · 1 line
~Randy
#18 lore raw
Quoted 72 lines · Randy Dunlap
Quoted 69 lines · Randy Dunlap
Quoted 64 lines · Jesse Taube
Quoted 43 lines · Randy Dunlap

Hi--

Quoted 40 lines · Jesse Taube
Quoted 37 lines · Damien Le Moal
Quoted 36 lines · Randy Dunlap

Hi--

Quoted 10 lines · Jesse Taube

This patch-set aims to add NOMMU support to RV32. Many people want to build simple emulators or HDL models of RISC-V this patch makes it possible to run linux on them.

Yimin Gu is the original author of this set. Submitted here:
https://lists.buildroot.org/pipermail/buildroot/2022-November/656134.html

Though Jesse T rewrote the Dconf.

Dconf?

Quoted 11 lines

The new set:
https://lists.buildroot.org/pipermail/buildroot/2022-December/658258.html
---
V1->V2:
   - Add Conor's clock patch for implicit div64
   - Fix typo in commit title 3/3
   - Fix typo in commit description 2/3
V2->V3
   - Change from defconfig file to a PHONY config
---

Is this 'rv32_nommu_virt_defconfig' target the only build target that is supported?

I ask because I applied the 3 patches and did 25 randconfig builds. 5 of them failed the same way:

riscv32-linux-ld: drivers/soc/canaan/k210-sysctl.o: in function `k210_soc_early_init':
k210-sysctl.c:(.init.text+0x78): undefined reference to `k210_clk_early_init'

Quoted 7 lines
Quoted 5 lines

I can not recreate this error.
can you send me the .config you used.

Thanks,
Jesse Taube

Sure, it's attached.

Hmmm, it links fine for me.

objdump -x vmlinux | grep k210_clk_early_init 81e40124 g     F .init.text     00000088 k210_clk_early_init

gcc version 11.3.0 (Buildroot 2022.11-361-g1be0d438f7) GNU assembler version 2.38 (riscv32-buildroot-linux-uclibc) GNU ld (GNU Binutils) 2.38

what gcc version are you using?

Quoted 8 lines
Quoted 4 lines

gcc (SUSE Linux) 12.2.1 20230124 [revision 193f7e62815b4089dfaed4c2bd34fd4f10209e27] from opensuse Tumbleweed.

I'll try it on a current tree...

OK, I don't know how it happened. I cannot reproduce it now. The failing .config files has CONFIG_MMU is not set (for RV32I), which appears to be impossible.

These patches add CONFIG_MMU is not set (for RV32I). But no worries it seems to be a non issue now.

Your thoughts Damien?

Thanks,
Jesse Taube

Quoted 39 lines

Sorry to bother you.

Thanks.

Quoted 33 lines
Quoted 32 lines
Quoted 32 lines
Quoted 31 lines
Quoted 31 lines

Arg. Forgot about that. k210 is rv64 only and while the clk driver could still compile test with rv32 (or any arch), that driver provides the k210_clk_early_init() function which is called very early in the boot process from k210_soc_early_init(), which is an SOC_EARLY_INIT_DECLARE() call. The problem may be there. Probably should be disabled for rv32 if no SoC need that sort of early init call.

Quoted 22 lines

because
# CONFIG_COMMON_CLK_K210 is not set

Maybe SOC_CANAAN needs some more selects for required code?

Quoted 14 lines

Conor Dooley (1):
    clk: k210: remove an implicit 64-bit division

Jesse Taube (1):
    riscv: configs: Add nommu PHONY defconfig for RV32

Yimin Gu (1):
    riscv: Kconfig: Allow RV32 to build with no MMU

    arch/riscv/Kconfig     | 5 ++---
    arch/riscv/Makefile    | 4 ++++
    drivers/clk/clk-k210.c | 2 +-
    3 files changed, 7 insertions(+), 4 deletions(-)
#19 lore raw
Quoted 80 lines · Jesse Taube
Quoted 77 lines · Randy Dunlap
Quoted 73 lines · Randy Dunlap
Quoted 56 lines · Jesse Taube
Quoted 43 lines · Randy Dunlap

Hi--

Quoted 40 lines · Jesse Taube
Quoted 37 lines · Damien Le Moal
Quoted 36 lines · Randy Dunlap

Hi--

Quoted 10 lines · Jesse Taube

This patch-set aims to add NOMMU support to RV32. Many people want to build simple emulators or HDL models of RISC-V this patch makes it possible to run linux on them.

Yimin Gu is the original author of this set. Submitted here:
https://lists.buildroot.org/pipermail/buildroot/2022-November/656134.html

Though Jesse T rewrote the Dconf.

Dconf?

Quoted 11 lines

The new set:
https://lists.buildroot.org/pipermail/buildroot/2022-December/658258.html
---
V1->V2:
    - Add Conor's clock patch for implicit div64
    - Fix typo in commit title 3/3
    - Fix typo in commit description 2/3 V2->V3
    - Change from defconfig file to a PHONY config
---

Is this 'rv32_nommu_virt_defconfig' target the only build target that is supported?

I ask because I applied the 3 patches and did 25 randconfig builds. 5 of them failed the same way:

riscv32-linux-ld: drivers/soc/canaan/k210-sysctl.o: in function `k210_soc_early_init':
k210-sysctl.c:(.init.text+0x78): undefined reference to `k210_clk_early_init'

Quoted 7 lines
Quoted 5 lines

I can not recreate this error.
can you send me the .config you used.

Thanks,
Jesse Taube

Sure, it's attached.

Hmmm, it links fine for me.

Quoted 8 lines

objdump -x vmlinux | grep k210_clk_early_init 81e40124 g     F .init.text     00000088 k210_clk_early_init

gcc version 11.3.0 (Buildroot 2022.11-361-g1be0d438f7) GNU assembler version 2.38 (riscv32-buildroot-linux-uclibc) GNU ld (GNU Binutils) 2.38

what gcc version are you using?

gcc (SUSE Linux) 12.2.1 20230124 [revision 193f7e62815b4089dfaed4c2bd34fd4f10209e27] from opensuse Tumbleweed.

I'll try it on a current tree...

Quoted 8 lines
Quoted 3 lines

OK, I don't know how it happened. I cannot reproduce it now. The failing .config files has CONFIG_MMU is not set (for RV32I), which appears to be impossible.

These patches add CONFIG_MMU is not set (for RV32I). But no worries it seems to be a non issue  now.

Your thoughts Damien?

Thanks for reminding me.

With these 3 patches applied to linux-next-20230307, I still get this build error.

Quoted 41 lines

Thanks,
Jesse Taube

Quoted 39 lines

Sorry to bother you.

Thanks.

Quoted 33 lines
Quoted 32 lines
Quoted 32 lines
Quoted 31 lines
Quoted 31 lines

Arg. Forgot about that. k210 is rv64 only and while the clk driver could still compile test with rv32 (or any arch), that driver provides the k210_clk_early_init() function which is called very early in the boot process from k210_soc_early_init(), which is an SOC_EARLY_INIT_DECLARE() call. The problem may be there. Probably should be disabled for rv32 if no SoC need that sort of early init call.

Quoted 22 lines

because
# CONFIG_COMMON_CLK_K210 is not set

Maybe SOC_CANAAN needs some more selects for required code?

Quoted 14 lines

Conor Dooley (1):
     clk: k210: remove an implicit 64-bit division

Jesse Taube (1):
     riscv: configs: Add nommu PHONY defconfig for RV32

Yimin Gu (1):
     riscv: Kconfig: Allow RV32 to build with no MMU

    arch/riscv/Kconfig     | 5 ++---
    arch/riscv/Makefile    | 4 ++++
    drivers/clk/clk-k210.c | 2 +-

    3 files changed, 7 insertions(+), 4 deletions(-)
Signature · 1 line
~Randy
#20 lore raw
Quoted 6 lines · Randy Dunlap
Quoted 6 lines
Quoted 3 lines

OK, I don't know how it happened. I cannot reproduce it now. The failing .config files has CONFIG_MMU is not set (for RV32I), which appears to be impossible.

These patches add CONFIG_MMU is not set (for RV32I). But no worries it seems to be a non issue  now.

Quoted 7 lines
Quoted 2 lines

Your thoughts Damien?

Thanks for reminding me.

With these 3 patches applied to linux-next-20230307, I still get this build error.

Does this help ?

drivers/soc/canaan/Kconfig +3 -2
index 2527cf5757ec..7796c5f1d109 100644
@@ -4,7 +4,8 @@ config SOC_K210_SYSCTL
        bool "Canaan Kendryte K210 SoC system controller"
        depends on RISCV && SOC_CANAAN && OF
        default SOC_CANAAN
-        select PM
-        select MFD_SYSCON
+       select COMMON_CLK_K210
+       select PM
+       select MFD_SYSCON
        help
          Canaan Kendryte K210 SoC system controller driver.

(just noticed that there are whitespace errors here...)

Note that both the sysctl and clk driver depend on RISCV. I think these should probably also depend on 64BIT, and eventually add a "|| COMPILE_TEST" as well. So something like this:

drivers/clk/Kconfig +1 -1
index b6c5bf69a2b2..657a36d2640d 100644
@@ -431,7 +431,7 @@ config COMMON_CLK_FIXED_MMIO
 
 config COMMON_CLK_K210
        bool "Clock driver for the Canaan Kendryte K210 SoC"
-       depends on OF && RISCV && SOC_CANAAN
+       depends on OF && RISCV && SOC_CANAAN && (64BIT || COMPILE_TEST)
        default SOC_CANAAN
        help
          Support for the Canaan Kendryte K210 RISC-V SoC clocks.
drivers/soc/canaan/Kconfig +4 -3
index 2527cf5757ec..1745a614d2a7 100644
@@ -2,9 +2,10 @@
 
 config SOC_K210_SYSCTL
        bool "Canaan Kendryte K210 SoC system controller"
-       depends on RISCV && SOC_CANAAN && OF
+       depends on RISCV && SOC_CANAAN && OF && (64BIT || COMPILE_TEST)
        default SOC_CANAAN
-        select PM
-        select MFD_SYSCON
+       select COMMON_CLK_K210
+       select PM
+       select MFD_SYSCON
        help
          Canaan Kendryte K210 SoC system controller driver.

COMPILE_TEST is optional though, but I do not see any reason why not eventhough in practice these drivers will likely never end up in 32-bits SoC.

Signature · 8 lines
Damien Le Moal
Western Digital Research


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#21 lore raw
Quoted 71 lines · Damien Le Moal
Quoted 6 lines · Randy Dunlap
Quoted 6 lines
Quoted 3 lines

OK, I don't know how it happened. I cannot reproduce it now. The failing .config files has CONFIG_MMU is not set (for RV32I), which appears to be impossible.

These patches add CONFIG_MMU is not set (for RV32I). But no worries it seems to be a non issue  now.

Quoted 7 lines
Quoted 2 lines

Your thoughts Damien?

Thanks for reminding me.

With these 3 patches applied to linux-next-20230307, I still get this build error.

Does this help ?

drivers/soc/canaan/Kconfig +3 -2
index 2527cf5757ec..7796c5f1d109 100644
@@ -4,7 +4,8 @@ config SOC_K210_SYSCTL
         bool "Canaan Kendryte K210 SoC system controller"
         depends on RISCV && SOC_CANAAN && OF
         default SOC_CANAAN
-        select PM
-        select MFD_SYSCON
+       select COMMON_CLK_K210
+       select PM
+       select MFD_SYSCON
         help
           Canaan Kendryte K210 SoC system controller driver.

(just noticed that there are whitespace errors here...)

Note that both the sysctl and clk driver depend on RISCV. I think these should probably also depend on 64BIT, and eventually add a "|| COMPILE_TEST" as well. So something like this:

drivers/clk/Kconfig +1 -1
index b6c5bf69a2b2..657a36d2640d 100644
@@ -431,7 +431,7 @@ config COMMON_CLK_FIXED_MMIO
 
  config COMMON_CLK_K210
         bool "Clock driver for the Canaan Kendryte K210 SoC"
-       depends on OF && RISCV && SOC_CANAAN
+       depends on OF && RISCV && SOC_CANAAN && (64BIT || COMPILE_TEST)
         default SOC_CANAAN
         help
           Support for the Canaan Kendryte K210 RISC-V SoC clocks.
drivers/soc/canaan/Kconfig +4 -3
index 2527cf5757ec..1745a614d2a7 100644
@@ -2,9 +2,10 @@
 
  config SOC_K210_SYSCTL
         bool "Canaan Kendryte K210 SoC system controller"
-       depends on RISCV && SOC_CANAAN && OF
+       depends on RISCV && SOC_CANAAN && OF && (64BIT || COMPILE_TEST)
         default SOC_CANAAN
-        select PM
-        select MFD_SYSCON
+       select COMMON_CLK_K210
+       select PM
+       select MFD_SYSCON
         help
           Canaan Kendryte K210 SoC system controller driver.
Quoted 4 lines

COMPILE_TEST is optional though, but I do not see any reason why not eventhough in practice these drivers will likely never end up in 32-bits SoC.

Oh thanks I was in the in the midst of making a similar patch.
Do you want to submit it or shall I. Also thanks for the help with this, was using tag 6.2.

#22 lore raw
Quoted 74 lines · Jesse Taube
Quoted 71 lines · Damien Le Moal
Quoted 6 lines · Randy Dunlap
Quoted 6 lines
Quoted 3 lines

OK, I don't know how it happened. I cannot reproduce it now. The failing .config files has CONFIG_MMU is not set (for RV32I), which appears to be impossible.

These patches add CONFIG_MMU is not set (for RV32I). But no worries it seems to be a non issue  now.

Quoted 7 lines
Quoted 2 lines

Your thoughts Damien?

Thanks for reminding me.

With these 3 patches applied to linux-next-20230307, I still get this build error.

Does this help ?

drivers/soc/canaan/Kconfig +3 -2
index 2527cf5757ec..7796c5f1d109 100644
@@ -4,7 +4,8 @@ config SOC_K210_SYSCTL
         bool "Canaan Kendryte K210 SoC system controller"
         depends on RISCV && SOC_CANAAN && OF
         default SOC_CANAAN
-        select PM
-        select MFD_SYSCON
+       select COMMON_CLK_K210
+       select PM
+       select MFD_SYSCON
         help
           Canaan Kendryte K210 SoC system controller driver.

(just noticed that there are whitespace errors here...)

Note that both the sysctl and clk driver depend on RISCV. I think these should probably also depend on 64BIT, and eventually add a "|| COMPILE_TEST" as well. So something like this:

drivers/clk/Kconfig +1 -1
index b6c5bf69a2b2..657a36d2640d 100644
@@ -431,7 +431,7 @@ config COMMON_CLK_FIXED_MMIO
 
  config COMMON_CLK_K210
         bool "Clock driver for the Canaan Kendryte K210 SoC"
-       depends on OF && RISCV && SOC_CANAAN
+       depends on OF && RISCV && SOC_CANAAN && (64BIT || COMPILE_TEST)
         default SOC_CANAAN
         help
           Support for the Canaan Kendryte K210 RISC-V SoC clocks.
drivers/soc/canaan/Kconfig +4 -3
index 2527cf5757ec..1745a614d2a7 100644
@@ -2,9 +2,10 @@
 
  config SOC_K210_SYSCTL
         bool "Canaan Kendryte K210 SoC system controller"
-       depends on RISCV && SOC_CANAAN && OF
+       depends on RISCV && SOC_CANAAN && OF && (64BIT || COMPILE_TEST)
         default SOC_CANAAN
-        select PM
-        select MFD_SYSCON
+       select COMMON_CLK_K210
+       select PM
+       select MFD_SYSCON
         help
           Canaan Kendryte K210 SoC system controller driver.
Quoted 8 lines
Quoted 4 lines

COMPILE_TEST is optional though, but I do not see any reason why not eventhough in practice these drivers will likely never end up in 32-bits SoC.

Oh thanks I was in the in the midst of making a similar patch. Do you want to submit it or shall I. Also thanks for the help with this, was using tag 6.2.

I am busy with other stuff and do not have time to properly test this. So please feel free to go ahead and send something fully tested.

Signature · 2 lines
Damien Le Moal
Western Digital Research
#23 lore raw
Quoted 21 lines · Damien Le Moal
Quoted 20 lines · Jesse Taube
Quoted 17 lines · Damien Le Moal
Quoted 6 lines · Randy Dunlap
Quoted 6 lines
Quoted 3 lines

OK, I don't know how it happened. I cannot reproduce it now. The failing .config files has CONFIG_MMU is not set (for RV32I), which appears to be impossible.

These patches add CONFIG_MMU is not set (for RV32I). But no worries it seems to be a non issue  now.

Quoted 7 lines
Quoted 2 lines

Your thoughts Damien?

Thanks for reminding me.

With these 3 patches applied to linux-next-20230307, I still get this build error.

Does this help ?

Quoted 11 lines
Quoted 11 lines

drivers/soc/canaan/Kconfig config SOC_K210_SYSCTL · line 7

Quoted 11 lines
drivers/soc/canaan/Kconfig +1 -2
index 2527cf5757ec..7796c5f1d109 100644
@@ -4,7 +4,8 @@ config SOC_K210_SYSCTL
          bool "Canaan Kendryte K210 SoC system controller"
          depends on RISCV && SOC_CANAAN && OF
          default SOC_CANAAN
-        select PM
-        select MFD_SYSCON
+       select COMMON_CLK_K210

Ok so this has nothing to do with my patch-set actually and will happen on 64BIT as well. the commit that brought in this bug is:

RISC-V: stop directly selecting drivers for SOC_CANAAN 3af577f9826fdddefac42b35fc5eb3912c5b7d85

I have tested the patches Damien here they work on 64BIT and 32BIT.
The change to drivers/clk/Kconfig is not strictly necessary but makes scene. I don't think they need to be tested on 32bit so we can omit COMPILE_TEST.

If needed i can submit the patches, which I will author under Damien.

As far as I can see there is nothing holding back this set as the issue found has no relation to this set.

Thanks,
Jesse Taube

Quoted 52 lines
Quoted 43 lines
Quoted 43 lines
drivers/soc/canaan/Kconfig +2 -0
+       select PM
+       select MFD_SYSCON
          help
            Canaan Kendryte K210 SoC system controller driver.

(just noticed that there are whitespace errors here...)

Note that both the sysctl and clk driver depend on RISCV. I think these should probably also depend on 64BIT, and eventually add a "|| COMPILE_TEST" as well. So something like this:

drivers/clk/Kconfig +1 -1
index b6c5bf69a2b2..657a36d2640d 100644
@@ -431,7 +431,7 @@ config COMMON_CLK_FIXED_MMIO
 
   config COMMON_CLK_K210
          bool "Clock driver for the Canaan Kendryte K210 SoC"
-       depends on OF && RISCV && SOC_CANAAN
+       depends on OF && RISCV && SOC_CANAAN && (64BIT || COMPILE_TEST)
          default SOC_CANAAN
          help
            Support for the Canaan Kendryte K210 RISC-V SoC clocks.
drivers/soc/canaan/Kconfig +4 -3
index 2527cf5757ec..1745a614d2a7 100644
@@ -2,9 +2,10 @@
 
   config SOC_K210_SYSCTL
          bool "Canaan Kendryte K210 SoC system controller"
-       depends on RISCV && SOC_CANAAN && OF
+       depends on RISCV && SOC_CANAAN && OF && (64BIT || COMPILE_TEST)
          default SOC_CANAAN
-        select PM
-        select MFD_SYSCON
+       select COMMON_CLK_K210
+       select PM
+       select MFD_SYSCON
          help
            Canaan Kendryte K210 SoC system controller driver.
Quoted 8 lines
Quoted 4 lines

COMPILE_TEST is optional though, but I do not see any reason why not eventhough in practice these drivers will likely never end up in 32-bits SoC.

Oh thanks I was in the in the midst of making a similar patch. Do you want to submit it or shall I. Also thanks for the help with this, was using tag 6.2.

Quoted 3 lines

I am busy with other stuff and do not have time to properly test this. So please feel free to go ahead and send something fully tested.

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#24 lore raw
Quoted 24 lines · Jesse Taube
Quoted 21 lines · Damien Le Moal
Quoted 20 lines · Jesse Taube
Quoted 17 lines · Damien Le Moal
Quoted 6 lines · Randy Dunlap
Quoted 6 lines
Quoted 3 lines

OK, I don't know how it happened. I cannot reproduce it now. The failing .config files has CONFIG_MMU is not set (for RV32I), which appears to be impossible.

These patches add CONFIG_MMU is not set (for RV32I). But no worries it seems to be a non issue  now.

Quoted 7 lines
Quoted 2 lines

Your thoughts Damien?

Thanks for reminding me.

With these 3 patches applied to linux-next-20230307, I still get this build error.

Does this help ?

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

drivers/soc/canaan/Kconfig config SOC_K210_SYSCTL · line 7

Quoted 11 lines
drivers/soc/canaan/Kconfig +1 -2
index 2527cf5757ec..7796c5f1d109 100644
@@ -4,7 +4,8 @@ config SOC_K210_SYSCTL
          bool "Canaan Kendryte K210 SoC system controller"
          depends on RISCV && SOC_CANAAN && OF
          default SOC_CANAAN
-        select PM
-        select MFD_SYSCON
+       select COMMON_CLK_K210

Ideally this would be depends on, rather than select, so that we avoid selecting user visible symbols like that.

Quoted 6 lines

Ok so this has nothing to do with my patch-set actually and will happen on 64BIT as well.
the commit that brought in this bug is:

RISC-V: stop directly selecting drivers for SOC_CANAAN 3af577f9826fdddefac42b35fc5eb3912c5b7d85

Ah right, because the select in Kconfig.socs enforced that if the conditions were correct for the system controller driver to be enabled, the clock driver would always be present.
In converting the select in kconfig.socs to a default "on location", I preserved the default behaviour but not the dependency.

Quoted 5 lines

I have tested the patches Damien here they work on 64BIT and 32BIT. The change to drivers/clk/Kconfig is not strictly necessary but makes scene. I don't think they need to be tested on 32bit so we can omit COMPILE_TEST.

If needed i can submit the patches, which I will author under Damien.

It probably does need fixing to satisfy the randconfigs, submit away!

Quoted 2 lines

As far as I can see there is nothing holding back this set as the issue found has no relation to this set.

Yup. You're currently in the queue on patchwork.

#25 lore raw
In reply to Damien Le Moal
Quoted 33 lines · Damien Le Moal
Quoted 6 lines · Randy Dunlap
Quoted 6 lines
Quoted 3 lines

OK, I don't know how it happened. I cannot reproduce it now. The failing .config files has CONFIG_MMU is not set (for RV32I), which appears to be impossible.

These patches add CONFIG_MMU is not set (for RV32I). But no worries it seems to be a non issue  now.

Quoted 7 lines
Quoted 2 lines

Your thoughts Damien?

Thanks for reminding me.

With these 3 patches applied to linux-next-20230307, I still get this build error.

Does this help ?

drivers/soc/canaan/Kconfig +3 -2
index 2527cf5757ec..7796c5f1d109 100644
@@ -4,7 +4,8 @@ config SOC_K210_SYSCTL
        bool "Canaan Kendryte K210 SoC system controller"
        depends on RISCV && SOC_CANAAN && OF
        default SOC_CANAAN
-        select PM
-        select MFD_SYSCON
+       select COMMON_CLK_K210
+       select PM
+       select MFD_SYSCON
        help
          Canaan Kendryte K210 SoC system controller driver.
Quoted 1 line

(just noticed that there are whitespace errors here...)

Yes, this patch allows it to build cleanly.
Thanks.

I didn't test any of the below changes.

Quoted 40 lines

Note that both the sysctl and clk driver depend on RISCV. I think these should probably also depend on 64BIT, and eventually add a "|| COMPILE_TEST" as well. So something like this:

drivers/clk/Kconfig +1 -1
index b6c5bf69a2b2..657a36d2640d 100644
@@ -431,7 +431,7 @@ config COMMON_CLK_FIXED_MMIO
 
 config COMMON_CLK_K210
        bool "Clock driver for the Canaan Kendryte K210 SoC"
-       depends on OF && RISCV && SOC_CANAAN
+       depends on OF && RISCV && SOC_CANAAN && (64BIT || COMPILE_TEST)
        default SOC_CANAAN
        help
          Support for the Canaan Kendryte K210 RISC-V SoC clocks.
drivers/soc/canaan/Kconfig +4 -3
index 2527cf5757ec..1745a614d2a7 100644
@@ -2,9 +2,10 @@
 
 config SOC_K210_SYSCTL
        bool "Canaan Kendryte K210 SoC system controller"
-       depends on RISCV && SOC_CANAAN && OF
+       depends on RISCV && SOC_CANAAN && OF && (64BIT || COMPILE_TEST)
        default SOC_CANAAN
-        select PM
-        select MFD_SYSCON
+       select COMMON_CLK_K210
+       select PM
+       select MFD_SYSCON
        help
          Canaan Kendryte K210 SoC system controller driver.

COMPILE_TEST is optional though, but I do not see any reason why not eventhough in practice these drivers will likely never end up in 32-bits SoC.

Signature · 1 line
~Randy
Reviewed-by on the v3 series
#26 lore raw
In reply to Jesse Taube
Quoted 9 lines · Jesse Taube

This patch-set aims to add NOMMU support to RV32. Many people want to build simple emulators or HDL models of RISC-V this patch makes it possible to run linux on them.

Jesse Taube (1):
riscv: configs: Add nommu PHONY defconfig for RV32
Yimin Gu (1):
riscv: Kconfig: Allow RV32 to build with no MMU

For these two:

I'll add an rv32 nommu build to the patchwork CI once this lands I suppose!

Thanks,
Conor.

#27 lore raw

Re: (subset) [PATCH v3 0/3] Add RISC-V 32 NOMMU support

In reply to Jesse Taube
Quoted 10 lines · Jesse Taube

This patch-set aims to add NOMMU support to RV32. Many people want to build simple emulators or HDL models of RISC-V this patch makes it possible to run linux on them.

Yimin Gu is the original author of this set. Submitted here:
https://lists.buildroot.org/pipermail/buildroot/2022-November/656134.html

[...]

Applied, thanks!

[2/3] riscv: Kconfig: Allow RV32 to build with no MMU

      https://git.kernel.org/palmer/c/b5e2c507b06c
[3/3] riscv: configs: Add nommu PHONY defconfig for RV32
      https://git.kernel.org/palmer/c/77c0c966719f

Best regards,

Signature · 1 line
Palmer Dabbelt <[email protected]>