* [PATCH 2/3] sandbox: specify sizeof(dma_addr_t) == sizeof(phys_addr_t) == 8 on 64BIT
2020-07-02 15:25 [PATCH 1/3] x86: Kconfig: specify sizeof(dma_addr_t) == 8 for 64BIT Ahmad Fatoum
@ 2020-07-02 15:25 ` Ahmad Fatoum
2020-07-02 15:25 ` [PATCH 3/3] sandbox: include: <asm/types.h>: don't define INTERNAL_SIZE_T Ahmad Fatoum
2020-07-05 14:09 ` [PATCH 1/3] x86: Kconfig: specify sizeof(dma_addr_t) == 8 for 64BIT Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2020-07-02 15:25 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
sizeof(dma_addr_t) == 8 shouldn't introduce any functional change, because
we can't have DMA on sandbox. For now it suppresses benign warnings about
mismatched pointer and integer sizes when some headers are included.
sizeof(phys_addr_t) == 8 was already the case on systems with
__x86_64__. As CONFIG_64BIT now is set according to the bitness
of the compiler, we can migrate this fully to Kconfig.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/sandbox/Kconfig | 5 +++++
arch/sandbox/include/asm/elf.h | 1 -
arch/sandbox/include/asm/types.h | 6 ------
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig
index 3f10709021a7..40e04919d21e 100644
--- a/arch/sandbox/Kconfig
+++ b/arch/sandbox/Kconfig
@@ -24,6 +24,9 @@ config SANDBOX_UNWIND
select ARCH_HAS_STACK_DUMP
depends on UBSAN || KASAN
+config PHYS_ADDR_T_64BIT
+ bool
+
config CC_IS_64BIT
def_bool $(success,$(srctree)/scripts/gcc-64bitptr.sh $(CC))
@@ -34,6 +37,8 @@ config 64BIT
bool
default n if SANDBOX_LINUX_I386
default CC_IS_64BIT
+ select ARCH_DMA_ADDR_T_64BIT
+ select PHYS_ADDR_T_64BIT
config SANDBOX_LINUX_I386
bool "32-bit x86 barebox" if CC_HAS_LINUX_I386_SUPPORT
diff --git a/arch/sandbox/include/asm/elf.h b/arch/sandbox/include/asm/elf.h
index 3939336ccba4..e71a60aeb93f 100644
--- a/arch/sandbox/include/asm/elf.h
+++ b/arch/sandbox/include/asm/elf.h
@@ -3,7 +3,6 @@
#if __SIZEOF_POINTER__ == 8
#define ELF_CLASS ELFCLASS64
-#define CONFIG_PHYS_ADDR_T_64BIT
#else
#define ELF_CLASS ELFCLASS32
#endif
diff --git a/arch/sandbox/include/asm/types.h b/arch/sandbox/include/asm/types.h
index 3e4a8f7ba34f..28046670f4e2 100644
--- a/arch/sandbox/include/asm/types.h
+++ b/arch/sandbox/include/asm/types.h
@@ -10,12 +10,6 @@
*/
#define INTERNAL_SIZE_T unsigned long
-/*
- * This is a Kconfig variable in the Kernel, but we want to detect
- * this during compile time, so we set it here.
- */
-#define CONFIG_PHYS_ADDR_T_64BIT
-
#endif
#endif
--
2.27.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/3] sandbox: include: <asm/types.h>: don't define INTERNAL_SIZE_T
2020-07-02 15:25 [PATCH 1/3] x86: Kconfig: specify sizeof(dma_addr_t) == 8 for 64BIT Ahmad Fatoum
2020-07-02 15:25 ` [PATCH 2/3] sandbox: specify sizeof(dma_addr_t) == sizeof(phys_addr_t) == 8 on 64BIT Ahmad Fatoum
@ 2020-07-02 15:25 ` Ahmad Fatoum
2020-07-05 14:09 ` [PATCH 1/3] x86: Kconfig: specify sizeof(dma_addr_t) == 8 for 64BIT Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2020-07-02 15:25 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The INTERNAL_SIZE_T default is size_t, which already is 64-bit on 64-bit
platforms and 32-bit on 32-bit ones. We can thus drop the #define and go
back to the minimal <asm/types.h>.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/sandbox/include/asm/types.h | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/arch/sandbox/include/asm/types.h b/arch/sandbox/include/asm/types.h
index 28046670f4e2..7b356a99eb66 100644
--- a/arch/sandbox/include/asm/types.h
+++ b/arch/sandbox/include/asm/types.h
@@ -1,15 +1,6 @@
-#ifndef __ASM_I386_TYPES_H
-#define __ASM_I386_TYPES_H
+#ifndef __ASM_SANDBOX_TYPES_H
+#define __ASM_SANDBOX_TYPES_H
#include <asm-generic/int-ll64.h>
-#ifdef __x86_64__
-/*
- * This is used in dlmalloc. On X86_64 we need it to be
- * 64 bit
- */
-#define INTERNAL_SIZE_T unsigned long
-
-#endif
-
#endif
--
2.27.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] x86: Kconfig: specify sizeof(dma_addr_t) == 8 for 64BIT
2020-07-02 15:25 [PATCH 1/3] x86: Kconfig: specify sizeof(dma_addr_t) == 8 for 64BIT Ahmad Fatoum
2020-07-02 15:25 ` [PATCH 2/3] sandbox: specify sizeof(dma_addr_t) == sizeof(phys_addr_t) == 8 on 64BIT Ahmad Fatoum
2020-07-02 15:25 ` [PATCH 3/3] sandbox: include: <asm/types.h>: don't define INTERNAL_SIZE_T Ahmad Fatoum
@ 2020-07-05 14:09 ` Sascha Hauer
2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2020-07-05 14:09 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On Thu, Jul 02, 2020 at 05:25:05PM +0200, Ahmad Fatoum wrote:
> This shouldn't introduce any functional change, because we don't yet do
> any DMA on EFI. For now it suppresses warnings about mismatched pointer
> and integer sizes when compile testing.
>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> arch/x86/Kconfig | 1 +
> 1 file changed, 1 insertion(+)
Applied, thanks
Sascha
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 19009442a4d7..0e3e5d61872a 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -25,6 +25,7 @@ menu "ARCH specific settings"
>
> config 64BIT
> def_bool y if X86_EFI
> + select ARCH_DMA_ADDR_T_64BIT
> help
> Say yes to build a 64-bit binary - formerly known as x86_64
> Say no to build a 32-bit binary - formerly known as i386.
> --
> 2.27.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread