irqchip/gic: Only allow the primary GIC to set the CPU map
irqchip/gic: Only allow the primary GIC to set the CPU map

The gic_init_bases() function initialises an array that stores the mapping
between the GIC and CPUs. This array is a global array that is
unconditionally initialised on every call to gic_init_bases(). Although,
it is not common for there to be more than one GIC instance, there are
some devices that do support nested GIC controllers and gic_init_bases()
can be called more than once.

A 2nd call to gic_init_bases() will clear the previous CPU mapping and
will only setup the mapping again for the CPU calling gic_init_bases().
Fix this by only allowing the CPU map to be configured for the primary GIC.

For secondary GICs the CPU map is not relevant because these GICs do not
directly route the interrupts to the main CPU(s) but to other GICs or
devices.

Signed-off-by: Jon Hunter <cbbc2a491dd609dc667a5c30620606c73351583d@nvidia.com>
Reviewed-by: Marc Zyngier <a16cc0c82647c52d401177f8e50567df5499e36c@arm.com>
Cc: <f99ef57ccac738b558d0fc2e44478b3c5def9522@lists.infradead.org>
Cc: Russell King <ba324ca7b1c77fc20bb970d5aff6eea9377918a5@arm.linux.org.uk>
Cc: Nicolas Pitre <408789a210b05fb3b46935e815320d62ba00a06e@linaro.org>
Cc: Jason Cooper <68c46a606457643eab92053c1c05574abb26f861@lakedaemon.net>
Link: http://lkml.kernel.org/r/1438332252-25248-1-git-send-email-cbbc2a491dd609dc667a5c30620606c73351583d@nvidia.com
Signed-off-by: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs