[U-Boot] [RFC PATCH] bitops: Fix GENMASK definition for Sandbox

Simon Glass sjg at chromium.org
Thu Jan 10 12:56:37 UTC 2019


On Mon, 17 Dec 2018 at 06:31, Vignesh R <vigneshr at ti.com> wrote:
>
> In arch/sandbox/include/asm/types.h we have
> Therefore for 32 bit Sandbox build BITS_PER_LONG turns out to be 32 as
> CONFIG_PHYS64 is not set
>
> This messes up the current logic of GENMASK macro due to mismatch b/w
> size of unsigned long (64 bit) and that of BITS_PER_LONG.
> Fix this by using CONFIG_SANDBOX_BITS_PER_LONG which is set to 64/32
> based on the host machine on which its being compiled.
>
> Without this patch:
> GENMASK(14,0) => 0x7fffffffffff
> After this patch:
> GENMASK(14,0) => 0x7fff
>
> Signed-off-by: Vignesh R <vigneshr at ti.com>
> ---
>
> I marked it as RFC because, I am not really sure if I am running Sandbox
> tests properly.
> My host machine is x86_64 (Ubuntu 18.04). Running below command[1] with
> some of my yet to be upstreamed patches that use GENMASK macro shows this issue.
>
> [1]:
> $ make check
>
>
>  include/linux/bitops.h | 5 +++++
>  1 file changed, 5 insertions(+)

I copied Bin who introduced this Kconfig option.

It is unfortunate that we need this #ifdef but I think it is correct.
I think we need some Kconfig help for SANDBOX_BITS_PER_LONG.

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list