Re: [PATCH V2 01/19] csky: Build infrastructure

From: Arnd Bergmann
Date: Tue Jul 03 2018 - 12:03:17 EST


On Sun, Jul 1, 2018 at 7:30 PM, Guo Ren <ren_guo@xxxxxxxxx> wrote:
> Signed-off-by: Guo Ren <ren_guo@xxxxxxxxx>

> +choice
> + prompt "CPU MODEL"
> + default CPU_CK610
> +
> +config CPU_CK610
> + bool "CSKY CPU ck610"
> + select CPU_NEED_TLBSYNC
> + select CPU_NEED_SOFTALIGN
> + select CPU_NO_USER_BKPT
> +
> +config CPU_CK810
> + bool "CSKY CPU ck810"
> + select CPU_HAS_HILO
> + select CPU_NEED_TLBSYNC
> +
> +config CPU_CK807
> + bool "CSKY CPU ck807"
> + select CPU_HAS_HILO
> +
> +config CPU_CK860
> + bool "CSKY CPU ck860"
> + select CPU_HAS_TLBI
> + select CPU_HAS_CACHEV2
> + select CPU_HAS_LDSTEX
> +endchoice

It looks like the CK8xx CPUs are basically compatible, so it would
be nice to have a way to configure a kernel that can run on all
of them, picking a safe default for options that depend on a
particular CPU. E.g. when only CK860 supports SMP, you might
start out by making SMP "depend on !(CPU_CK807 || CPU_CK810)",
as an alternative to implementing a way for an SMP-enabled kernel
to run on non-SMP CPUs (arm has that, but it's probably too complex
for your needs).

Similarly, you can set L1_CACHE_BYTES to the largest possible
size, and make things like CPU_TLB_SIZE dynamically detected.

> +menu "C-SKY Debug Options"
> +config CSKY_DEBUG_INFO
> + bool "Compile the kernel with debug info, just add -g"
> + depends on !DEBUG_INFO
> + help
> + DEBUG_INFO and COMPILE_TEST is conflict, so we provide
> + another way to support -g.
> + Some drivers eg: DW_MMC need COMPILE_TEST for new cpu
> + arch :(

Just send a patch to change those dependencies, there is no reason
not to apply those. Generally speaking, the kernel should not contain
workarounds for particular (mis-)features of the kernel, when you can
just change those.

> diff --git a/arch/csky/include/asm/Kbuild b/arch/csky/include/asm/Kbuild
> new file mode 100644
> index 0000000..5de6519
> --- /dev/null
> +++ b/arch/csky/include/asm/Kbuild
> @@ -0,0 +1,72 @@
> +generic-y += asm-offsets.h
> +generic-y += atomic.h

The asm-generic version of atomic.h is a bit inefficient,
you might want to provide an optimized version for your
architecture.

> +generic-y += auxvec.h

You should not need asm/auxvec.h or uapi/asm/auxvec.h

> +generic-y += bitsperlong.h
> +generic-y += bug.h

providing your own bug.h might be helpful too.
Have a look

> +generic-y += bugs.h
> +generic-y += clkdev.h
> +generic-y += cputime.h

asm-generic/cputime.h no loinger exists

> +generic-y += kvm_para.h

Do you support KVM?

> +generic-y += sizes.h

Deprecated and should not be needed

Arnd