[PATCH v2 06/16] LoongArch: skeleton and headers

Yao Zi me at ziyao.cc
Thu Jul 2 23:22:34 CEST 2026


On Thu, Jul 02, 2026 at 11:28:23AM +0100, Simon Glass wrote:
> Hi Jiaxun,
> 
> On 2026-07-01T11:17:53, Yao Zi <me at ziyao.cc> wrote:
> > LoongArch: skeleton and headers
> >
> > Commit for directories, Kconfig, Makefile and headers
> >
> > Some of them are copied from linux, some of them are derived
> > from other architectures, the rest are wriiten on my own.
> >
> > Signed-off-by: Jiaxun Yang <jiaxun.yang at flygoat.com>
> > Signed-off-by: Yao Zi <me at ziyao.cc>
> 
> > Some of them are copied from linux, some of them are derived
> > from other architectures, the rest are wriiten on my own.
> 

...

> > diff --git a/arch/loongarch/include/asm/asm.h b/arch/loongarch/include/asm/asm.h
> > @@ -0,0 +1,186 @@
> > +/*
> > + * Size of a register
> > + */
> > +#if defined(__loongarch__) && __loongarch_grlen == 64
> > +#define SZREG        4
> > +#else
> > +#define SZREG        8
> > +#endif
> 
> This is inverted - on 64-bit LoongArch a register is 8 bytes, not
> 4. The result is that REG_L/REG_S resolve to ld.w/st.w on the only
> ISA this series supports. Linux seems to use __loongarch64, BTW.

__loongarch64 is a deprecated macro, provided for only compatibility
reasons[1]. For v1 of the series Heinrich has raised this[2], so I
tried to migrate to the new ones but obviously messed it up here :(

...

> > diff --git a/arch/loongarch/include/asm/types.h b/arch/loongarch/include/asm/types.h
> > @@ -0,0 +1,37 @@
> > +#ifdef __KERNEL__
> > +
> > +#define BITS_PER_LONG _LOONGARCH_SZLONG
> 
> _LOONGARCH_SZLONG is never defined anywhere in the tree, so this
> expands to an empty token. Please either define it (e.g. 64 for LA64)
> or drop this and rely on asm-generic/bitsperlong.h like other arches.

_LOONGARCH_SZLONG is a pre-defined macro provided by toolchain[3], so
it wouldn't be expanded to an empty token. But after examining the
toolchain convention documentation, I did find it's also deprecated.
Will drop it in the next version.

> Regards,
> Simon

Thanks,
Yao Zi

[1]: https://github.com/loongson/la-toolchain-conventions/blob/36d207cd76301618624d10e67daf7b7f1c060411/LoongArch-toolchain-conventions-EN.adoc?plain=1#L791
[2]: https://lore.kernel.org/u-boot/304f9e83-45eb-4f8e-98f3-2658aac5c20b@gmx.de/
[3]: https://github.com/loongson/la-toolchain-conventions/blob/36d207cd76301618624d10e67daf7b7f1c060411/LoongArch-toolchain-conventions-EN.adoc?plain=1#L811


More information about the U-Boot mailing list