Re: [PATCH v3 7/7] riscv: config: enable SOC_CANAAN in defconfig

Yangyu Chen
2024-03-05T16:56:26Z

> On Mar 5, 2024, at 07:50, Damien Le Moal <dlemoal@kernel.org> wrote:
>
> On 3/5/24 06:06, Yangyu Chen wrote:
>> Since K230 has been supported, allow SOC_CANAAN to be selected to build dt
>> and drivers for it in defconfig.
>>
>> Signed-off-by: Yangyu Chen <cyy@cyyself.name>
>> Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
>> ---
>> arch/riscv/configs/defconfig | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/riscv/configs/defconfig b/arch/riscv/configs/defconfig
>> index 89a009a580fe..20b557ec28df 100644
>> --- a/arch/riscv/configs/defconfig
>> +++ b/arch/riscv/configs/defconfig
>> @@ -33,6 +33,7 @@ CONFIG_SOC_STARFIVE=y
>> CONFIG_ARCH_SUNXI=y
>> CONFIG_ARCH_THEAD=y
>> CONFIG_SOC_VIRT=y
>> +CONFIG_SOC_CANAAN=y
>
> Given that the k210 need !MMU, including it like this in the defconfig is
> odd... I do not even see how that could work. But that depends on patch 5,
> which does not seem OK to me.
>

I don’t know why “not seem OK” here.

I will show the console to tell you what changes in defconfig:

```console
$ linux git:(rv_builtin_dtb_v3) make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- defconfig
*** Default configuration is based on 'defconfig'
#
# configuration written to .config
#
$ linux git:(rv_builtin_dtb_v3) cp .config .config.bak
$ linux git:(rv_builtin_dtb_v3) git checkout k230_dt_initial_v3
Switched to branch 'k230_dt_initial_v3'
$ linux git:(k230_dt_initial_v3) make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- defconfig
*** Default configuration is based on 'defconfig'
#
# configuration written to .config
#
$ linux git:(k230_dt_initial_v3) diff .config .config.bak
301,302d300
< CONFIG_ARCH_CANAAN=y
< CONFIG_SOC_CANAAN=y
2678d2675
< CONFIG_PINCTRL_K210=y
4621d4617
< CONFIG_COMMON_CLK_K210=y
4<
706,4707d4701
< CONFIG_SOC_K210_SYSCTL=y
5334d5327
< CONFIG_ARCH_HAS_RESET_CONTROLLER=y
5336d5328
< CONFIG_RESET_K210=y
$ linux git:(k230_dt_initial_v3) grep -r "CONFIG_ARCH_HAS_RESET_CONTROLLER"
kernel/config_data:CONFIG_ARCH_HAS_RESET_CONTROLLER=y
include/config/auto.conf:CONFIG_ARCH_HAS_RESET_CONTROLLER=y
include/generated/autoconf.h:#define CONFIG_ARCH_HAS_RESET_CONTROLLER 1
include/generated/rustc_cfg:--cfg=CONFIG_ARCH_HAS_RESET_CONTROLLER
include/generated/rustc_cfg:--cfg=CONFIG_ARCH_HAS_RESET_CONTROLLER="y"
.config:CONFIG_ARCH_HAS_RESET_CONTROLLER=y
$ linux git:(k230_dt_initial_v3)
```

As you can see, we only have some drivers enabled for K210 and
CONFIG_ARCH_HAS_RESET_CONTROLLER being enabled. The next grep -r shows it
does not change the kernel behavior.

>> CONFIG_SMP=y
>> CONFIG_HOTPLUG_CPU=y
>> CONFIG_PM=y
>
> --
> Damien Le Moal
> Western Digital Research