Re: [PATCH 1/1] MIPS: Add new Kconfig variable to avoid unaligned access instructions

From: Paul Burton
Date: Tue Sep 25 2018 - 15:58:05 EST


Hi Yasha,

On Tue, Sep 25, 2018 at 10:30:52PM +0300, Yasha Cherikovsky wrote:
> On Tue, 2018-09-25 at 17:45 +0000, Paul Burton wrote:
> > How about we:
> >
> > - Add a Kconfig option CONFIG_CPU_SUPPORTS_LOAD_STORE_LR, and
> > select
> > it for all existing pre-r6 targets (probably from CONFIG_CPU_*).
> >
> > - Change CONFIG_GENERIC_CSUM to default y if
> > !CONFIG_CPU_SUPPORTS_LOAD_STORE_LR, and drop the selects of it.
> >
> > That would avoid the double-negative ("if we don't not support this")
> > that the #ifndef's currently represent. It would also mean any future
> > architecture/ISA targets beyond MIPSr6 automatically avoid the
> > instructions.
>
> Thanks for your feedback, I'll start preparing v2.
>
> Looking in arch/mips/Kconfig, some CPU options start
> with CPU_SUPPORTS_ and some with CPU_HAS_.
> Which perfix should we use here?

That's a good question :)

To be honest I don't think either of them is perfect, since what we're
really describing is what's supported by the ISA that the kernel build
is targeting - and in theory the CPU we actually run on could support
extra things.

But considering it I think CPU_HAS_ is probably the best choice for
this, since it's already used similarly to indicate support for pref &
sync instructions.

Thanks,
Paul