Re: [PATCH RFC 1/2] m68k: io_mm.h: conditionalize ISA address translation on Atari

Finn Thain
2021-06-04T23:31:39Z

On Sat, 5 Jun 2021, Michael Schmitz wrote:

> Am 04.06.2021 um 19:54 schrieb Geert Uytterhoeven:
> > > > I have to wonder whether there is a nice simple definition for
> > > > MULTI_ISA.
> > >
> > > As I understand it, MULTI_ISA means that different byte orders
> > > and/or different address translations need to be used in the same
> > > kernel, so all that cannot be decided at build time.
> > >
> > > As long as there is only a single platform that will use this code
> > > (ISA only used on a single platform, and neither Atari IDE nor
> > > EtherNEC used), MULTI_ISA is not needed.
> > >
> > > If we have Kconfig symbols for 'single platform only', and
> > > 'multi-platform ISA use', that might be shorter to write and easier
> > > to understand. Geert?
> >
> > It would be nice to have that automatically, like with the current
> > MULTI_ISA define (and all the MACH_* in
> > arch/m68k/include/asm/setup.h). Perhaps we should extend kconfig
> > syntax to define a group of related symbols, and to automatically
> > generate CONFIG_FOO_MULTI or CONFIG_FOO_SINGLE (and even
> > CONFIG_BAR_ONLY?) symbols?
>
> I take it this is not supported by our current Kconfig syntax?
>

That may be because CPP hacking is seen as a competitive sport in some
circles.

> > group ISA
> > item ATARI_ROM_ISA
> > item AMIGA_PCMCIA
> > item Q40
> >
> > => CONFIG_ISA_MULTI or CONFIG_ISA_SINGLE (+ e.g. ATARI_ROM_ISA_ONLY
> > if appropriate).
> >

Since the items may be bools or tristates, it not clear what type the
group has.

Anyway, I see that we can already write this:

#define IS_MULTI(a,b) __or(IS_ENABLED(a), IS_ENABLED(b))

So maybe we just need an exclusive-OR macro to go with the other operators
defined in include/linux/kconfig.h? Then we could write this:

#define IS_SINGLE(a,b) __xor(IS_ENABLED(a), IS_ENABLED(b))

But these only work for a 2-way group. Extending them to N-way groups is
beyond my CPP abilities. It probably requires N-way __or() and __xor()...