Message ID | 20221022212201.24268-1-msuchanek@suse.de |
---|---|
State | Accepted |
Commit | 3cbaa4e1efa70b463a0057920e145f5e52784b9a |
Delegated to: | Simon Glass |
Headers | show |
Series | sandbox: Correctly define BITS_PER_LONG | expand |
Am 22. Oktober 2022 23:22:01 MESZ schrieb Michal Suchanek <msuchanek@suse.de>: >SANDBOX_BITS_PER_LONG is 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 > >Signed-off-by: Michal Suchanek <msuchanek@suse.de> >--- > > arch/sandbox/include/asm/types.h | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) > >diff --git a/arch/sandbox/include/asm/types.h b/arch/sandbox/include/asm/types.h >index c1a5d2af82..5f4b649ee3 100644 >--- a/arch/sandbox/include/asm/types.h >+++ b/arch/sandbox/include/asm/types.h >@@ -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;
On Sat, Oct 22, 2022 at 11:52:29PM +0200, Heinrich Schuchardt wrote: > > > Am 22. Oktober 2022 23:22:01 MESZ schrieb Michal Suchanek <msuchanek@suse.de>: > >SANDBOX_BITS_PER_LONG is 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. > 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 > Best regards > > Heinrich > > > > >Signed-off-by: Michal Suchanek <msuchanek@suse.de> > >--- > > > > arch/sandbox/include/asm/types.h | 6 +----- > > 1 file changed, 1 insertion(+), 5 deletions(-) > > > >diff --git a/arch/sandbox/include/asm/types.h b/arch/sandbox/include/asm/types.h > >index c1a5d2af82..5f4b649ee3 100644 > >--- a/arch/sandbox/include/asm/types.h > >+++ b/arch/sandbox/include/asm/types.h > >@@ -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;
On 10/23/22 09:50, Michal Suchánek wrote: > On Sat, Oct 22, 2022 at 11:52:29PM +0200, Heinrich Schuchardt wrote: >> >> >> Am 22. Oktober 2022 23:22:01 MESZ schrieb Michal Suchanek <msuchanek@suse.de>: >>> SANDBOX_BITS_PER_LONG is 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. > >> 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 > >> Best regards >> >> Heinrich >> >>> >>> Signed-off-by: Michal Suchanek <msuchanek@suse.de> >>> --- >>> >>> arch/sandbox/include/asm/types.h | 6 +----- >>> 1 file changed, 1 insertion(+), 5 deletions(-) >>> >>> diff --git a/arch/sandbox/include/asm/types.h b/arch/sandbox/include/asm/types.h >>> index c1a5d2af82..5f4b649ee3 100644 >>> --- a/arch/sandbox/include/asm/types.h >>> +++ b/arch/sandbox/include/asm/types.h >>> @@ -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 >>> -#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;
On Sun, Oct 23, 2022 at 09:56:29AM +0200, Heinrich Schuchardt wrote: > On 10/23/22 09:50, Michal Suchánek wrote: > > On Sat, Oct 22, 2022 at 11:52:29PM +0200, Heinrich Schuchardt wrote: > > > > > > > > > Am 22. Oktober 2022 23:22:01 MESZ schrieb Michal Suchanek <msuchanek@suse.de>: > > > > SANDBOX_BITS_PER_LONG is 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. > > > > > 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 > > > > > Best regards > > > > > > Heinrich > > > > > > > > > > > Signed-off-by: Michal Suchanek <msuchanek@suse.de> > > > > --- > > > > > > > > arch/sandbox/include/asm/types.h | 6 +----- > > > > 1 file changed, 1 insertion(+), 5 deletions(-) > > > > > > > > diff --git a/arch/sandbox/include/asm/types.h b/arch/sandbox/include/asm/types.h > > > > index c1a5d2af82..5f4b649ee3 100644 > > > > --- a/arch/sandbox/include/asm/types.h > > > > +++ b/arch/sandbox/include/asm/types.h > > > > @@ -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. Sure > > The length of long is defined by the compiler. Sure > phys_addr_t exists for > having a type that is independent of the length of long. sure > > 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 > > Best regards > > Heinrich > > > > > -#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; >
On Sun, Oct 23, 2022 at 09:56:29AM +0200, Heinrich Schuchardt wrote: > On 10/23/22 09:50, Michal Suchánek wrote: > > On Sat, Oct 22, 2022 at 11:52:29PM +0200, Heinrich Schuchardt wrote: > > > > > > > > > Am 22. Oktober 2022 23:22:01 MESZ schrieb Michal Suchanek <msuchanek@suse.de>: > > > > SANDBOX_BITS_PER_LONG is 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. > > > > > 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 > > > > > Best regards > > > > > > Heinrich > > > > > > > > > > > Signed-off-by: Michal Suchanek <msuchanek@suse.de> > > > > --- > > > > > > > > arch/sandbox/include/asm/types.h | 6 +----- > > > > 1 file changed, 1 insertion(+), 5 deletions(-) > > > > Applied to u-boot-dm, thanks!
diff --git a/arch/sandbox/include/asm/types.h b/arch/sandbox/include/asm/types.h index c1a5d2af82..5f4b649ee3 100644 --- a/arch/sandbox/include/asm/types.h +++ b/arch/sandbox/include/asm/types.h @@ -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;
SANDBOX_BITS_PER_LONG is the number of bits in long on the sandbox platform. Signed-off-by: Michal Suchanek <msuchanek@suse.de> --- arch/sandbox/include/asm/types.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)