2024-03-23 12:13:33

by Yangyu Chen

[permalink] [raw]
Subject: [PATCH v6 05/11] riscv: Kconfig.socs: Split ARCH_CANAAN and SOC_CANAAN_K210

Since SOC_FOO should be deprecated from patch [1], and cleanup for other
SoCs is already on the mailing list [2,3,4], we remove the use of
SOC_CANAAN and use ARCH_CANAAN for SoCs vendored by Canaan instead from
now on. And allows ARCH_CANAAN to be selected for other Canaan SoCs.

Then, since we have Canaan Kendryte K230 with MMU now, the use of
SOC_CANAAN is no longer only referred to K210. Thus, we introduce a new
symbol SOC_CANAAN_K210 for any conditional code or driver selection
specific to the K210, so users will not try to build some K210-specific
things when MMU is enabled and see it fails to boot on K210.

[1] https://lore.kernel.org/linux-riscv/[email protected]/
[2] https://lore.kernel.org/linux-riscv/20240305-praying-clad-c4fbcaa7ed0a@spud/
[3] https://lore.kernel.org/linux-riscv/20240305-fled-undrilled-41dc0c46bb29@spud/
[4] https://lore.kernel.org/linux-riscv/20240305-stress-earflap-d7ddb8655a4d@spud/

Signed-off-by: Yangyu Chen <[email protected]>
---
arch/riscv/Kconfig.socs | 8 +++++---
arch/riscv/Makefile | 2 +-
arch/riscv/configs/nommu_k210_defconfig | 3 ++-
arch/riscv/configs/nommu_k210_sdcard_defconfig | 3 ++-
4 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/arch/riscv/Kconfig.socs b/arch/riscv/Kconfig.socs
index 623de5f8a208..5710aee456ac 100644
--- a/arch/riscv/Kconfig.socs
+++ b/arch/riscv/Kconfig.socs
@@ -72,11 +72,13 @@ config SOC_VIRT
This enables support for QEMU Virt Machine.

config ARCH_CANAAN
- def_bool SOC_CANAAN
+ bool "Canaan Kendryte SoC"
+ help
+ This enables support for Canaan Kendryte SoC platform hardware.

-config SOC_CANAAN
+config SOC_CANAAN_K210
bool "Canaan Kendryte K210 SoC"
- depends on !MMU
+ depends on !MMU && ARCH_CANAAN
select CLINT_TIMER if RISCV_M_MODE
select ARCH_HAS_RESET_CONTROLLER
select PINCTRL
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 0b7d109258e7..294b2b3e8e6a 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -149,7 +149,7 @@ vdso-install-y += arch/riscv/kernel/vdso/vdso.so.dbg
vdso-install-$(CONFIG_COMPAT) += arch/riscv/kernel/compat_vdso/compat_vdso.so.dbg:../compat_vdso/compat_vdso.so

ifneq ($(CONFIG_XIP_KERNEL),y)
-ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_ARCH_CANAAN),yy)
+ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_SOC_CANAAN_K210),yy)
KBUILD_IMAGE := $(boot)/loader.bin
else
ifeq ($(CONFIG_EFI_ZBOOT),)
diff --git a/arch/riscv/configs/nommu_k210_defconfig b/arch/riscv/configs/nommu_k210_defconfig
index 7e75200543f4..2552e78074a3 100644
--- a/arch/riscv/configs/nommu_k210_defconfig
+++ b/arch/riscv/configs/nommu_k210_defconfig
@@ -27,7 +27,8 @@ CONFIG_EXPERT=y
CONFIG_SLUB=y
CONFIG_SLUB_TINY=y
# CONFIG_MMU is not set
-CONFIG_SOC_CANAAN=y
+CONFIG_ARCH_CANAAN=y
+CONFIG_SOC_CANAAN_K210=y
CONFIG_NONPORTABLE=y
CONFIG_SMP=y
CONFIG_NR_CPUS=2
diff --git a/arch/riscv/configs/nommu_k210_sdcard_defconfig b/arch/riscv/configs/nommu_k210_sdcard_defconfig
index 0ba353e9ca71..8f67fb830585 100644
--- a/arch/riscv/configs/nommu_k210_sdcard_defconfig
+++ b/arch/riscv/configs/nommu_k210_sdcard_defconfig
@@ -19,7 +19,8 @@ CONFIG_EXPERT=y
CONFIG_SLUB=y
CONFIG_SLUB_TINY=y
# CONFIG_MMU is not set
-CONFIG_SOC_CANAAN=y
+CONFIG_ARCH_CANAAN=y
+CONFIG_SOC_CANAAN_K210=y
CONFIG_NONPORTABLE=y
CONFIG_SMP=y
CONFIG_NR_CPUS=2
--
2.43.0



2024-03-25 14:44:21

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH v6 05/11] riscv: Kconfig.socs: Split ARCH_CANAAN and SOC_CANAAN_K210

On Sat, Mar 23, 2024 at 08:12:17PM +0800, Yangyu Chen wrote:
> Since SOC_FOO should be deprecated from patch [1], and cleanup for other
> SoCs is already on the mailing list [2,3,4], we remove the use of
> SOC_CANAAN and use ARCH_CANAAN for SoCs vendored by Canaan instead from
> now on. And allows ARCH_CANAAN to be selected for other Canaan SoCs.
>
> Then, since we have Canaan Kendryte K230 with MMU now, the use of
> SOC_CANAAN is no longer only referred to K210. Thus, we introduce a new
> symbol SOC_CANAAN_K210 for any conditional code or driver selection
> specific to the K210, so users will not try to build some K210-specific
> things when MMU is enabled and see it fails to boot on K210.
>
> [1] https://lore.kernel.org/linux-riscv/[email protected]/
> [2] https://lore.kernel.org/linux-riscv/20240305-praying-clad-c4fbcaa7ed0a@spud/
> [3] https://lore.kernel.org/linux-riscv/20240305-fled-undrilled-41dc0c46bb29@spud/
> [4] https://lore.kernel.org/linux-riscv/20240305-stress-earflap-d7ddb8655a4d@spud/
>
> Signed-off-by: Yangyu Chen <[email protected]>
> ---
> arch/riscv/Kconfig.socs | 8 +++++---
> arch/riscv/Makefile | 2 +-
> arch/riscv/configs/nommu_k210_defconfig | 3 ++-
> arch/riscv/configs/nommu_k210_sdcard_defconfig | 3 ++-
> 4 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/arch/riscv/Kconfig.socs b/arch/riscv/Kconfig.socs
> index 623de5f8a208..5710aee456ac 100644
> --- a/arch/riscv/Kconfig.socs
> +++ b/arch/riscv/Kconfig.socs
> @@ -72,11 +72,13 @@ config SOC_VIRT
> This enables support for QEMU Virt Machine.
>
> config ARCH_CANAAN
> - def_bool SOC_CANAAN
> + bool "Canaan Kendryte SoC"
> + help
> + This enables support for Canaan Kendryte SoC platform hardware.
>
> -config SOC_CANAAN
> +config SOC_CANAAN_K210

This breaks git bisect, right? There are references to SOC_CANAAN that
are get updated later in the patch series. You can't delete SOC_CANAAN
and leave the other references dangling.

regards,
dan carpenter


2024-03-25 20:27:14

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v6 05/11] riscv: Kconfig.socs: Split ARCH_CANAAN and SOC_CANAAN_K210

On Mon, Mar 25, 2024 at 01:52:42PM +0300, Dan Carpenter wrote:
> On Sat, Mar 23, 2024 at 08:12:17PM +0800, Yangyu Chen wrote:
> > Since SOC_FOO should be deprecated from patch [1], and cleanup for other
> > SoCs is already on the mailing list [2,3,4], we remove the use of
> > SOC_CANAAN and use ARCH_CANAAN for SoCs vendored by Canaan instead from
> > now on. And allows ARCH_CANAAN to be selected for other Canaan SoCs.
> >
> > Then, since we have Canaan Kendryte K230 with MMU now, the use of
> > SOC_CANAAN is no longer only referred to K210. Thus, we introduce a new
> > symbol SOC_CANAAN_K210 for any conditional code or driver selection
> > specific to the K210, so users will not try to build some K210-specific
> > things when MMU is enabled and see it fails to boot on K210.
> >
> > [1] https://lore.kernel.org/linux-riscv/[email protected]/
> > [2] https://lore.kernel.org/linux-riscv/20240305-praying-clad-c4fbcaa7ed0a@spud/
> > [3] https://lore.kernel.org/linux-riscv/20240305-fled-undrilled-41dc0c46bb29@spud/
> > [4] https://lore.kernel.org/linux-riscv/20240305-stress-earflap-d7ddb8655a4d@spud/
> >
> > Signed-off-by: Yangyu Chen <[email protected]>
> > ---
> > arch/riscv/Kconfig.socs | 8 +++++---
> > arch/riscv/Makefile | 2 +-
> > arch/riscv/configs/nommu_k210_defconfig | 3 ++-
> > arch/riscv/configs/nommu_k210_sdcard_defconfig | 3 ++-
> > 4 files changed, 10 insertions(+), 6 deletions(-)
> >
> > diff --git a/arch/riscv/Kconfig.socs b/arch/riscv/Kconfig.socs
> > index 623de5f8a208..5710aee456ac 100644
> > --- a/arch/riscv/Kconfig.socs
> > +++ b/arch/riscv/Kconfig.socs
> > @@ -72,11 +72,13 @@ config SOC_VIRT
> > This enables support for QEMU Virt Machine.
> >
> > config ARCH_CANAAN
> > - def_bool SOC_CANAAN
> > + bool "Canaan Kendryte SoC"
> > + help
> > + This enables support for Canaan Kendryte SoC platform hardware.
> >
> > -config SOC_CANAAN
> > +config SOC_CANAAN_K210
>
> This breaks git bisect, right? There are references to SOC_CANAAN that
> are get updated later in the patch series. You can't delete SOC_CANAAN
> and leave the other references dangling.

Right. I thought that I had said to resend the patch from v5 and solicit
acks to take it via the soc tree [1]. Splitting it out like this means you
have to introduce a symbol that shadows the original one and then switch
only once all references have been removed. If this series went into 6.10,
which it should, the switch would be in 6.11. I think the chances of a
meaningful conflict are low with the treewide swap so it should be safe
to do.


1 - https://lore.kernel.org/all/20240320-ideology-pasty-d3aea07cc519@spud/


Attachments:
(No filename) (2.71 kB)
signature.asc (235.00 B)
Download all attachments