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(-)
--
2.39.0
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.
Reported-by: kernel test robot <[email protected]>
Link: https://lore.kernel.org/linux-riscv/[email protected]/
Signed-off-by: Conor Dooley <[email protected]>
Signed-off-by: Jesse Taube <[email protected]>
---
V1->V2:
- new commit
V2->V3:
- No change
---
drivers/clk/clk-k210.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/clk-k210.c b/drivers/clk/clk-k210.c
index 67a7cb3503c3..4eed667eddaf 100644
--- a/drivers/clk/clk-k210.c
+++ b/drivers/clk/clk-k210.c
@@ -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 = {
--
2.39.0
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".
Suggested-by: Conor Dooley <[email protected]>
Signed-off-by: Jesse Taube <[email protected]>
Cc: Yimin Gu <[email protected]>
---
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(+)
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 6203c3378922..1b276f62f22b 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -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
--
2.39.0
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.
Signed-off-by: Yimin Gu <[email protected]>
CC: Jesse Taube <[email protected]>
Tested-by: Waldemar Brodkorb <[email protected]>
Signed-off-by: Jesse Taube <[email protected]>
---
V1->V2:
- Fix typo in commit description
V2->V3:
- No change
---
arch/riscv/Kconfig | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index c5e42cc37604..d1f661425790 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -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"
--
2.39.0
On 3/1/23 09:26, Jesse Taube wrote:
> 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.
>
> Reported-by: kernel test robot <[email protected]>
> Link: https://lore.kernel.org/linux-riscv/[email protected]/
> Signed-off-by: Conor Dooley <[email protected]>
> Signed-off-by: Jesse Taube <[email protected]>
Looks OK to me.
Reviewed-by: Damien Le Moal <[email protected]>
--
Damien Le Moal
Western Digital Research
On 3/1/23 09:26, Jesse Taube wrote:
> 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.
>
> Signed-off-by: Yimin Gu <[email protected]>
> CC: Jesse Taube <[email protected]>
> Tested-by: Waldemar Brodkorb <[email protected]>
> Signed-off-by: Jesse Taube <[email protected]>
Looks OK.
Reviewed-by: Damien Le Moal <[email protected]>
--
Damien Le Moal
Western Digital Research
Hi--
On 2/28/23 16:26, Jesse Taube wrote:
> 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?
>
> 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?
> 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(-)
>
--
~Randy
On 3/1/23 13:07, Randy Dunlap wrote:
> Hi--
>
> On 2/28/23 16:26, Jesse Taube wrote:
>> 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?
>
>>
>> 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'
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.
>
> because
> # CONFIG_COMMON_CLK_K210 is not set
>
>
> Maybe SOC_CANAAN needs some more selects for required code?
>
>> 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(-)
>>
>
--
Damien Le Moal
Western Digital Research
Quoting Jesse Taube (2023-02-28 16:26:55)
> diff --git a/drivers/clk/clk-k210.c b/drivers/clk/clk-k210.c
> index 67a7cb3503c3..4eed667eddaf 100644
> --- a/drivers/clk/clk-k210.c
> +++ b/drivers/clk/clk-k210.c
> @@ -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?
On Mon, Mar 06, 2023 at 02:31:00PM -0800, Stephen Boyd wrote:
> Quoting Jesse Taube (2023-02-28 16:26:55)
> > diff --git a/drivers/clk/clk-k210.c b/drivers/clk/clk-k210.c
> > index 67a7cb3503c3..4eed667eddaf 100644
> > --- a/drivers/clk/clk-k210.c
> > +++ b/drivers/clk/clk-k210.c
> > @@ -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?
Yah, I checked that when writing the patch. They're 4-bit fields:
> /*
> * 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.
Quoting Conor Dooley (2023-03-06 14:35:01)
> On Mon, Mar 06, 2023 at 02:31:00PM -0800, Stephen Boyd wrote:
> > Quoting Jesse Taube (2023-02-28 16:26:55)
> > > diff --git a/drivers/clk/clk-k210.c b/drivers/clk/clk-k210.c
> > > index 67a7cb3503c3..4eed667eddaf 100644
> > > --- a/drivers/clk/clk-k210.c
> > > +++ b/drivers/clk/clk-k210.c
> > > @@ -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?
>
> Yah, I checked that when writing the patch. They're 4-bit fields:
Awesome
Quoting Jesse Taube (2023-02-28 16:26:55)
> 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.
>
> Reported-by: kernel test robot <[email protected]>
> Link: https://lore.kernel.org/linux-riscv/[email protected]/
> Signed-off-by: Conor Dooley <[email protected]>
> Signed-off-by: Jesse Taube <[email protected]>
> ---
Seems better to merge this one-liner earlier to unblock 32-bit.
Applied to clk-fixes
On Mon, 06 Mar 2023 14:41:11 PST (-0800), [email protected] wrote:
> Quoting Jesse Taube (2023-02-28 16:26:55)
>> 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.
>>
>> Reported-by: kernel test robot <[email protected]>
>> Link: https://lore.kernel.org/linux-riscv/[email protected]/
>> Signed-off-by: Conor Dooley <[email protected]>
>> Signed-off-by: Jesse Taube <[email protected]>
>> ---
>
> Seems better to merge this one-liner earlier to unblock 32-bit.
>
> Applied to clk-fixes
Thanks!
On 2/28/23 23:42, Damien Le Moal wrote:
> On 3/1/23 13:07, Randy Dunlap wrote:
>> Hi--
>>
>> On 2/28/23 16:26, Jesse Taube wrote:
>>> 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?
>>
>>>
>>> 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'
I can not recreate this error.
can you send me the .config you used.
Thanks,
Jesse Taube
>
> 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.
>
>>
>> because
>> # CONFIG_COMMON_CLK_K210 is not set
>>
>>
>> Maybe SOC_CANAAN needs some more selects for required code?
>>
>>> 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(-)
>>>
>>
>
Hi--
On 3/7/23 17:26, Jesse Taube wrote:
>
>
> On 2/28/23 23:42, Damien Le Moal wrote:
>> On 3/1/23 13:07, Randy Dunlap wrote:
>>> Hi--
>>>
>>> On 2/28/23 16:26, Jesse Taube wrote:
>>>> 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?
>>>
>>>>
>>>> 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'
> I can not recreate this error.
> can you send me the .config you used.
>
> Thanks,
> Jesse Taube
Sure, it's attached.
>> 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.
>>
>>>
>>> because
>>> # CONFIG_COMMON_CLK_K210 is not set
>>>
>>>
>>> Maybe SOC_CANAAN needs some more selects for required code?
>>>
>>>> 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(-)
>>>>
>>>
>>
--
~Randy
On 3/7/23 21:16, Randy Dunlap wrote:
> Hi--
>
> On 3/7/23 17:26, Jesse Taube wrote:
>>
>>
>> On 2/28/23 23:42, Damien Le Moal wrote:
>>> On 3/1/23 13:07, Randy Dunlap wrote:
>>>> Hi--
>>>>
>>>> On 2/28/23 16:26, Jesse Taube wrote:
>>>>> 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?
>>>>
>>>>>
>>>>> 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'
>> 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
>
>>> 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.
>>>
>>>>
>>>> because
>>>> # CONFIG_COMMON_CLK_K210 is not set
>>>>
>>>>
>>>> Maybe SOC_CANAAN needs some more selects for required code?
>>>>
>>>>> 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(-)
>>>>>
>>>>
>>>
>
On 3/7/23 18:30, Jesse Taube wrote:
>
>
> On 3/7/23 21:16, Randy Dunlap wrote:
>> Hi--
>>
>> On 3/7/23 17:26, Jesse Taube wrote:
>>>
>>>
>>> On 2/28/23 23:42, Damien Le Moal wrote:
>>>> On 3/1/23 13:07, Randy Dunlap wrote:
>>>>> Hi--
>>>>>
>>>>> On 2/28/23 16:26, Jesse Taube wrote:
>>>>>> 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?
>>>>>
>>>>>>
>>>>>> 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'
>>> 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?
gcc (SUSE Linux) 12.2.1 20230124 [revision 193f7e62815b4089dfaed4c2bd34fd4f10209e27]
from opensuse Tumbleweed.
I'll try it on a current tree...
>>
>>>> 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.
>>>>
>>>>>
>>>>> because
>>>>> # CONFIG_COMMON_CLK_K210 is not set
>>>>>
>>>>>
>>>>> Maybe SOC_CANAAN needs some more selects for required code?
>>>>>
>>>>>> 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(-)
>>>>>>
>>>>>
>>>>
>>
--
~Randy
On 3/7/23 18:33, Randy Dunlap wrote:
>
>
> On 3/7/23 18:30, Jesse Taube wrote:
>>
>>
>> On 3/7/23 21:16, Randy Dunlap wrote:
>>> Hi--
>>>
>>> On 3/7/23 17:26, Jesse Taube wrote:
>>>>
>>>>
>>>> On 2/28/23 23:42, Damien Le Moal wrote:
>>>>> On 3/1/23 13:07, Randy Dunlap wrote:
>>>>>> Hi--
>>>>>>
>>>>>> On 2/28/23 16:26, Jesse Taube wrote:
>>>>>>> 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?
>>>>>>
>>>>>>>
>>>>>>> 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'
>>>> 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?
>
>
> 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.
>>>
>>>>> 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.
>>>>>
>>>>>>
>>>>>> because
>>>>>> # CONFIG_COMMON_CLK_K210 is not set
>>>>>>
>>>>>>
>>>>>> Maybe SOC_CANAAN needs some more selects for required code?
>>>>>>
>>>>>>> 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(-)
>>>>>>>
>>>>>>
>>>>>
>>>
>
--
~Randy
On 3/7/23 21:51, Randy Dunlap wrote:
>
>
> On 3/7/23 18:33, Randy Dunlap wrote:
>>
>>
>> On 3/7/23 18:30, Jesse Taube wrote:
>>>
>>>
>>> On 3/7/23 21:16, Randy Dunlap wrote:
>>>> Hi--
>>>>
>>>> On 3/7/23 17:26, Jesse Taube wrote:
>>>>>
>>>>>
>>>>> On 2/28/23 23:42, Damien Le Moal wrote:
>>>>>> On 3/1/23 13:07, Randy Dunlap wrote:
>>>>>>> Hi--
>>>>>>>
>>>>>>> On 2/28/23 16:26, Jesse Taube wrote:
>>>>>>>> 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?
>>>>>>>
>>>>>>>>
>>>>>>>> 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'
>>>>> 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?
>>
>>
>> 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
>
> Sorry to bother you.
>
> Thanks.
>
>>>>
>>>>>> 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.
>>>>>>
>>>>>>>
>>>>>>> because
>>>>>>> # CONFIG_COMMON_CLK_K210 is not set
>>>>>>>
>>>>>>>
>>>>>>> Maybe SOC_CANAAN needs some more selects for required code?
>>>>>>>
>>>>>>>> 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(-)
>>>>>>>>
>>>>>>>
>>>>>>
>>>>
>>
>
On 3/7/23 18:54, Jesse Taube wrote:
>
>
> On 3/7/23 21:51, Randy Dunlap wrote:
>>
>>
>> On 3/7/23 18:33, Randy Dunlap wrote:
>>>
>>>
>>> On 3/7/23 18:30, Jesse Taube wrote:
>>>>
>>>>
>>>> On 3/7/23 21:16, Randy Dunlap wrote:
>>>>> Hi--
>>>>>
>>>>> On 3/7/23 17:26, Jesse Taube wrote:
>>>>>>
>>>>>>
>>>>>> On 2/28/23 23:42, Damien Le Moal wrote:
>>>>>>> On 3/1/23 13:07, Randy Dunlap wrote:
>>>>>>>> Hi--
>>>>>>>>
>>>>>>>> On 2/28/23 16:26, Jesse Taube wrote:
>>>>>>>>> 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?
>>>>>>>>
>>>>>>>>>
>>>>>>>>> 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'
>>>>>> 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?
>>>
>>>
>>> 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 for reminding me.
With these 3 patches applied to linux-next-20230307,
I still get this build error.
> Thanks,
> Jesse Taube
>>
>> Sorry to bother you.
>>
>> Thanks.
>>
>>>>>
>>>>>>> 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.
>>>>>>>
>>>>>>>>
>>>>>>>> because
>>>>>>>> # CONFIG_COMMON_CLK_K210 is not set
>>>>>>>>
>>>>>>>>
>>>>>>>> Maybe SOC_CANAAN needs some more selects for required code?
>>>>>>>>
>>>>>>>>> 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(-)
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>
>>>
>>
--
~Randy
On 3/8/23 12:23, Randy Dunlap wrote:
>>> 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.
Does this help ?
diff --git a/drivers/soc/canaan/Kconfig b/drivers/soc/canaan/Kconfig
index 2527cf5757ec..7796c5f1d109 100644
--- a/drivers/soc/canaan/Kconfig
+++ b/drivers/soc/canaan/Kconfig
@@ -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:
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index b6c5bf69a2b2..657a36d2640d 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -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.
diff --git a/drivers/soc/canaan/Kconfig b/drivers/soc/canaan/Kconfig
index 2527cf5757ec..1745a614d2a7 100644
--- a/drivers/soc/canaan/Kconfig
+++ b/drivers/soc/canaan/Kconfig
@@ -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.
--
Damien Le Moal
Western Digital Research
On 3/7/23 22:42, Damien Le Moal wrote:
> On 3/8/23 12:23, Randy Dunlap wrote:
>>>> 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.
>
> Does this help ?
>
> diff --git a/drivers/soc/canaan/Kconfig b/drivers/soc/canaan/Kconfig
> index 2527cf5757ec..7796c5f1d109 100644
> --- a/drivers/soc/canaan/Kconfig
> +++ b/drivers/soc/canaan/Kconfig
> @@ -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:
>
> diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
> index b6c5bf69a2b2..657a36d2640d 100644
> --- a/drivers/clk/Kconfig
> +++ b/drivers/clk/Kconfig
> @@ -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.
> diff --git a/drivers/soc/canaan/Kconfig b/drivers/soc/canaan/Kconfig
> index 2527cf5757ec..1745a614d2a7 100644
> --- a/drivers/soc/canaan/Kconfig
> +++ b/drivers/soc/canaan/Kconfig
> @@ -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.
>
>
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.
On 3/7/23 19:42, Damien Le Moal wrote:
> On 3/8/23 12:23, Randy Dunlap wrote:
>>>> 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.
>
> Does this help ?
>
> diff --git a/drivers/soc/canaan/Kconfig b/drivers/soc/canaan/Kconfig
> index 2527cf5757ec..7796c5f1d109 100644
> --- a/drivers/soc/canaan/Kconfig
> +++ b/drivers/soc/canaan/Kconfig
> @@ -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...)
Yes, this patch allows it to build cleanly.
Thanks.
I didn't test any of the below changes.
> 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:
>
> diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
> index b6c5bf69a2b2..657a36d2640d 100644
> --- a/drivers/clk/Kconfig
> +++ b/drivers/clk/Kconfig
> @@ -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.
> diff --git a/drivers/soc/canaan/Kconfig b/drivers/soc/canaan/Kconfig
> index 2527cf5757ec..1745a614d2a7 100644
> --- a/drivers/soc/canaan/Kconfig
> +++ b/drivers/soc/canaan/Kconfig
> @@ -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.
>
>
--
~Randy
On 3/8/23 12:46, Jesse Taube wrote:
>
>
> On 3/7/23 22:42, Damien Le Moal wrote:
>> On 3/8/23 12:23, Randy Dunlap wrote:
>>>>> 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.
>>
>> Does this help ?
>>
>> diff --git a/drivers/soc/canaan/Kconfig b/drivers/soc/canaan/Kconfig
>> index 2527cf5757ec..7796c5f1d109 100644
>> --- a/drivers/soc/canaan/Kconfig
>> +++ b/drivers/soc/canaan/Kconfig
>> @@ -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:
>>
>> diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
>> index b6c5bf69a2b2..657a36d2640d 100644
>> --- a/drivers/clk/Kconfig
>> +++ b/drivers/clk/Kconfig
>> @@ -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.
>> diff --git a/drivers/soc/canaan/Kconfig b/drivers/soc/canaan/Kconfig
>> index 2527cf5757ec..1745a614d2a7 100644
>> --- a/drivers/soc/canaan/Kconfig
>> +++ b/drivers/soc/canaan/Kconfig
>> @@ -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.
>>
>>
>
> 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.
--
Damien Le Moal
Western Digital Research
On 3/7/23 23:11, Damien Le Moal wrote:
> On 3/8/23 12:46, Jesse Taube wrote:
>>
>>
>> On 3/7/23 22:42, Damien Le Moal wrote:
>>> On 3/8/23 12:23, Randy Dunlap wrote:
>>>>>> 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.
>>>
>>> Does this help ?
>>>
>>> diff --git a/drivers/soc/canaan/Kconfig b/drivers/soc/canaan/Kconfig
>>> index 2527cf5757ec..7796c5f1d109 100644
>>> --- a/drivers/soc/canaan/Kconfig
>>> +++ b/drivers/soc/canaan/Kconfig
>>> @@ -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
>>> + 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:
>>>
>>> diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
>>> index b6c5bf69a2b2..657a36d2640d 100644
>>> --- a/drivers/clk/Kconfig
>>> +++ b/drivers/clk/Kconfig
>>> @@ -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.
>>> diff --git a/drivers/soc/canaan/Kconfig b/drivers/soc/canaan/Kconfig
>>> index 2527cf5757ec..1745a614d2a7 100644
>>> --- a/drivers/soc/canaan/Kconfig
>>> +++ b/drivers/soc/canaan/Kconfig
>>> @@ -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.
>>>
>>>
>>
>> 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.
>
On Tue, Mar 14, 2023 at 02:35:39PM -0400, Jesse Taube wrote:
>
>
> On 3/7/23 23:11, Damien Le Moal wrote:
> > On 3/8/23 12:46, Jesse Taube wrote:
> > >
> > >
> > > On 3/7/23 22:42, Damien Le Moal wrote:
> > > > On 3/8/23 12:23, Randy Dunlap wrote:
> > > > > > > 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.
> > > >
> > > > Does this help ?
> > > >
> > > > diff --git a/drivers/soc/canaan/Kconfig b/drivers/soc/canaan/Kconfig
> > > > index 2527cf5757ec..7796c5f1d109 100644
> > > > --- a/drivers/soc/canaan/Kconfig
> > > > +++ b/drivers/soc/canaan/Kconfig
> > > > @@ -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.
> 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.
> 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!
> 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.
On Tue, Feb 28, 2023 at 07:26:54PM -0500, Jesse Taube wrote:
> 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:
Reviewed-by: Conor Dooley <[email protected]>
I'll add an rv32 nommu build to the patchwork CI once this lands I
suppose!
Thanks,
Conor.
On Tue, 28 Feb 2023 19:26:54 -0500, Jesse Taube wrote:
> 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,
--
Palmer Dabbelt <[email protected]>