[PATCH] clk: k210: Fix error calculation on 32bit

Michal Suchánek msuchanek at suse.de
Sun Oct 16 17:42:43 CEST 2022


Hello,

On Sun, Oct 16, 2022 at 05:02:38PM +0200, Heinrich Schuchardt wrote:
> 
> 
> On 10/16/22 16:57, Sean Anderson wrote:
> > On 10/16/22 10:50, Heinrich Schuchardt wrote:
> > > 
> > > 
> > > On 10/16/22 16:48, Sean Anderson wrote:
> > > > On 10/16/22 10:40, Heinrich Schuchardt wrote:
> > > > > 
> > > > > 
> > > > > On 10/16/22 16:19, Sean Anderson wrote:
> > > > > > On 10/16/22 07:46, Heinrich Schuchardt wrote:
> > > > > > > 
> > > > > > > 
> > > > > > > On 10/16/22 09:51, Michal Suchánek wrote:
> > > > > > > > On Thu, Oct 13, 2022 at 10:34:29PM +0200, Michal Suchanek wrote:
> > > > > > > > > k210 is 64bit but the driver and tests are
> > > > > > > > > also built in sandbox, and
> > > > > > > > > that can be built 32bit.
> > > > > > > > > 
> > > > > > > > > BIT(32) does not work on 32bit, shift before
> > > > > > > > > subtraction to fit into
> > > > > > > > > 32bit integer with BIT values.

> > > > > > 
> > > > > > IMO the driver should just be changed to depend on
> > > > > > 64-bit. The k210 is 64-bit,
> > > > > > and I didn't write anything with 32-bit in mind.
> > > > > 
> > > > > Michal, Simon, and I are striving to get the sandbox working
> > > > > on ilp32 systems.
> > > > > 
> > > > > Do you suggest to remove  the driver from sandbox_defconfig?
> > > > > 
> > > > > This would imply that the unit test is not executed on
> > > > > Gitlab CI. You will still be able to execute it on the
> > > > > actual hardware.
> > > > 
> > > > It's still enabled for sandbox64, so it should still be executed there.
> > > 
> > > No, the sandbox64 is also to be compiled on ilp32. It models
> > > physical address extension (PAE).
> > 
> > Do we have a config for word size? PHYS_64BIT seems to be for the
> > address size.
> 
> phys_addr_t is what is used to address physical memory which may be 64bit on
> a 32bit PAE system (CONFIG_PHYS_64BIT=y).
> 
> Compiling on armv7 yields 32bit pointers.
> 
> There are two alternative patches in review removing HOST_32BIT and
> HOST_64BIT:
> 
> https://patchwork.ozlabs.org/project/uboot/patch/20221014064052.5592-1-heinrich.schuchardt@canonical.com/
> 
> https://patchwork.ozlabs.org/project/uboot/patch/20221013203429.15200-1-msuchanek@suse.de/

I don't think that we have a config option that can be used to detect
that the build is 64bit. Such option may exit per platform but drivers
that can be built for multiple platforms will have hard time detecting
it.

I think that Heinrich's suggestion to use BIT_ULL instead of BIT and
abs64 instead of abs is non-controversial. It's technically more correct
way to write the expression although relevant only for 32bit.

Thanks

Michal


More information about the U-Boot mailing list