[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <4c58592d-224b-481c-a728-3c279f8e55cd@app.fastmail.com>
Date: Tue, 25 Nov 2025 18:54:47 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Huacai Chen" <chenhuacai@...nel.org>
Cc: Thomas Weißschuh <thomas@...ch.de>,
"Huacai Chen" <chenhuacai@...ngson.cn>, loongarch@...ts.linux.dev,
Linux-Arch <linux-arch@...r.kernel.org>,
"Xuefeng Li" <lixuefeng@...ngson.cn>, guoren <guoren@...nel.org>,
"WANG Xuerui" <kernel@...0n.name>, "Jiaxun Yang" <jiaxun.yang@...goat.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH V3 13/14] LoongArch: Adjust default config files for 32BIT/64BIT
On Sat, Nov 22, 2025, at 15:13, Huacai Chen wrote:
> On Sat, Nov 22, 2025 at 7:57 PM Arnd Bergmann <arnd@...db.de> wrote:
>> On Sat, Nov 22, 2025, at 10:45, Thomas Weißschuh wrote:
>> > On 2025-11-22 12:36:33+0800, Huacai Chen wrote:
>> >> diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
>> >> index 96ca1a688984..cf9373786969 100644
>> >> --- a/arch/loongarch/Makefile
>> >> +++ b/arch/loongarch/Makefile
>> >> @@ -5,7 +5,12 @@
>> >>
>> >> boot := arch/loongarch/boot
>> >>
>> >> -KBUILD_DEFCONFIG := loongson3_defconfig
>> >> +ifdef CONFIG_32BIT
>> >
>> > Testing for CONFIG options here doesn't make sense, as the config is not yet
>> > created.
>>
>> > Either test for $(ARCH) or uname or just use one unconditionally.
>>
>> I don't really like the $(ARCH) hacks, nobody is going to build kernels
>> natively on loongarch32, and for the rest it's fine to set the option.
> OK, I will use 'uname -m' for checking. Though native builds on
> loongarch32 will hardly happen, we can give a small chance to use
> loongson32_defconfig, in all other cases, let's use
> loongson64_defconfig.
What I meant is not to guess the CONFIG_64BIT option from any
part of the build environment other than the actual .config settings.
$(ARCH) is initialized from 'uname -m' in scripts/subarch.include,
and I think this should stay unchanged.
>> > Also as mentioned before, snippets can reduce the duplication.
>> >
>> >> +KBUILD_DEFCONFIG := loongson32_defconfig
>> >> +else
>> >> +KBUILD_DEFCONFIG := loongson64_defconfig
>> >> +endif
>> >> +
>>
>> This is also not the change I had suggested in my review. I think this
>> should be a fragment along the lines of arch/mips/configs/generic/32r2.config
>> and arch/powerpc/configs/book3s_32.config.
>
> Sorry for that. I know that the default config file is usually
> generated by 'make savedefconfig', and the main purpose is
> significantly reducing file size. I did that, but manually add some
> lines such as CONFIG_LOONGARCH, CONFIG_32BIT/64BIT, CONFIG_ACPI,
> CONFIG_EFI, etc. My original goal of doing this is to let users easily
> know those fundamental options without reading Kconfig files (of
> course we should not increase the defconfig too much).
>
> Sorry again for not explaining about this in the previous version.
I don't mind having the extra options in the generic defconfig
file, that is unusual but I see your logic there.
My point here is that you should absolutely not duplicate the
contents but only put the differences into the new file, such
as
+++ arch/loongarch/configs/loongson32.config
CONFIG_32BIT=y
# CONFIG_64BIT is not set
CONFIG_32BIT_STANDARD=y
CONFIG_MACH_LOONGSON32=y
# CONFIG_SMP is not set
# CONFIG_LOONGSON3_CPUFREQ is not set
# CONFIG_IPMI_HANDLER is not set
# CONFIG_TCG_TPM is not set
# CONFIG_I2C_LS2X is not set
# CONFIG_PINCTRL_LOONGSON2 is not set
CONFIG_GPIO_LOONGSON1=y
# CONFIG_GPIO_LOONGSON is not set
CONFIG_WATCHDOG=y
CONFIG_LOONGSON1_WDT=m
# CONFIG_LOONGSON2_THERMAL=m is not set
# CONFIG_IOMMU_SUPPORT is not set
CONFIG_LOONGSON1_APB_DMA=y
# CONFIG_LOONGSON2_APB_DMA is not set
# CONFIG_PWM_LOONGSON is not set
This way, running 'make defconfig; make loongson32.config'
should produce the same output as your current
'make loongson32_defconfig', but it is much easier to keep
the two in sync because any future changes only
have to be done in the shared file.
Arnd
Powered by blists - more mailing lists