tests: Build correct sandbox configuration on 32bit
PATCH 1/1 tests: Build correct sandbox configuration on 32bit
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
cpp does not know about target specification, code needs to be compiled to determine integer width.
Add a test program that prints the integer width, and a make target that aligns the sandbox configuration with the result.
---
Makefile | 6 ++++++ doc/arch/sandbox.rst | 16 +++++++++++----- test/py/conftest.py | 1 + tools/Makefile | 2 ++ tools/bits-per-long.c | 14 ++++++++++++++ 5 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 tools/bits-per-long.c
Makefile +6 -0
@@ -2166,6 +2166,12 @@ tools-all: envtools tools ; cross_tools: export CROSS_BUILD_TOOLS=y cross_tools: tools ; +PHONY += set_host_bits +set_host_bits: tools + $(Q)sed -i -e /CONFIG_HOST_$$($(objtree)/tools/bits-per-long)BIT/d $(KCONFIG_CONFIG) + $(Q)sed -i -E -e "s/CONFIG_HOST_(..)BIT=y/# CONFIG_HOST_\1BIT is not set/" $(KCONFIG_CONFIG) + $(Q)echo CONFIG_HOST_$$($(objtree)/tools/bits-per-long)BIT=y >> $(KCONFIG_CONFIG) + .PHONY : CHANGELOG CHANGELOG: git log --no-merges U-Boot-1_1_5.. | \
doc/arch/sandbox.rst +11 -5
@@ -33,9 +33,11 @@ machines. There are two versions of the sandbox: One using 32-bit-wide integers, and one using 64-bit-wide integers. The 32-bit version can be build and run on either -32 or 64-bit hosts by either selecting or deselecting CONFIG_SANDBOX_32BIT; by -default, the sandbox it built for a 32-bit host. The sandbox using 64-bit-wide -integers can only be built on 64-bit hosts. +32 or 64-bit hosts by either selecting or deselecting HOST_64BIT; by +default, the sandbox it built for a 64-bit host. The sandbox using 64-bit-wide +integers can only be built on 64-bit hosts. There is no automation for ensuring +32bit build on 32bit hosts - use ``make set_host_bits`` to adjust the sandbox +config. Note that standalone/API support is not available at present.
@@ -51,7 +53,9 @@ Basic Operation To run sandbox U-Boot use something like:: - make sandbox_defconfig all + make sandbox_defconfig + make set_host_bits + make all ./u-boot Note: If you get errors about 'sdl-config: Command not found' you may need to
@@ -59,7 +63,9 @@ install libsdl2.0-dev or similar to get SDL support. Alternatively you can build sandbox without SDL (i.e. no display/keyboard support) by removing the CONFIG_SANDBOX_SDL line in include/configs/sandbox.h or using:: - make sandbox_defconfig all NO_SDL=1 + make sandbox_defconfig + make set_host_bits + make all NO_SDL=1 ./u-boot U-Boot will start on your computer, showing a sandbox emulation of the serial
test/py/conftest.py +1 -0
@@ -104,6 +104,7 @@ def run_build(config, source_dir, build_dir, board_type, log): o_opt = '' cmds = ( ['make', o_opt, '-s', board_type + '_defconfig'], + ['make', o_opt, '-s', 'set_host_bits'], ['make', o_opt, '-s', '-j{}'.format(os.cpu_count())], ) name = 'make'
tools/Makefile +2 -0
@@ -68,6 +68,8 @@ HOSTCFLAGS_img2srec.o := -pedantic hostprogs-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes HOSTCFLAGS_xway-swap-bytes.o := -pedantic +hostprogs-y += bits-per-long + hostprogs-y += mkenvimage mkenvimage-objs := mkenvimage.o os_support.o lib/crc32.o
tools/bits-per-long.c new file +14 -0
@@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0 +#include <stdio.h> + +int main (int argc,char **argv) +{ +unsigned long testvar = ~0UL ; +unsigned int i; + +for (i =0 ; testvar; i++, testvar >>=1 ) + ; + +return printf ("%u\n" , i); +} +
Signature · 1 line
2.37.3
Quoted 57 lines · Michal Suchanek
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
cpp does not know about target specification, code needs to be compiled to determine integer width.
Add a test program that prints the integer width, and a make target that aligns the sandbox configuration with the result.
Signed-off-by Michal Suchanek <[email protected]>---
Makefile | 6 ++++++ doc/arch/sandbox.rst | 16 +++++++++++----- test/py/conftest.py | 1 + tools/Makefile | 2 ++ tools/bits-per-long.c | 14 ++++++++++++++ 5 files changed, 34 insertions(+), 5 deletions(-)create mode 100644
tools/bits-per-long.cMakefile +6
-0@@ -2166,6 +2166,12 @@ tools-all: envtools tools ; cross_tools: export CROSS_BUILD_TOOLS=y cross_tools: tools ; +PHONY += set_host_bits +set_host_bits: tools + $(Q)sed -i -e /CONFIG_HOST_$$($(objtree)/tools/bits-per-long)BIT/d $(KCONFIG_CONFIG) + $(Q)sed -i -E -e "s/CONFIG_HOST_(..)BIT=y/# CONFIG_HOST_\1BIT is not set/" $(KCONFIG_CONFIG) + $(Q)echo CONFIG_HOST_$$($(objtree)/tools/bits-per-long)BIT=y >> $(KCONFIG_CONFIG) + .PHONY : CHANGELOG CHANGELOG: git log --no-merges U-Boot-1_1_5.. | \doc/arch/sandbox.rst +5
-3@@ -33,9 +33,11 @@ machines. There are two versions of the sandbox: One using 32-bit-wide integers, and one using 64-bit-wide integers. The 32-bit version can be build and run on either -32 or 64-bit hosts by either selecting or deselecting CONFIG_SANDBOX_32BIT; by -default, the sandbox it built for a 32-bit host. The sandbox using 64-bit-wide -integers can only be built on 64-bit hosts. +32 or 64-bit hosts by either selecting or deselecting HOST_64BIT; by +default, the sandbox it built for a 64-bit host. The sandbox using 64-bit-wide +integers can only be built on 64-bit hosts. There is no automation for ensuring +32bit build on 32bit hosts - use ``make set_host_bits`` to adjust the sandbox +config. Note that standalone/API support is not available at present.
doc/arch/sandbox.rst Basic Operation · line 58
Quoted 7 lines
doc/arch/sandbox.rst +3
-1@@ -51,7 +53,9 @@ Basic Operation To run sandbox U-Boot use something like:: - make sandbox_defconfig all + make sandbox_defconfig + make set_host_bits + make all
Thanks for addressing the problem of sandbox bitness.
We should not make building the sandbox more complicated. You could integrate building set_host_bits into an existing target like u-boot.cfg:.
Overall an approach with an external program is too complicated. CONFIG_HOST_32BIT and CONFIG_HOST_64BIT are used to define CONFIG_SANDBOX_BITS_PER_LONG.
We could add
#ifndef __LP64__
#undef SANDBOX_BITS_PER_LONG
#define SANDBOX_BITS_PER_LONG 32
#endif
to the top of arch/sandbox/include/asm/posix_types.h and use
#if defined(CONFIG_HOST_64BIT) && defined(__LP64__)
in drivers/misc/swap_case.c to solve the problem. This demonstrates that CONFIG_HOST_32BIT and CONFIG_HOST_64BIT are superfluous symbols.
Eliminating them and only using __LP64__ is the right approach.
@Simon:
We should add sandbox_defconfig built with -m32 to our Gitlab CI testing after fixing the incompatibilities in the unit tests.
Quoted 47 lines
doc/arch/sandbox.rst +3
-1./u-boot Note: If you get errors about 'sdl-config: Command not found' you may need to@@ -59,7 +63,9 @@ install libsdl2.0-dev or similar to get SDL support. Alternatively you can build sandbox without SDL (i.e. no display/keyboard support) by removing the CONFIG_SANDBOX_SDL line in include/configs/sandbox.h or using:: - make sandbox_defconfig all NO_SDL=1 + make sandbox_defconfig + make set_host_bits + make all NO_SDL=1 ./u-boot U-Boot will start on your computer, showing a sandbox emulation of the serialtest/py/conftest.py +1
-0@@ -104,6 +104,7 @@ def run_build(config, source_dir, build_dir, board_type, log): o_opt = '' cmds = ( ['make', o_opt, '-s', board_type + '_defconfig'], + ['make', o_opt, '-s', 'set_host_bits'], ['make', o_opt, '-s', '-j{}'.format(os.cpu_count())], ) name = 'make'tools/Makefile +2
-0@@ -68,6 +68,8 @@ HOSTCFLAGS_img2srec.o := -pedantic hostprogs-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes HOSTCFLAGS_xway-swap-bytes.o := -pedantic +hostprogs-y += bits-per-long + hostprogs-y += mkenvimage mkenvimage-objs := mkenvimage.o os_support.o lib/crc32.otools/bits-per-long.c new file +2
-0@@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0 +#include <stdio.h>
tools/bits-per-long.c line 12
Quoted 10 lines
tools/bits-per-long.c new file +10
-0+ +int main (int argc,char **argv) +{ +unsigned long testvar = ~0UL ; +unsigned int i; + +for (i =0 ; testvar; i++, testvar >>=1 ) + ; + +return printf ("%u\n" , i);
return printf("%zd\n", 8 * sizeof(long));
tools/bits-per-long.c line 14
Quoted 2 lines
tools/bits-per-long.c new file +2
-0+} +
Please avoid empty lines at the end files.
Best regards
Heinrich
Quoted 68 lines · Heinrich Schuchardt
Quoted 57 lines · Michal Suchanek
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
cpp does not know about target specification, code needs to be compiled to determine integer width.
Add a test program that prints the integer width, and a make target that aligns the sandbox configuration with the result.
Signed-off-by Michal Suchanek <[email protected]>---
Makefile | 6 ++++++ doc/arch/sandbox.rst | 16 +++++++++++----- test/py/conftest.py | 1 + tools/Makefile | 2 ++ tools/bits-per-long.c | 14 ++++++++++++++ 5 files changed, 34 insertions(+), 5 deletions(-)create mode 100644
tools/bits-per-long.cMakefile +6
-0@@ -2166,6 +2166,12 @@ tools-all: envtools tools ; cross_tools: export CROSS_BUILD_TOOLS=y cross_tools: tools ; +PHONY += set_host_bits +set_host_bits: tools + $(Q)sed -i -e /CONFIG_HOST_$$($(objtree)/tools/bits-per-long)BIT/d $(KCONFIG_CONFIG) + $(Q)sed -i -E -e "s/CONFIG_HOST_(..)BIT=y/# CONFIG_HOST_\1BIT is not set/" $(KCONFIG_CONFIG) + $(Q)echo CONFIG_HOST_$$($(objtree)/tools/bits-per-long)BIT=y >> $(KCONFIG_CONFIG) + .PHONY : CHANGELOG CHANGELOG: git log --no-merges U-Boot-1_1_5.. | \doc/arch/sandbox.rst +5
-3@@ -33,9 +33,11 @@ machines. There are two versions of the sandbox: One using 32-bit-wide integers, and one using 64-bit-wide integers. The 32-bit version can be build and run on either -32 or 64-bit hosts by either selecting or deselecting CONFIG_SANDBOX_32BIT; by -default, the sandbox it built for a 32-bit host. The sandbox using 64-bit-wide -integers can only be built on 64-bit hosts. +32 or 64-bit hosts by either selecting or deselecting HOST_64BIT; by +default, the sandbox it built for a 64-bit host. The sandbox using 64-bit-wide +integers can only be built on 64-bit hosts. There is no automation for ensuring +32bit build on 32bit hosts - use ``make set_host_bits`` to adjust the sandbox +config. Note that standalone/API support is not available at present.doc/arch/sandbox.rst Basic Operation · line 58
Quoted 7 lines
doc/arch/sandbox.rst +3
-1@@ -51,7 +53,9 @@ Basic Operation To run sandbox U-Boot use something like:: - make sandbox_defconfig all + make sandbox_defconfig + make set_host_bits + make allThanks for addressing the problem of sandbox bitness.
Quoted 6 lines
We should not make building the sandbox more complicated. You could integrate building
set_host_bitsinto an existing target like u-boot.cfg:.Overall an approach with an external program is too complicated.
CONFIG_HOST_32BITandCONFIG_HOST_64BITare used to defineCONFIG_SANDBOX_BITS_PER_LONG.
And for making SANDBOX64 depend on 64bit build.
Quoted 7 lines
We could add
#ifndef
__LP64__
#undefSANDBOX_BITS_PER_LONG
#defineSANDBOX_BITS_PER_LONG32
#endif
If we are willing to depend on this define which is clearly named as compiler-internal we could do similar to cc-option to run something like $(CC) -dM -E - < /dev/null | grep -q _LP64
Quoted 7 lines
to the top of
arch/sandbox/include/asm/posix_types.hand use#if
defined(CONFIG_HOST_64BIT)&&defined(__LP64__)in
drivers/misc/swap_case.cto solve the problem. This demonstrates thatCONFIG_HOST_32BITandCONFIG_HOST_64BITare superfluous symbols.
Not really.
Thanks
Michal
Quoted 69 lines · Michal Suchánek
Quoted 68 lines · Heinrich Schuchardt
Quoted 57 lines · Michal Suchanek
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
cpp does not know about target specification, code needs to be compiled to determine integer width.
Add a test program that prints the integer width, and a make target that aligns the sandbox configuration with the result.
Signed-off-by Michal Suchanek <[email protected]>---
Makefile | 6 ++++++ doc/arch/sandbox.rst | 16 +++++++++++----- test/py/conftest.py | 1 + tools/Makefile | 2 ++ tools/bits-per-long.c | 14 ++++++++++++++ 5 files changed, 34 insertions(+), 5 deletions(-)create mode 100644
tools/bits-per-long.cMakefile +6
-0@@ -2166,6 +2166,12 @@ tools-all: envtools tools ; cross_tools: export CROSS_BUILD_TOOLS=y cross_tools: tools ; +PHONY += set_host_bits +set_host_bits: tools + $(Q)sed -i -e /CONFIG_HOST_$$($(objtree)/tools/bits-per-long)BIT/d $(KCONFIG_CONFIG) + $(Q)sed -i -E -e "s/CONFIG_HOST_(..)BIT=y/# CONFIG_HOST_\1BIT is not set/" $(KCONFIG_CONFIG) + $(Q)echo CONFIG_HOST_$$($(objtree)/tools/bits-per-long)BIT=y >> $(KCONFIG_CONFIG) + .PHONY : CHANGELOG CHANGELOG: git log --no-merges U-Boot-1_1_5.. | \doc/arch/sandbox.rst +5
-3@@ -33,9 +33,11 @@ machines. There are two versions of the sandbox: One using 32-bit-wide integers, and one using 64-bit-wide integers. The 32-bit version can be build and run on either -32 or 64-bit hosts by either selecting or deselecting CONFIG_SANDBOX_32BIT; by -default, the sandbox it built for a 32-bit host. The sandbox using 64-bit-wide -integers can only be built on 64-bit hosts. +32 or 64-bit hosts by either selecting or deselecting HOST_64BIT; by +default, the sandbox it built for a 64-bit host. The sandbox using 64-bit-wide +integers can only be built on 64-bit hosts. There is no automation for ensuring +32bit build on 32bit hosts - use ``make set_host_bits`` to adjust the sandbox +config. Note that standalone/API support is not available at present.doc/arch/sandbox.rst Basic Operation · line 58
Quoted 7 lines
doc/arch/sandbox.rst +3
-1@@ -51,7 +53,9 @@ Basic Operation To run sandbox U-Boot use something like:: - make sandbox_defconfig all + make sandbox_defconfig + make set_host_bits + make allThanks for addressing the problem of sandbox bitness.
Quoted 7 lines
Quoted 6 lines
We should not make building the sandbox more complicated. You could integrate building
set_host_bitsinto an existing target like u-boot.cfg:.Overall an approach with an external program is too complicated.
CONFIG_HOST_32BITandCONFIG_HOST_64BITare used to defineCONFIG_SANDBOX_BITS_PER_LONG.And for making SANDBOX64 depend on 64bit build.
Sandbox64 is about the width of phys_addr_t and not about the bitness of the build. sandbox64_defconfig builds fine on ilp32 and many aspects work there.
We should test that 64bit phys_addr_t works on ilp32 systems. Sandbox64 would we the right way to do this.
Best regards
Heinrich
Quoted 25 lines
Quoted 7 lines
We could add
#ifndef
__LP64__
#undefSANDBOX_BITS_PER_LONG
#defineSANDBOX_BITS_PER_LONG32
#endifIf we are willing to depend on this define which is clearly named as compiler-internal we could do similar to cc-option to run something like $(CC) -dM -E - <
/dev/null| grep -q_LP64Quoted 7 lines
to the top of
arch/sandbox/include/asm/posix_types.hand use#if
defined(CONFIG_HOST_64BIT)&&defined(__LP64__)in
drivers/misc/swap_case.cto solve the problem. This demonstrates thatCONFIG_HOST_32BITandCONFIG_HOST_64BITare superfluous symbols.Not really.
Thanks
Michal
Hi Michal,
Quoted 13 lines · Michal Suchanek
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
cpp does not know about target specification, code needs to be compiled to determine integer width.
Add a test program that prints the integer width, and a make target that aligns the sandbox configuration with the result.
Signed-off-by Michal Suchanek <[email protected]>---
Quoted 7 lines
Makefile | 6 ++++++ doc/arch/sandbox.rst | 16 +++++++++++----- test/py/conftest.py | 1 + tools/Makefile | 2 ++ tools/bits-per-long.c | 14 ++++++++++++++ 5 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 tools/bits-per-long.c
This needs to be automatic, so that it builds the 32-bit version on 32-bit hosts, 64-bit version on 64-bit hosts.
See here for my attempt. I suspect it just needs your bits_per_long thing brought in, but in any case I hope it gives you inspiration.
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Basically we should be able to build sandbox on any platform and it should just work, without manual configuration.
Regards,
Simon
PATCH v2 1/1 tests: Build correct sandbox configuration on 32bit
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
Use _LP64 macro as heuristic for detecting 64bit targets.
---
Changes in v2:
simplify and move detection to kconfig
--- arch/sandbox/Kconfig | 18 +++--------------- scripts/Kconfig.include | 4 ++++ 2 files changed, 7 insertions(+), 15 deletions(-)
arch/sandbox/Kconfig +3 -15
@@ -13,7 +13,7 @@ config SYS_CPU config SANDBOX64 bool "Use 64-bit addresses" select PHYS_64BIT - select HOST_64BIT + depends on HOST_64BIT config SANDBOX_RAM_SIZE_MB int "RAM size in MiB"
@@ -41,23 +41,11 @@ config SYS_CONFIG_NAME default "sandbox_spl" if SANDBOX_SPL default "sandbox" if !SANDBOX_SPL -choice - prompt "Run sandbox on 32/64-bit host" - default HOST_64BIT - help - Sandbox can be built on 32-bit and 64-bit hosts. - The default is to build on a 64-bit host and run - on a 64-bit host. If you want to run sandbox on - a 32-bit host, change it here. - config HOST_32BIT - bool "32-bit host" - depends on !PHYS_64BIT + def_bool ! $(cc-define,_LP64) config HOST_64BIT - bool "64-bit host" - -endchoice + def_bool $(cc-define,_LP64) config SANDBOX_CRASH_RESET bool "Reset on crash"
scripts/Kconfig.include +4 -0
@@ -22,6 +22,10 @@ success = $(if-success,$(1),y,n) # Return y if the compiler supports <flag>, n otherwise cc-option = $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null) +# $(cc-define,<macro>) +# Return y if the compiler defines <macro>, n otherwise +cc-define = $(success,$(CC) -dM -E -x c /dev/null | grep -q '^#define \<$(1)\>') + # $(ld-option,<flag>) # Return y if the linker supports <flag>, n otherwise ld-option = $(success,$(LD) -v $(1))
Signature · 1 line
2.37.3
Quoted 6 lines · Michal Suchanek
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
Use
_LP64macro as heuristic for detecting 64bit targets.Signed-off-by Michal Suchanek <[email protected]>
Please, explain why you think a Kconfig level patch is preferable to what I proposed in
[PATCH] sandbox: Eliminate CONFIG_HOST_32/64BIT
https://lists.denx.de/pipermail/u-boot/2022-October/497236.html
scripts/Kconfig.include
Quoted 53 lines
---
Changes in v2:
simplify and move detection to kconfig--- arch/sandbox/Kconfig | 18 +++--------------- scripts/Kconfig.include | 4 ++++ 2 files changed, 7 insertions(+), 15 deletions(-)arch/sandbox/Kconfig +3
-15@@ -13,7 +13,7 @@ config SYS_CPU config SANDBOX64 bool "Use 64-bit addresses" select PHYS_64BIT - select HOST_64BIT + depends on HOST_64BIT config SANDBOX_RAM_SIZE_MB int "RAM size in MiB"@@ -41,23 +41,11 @@ config SYS_CONFIG_NAME default "sandbox_spl" if SANDBOX_SPL default "sandbox" if !SANDBOX_SPL -choice - prompt "Run sandbox on 32/64-bit host" - default HOST_64BIT - help - Sandbox can be built on 32-bit and 64-bit hosts. - The default is to build on a 64-bit host and run - on a 64-bit host. If you want to run sandbox on - a 32-bit host, change it here. - config HOST_32BIT - bool "32-bit host" - depends on !PHYS_64BIT + def_bool ! $(cc-define,_LP64) config HOST_64BIT - bool "64-bit host" - -endchoice + def_bool $(cc-define,_LP64) config SANDBOX_CRASH_RESET bool "Reset on crash"scripts/Kconfig.include +0
-0
This include is copied from Linux. From time to time we synchronize the Kconfig framework from Linux. So we should avoid U-Boot specific changes here.
Best regards
Heinrich
Quoted 11 lines
scripts/Kconfig.include +4
-0@@ -22,6 +22,10 @@ success = $(if-success,$(1),y,n) # Return y if the compiler supports <flag>, n otherwise cc-option = $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null) +# $(cc-define,<macro>) +# Return y if the compiler defines <macro>, n otherwise +cc-define = $(success,$(CC) -dM -E -x c /dev/null | grep -q '^#define \<$(1)\>') + # $(ld-option,<flag>) # Return y if the linker supports <flag>, n otherwise ld-option = $(success,$(LD) -v $(1))
Quoted 6 lines · Heinrich Schuchardt
Quoted 5 lines · Michal Suchanek
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
Use
_LP64macro as heuristic for detecting 64bit targets.
Quoted 7 lines
Quoted 1 line
Signed-off-by Michal Suchanek <[email protected]>Please, explain why you think a
Kconfiglevel patch is preferable to what I proposed in[PATCH] sandbox: Eliminate CONFIG_HOST_32/64BIT
https://lists.denx.de/pipermail/u-boot/2022-October/497236.html
The existing dependency canot be described when the option is eliminated:
arch/sandbox/Kconfig config SYS_CPU · line 16
Quoted 5 lines
config SANDBOX64
bool "Use 64-bit addresses"
selectPHYS_64BITarch/sandbox/Kconfig +1
-1- select HOST_64BIT + depends on HOST_64BIT
If we can run SANDBOX64 on 32bit eliminating the option is fine.
Thanks
Michal
Quoted 75 lines
scripts/Kconfig.include
Quoted 54 lines
---
Changes in v2:
simplify and move detection to kconfig--- arch/sandbox/Kconfig | 18 +++--------------- scripts/Kconfig.include | 4 ++++ 2 files changed, 7 insertions(+), 15 deletions(-)arch/sandbox/Kconfig +3
-15@@ -13,7 +13,7 @@ config SYS_CPU config SANDBOX64 bool "Use 64-bit addresses" select PHYS_64BIT - select HOST_64BIT + depends on HOST_64BIT config SANDBOX_RAM_SIZE_MB int "RAM size in MiB"@@ -41,23 +41,11 @@ config SYS_CONFIG_NAME default "sandbox_spl" if SANDBOX_SPL default "sandbox" if !SANDBOX_SPL -choice - prompt "Run sandbox on 32/64-bit host" - default HOST_64BIT - help - Sandbox can be built on 32-bit and 64-bit hosts. - The default is to build on a 64-bit host and run - on a 64-bit host. If you want to run sandbox on - a 32-bit host, change it here. - config HOST_32BIT - bool "32-bit host" - depends on !PHYS_64BIT + def_bool ! $(cc-define,_LP64) config HOST_64BIT - bool "64-bit host" - -endchoice + def_bool $(cc-define,_LP64) config SANDBOX_CRASH_RESET bool "Reset on crash"scripts/Kconfig.include +0
-0This include is copied from Linux. From time to time we synchronize the
Kconfigframework from Linux. So we should avoid U-Boot specific changes here.Best regards
Heinrich
Quoted 11 lines
scripts/Kconfig.include +4
-0@@ -22,6 +22,10 @@ success = $(if-success,$(1),y,n) # Return y if the compiler supports <flag>, n otherwise cc-option = $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null) +# $(cc-define,<macro>) +# Return y if the compiler defines <macro>, n otherwise +cc-define = $(success,$(CC) -dM -E -x c /dev/null | grep -q '^#define \<$(1)\>') + # $(ld-option,<flag>) # Return y if the linker supports <flag>, n otherwise ld-option = $(success,$(LD) -v $(1))
Hi Michal,
Quoted 9 lines · Michal Suchanek
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
Use
_LP64macro as heuristic for detecting 64bit targets.Signed-off-by Michal Suchanek <[email protected]>---
Quoted 7 lines
Changes in v2:
simplify and move detection to kconfig--- arch/sandbox/Kconfig | 18 +++--------------- scripts/Kconfig.include | 4 ++++ 2 files changed, 7 insertions(+), 15 deletions(-)
My only question is whether we can allow building the 32-bit version on a 64-bit machine? That would need a separate option I think, to say:
I don't want you to automatically determine HOST_32/64BIT. Instead, use 32 (or 64).
This is along the lines of what Heinrich is saying, except that I strongly feel that we must do the right thing by default, as your patch does.
Quoted 56 lines
arch/sandbox/Kconfig +3
-15@@ -13,7 +13,7 @@ config SYS_CPU config SANDBOX64 bool "Use 64-bit addresses" select PHYS_64BIT - select HOST_64BIT + depends on HOST_64BIT config SANDBOX_RAM_SIZE_MB int "RAM size in MiB"@@ -41,23 +41,11 @@ config SYS_CONFIG_NAME default "sandbox_spl" if SANDBOX_SPL default "sandbox" if !SANDBOX_SPL -choice - prompt "Run sandbox on 32/64-bit host" - default HOST_64BIT - help - Sandbox can be built on 32-bit and 64-bit hosts. - The default is to build on a 64-bit host and run - on a 64-bit host. If you want to run sandbox on - a 32-bit host, change it here. - config HOST_32BIT - bool "32-bit host" - depends on !PHYS_64BIT + def_bool ! $(cc-define,_LP64) config HOST_64BIT - bool "64-bit host" - -endchoice + def_bool $(cc-define,_LP64) config SANDBOX_CRASH_RESET bool "Reset on crash"scripts/Kconfig.include +4
-1@@ -22,6 +22,10 @@ success = $(if-success,$(1),y,n) # Return y if the compiler supports <flag>, n otherwise cc-option = $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null) +# $(cc-define,<macro>) +# Return y if the compiler defines <macro>, n otherwise +cc-define = $(success,$(CC) -dM -E -x c /dev/null | grep -q '^#define \<$(1)\>') + # $(ld-option,<flag>) # Return y if the linker supports <flag>, n otherwise ld-option = $(success,$(LD) -v $(1)) --
Quoted 2 lines
2.37.3
Regards,
SImon
Quoted 26 lines · Simon Glass
Hi Michal,
Quoted 9 lines · Michal Suchanek
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
Use
_LP64macro as heuristic for detecting 64bit targets.Signed-off-by Michal Suchanek <[email protected]>---
Quoted 7 lines
Changes in v2:
simplify and move detection to kconfig--- arch/sandbox/Kconfig | 18 +++--------------- scripts/Kconfig.include | 4 ++++ 2 files changed, 7 insertions(+), 15 deletions(-)Reviewed-by Simon Glass <[email protected]>My only question is whether we can allow building the 32-bit version on a 64-bit machine? That would need a separate option I think, to say:
Quoted 6 lines
I don't want you to automatically determine HOST_32/64BIT. Instead, use 32 (or 64).
This is along the lines of what Heinrich is saying, except that I strongly feel that we must do the right thing by default, as your patch does.
The whole point of phys_addr_t and phys_size_t is that it can be 64bit or 32bit on ilp32.
With this patch we cannot build with CONFIG_PHYS_64BIT=y on ilp32 and that is bad.
32 bit phys_addr_t on lp64 is irrelevant for actual hardware but this is what we currently test with sandbox_defconfig on Gitlab CI.
My patch is ending up in the same behavior as Michal's patch except that it allows to have 64bit phys_addr_t on ilp32.
Quoted 12 lines
arch/sandbox/Kconfig config SYS_CPU · line 16
Quoted 12 lines
arch/sandbox/Kconfig +1
-1@@ -13,7 +13,7 @@ config SYS_CPU config SANDBOX64 bool "Use 64-bit addresses" select PHYS_64BIT - select HOST_64BIT + depends on HOST_64BIT
This line is utterly wrong.
Best regards
Heinrich
Quoted 50 lines
Quoted 45 lines
arch/sandbox/Kconfig +2
-14config SANDBOX_RAM_SIZE_MB int "RAM size in MiB"@@ -41,23 +41,11 @@ config SYS_CONFIG_NAME default "sandbox_spl" if SANDBOX_SPL default "sandbox" if !SANDBOX_SPL -choice - prompt "Run sandbox on 32/64-bit host" - default HOST_64BIT - help - Sandbox can be built on 32-bit and 64-bit hosts. - The default is to build on a 64-bit host and run - on a 64-bit host. If you want to run sandbox on - a 32-bit host, change it here. - config HOST_32BIT - bool "32-bit host" - depends on !PHYS_64BIT + def_bool ! $(cc-define,_LP64) config HOST_64BIT - bool "64-bit host" - -endchoice + def_bool $(cc-define,_LP64) config SANDBOX_CRASH_RESET bool "Reset on crash"scripts/Kconfig.include +4
-1@@ -22,6 +22,10 @@ success = $(if-success,$(1),y,n) # Return y if the compiler supports <flag>, n otherwise cc-option = $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null) +# $(cc-define,<macro>) +# Return y if the compiler defines <macro>, n otherwise +cc-define = $(success,$(CC) -dM -E -x c /dev/null | grep -q '^#define \<$(1)\>') + # $(ld-option,<flag>) # Return y if the linker supports <flag>, n otherwise ld-option = $(success,$(LD) -v $(1)) --Quoted 2 lines
2.37.3
Regards,
SImon
Hi Heinrich,
Quoted 38 lines · Heinrich Schuchardt
Quoted 26 lines · Simon Glass
Hi Michal,
Quoted 9 lines · Michal Suchanek
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
Use
_LP64macro as heuristic for detecting 64bit targets.Signed-off-by Michal Suchanek <[email protected]>---
Quoted 7 lines
Changes in v2:
simplify and move detection to kconfig--- arch/sandbox/Kconfig | 18 +++--------------- scripts/Kconfig.include | 4 ++++ 2 files changed, 7 insertions(+), 15 deletions(-)Reviewed-by Simon Glass <[email protected]>My only question is whether we can allow building the 32-bit version on a 64-bit machine? That would need a separate option I think, to say:
Quoted 6 lines
I don't want you to automatically determine HOST_32/64BIT. Instead, use 32 (or 64).
This is along the lines of what Heinrich is saying, except that I strongly feel that we must do the right thing by default, as your patch does.
The whole point of
phys_addr_tandphys_size_tis that it can be 64bit or 32bit on ilp32.
Quoted 8 lines
With this patch we cannot build with
CONFIG_PHYS_64BIT=yon ilp32 and that is bad.32 bit
phys_addr_ton lp64 is irrelevant for actual hardware but this is what we currently test withsandbox_defconfigon Gitlab CI.My patch is ending up in the same behavior as Michal's patch except that it allows to have 64bit
phys_addr_ton ilp32.
It needs to automatically default to 32 or 64 bit depending on the host. If the user wants to fiddle with Kconfig to force it to the other one, that should be possible to.
It looks like your patch requires manual configuration, but perhaps I just misunderstood it?
[..]
Regards,
Simon
Quoted 50 lines · Simon Glass
Hi Heinrich,
Quoted 38 lines · Heinrich Schuchardt
Quoted 26 lines · Simon Glass
Hi Michal,
Quoted 9 lines · Michal Suchanek
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
Use
_LP64macro as heuristic for detecting 64bit targets.Signed-off-by Michal Suchanek <[email protected]>---
Quoted 7 lines
Changes in v2:
simplify and move detection to kconfig--- arch/sandbox/Kconfig | 18 +++--------------- scripts/Kconfig.include | 4 ++++ 2 files changed, 7 insertions(+), 15 deletions(-)Reviewed-by Simon Glass <[email protected]>My only question is whether we can allow building the 32-bit version on a 64-bit machine? That would need a separate option I think, to say:
Quoted 6 lines
I don't want you to automatically determine HOST_32/64BIT. Instead, use 32 (or 64).
This is along the lines of what Heinrich is saying, except that I strongly feel that we must do the right thing by default, as your patch does.
The whole point of
phys_addr_tandphys_size_tis that it can be 64bit or 32bit on ilp32.Quoted 8 lines
With this patch we cannot build with
CONFIG_PHYS_64BIT=yon ilp32 and that is bad.32 bit
phys_addr_ton lp64 is irrelevant for actual hardware but this is what we currently test withsandbox_defconfigon Gitlab CI.My patch is ending up in the same behavior as Michal's patch except that it allows to have 64bit
phys_addr_ton ilp32.
Quoted 6 lines
It needs to automatically default to 32 or 64 bit depending on the host. If the user wants to fiddle with
Kconfigto force it to the other one, that should be possible to.It looks like your patch requires manual configuration, but perhaps I just misunderstood it?
__LP64__ is a symbol defined by the compiler when compiling for 64bit and not defined when compiling for 32bit systems. There is nothing manual about it.
My patch uses this symbol to replace HOST_32BIT and HOST_64BIT.
Michal's patch compiles a program tools/bits-per-long.c that ends up returning 64 on 64 bit systems (where __LP64__ is defined) and 32 on 32 bit systems (where __LP64__ is not defined) and then chooses HOST_32BIT and HOST_64BIT accordingly. This part of Michal's patch is not wrong. The solution is only overly complicated.
What has to be chosen manually with both patches is PHYS_64BIT e.g. by selecting sandbox64_defconfig instead of sandbox_defconfig.
Unfortunately Michal did not understand that PHYS_64BIT=y, HOST_32BIT=y is a necessary test scenario and introduced an invalid dependency.
With my patch sandbox64_defconfig on a 32bit system uses 64bit phys_addr_t.
With Michal's patch sandbox64_defconfig on a 32bit system uses 32bit phys_addr_t.
Best regards
Heinrich
Quoted 70 lines · Heinrich Schuchardt
Quoted 50 lines · Simon Glass
Hi Heinrich,
Quoted 38 lines · Heinrich Schuchardt
Quoted 26 lines · Simon Glass
Hi Michal,
Quoted 9 lines · Michal Suchanek
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
Use
_LP64macro as heuristic for detecting 64bit targets.Signed-off-by Michal Suchanek <[email protected]>---
Quoted 7 lines
Changes in v2:
simplify and move detection to kconfig--- arch/sandbox/Kconfig | 18 +++--------------- scripts/Kconfig.include | 4 ++++ 2 files changed, 7 insertions(+), 15 deletions(-)Reviewed-by Simon Glass <[email protected]>My only question is whether we can allow building the 32-bit version on a 64-bit machine? That would need a separate option I think, to say:
Quoted 6 lines
I don't want you to automatically determine HOST_32/64BIT. Instead, use 32 (or 64).
This is along the lines of what Heinrich is saying, except that I strongly feel that we must do the right thing by default, as your patch does.
The whole point of
phys_addr_tandphys_size_tis that it can be 64bit or 32bit on ilp32.Quoted 8 lines
With this patch we cannot build with
CONFIG_PHYS_64BIT=yon ilp32 and that is bad.32 bit
phys_addr_ton lp64 is irrelevant for actual hardware but this is what we currently test withsandbox_defconfigon Gitlab CI.My patch is ending up in the same behavior as Michal's patch except that it allows to have 64bit
phys_addr_ton ilp32.Quoted 6 lines
It needs to automatically default to 32 or 64 bit depending on the host. If the user wants to fiddle with
Kconfigto force it to the other one, that should be possible to.It looks like your patch requires manual configuration, but perhaps I just misunderstood it?
__LP64__is a symbol defined by the compiler when compiling for 64bit and not defined when compiling for 32bit systems. There is nothing manual about it.My patch uses this symbol to replace
HOST_32BITandHOST_64BIT.Michal's patch compiles a program
tools/bits-per-long.cthat ends up returning 64 on 64 bit systems (where__LP64__is defined) and 32 on 32 bit systems (where__LP64__is not defined) and then choosesHOST_32BITandHOST_64BITaccordingly. This part of Michal's patch is not wrong. The solution is only overly complicated.
Quoted 5 lines
What has to be chosen manually with both patches is
PHYS_64BITe.g. by selectingsandbox64_defconfiginstead ofsandbox_defconfig.Unfortunately Michal did not understand that PHYS_64BIT=y, HOST_32BIT=y is a necessary test scenario and introduced an invalid dependency.
It did not introduce it, it merely did not remove it.
Quoted 8 lines
With my patch
sandbox64_defconfigon a 32bit system uses 64bitphys_addr_t.With Michal's patch
sandbox64_defconfigon a 32bit system uses 32bitphys_addr_t.Best regards
Heinrich
Am 15. Oktober 2022 21:17:12 MESZ schrieb "Michal Suchánek" <[email protected]>:
Quoted 71 lines · Heinrich Schuchardt
Quoted 70 lines · Simon Glass
Quoted 50 lines
Hi Heinrich,
Quoted 38 lines · Heinrich Schuchardt
Quoted 26 lines · Simon Glass
Hi Michal,
Quoted 9 lines · Michal Suchanek
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
Use
_LP64macro as heuristic for detecting 64bit targets.Signed-off-by Michal Suchanek <[email protected]>---
Quoted 7 lines
Changes in v2:
simplify and move detection to kconfig--- arch/sandbox/Kconfig | 18 +++--------------- scripts/Kconfig.include | 4 ++++ 2 files changed, 7 insertions(+), 15 deletions(-)Reviewed-by Simon Glass <[email protected]>My only question is whether we can allow building the 32-bit version on a 64-bit machine? That would need a separate option I think, to say:
Quoted 6 lines
I don't want you to automatically determine HOST_32/64BIT. Instead, use 32 (or 64).
This is along the lines of what Heinrich is saying, except that I strongly feel that we must do the right thing by default, as your patch does.
The whole point of
phys_addr_tandphys_size_tis that it can be 64bit or 32bit on ilp32.Quoted 8 lines
With this patch we cannot build with
CONFIG_PHYS_64BIT=yon ilp32 and that is bad.32 bit
phys_addr_ton lp64 is irrelevant for actual hardware but this is what we currently test withsandbox_defconfigon Gitlab CI.My patch is ending up in the same behavior as Michal's patch except that it allows to have 64bit
phys_addr_ton ilp32.Quoted 6 lines
It needs to automatically default to 32 or 64 bit depending on the host. If the user wants to fiddle with
Kconfigto force it to the other one, that should be possible to.It looks like your patch requires manual configuration, but perhaps I just misunderstood it?
__LP64__is a symbol defined by the compiler when compiling for 64bit and not defined when compiling for 32bit systems. There is nothing manual about it.My patch uses this symbol to replace
HOST_32BITandHOST_64BIT.Michal's patch compiles a program
tools/bits-per-long.cthat ends up returning 64 on 64 bit systems (where__LP64__is defined) and 32 on 32 bit systems (where__LP64__is not defined) and then choosesHOST_32BITandHOST_64BITaccordingly. This part of Michal's patch is not wrong. The solution is only overly complicated.
Quoted 7 lines
Quoted 5 lines
What has to be chosen manually with both patches is
PHYS_64BITe.g. by selectingsandbox64_defconfiginstead ofsandbox_defconfig.Unfortunately Michal did not understand that PHYS_64BIT=y, HOST_32BIT=y is a necessary test scenario and introduced an invalid dependency.
It did not introduce it, it merely did not remove it.
Without your patch I could build with PHYS_64BIT=y on ARMv7. With your patch I can not.
This obviously is a new constraint.
Best regards
Heinrich
Quoted 9 lines
Quoted 9 lines
With my patch
sandbox64_defconfigon a 32bit system uses 64bitphys_addr_t.With Michal's patch
sandbox64_defconfigon a 32bit system uses 32bitphys_addr_t.Best regards
Heinrich
Hi Heinrich,
Quoted 74 lines · Heinrich Schuchardt
Quoted 50 lines · Simon Glass
Hi Heinrich,
Quoted 38 lines · Heinrich Schuchardt
Quoted 26 lines · Simon Glass
Hi Michal,
Quoted 9 lines · Michal Suchanek
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
Use
_LP64macro as heuristic for detecting 64bit targets.Signed-off-by Michal Suchanek <[email protected]>---
Quoted 7 lines
Changes in v2:
simplify and move detection to kconfig--- arch/sandbox/Kconfig | 18 +++--------------- scripts/Kconfig.include | 4 ++++ 2 files changed, 7 insertions(+), 15 deletions(-)Reviewed-by Simon Glass <[email protected]>My only question is whether we can allow building the 32-bit version on a 64-bit machine? That would need a separate option I think, to say:
Quoted 6 lines
I don't want you to automatically determine HOST_32/64BIT. Instead, use 32 (or 64).
This is along the lines of what Heinrich is saying, except that I strongly feel that we must do the right thing by default, as your patch does.
The whole point of
phys_addr_tandphys_size_tis that it can be 64bit or 32bit on ilp32.Quoted 8 lines
With this patch we cannot build with
CONFIG_PHYS_64BIT=yon ilp32 and that is bad.32 bit
phys_addr_ton lp64 is irrelevant for actual hardware but this is what we currently test withsandbox_defconfigon Gitlab CI.My patch is ending up in the same behavior as Michal's patch except that it allows to have 64bit
phys_addr_ton ilp32.Quoted 6 lines
It needs to automatically default to 32 or 64 bit depending on the host. If the user wants to fiddle with
Kconfigto force it to the other one, that should be possible to.It looks like your patch requires manual configuration, but perhaps I just misunderstood it?
__LP64__is a symbol defined by the compiler when compiling for 64bit and not defined when compiling for 32bit systems. There is nothing manual about it.My patch uses this symbol to replace
HOST_32BITandHOST_64BIT.Michal's patch compiles a program
tools/bits-per-long.cthat ends up returning 64 on 64 bit systems (where__LP64__is defined) and 32 on 32 bit systems (where__LP64__is not defined) and then choosesHOST_32BITandHOST_64BITaccordingly. This part of Michal's patch is not wrong. The solution is only overly complicated.What has to be chosen manually with both patches is
PHYS_64BITe.g. by selectingsandbox64_defconfiginstead ofsandbox_defconfig.
Quoted 7 lines
Unfortunately Michal did not understand that PHYS_64BIT=y, HOST_32BIT=y is a necessary test scenario and introduced an invalid dependency.
With my patch
sandbox64_defconfigon a 32bit system uses 64bitphys_addr_t.With Michal's patch
sandbox64_defconfigon a 32bit system uses 32bitphys_addr_t.
That's all great, thank you, but please can you address my actual question?
Regards,
Simon
Am 15. Oktober 2022 21:24:36 MESZ schrieb Simon Glass <[email protected]>:
Quoted 80 lines
Hi Heinrich,
Quoted 77 lines · Heinrich Schuchardt
Quoted 50 lines · Simon Glass
Hi Heinrich,
Quoted 38 lines · Heinrich Schuchardt
Quoted 26 lines · Simon Glass
Hi Michal,
Quoted 9 lines · Michal Suchanek
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
Use
_LP64macro as heuristic for detecting 64bit targets.Signed-off-by Michal Suchanek <[email protected]>---
Quoted 7 lines
Changes in v2:
simplify and move detection to kconfig--- arch/sandbox/Kconfig | 18 +++--------------- scripts/Kconfig.include | 4 ++++ 2 files changed, 7 insertions(+), 15 deletions(-)Reviewed-by Simon Glass <[email protected]>My only question is whether we can allow building the 32-bit version on a 64-bit machine? That would need a separate option I think, to say:
Quoted 6 lines
I don't want you to automatically determine HOST_32/64BIT. Instead, use 32 (or 64).
This is along the lines of what Heinrich is saying, except that I strongly feel that we must do the right thing by default, as your patch does.
The whole point of
phys_addr_tandphys_size_tis that it can be 64bit or 32bit on ilp32.Quoted 8 lines
With this patch we cannot build with
CONFIG_PHYS_64BIT=yon ilp32 and that is bad.32 bit
phys_addr_ton lp64 is irrelevant for actual hardware but this is what we currently test withsandbox_defconfigon Gitlab CI.My patch is ending up in the same behavior as Michal's patch except that it allows to have 64bit
phys_addr_ton ilp32.Quoted 6 lines
It needs to automatically default to 32 or 64 bit depending on the host. If the user wants to fiddle with
Kconfigto force it to the other one, that should be possible to.It looks like your patch requires manual configuration, but perhaps I just misunderstood it?
__LP64__is a symbol defined by the compiler when compiling for 64bit and not defined when compiling for 32bit systems. There is nothing manual about it.My patch uses this symbol to replace
HOST_32BITandHOST_64BIT.Michal's patch compiles a program
tools/bits-per-long.cthat ends up returning 64 on 64 bit systems (where__LP64__is defined) and 32 on 32 bit systems (where__LP64__is not defined) and then choosesHOST_32BITandHOST_64BITaccordingly. This part of Michal's patch is not wrong. The solution is only overly complicated.What has to be chosen manually with both patches is
PHYS_64BITe.g. by selectingsandbox64_defconfiginstead ofsandbox_defconfig.Unfortunately Michal did not understand that PHYS_64BIT=y, HOST_32BIT=y is a necessary test scenario and introduced an invalid dependency.
Quoted 6 lines
Quoted 4 lines
With my patch
sandbox64_defconfigon a 32bit system uses 64bitphys_addr_t.With Michal's patch
sandbox64_defconfigon a 32bit system uses 32bitphys_addr_t.That's all great, thank you, but please can you address my actual question?
Your question in this thread was if my patch requires extra manual configuration compared to Michal's patch and the answer was no.
What other question do you have?
Best regards
Heinrich
Quoted 3 lines
Regards,
Simon
Hi Heinrich,
Quoted 86 lines · Heinrich Schuchardt
Am 15. Oktober 2022 21:24:36 MESZ schrieb Simon Glass <[email protected]>:
Quoted 82 lines
Hi Heinrich,
Quoted 79 lines · Heinrich Schuchardt
Quoted 50 lines · Simon Glass
Hi Heinrich,
Quoted 38 lines · Heinrich Schuchardt
Quoted 26 lines · Simon Glass
Hi Michal,
Quoted 9 lines · Michal Suchanek
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
Use
_LP64macro as heuristic for detecting 64bit targets.Signed-off-by Michal Suchanek <[email protected]>---
Quoted 7 lines
Changes in v2:
simplify and move detection to kconfig--- arch/sandbox/Kconfig | 18 +++--------------- scripts/Kconfig.include | 4 ++++ 2 files changed, 7 insertions(+), 15 deletions(-)Reviewed-by Simon Glass <[email protected]>My only question is whether we can allow building the 32-bit version on a 64-bit machine? That would need a separate option I think, to say:
Quoted 6 lines
I don't want you to automatically determine HOST_32/64BIT. Instead, use 32 (or 64).
This is along the lines of what Heinrich is saying, except that I strongly feel that we must do the right thing by default, as your patch does.
The whole point of
phys_addr_tandphys_size_tis that it can be 64bit or 32bit on ilp32.Quoted 8 lines
With this patch we cannot build with
CONFIG_PHYS_64BIT=yon ilp32 and that is bad.32 bit
phys_addr_ton lp64 is irrelevant for actual hardware but this is what we currently test withsandbox_defconfigon Gitlab CI.My patch is ending up in the same behavior as Michal's patch except that it allows to have 64bit
phys_addr_ton ilp32.Quoted 6 lines
It needs to automatically default to 32 or 64 bit depending on the host. If the user wants to fiddle with
Kconfigto force it to the other one, that should be possible to.It looks like your patch requires manual configuration, but perhaps I just misunderstood it?
__LP64__is a symbol defined by the compiler when compiling for 64bit and not defined when compiling for 32bit systems. There is nothing manual about it.My patch uses this symbol to replace
HOST_32BITandHOST_64BIT.Michal's patch compiles a program
tools/bits-per-long.cthat ends up returning 64 on 64 bit systems (where__LP64__is defined) and 32 on 32 bit systems (where__LP64__is not defined) and then choosesHOST_32BITandHOST_64BITaccordingly. This part of Michal's patch is not wrong. The solution is only overly complicated.What has to be chosen manually with both patches is
PHYS_64BITe.g. by selectingsandbox64_defconfiginstead ofsandbox_defconfig.Unfortunately Michal did not understand that PHYS_64BIT=y, HOST_32BIT=y is a necessary test scenario and introduced an invalid dependency.
With my patch
sandbox64_defconfigon a 32bit system uses 64bitphys_addr_t.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
With Michal's patch
sandbox64_defconfigon a 32bit system uses 32bitphys_addr_t.That's all great, thank you, but please can you address my actual question?
Your question in this thread was if my patch requires extra manual configuration compared to Michal's patch and the answer was no.
What other question do you have?
"It needs to automatically default to 32 or 64 bit depending on the host. If the user wants to fiddle with Kconfig to force it to the other one, that should be possible to."
I am not talking about anyone's patch, actually, just trying to state what I think should happen.
Regards,
Simon
Quoted 94 lines · Simon Glass
Hi Heinrich,
Quoted 91 lines · Heinrich Schuchardt
Am 15. Oktober 2022 21:24:36 MESZ schrieb Simon Glass <[email protected]>:
Quoted 86 lines
Hi Heinrich,
Quoted 74 lines · Heinrich Schuchardt
Quoted 50 lines · Simon Glass
Hi Heinrich,
Quoted 38 lines · Heinrich Schuchardt
Quoted 26 lines · Simon Glass
Hi Michal,
Quoted 9 lines · Michal Suchanek
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
Use
_LP64macro as heuristic for detecting 64bit targets.Signed-off-by Michal Suchanek <[email protected]>---
Quoted 7 lines
Changes in v2:
simplify and move detection to kconfig--- arch/sandbox/Kconfig | 18 +++--------------- scripts/Kconfig.include | 4 ++++ 2 files changed, 7 insertions(+), 15 deletions(-)Reviewed-by Simon Glass <[email protected]>My only question is whether we can allow building the 32-bit version on a 64-bit machine? That would need a separate option I think, to say:
Quoted 6 lines
I don't want you to automatically determine HOST_32/64BIT. Instead, use 32 (or 64).
This is along the lines of what Heinrich is saying, except that I strongly feel that we must do the right thing by default, as your patch does.
The whole point of
phys_addr_tandphys_size_tis that it can be 64bit or 32bit on ilp32.Quoted 8 lines
With this patch we cannot build with
CONFIG_PHYS_64BIT=yon ilp32 and that is bad.32 bit
phys_addr_ton lp64 is irrelevant for actual hardware but this is what we currently test withsandbox_defconfigon Gitlab CI.My patch is ending up in the same behavior as Michal's patch except that it allows to have 64bit
phys_addr_ton ilp32.Quoted 6 lines
It needs to automatically default to 32 or 64 bit depending on the host. If the user wants to fiddle with
Kconfigto force it to the other one, that should be possible to.It looks like your patch requires manual configuration, but perhaps I just misunderstood it?
__LP64__is a symbol defined by the compiler when compiling for 64bit and not defined when compiling for 32bit systems. There is nothing manual about it.My patch uses this symbol to replace
HOST_32BITandHOST_64BIT.Michal's patch compiles a program
tools/bits-per-long.cthat ends up returning 64 on 64 bit systems (where__LP64__is defined) and 32 on 32 bit systems (where__LP64__is not defined) and then choosesHOST_32BITandHOST_64BITaccordingly. This part of Michal's patch is not wrong. The solution is only overly complicated.What has to be chosen manually with both patches is
PHYS_64BITe.g. by selectingsandbox64_defconfiginstead ofsandbox_defconfig.Quoted 7 lines
Unfortunately Michal did not understand that PHYS_64BIT=y, HOST_32BIT=y is a necessary test scenario and introduced an invalid dependency.
With my patch
sandbox64_defconfigon a 32bit system uses 64bitphys_addr_t.With Michal's patch
sandbox64_defconfigon a 32bit system uses 32bitphys_addr_t.That's all great, thank you, but please can you address my actual question?
Quoted 7 lines
Quoted 3 lines
Your question in this thread was if my patch requires extra manual configuration compared to Michal's patch and the answer was no.
What other question do you have?
"It needs to automatically default to 32 or 64 bit depending on the host. If the user wants to fiddle with
Kconfigto force it to the other one, that should be possible to."
The user forces 32bit or 64bit by selecting a 32bit or 64bit compiler not with Kconfig. PHYS_64BIT is the only thing that needs to be selected via Kconfig.
Quoted 3 lines
I am not talking about anyone's patch, actually, just trying to state what I think should happen.
The physical systems that U-Boot has to deal with are:
* 32bit without physical address extension (PAE)
Here phys_addr_t must be 32 bit.
* 32bit with physical address extension.
Here phys_addr_t must be 64 bit.
* 64bit systems without PAE.
Here phys_addr_t must be 64 bit.
We want to model these three scenarios with the sandbox.
So we have to build:
* Sandbox with PHYS_64BIT=n using a 32bit compiler.
* Sandbox with PHYS_64BIT=y using a 32bit compiler.
* Sandbox with PHYS_64BIT=y using a 64bit compiler.
Sandbox with PHYS_64BIT=n and using a 64bit compiler is irrelevant as it does not match any physical system.
PHYS_64BIT selecting HOST_64BIT=y was always wrong.
Best regards
Heinrich
Quoted 120 lines · Heinrich Schuchardt
Quoted 94 lines · Simon Glass
Hi Heinrich,
Quoted 91 lines · Heinrich Schuchardt
Am 15. Oktober 2022 21:24:36 MESZ schrieb Simon Glass <[email protected]>:
Quoted 86 lines
Hi Heinrich,
Quoted 74 lines · Heinrich Schuchardt
Quoted 50 lines · Simon Glass
Hi Heinrich,
Quoted 38 lines · Heinrich Schuchardt
Quoted 26 lines · Simon Glass
Hi Michal,
Quoted 9 lines · Michal Suchanek
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
Use
_LP64macro as heuristic for detecting 64bit targets.Signed-off-by Michal Suchanek <[email protected]>---
Quoted 7 lines
Changes in v2:
simplify and move detection to kconfig--- arch/sandbox/Kconfig | 18 +++--------------- scripts/Kconfig.include | 4 ++++ 2 files changed, 7 insertions(+), 15 deletions(-)Reviewed-by Simon Glass <[email protected]>My only question is whether we can allow building the 32-bit version on a 64-bit machine? That would need a separate option I think, to say:
Quoted 6 lines
I don't want you to automatically determine HOST_32/64BIT. Instead, use 32 (or 64).
This is along the lines of what Heinrich is saying, except that I strongly feel that we must do the right thing by default, as your patch does.
The whole point of
phys_addr_tandphys_size_tis that it can be 64bit or 32bit on ilp32.Quoted 8 lines
With this patch we cannot build with
CONFIG_PHYS_64BIT=yon ilp32 and that is bad.32 bit
phys_addr_ton lp64 is irrelevant for actual hardware but this is what we currently test withsandbox_defconfigon Gitlab CI.My patch is ending up in the same behavior as Michal's patch except that it allows to have 64bit
phys_addr_ton ilp32.Quoted 6 lines
It needs to automatically default to 32 or 64 bit depending on the host. If the user wants to fiddle with
Kconfigto force it to the other one, that should be possible to.It looks like your patch requires manual configuration, but perhaps I just misunderstood it?
__LP64__is a symbol defined by the compiler when compiling for 64bit and not defined when compiling for 32bit systems. There is nothing manual about it.My patch uses this symbol to replace
HOST_32BITandHOST_64BIT.Michal's patch compiles a program
tools/bits-per-long.cthat ends up returning 64 on 64 bit systems (where__LP64__is defined) and 32 on 32 bit systems (where__LP64__is not defined) and then choosesHOST_32BITandHOST_64BITaccordingly. This part of Michal's patch is not wrong. The solution is only overly complicated.What has to be chosen manually with both patches is
PHYS_64BITe.g. by selectingsandbox64_defconfiginstead ofsandbox_defconfig.Quoted 7 lines
Unfortunately Michal did not understand that PHYS_64BIT=y, HOST_32BIT=y is a necessary test scenario and introduced an invalid dependency.
With my patch
sandbox64_defconfigon a 32bit system uses 64bitphys_addr_t.With Michal's patch
sandbox64_defconfigon a 32bit system uses 32bitphys_addr_t.That's all great, thank you, but please can you address my actual question?
Quoted 7 lines
Quoted 3 lines
Your question in this thread was if my patch requires extra manual configuration compared to Michal's patch and the answer was no.
What other question do you have?
"It needs to automatically default to 32 or 64 bit depending on the host. If the user wants to fiddle with
Kconfigto force it to the other one, that should be possible to."The user forces 32bit or 64bit by selecting a 32bit or 64bit compiler not with
Kconfig.PHYS_64BITis the only thing that needs to be selected viaKconfig.Quoted 3 lines
I am not talking about anyone's patch, actually, just trying to state what I think should happen.
The physical systems that U-Boot has to deal with are:
* 32bit without physical address extension (PAE)
Herephys_addr_tmust be 32 bit.
* 32bit with physical address extension.
Herephys_addr_tmust be 64 bit.
* 64bit systems without PAE.
Herephys_addr_tmust be 64 bit.
Quoted 7 lines
We want to model these three scenarios with the sandbox.
So we have to build:
* Sandbox with PHYS_64BIT=n using a 32bit compiler.
* Sandbox with PHYS_64BIT=y using a 32bit compiler.
* Sandbox with PHYS_64BIT=y using a 64bit compiler.
To get these three and not the fourth a kconfig option would still be needed, right?
Thanks
Michal
Hi,
Quoted 124 lines · Michal Suchánek
Quoted 122 lines · Heinrich Schuchardt
Quoted 94 lines · Simon Glass
Hi Heinrich,
Quoted 91 lines · Heinrich Schuchardt
Am 15. Oktober 2022 21:24:36 MESZ schrieb Simon Glass <[email protected]>:
Quoted 86 lines
Hi Heinrich,
Quoted 74 lines · Heinrich Schuchardt
Quoted 50 lines · Simon Glass
Hi Heinrich,
Quoted 38 lines · Heinrich Schuchardt
Quoted 26 lines · Simon Glass
Hi Michal,
Quoted 9 lines · Michal Suchanek
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
Use
_LP64macro as heuristic for detecting 64bit targets.Signed-off-by Michal Suchanek <[email protected]>---
Quoted 7 lines
Changes in v2:
simplify and move detection to kconfig--- arch/sandbox/Kconfig | 18 +++--------------- scripts/Kconfig.include | 4 ++++ 2 files changed, 7 insertions(+), 15 deletions(-)Reviewed-by Simon Glass <[email protected]>My only question is whether we can allow building the 32-bit version on a 64-bit machine? That would need a separate option I think, to say:
Quoted 6 lines
I don't want you to automatically determine HOST_32/64BIT. Instead, use 32 (or 64).
This is along the lines of what Heinrich is saying, except that I strongly feel that we must do the right thing by default, as your patch does.
The whole point of
phys_addr_tandphys_size_tis that it can be 64bit or 32bit on ilp32.Quoted 8 lines
With this patch we cannot build with
CONFIG_PHYS_64BIT=yon ilp32 and that is bad.32 bit
phys_addr_ton lp64 is irrelevant for actual hardware but this is what we currently test withsandbox_defconfigon Gitlab CI.My patch is ending up in the same behavior as Michal's patch except that it allows to have 64bit
phys_addr_ton ilp32.Quoted 6 lines
It needs to automatically default to 32 or 64 bit depending on the host. If the user wants to fiddle with
Kconfigto force it to the other one, that should be possible to.It looks like your patch requires manual configuration, but perhaps I just misunderstood it?
__LP64__is a symbol defined by the compiler when compiling for 64bit and not defined when compiling for 32bit systems. There is nothing manual about it.My patch uses this symbol to replace
HOST_32BITandHOST_64BIT.Michal's patch compiles a program
tools/bits-per-long.cthat ends up returning 64 on 64 bit systems (where__LP64__is defined) and 32 on 32 bit systems (where__LP64__is not defined) and then choosesHOST_32BITandHOST_64BITaccordingly. This part of Michal's patch is not wrong. The solution is only overly complicated.What has to be chosen manually with both patches is
PHYS_64BITe.g. by selectingsandbox64_defconfiginstead ofsandbox_defconfig.Quoted 7 lines
Unfortunately Michal did not understand that PHYS_64BIT=y, HOST_32BIT=y is a necessary test scenario and introduced an invalid dependency.
With my patch
sandbox64_defconfigon a 32bit system uses 64bitphys_addr_t.With Michal's patch
sandbox64_defconfigon a 32bit system uses 32bitphys_addr_t.That's all great, thank you, but please can you address my actual question?
Quoted 7 lines
Quoted 3 lines
Your question in this thread was if my patch requires extra manual configuration compared to Michal's patch and the answer was no.
What other question do you have?
"It needs to automatically default to 32 or 64 bit depending on the host. If the user wants to fiddle with
Kconfigto force it to the other one, that should be possible to."The user forces 32bit or 64bit by selecting a 32bit or 64bit compiler not with
Kconfig.PHYS_64BITis the only thing that needs to be selected viaKconfig.Quoted 3 lines
I am not talking about anyone's patch, actually, just trying to state what I think should happen.
The physical systems that U-Boot has to deal with are:
* 32bit without physical address extension (PAE)
Herephys_addr_tmust be 32 bit.
* 32bit with physical address extension.
Herephys_addr_tmust be 64 bit.
* 64bit systems without PAE.
Herephys_addr_tmust be 64 bit.We want to model these three scenarios with the sandbox.
Quoted 8 lines
Quoted 5 lines
So we have to build:
* Sandbox with PHYS_64BIT=n using a 32bit compiler.
* Sandbox with PHYS_64BIT=y using a 32bit compiler.
* Sandbox with PHYS_64BIT=y using a 64bit compiler.To get these three and not the fourth a kconfig option would still be needed, right?
My concern is that 1 and 3 are built automatically by default, depending on what bitness you are using (or compiler, that's fine too as it might be equivalent).
So NO Kconfig change to get that behaviour. My request for a Kconfig to *manually* select which to use is not as important as the above, so let's ignore it.
For #2 that would need to do a config change as it isn't worth creating a new sandbox build just for that. We could do it in CI with 'buildman -a PHYS_64BIT=y'
Regards,
Simon
Hi,
Quoted 124 lines · Michal Suchánek
Quoted 122 lines · Heinrich Schuchardt
Quoted 94 lines · Simon Glass
Hi Heinrich,
Quoted 91 lines · Heinrich Schuchardt
Am 15. Oktober 2022 21:24:36 MESZ schrieb Simon Glass <[email protected]>:
Quoted 86 lines
Hi Heinrich,
Quoted 74 lines · Heinrich Schuchardt
Quoted 50 lines · Simon Glass
Hi Heinrich,
Quoted 38 lines · Heinrich Schuchardt
Quoted 26 lines · Simon Glass
Hi Michal,
Quoted 9 lines · Michal Suchanek
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
Use
_LP64macro as heuristic for detecting 64bit targets.Signed-off-by Michal Suchanek <[email protected]>---
Quoted 7 lines
Changes in v2:
simplify and move detection to kconfig--- arch/sandbox/Kconfig | 18 +++--------------- scripts/Kconfig.include | 4 ++++ 2 files changed, 7 insertions(+), 15 deletions(-)Reviewed-by Simon Glass <[email protected]>My only question is whether we can allow building the 32-bit version on a 64-bit machine? That would need a separate option I think, to say:
Quoted 6 lines
I don't want you to automatically determine HOST_32/64BIT. Instead, use 32 (or 64).
This is along the lines of what Heinrich is saying, except that I strongly feel that we must do the right thing by default, as your patch does.
The whole point of
phys_addr_tandphys_size_tis that it can be 64bit or 32bit on ilp32.Quoted 8 lines
With this patch we cannot build with
CONFIG_PHYS_64BIT=yon ilp32 and that is bad.32 bit
phys_addr_ton lp64 is irrelevant for actual hardware but this is what we currently test withsandbox_defconfigon Gitlab CI.My patch is ending up in the same behavior as Michal's patch except that it allows to have 64bit
phys_addr_ton ilp32.Quoted 6 lines
It needs to automatically default to 32 or 64 bit depending on the host. If the user wants to fiddle with
Kconfigto force it to the other one, that should be possible to.It looks like your patch requires manual configuration, but perhaps I just misunderstood it?
__LP64__is a symbol defined by the compiler when compiling for 64bit and not defined when compiling for 32bit systems. There is nothing manual about it.My patch uses this symbol to replace
HOST_32BITandHOST_64BIT.Michal's patch compiles a program
tools/bits-per-long.cthat ends up returning 64 on 64 bit systems (where__LP64__is defined) and 32 on 32 bit systems (where__LP64__is not defined) and then choosesHOST_32BITandHOST_64BITaccordingly. This part of Michal's patch is not wrong. The solution is only overly complicated.What has to be chosen manually with both patches is
PHYS_64BITe.g. by selectingsandbox64_defconfiginstead ofsandbox_defconfig.Quoted 7 lines
Unfortunately Michal did not understand that PHYS_64BIT=y, HOST_32BIT=y is a necessary test scenario and introduced an invalid dependency.
With my patch
sandbox64_defconfigon a 32bit system uses 64bitphys_addr_t.With Michal's patch
sandbox64_defconfigon a 32bit system uses 32bitphys_addr_t.That's all great, thank you, but please can you address my actual question?
Quoted 7 lines
Quoted 3 lines
Your question in this thread was if my patch requires extra manual configuration compared to Michal's patch and the answer was no.
What other question do you have?
"It needs to automatically default to 32 or 64 bit depending on the host. If the user wants to fiddle with
Kconfigto force it to the other one, that should be possible to."The user forces 32bit or 64bit by selecting a 32bit or 64bit compiler not with
Kconfig.PHYS_64BITis the only thing that needs to be selected viaKconfig.Quoted 3 lines
I am not talking about anyone's patch, actually, just trying to state what I think should happen.
The physical systems that U-Boot has to deal with are:
* 32bit without physical address extension (PAE)
Herephys_addr_tmust be 32 bit.
* 32bit with physical address extension.
Herephys_addr_tmust be 64 bit.
* 64bit systems without PAE.
Herephys_addr_tmust be 64 bit.We want to model these three scenarios with the sandbox.
Quoted 8 lines
Quoted 5 lines
So we have to build:
* Sandbox with PHYS_64BIT=n using a 32bit compiler.
* Sandbox with PHYS_64BIT=y using a 32bit compiler.
* Sandbox with PHYS_64BIT=y using a 64bit compiler.To get these three and not the fourth a kconfig option would still be needed, right?
My concern is that 1 and 3 are built automatically by default, depending on what bitness you are using (or compiler, that's fine too as it might be equivalent).
So NO Kconfig change to get that behaviour. My request for a Kconfig to *manually* select which to use is not as important as the above, so let's ignore it.
For #2 that would need to do a config change as it isn't worth creating a new sandbox build just for that. We could do it in CI with 'buildman -a PHYS_64BIT=y'
Regards,
Simon
Applied to u-boot-dm, thanks!
Quoted 140 lines · Simon Glass
Hi,
Quoted 124 lines · Michal Suchánek
Quoted 122 lines · Heinrich Schuchardt
Quoted 94 lines · Simon Glass
Hi Heinrich,
Quoted 91 lines · Heinrich Schuchardt
Am 15. Oktober 2022 21:24:36 MESZ schrieb Simon Glass <[email protected]>:
Quoted 86 lines
Hi Heinrich,
Quoted 74 lines · Heinrich Schuchardt
Quoted 50 lines · Simon Glass
Hi Heinrich,
Quoted 38 lines · Heinrich Schuchardt
Quoted 26 lines · Simon Glass
Hi Michal,
Quoted 9 lines · Michal Suchanek
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
Use
_LP64macro as heuristic for detecting 64bit targets.Signed-off-by Michal Suchanek <[email protected]>---
Quoted 7 lines
Changes in v2:
simplify and move detection to kconfig--- arch/sandbox/Kconfig | 18 +++--------------- scripts/Kconfig.include | 4 ++++ 2 files changed, 7 insertions(+), 15 deletions(-)Reviewed-by Simon Glass <[email protected]>My only question is whether we can allow building the 32-bit version on a 64-bit machine? That would need a separate option I think, to say:
Quoted 6 lines
I don't want you to automatically determine HOST_32/64BIT. Instead, use 32 (or 64).
This is along the lines of what Heinrich is saying, except that I strongly feel that we must do the right thing by default, as your patch does.
The whole point of
phys_addr_tandphys_size_tis that it can be 64bit or 32bit on ilp32.Quoted 8 lines
With this patch we cannot build with
CONFIG_PHYS_64BIT=yon ilp32 and that is bad.32 bit
phys_addr_ton lp64 is irrelevant for actual hardware but this is what we currently test withsandbox_defconfigon Gitlab CI.My patch is ending up in the same behavior as Michal's patch except that it allows to have 64bit
phys_addr_ton ilp32.Quoted 6 lines
It needs to automatically default to 32 or 64 bit depending on the host. If the user wants to fiddle with
Kconfigto force it to the other one, that should be possible to.It looks like your patch requires manual configuration, but perhaps I just misunderstood it?
__LP64__is a symbol defined by the compiler when compiling for 64bit and not defined when compiling for 32bit systems. There is nothing manual about it.My patch uses this symbol to replace
HOST_32BITandHOST_64BIT.Michal's patch compiles a program
tools/bits-per-long.cthat ends up returning 64 on 64 bit systems (where__LP64__is defined) and 32 on 32 bit systems (where__LP64__is not defined) and then choosesHOST_32BITandHOST_64BITaccordingly. This part of Michal's patch is not wrong. The solution is only overly complicated.What has to be chosen manually with both patches is
PHYS_64BITe.g. by selectingsandbox64_defconfiginstead ofsandbox_defconfig.Quoted 7 lines
Unfortunately Michal did not understand that PHYS_64BIT=y, HOST_32BIT=y is a necessary test scenario and introduced an invalid dependency.
With my patch
sandbox64_defconfigon a 32bit system uses 64bitphys_addr_t.With Michal's patch
sandbox64_defconfigon a 32bit system uses 32bitphys_addr_t.That's all great, thank you, but please can you address my actual question?
Quoted 7 lines
Quoted 3 lines
Your question in this thread was if my patch requires extra manual configuration compared to Michal's patch and the answer was no.
What other question do you have?
"It needs to automatically default to 32 or 64 bit depending on the host. If the user wants to fiddle with
Kconfigto force it to the other one, that should be possible to."The user forces 32bit or 64bit by selecting a 32bit or 64bit compiler not with
Kconfig.PHYS_64BITis the only thing that needs to be selected viaKconfig.Quoted 3 lines
I am not talking about anyone's patch, actually, just trying to state what I think should happen.
The physical systems that U-Boot has to deal with are:
* 32bit without physical address extension (PAE)
Herephys_addr_tmust be 32 bit.
* 32bit with physical address extension.
Herephys_addr_tmust be 64 bit.
* 64bit systems without PAE.
Herephys_addr_tmust be 64 bit.We want to model these three scenarios with the sandbox.
Quoted 8 lines
Quoted 5 lines
So we have to build:
* Sandbox with PHYS_64BIT=n using a 32bit compiler.
* Sandbox with PHYS_64BIT=y using a 32bit compiler.
* Sandbox with PHYS_64BIT=y using a 64bit compiler.To get these three and not the fourth a kconfig option would still be needed, right?
My concern is that 1 and 3 are built automatically by default, depending on what bitness you are using (or compiler, that's fine too as it might be equivalent).
Quoted 7 lines
So NO
Kconfigchange to get that behaviour. My request for aKconfigto *manually* select which to use is not as important as the above, so let's ignore it.For #2 that would need to do a config change as it isn't worth creating a new sandbox build just for that. We could do it in CI with 'buildman -a PHYS_64BIT=y'
Then you may want the alternative patch instead:
[PATCH] sandbox: Eliminate CONFIG_HOST_32/64BIT
https://lists.denx.de/pipermail/u-boot/2022-October/497236.html
hm, on a second thought you probably don't unless it's cleaned up to use __LP64__ only once to define the sandbox bits.
Thanks
Michal
Quoted 5 lines
Regards,
SimonApplied to u-boot-dm, thanks!
PATCH 1/1 sandbox: Correctly define BITS_PER_LONG
SANDBOX_BITS_PER_LONG is the number of bits in long on the sandbox platform.
---
arch/sandbox/include/asm/types.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
arch/sandbox/include/asm/types.h +1 -5
@@ -18,11 +18,7 @@ typedef unsigned short umode_t;/* * Number of bits in a C 'long' on this architecture. */ -#ifdef CONFIG_PHYS_64BIT -#define BITS_PER_LONG 64 -#else /* CONFIG_PHYS_64BIT */ -#define BITS_PER_LONG 32 -#endif /* CONFIG_PHYS_64BIT */ +#define BITS_PER_LONG CONFIG_SANDBOX_BITS_PER_LONG#ifdef CONFIG_PHYS_64BIT typedef unsigned long long dma_addr_t ;
Signature · 1 line
2.38.0
Re: [PATCH] sandbox: Correctly define BITS_PER_LONG
Am 22. Oktober 2022 23:22:01 MESZ schrieb Michal Suchanek <[email protected]>:
Quoted 2 lines
SANDBOX_BITS_PER_LONGis the number of bits in long on the sandbox platform.
Please, explain in the commit message what this patch is good for.
Aren't further patches needed to make use of it?
Best regards
Heinrich
Quoted 24 lines
Signed-off-by Michal Suchanek <[email protected]>---
arch/sandbox/include/asm/types.h| 6 +-----1 file changed, 1 insertion(+), 5 deletions(-)arch/sandbox/include/asm/types.h +1
-5@@ -18,11 +18,7 @@ typedef unsigned short umode_t;/* * Number of bits in a C 'long' on this architecture. */ -#ifdef CONFIG_PHYS_64BIT -#define BITS_PER_LONG 64 -#else /* CONFIG_PHYS_64BIT */ -#define BITS_PER_LONG 32 -#endif /* CONFIG_PHYS_64BIT */ +#define BITS_PER_LONG CONFIG_SANDBOX_BITS_PER_LONG#ifdef CONFIG_PHYS_64BIT typedef unsigned long long dma_addr_t ;
Re: [PATCH] sandbox: Correctly define BITS_PER_LONG
Quoted 7 lines · Heinrich Schuchardt
Am 22. Oktober 2022 23:22:01 MESZ schrieb Michal Suchanek <[email protected]>:
Quoted 2 lines
SANDBOX_BITS_PER_LONGis the number of bits in long on the sandbox platform.Please, explain in the commit message what this patch is good for.
For setting BITS_PER_LONG correctly.
Quoted 1 line
Aren't further patches needed to make use of it?
'make ue of it' would likely by running 32bit sandbox with 64bit phys_addr_t, and that indeed won't be fixed by this patch alone.
Nonetheless, since nobody noticed that this is broken so far I figured I will send the patch anyway.
Thanks
Michal
Quoted 28 lines
Best regards
Heinrich
Quoted 24 lines
Signed-off-by Michal Suchanek <[email protected]>---
arch/sandbox/include/asm/types.h| 6 +-----1 file changed, 1 insertion(+), 5 deletions(-)arch/sandbox/include/asm/types.h +1
-5@@ -18,11 +18,7 @@ typedef unsigned short umode_t;/* * Number of bits in a C 'long' on this architecture. */ -#ifdef CONFIG_PHYS_64BIT -#define BITS_PER_LONG 64 -#else /* CONFIG_PHYS_64BIT */ -#define BITS_PER_LONG 32 -#endif /* CONFIG_PHYS_64BIT */ +#define BITS_PER_LONG CONFIG_SANDBOX_BITS_PER_LONG#ifdef CONFIG_PHYS_64BIT typedef unsigned long long dma_addr_t ;
Re: [PATCH] sandbox: Correctly define BITS_PER_LONG
Quoted 34 lines · Michal Suchánek
Quoted 7 lines · Heinrich Schuchardt
Am 22. Oktober 2022 23:22:01 MESZ schrieb Michal Suchanek <[email protected]>:
Quoted 2 lines
SANDBOX_BITS_PER_LONGis the number of bits in long on the sandbox platform.Please, explain in the commit message what this patch is good for.
For setting
BITS_PER_LONGcorrectly.Quoted 1 line
Aren't further patches needed to make use of it?
'make ue of it' would likely by running 32bit sandbox with 64bit
phys_addr_t, and that indeed won't be fixed by this patch alone.Nonetheless, since nobody noticed that this is broken so far I figured I will send the patch anyway.
Thanks
Michal
Quoted 11 lines
Best regards
Heinrich
Quoted 7 lines
Signed-off-by Michal Suchanek <[email protected]>---
arch/sandbox/include/asm/types.h| 6 +-----1 file changed, 1 insertion(+), 5 deletions(-)
Quoted 10 lines
Quoted 10 lines
arch/sandbox/include/asm/types.h typedef unsigned short umode_t; · line 22
Quoted 10 lines
arch/sandbox/include/asm/types.h +0
-2@@ -18,11 +18,7 @@ typedef unsigned short umode_t;/* * Number of bits in a C 'long' on this architecture. */ -#ifdef CONFIG_PHYS_64BIT -#define BITS_PER_LONG 64
CONFIG_PHYS_64BIT defines the length of phys_addr_t.
BITS_PER_LONG is about the length of long.
The length of long is defined by the compiler. phys_addr_t exists for having a type that is independent of the length of long.
This patch is obviously wrong.
Best regards
Heinrich
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
arch/sandbox/include/asm/types.h +1
-3-#else /* CONFIG_PHYS_64BIT */ -#define BITS_PER_LONG 32 -#endif /* CONFIG_PHYS_64BIT */ +#define BITS_PER_LONG CONFIG_SANDBOX_BITS_PER_LONG#ifdef CONFIG_PHYS_64BIT typedef unsigned long long dma_addr_t ;
Re: [PATCH] sandbox: Correctly define BITS_PER_LONG
Quoted 47 lines · Heinrich Schuchardt
Quoted 34 lines · Michal Suchánek
Quoted 7 lines · Heinrich Schuchardt
Am 22. Oktober 2022 23:22:01 MESZ schrieb Michal Suchanek <[email protected]>:
Quoted 2 lines
SANDBOX_BITS_PER_LONGis the number of bits in long on the sandbox platform.Please, explain in the commit message what this patch is good for.
For setting
BITS_PER_LONGcorrectly.Quoted 1 line
Aren't further patches needed to make use of it?
'make ue of it' would likely by running 32bit sandbox with 64bit
phys_addr_t, and that indeed won't be fixed by this patch alone.Nonetheless, since nobody noticed that this is broken so far I figured I will send the patch anyway.
Thanks
Michal
Quoted 11 lines
Best regards
Heinrich
Quoted 7 lines
Signed-off-by Michal Suchanek <[email protected]>---
arch/sandbox/include/asm/types.h| 6 +-----1 file changed, 1 insertion(+), 5 deletions(-)Quoted 10 lines
Quoted 10 lines
arch/sandbox/include/asm/types.h typedef unsigned short umode_t; · line 22
Quoted 10 lines
arch/sandbox/include/asm/types.h +0
-2@@ -18,11 +18,7 @@ typedef unsigned short umode_t;/* * Number of bits in a C 'long' on this architecture. */ -#ifdef CONFIG_PHYS_64BIT -#define BITS_PER_LONG 64
CONFIG_PHYS_64BITdefines the length ofphys_addr_t.
Quoted 1 line
BITS_PER_LONGis about the length of long.
Sure
Quoted 2 lines
The length of long is defined by the compiler.
Sure
Quoted 2 lines
phys_addr_texists for
having a type that is independent of the length of long.
sure
Quoted 2 lines
This patch is obviously wrong.
That's completely contradictory to what you say above.
According to that the patch is obviously right because it changes the definition of BITS_PER_LONG from depending on phys_addr_t to depending on the length of long is defined by the compiler.
Thanks
Michal
Quoted 13 lines
Best regards
Heinrich
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
arch/sandbox/include/asm/types.h +1
-3-#else /* CONFIG_PHYS_64BIT */ -#define BITS_PER_LONG 32 -#endif /* CONFIG_PHYS_64BIT */ +#define BITS_PER_LONG CONFIG_SANDBOX_BITS_PER_LONG#ifdef CONFIG_PHYS_64BIT typedef unsigned long long dma_addr_t ;
Re: [PATCH] sandbox: Correctly define BITS_PER_LONG
Quoted 29 lines · Heinrich Schuchardt
Quoted 28 lines · Michal Suchánek
Quoted 7 lines · Heinrich Schuchardt
Am 22. Oktober 2022 23:22:01 MESZ schrieb Michal Suchanek <[email protected]>:
Quoted 2 lines
SANDBOX_BITS_PER_LONGis the number of bits in long on the sandbox platform.Please, explain in the commit message what this patch is good for.
For setting
BITS_PER_LONGcorrectly.Quoted 1 line
Aren't further patches needed to make use of it?
'make ue of it' would likely by running 32bit sandbox with 64bit
phys_addr_t, and that indeed won't be fixed by this patch alone.Nonetheless, since nobody noticed that this is broken so far I figured I will send the patch anyway.
Thanks
Michal
Quoted 5 lines
Best regards
Heinrich
Quoted 1 line
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Signed-off-by Michal Suchanek <[email protected]>---
arch/sandbox/include/asm/types.h| 6 +-----1 file changed, 1 insertion(+), 5 deletions(-)
Applied to u-boot-dm, thanks!
Quoted 24 lines · Simon Glass
Hi Michal,
Quoted 13 lines · Michal Suchanek
Currently sandbox configuration defautls to 64bit and there is no automation for building 32bit sandbox on 32bit hosts.
cpp does not know about target specification, code needs to be compiled to determine integer width.
Add a test program that prints the integer width, and a make target that aligns the sandbox configuration with the result.
Signed-off-by Michal Suchanek <[email protected]>---
Quoted 7 lines
Makefile | 6 ++++++ doc/arch/sandbox.rst | 16 +++++++++++----- test/py/conftest.py | 1 + tools/Makefile | 2 ++ tools/bits-per-long.c | 14 ++++++++++++++ 5 files changed, 34 insertions(+), 5 deletions(-)create mode 100644
tools/bits-per-long.c
Quoted 2 lines
This needs to be automatic, so that it builds the 32-bit version on 32-bit hosts, 64-bit version on 64-bit hosts.
We should be able to test the following:
* 64bit phys_addr_t on ilp32.
* 32bit phys_addr_t on ilp32.
* 64bit phys_addr_t on lp64.
Gitlab CI currently tests:
* 64bit phys_addr_t on lp64.
* 32bit phys_addr_t on lp64.
Best regards
Heinrich
Quoted 11 lines
See here for my attempt. I suspect it just needs your
bits_per_longthing brought in, but in any case I hope it gives you inspiration.https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Basically we should be able to build sandbox on any platform and it should just work, without manual configuration.
Regards,
Simon