[PATCH] arm: Fix linux-next compile error in arch/arm/common/gic.c

Will Deacon will.deacon at arm.com
Tue Jan 3 12:32:54 EST 2012


On Tue, Jan 03, 2012 at 02:05:40PM +0000, Marc Zyngier wrote:
> On 03/01/12 13:53, Rob Herring wrote:
> >>> On Tue, Jan 3, 2012 at 12:33 AM, Joerg Roedel <joerg.roedel at amd.com> wrote:
> >>>> With CONFIG_SMP=n the following compile error occurs:
> >>>>
> >>>>  CC      arch/arm/common/gic.o
> >>>> arch/arm/common/gic.c: In function 'gic_init_bases':
> >>>> arch/arm/common/gic.c:679:4: error: implicit declaration of function 'cpu_logical_map' [-Werror=implicit-function-declaration]
> >>>> cc1: some warnings being treated as errors

[...]

> > IIRC, part of the problem is asm/smp.h is only included by linux/smp.h
> > for CONFIG_SMP, so this would have to change. Doing that could easily
> > break other arches.
> 
> Ah... good point.

We could probably move smp_setup_processor_id out of smp.c if we need to as
it seems as though you can provide a definition of that function even when
!CONFIG_SMP.

> >>
> >> Well, both patches are wrong. In the UP case (and assuming we're running
> >> on physical CPU 0), offset should be 0.
> >>
> >> The second patch would be my favorite approach, except that
> >> cpu_logical_map(x) should return either "x" or 0. And I'm not sure how
> >> to handle the (unlikely?) case of running a UP kernel on a secondary CPU...
> > 
> > Wouldn't this be the case with 2 AMP instances of Linux running?

In this configuration, I think returning 0 would probably be the right thing
to do. If it's anything else, there's the implication that both of your
kernels are hanging off the same GIC distributor / SCU / L2 Cache etc. and
so you would need a single SMP kernel (or some funky message passing that we
don't yet have).

The bit we're currently missing is the notion of a cluster ID, but both CPU IDs
should be 0 for AMP.

> Yes, or kexec-ing a UP kernel on a secondary CPU. It really looks like
> we ought to make this cpu_logical_map() independent from CONFIG_SMP.

We could always prevent this from happening by hacking kexec / kexec-tools
but I think that booting a UP kernel on a CPU other than 0 is rather silly :)

So I'd be inclined to simply move the existing smp_setup_processor_id
implementation (and the map declaration) into somewhere like kernel/setup.c
and I think things should work.

Will



More information about the linux-arm-kernel mailing list