[PATCH v2 0/2] arm64: Enable CONFIG_64BIT for static analysis

The makefiles currently pass -m32 to Smatch static checker when I'm building on arm64. Also the arch is set to "arm" and Smatch thinks "arm" is 32 bits and "arm64" is 64 bits. With this patchset we pass -m64 and Smatch works correctly.
Changes since v1: Break up the patch into two patches.
Dan Carpenter (2): Kconfig: move CONFIG_32/64BIT to arch/Kconfig ARM: Enable CONFIG_64BIT for static analysis
arch/Kconfig | 6 ++++++ arch/arm/Kconfig | 1 + arch/mips/Kconfig | 6 ------ arch/riscv/Kconfig | 6 ------ 4 files changed, 7 insertions(+), 12 deletions(-)

These configs are used in multiple places so put them in a shared Kconfig file.
Signed-off-by: Dan Carpenter dan.carpenter@linaro.org --- v2: split the patch into two patches
arch/Kconfig | 6 ++++++ arch/mips/Kconfig | 6 ------ arch/riscv/Kconfig | 6 ------ 3 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/arch/Kconfig b/arch/Kconfig index b6fb9e927337..70f3b85b449a 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -20,6 +20,12 @@ config SYS_CACHE_SHIFT_6 config SYS_CACHE_SHIFT_7 bool
+config 32BIT + bool + +config 64BIT + bool + config SYS_CACHELINE_SIZE int default 128 if SYS_CACHE_SHIFT_7 diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index f0704d97f79b..eb7f3ad23762 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -473,12 +473,6 @@ config MIPS_TUNE_74KC config MIPS_TUNE_OCTEON3 bool
-config 32BIT - bool - -config 64BIT - bool - config SWAP_IO_SPACE bool
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index ac52c5e6dafa..6c26f91f1669 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -288,12 +288,6 @@ endmenu config RISCV_ISA_A def_bool y
-config 32BIT - bool - -config 64BIT - bool - config DMA_ADDR_T_64BIT bool default y if 64BIT

On Mon, Mar 04, 2024 at 10:04:15AM +0300, Dan Carpenter wrote:
These configs are used in multiple places so put them in a shared Kconfig file.
Signed-off-by: Dan Carpenter dan.carpenter@linaro.org
Reviewed-by: Tom Rini trini@konsulko.com

On Mon, Mar 04, 2024 at 10:04:15AM +0300, Dan Carpenter wrote:
These configs are used in multiple places so put them in a shared Kconfig file.
Signed-off-by: Dan Carpenter dan.carpenter@linaro.org Reviewed-by: Tom Rini trini@konsulko.com
Applied to u-boot/next, thanks!

In the Makefile there is a line that says this:
# the checker needs the correct machine size CHECKFLAGS += $(if $(CONFIG_64BIT),-m64,-m32)
Set CONFIG_64BIT for ARM64 so that we pass -m64 to the static checkers instead of -m32.
Signed-off-by: Dan Carpenter dan.carpenter@linaro.org --- v2: split the patch into two patches
arch/arm/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index fde85dc0d537..76d6a8cc6886 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -6,6 +6,7 @@ config SYS_ARCH
config ARM64 bool + select 64BIT select PHYS_64BIT select SYS_CACHE_SHIFT_6 imply SPL_SEPARATE_BSS

On 04.03.24 08:04, Dan Carpenter wrote:
In the Makefile there is a line that says this:
# the checker needs the correct machine size CHECKFLAGS += $(if $(CONFIG_64BIT),-m64,-m32)
Set CONFIG_64BIT for ARM64 so that we pass -m64 to the static checkers instead of -m32.
Signed-off-by: Dan Carpenter dan.carpenter@linaro.org
v2: split the patch into two patches
arch/arm/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index fde85dc0d537..76d6a8cc6886 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -6,6 +6,7 @@ config SYS_ARCH
config ARM64 bool
- select 64BIT
How about other 64bit architectures (sandbox64, x86_64)?
Best regards
Heinrich
select PHYS_64BIT select SYS_CACHE_SHIFT_6 imply SPL_SEPARATE_BSS

2024. 03. 04. 14:44 keltezéssel, Heinrich Schuchardt írta> How about other 64bit architectures (sandbox64, x86_64)?
I think that could be its own patchset.
Best regards
Heinrich
Bence
P.S., does anyone know why I'm being CC'ed here? Did I participate in this thread at some point? I only remember contributing to lib/rsa and also a small patch to arch/arm/lib/vectors.S. Maybe because the latter touched arch/arm/Kconfig as well, so now I should expect to get loads of mail for a month or two?

On Mon, Mar 04, 2024 at 03:11:04PM +0100, Csókás Bence wrote:
- 14:44 keltezéssel, Heinrich Schuchardt írta> How about other
64bit architectures (sandbox64, x86_64)?
I think that could be its own patchset.
Yes, a follow-up is fine.
Best regards
Heinrich
Bence
P.S., does anyone know why I'm being CC'ed here? Did I participate in this thread at some point? I only remember contributing to lib/rsa and also a small patch to arch/arm/lib/vectors.S. Maybe because the latter touched arch/arm/Kconfig as well, so now I should expect to get loads of mail for a month or two?
I wouldn't say loads of mail since it's the top-level arm Kconfig file but yes, git history is going to suggest you for a while.

On Mon, Mar 04, 2024 at 02:44:12PM +0100, Heinrich Schuchardt wrote:
On 04.03.24 08:04, Dan Carpenter wrote:
In the Makefile there is a line that says this:
# the checker needs the correct machine size CHECKFLAGS += $(if $(CONFIG_64BIT),-m64,-m32)
Set CONFIG_64BIT for ARM64 so that we pass -m64 to the static checkers instead of -m32.
Signed-off-by: Dan Carpenter dan.carpenter@linaro.org
v2: split the patch into two patches
arch/arm/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index fde85dc0d537..76d6a8cc6886 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -6,6 +6,7 @@ config SYS_ARCH config ARM64 bool
- select 64BIT
How about other 64bit architectures (sandbox64, x86_64)?
You're right. That was laziness on my part. Plus, I didn't know about sandbox64. But I think once we fix the two you mentioned then everything will be updated.
$ grep -l 64 arch/*/Kconfig arch/arm/Kconfig arch/mips/Kconfig arch/riscv/Kconfig arch/sandbox/Kconfig arch/x86/Kconfig
I'll send those patches tomorrow.
regards, dan carpenter

On Mon, Mar 04, 2024 at 10:04:29AM +0300, Dan Carpenter wrote:
In the Makefile there is a line that says this:
# the checker needs the correct machine size CHECKFLAGS += $(if $(CONFIG_64BIT),-m64,-m32)
Set CONFIG_64BIT for ARM64 so that we pass -m64 to the static checkers instead of -m32.
Signed-off-by: Dan Carpenter dan.carpenter@linaro.org
Applied to u-boot/next, thanks!
participants (4)
-
Csókás Bence
-
Dan Carpenter
-
Heinrich Schuchardt
-
Tom Rini