Subject: Re: [PATCH v2] powerpc/setup_{32, 64}.c: remove unneeded boot_cpuid{, _phys}

From: Scott Wood <[email-masked]>
Date: Fri, 16 Dec 2011 15:29:48 -0600

On 12/15/2011 09:35 PM, Benjamin Herrenschmidt wrote:
> On Fri, 2011-12-16 at 03:29 +0000, McClintock Matthew-B29882 wrote:
>> On Thu, Dec 15, 2011 at 9:12 PM, Benjamin Herrenschmidt
>> <[email-masked]> wrote:
>>> On Mon, 2011-11-28 at 22:24 -0600, Matthew McClintock wrote:
>>>> boot_cpuid and init_thread_info.cpu are redundant, just use the
>>>> var that stays around longer and add a define to make boot_cpuid
>>>> point at the correct value
>>>>
>>>> boot_cpudid_phys is not needed and can completly go away from the
>>>> SMP case, we leave it there for the non-SMP case since the paca
>>>> struct is not around to store this info
>>>>
>>>> This patch also has the effect of having the logical cpu number
>>>> of the boot cpu be updated correctly independently of the ordering
>>>> of the cpu nodes in the device tree.

Where does the ordering matter currently?

>>> So what about head_fsl_booke.S comparing boot_cpuid to -1 ? That seems
>>> to be broken now in at least 2 ways, boot_cpuid doesn't exist anymore
>>> and you don't initialize it to -1 either...
>>
>> This is 4/5 which is also waiting for your review.
>>
>> http://lists.ozlabs.org/pipermail/linuxppc-dev/2011-October/093474.html
> 
> Ah missed that. This is FSL specific, I'd need Kumar and/or Scott's ack
> for that one.

It would be nice if we could eliminate all usage of the boot cpu dtb
field -- it's easy to forget to set it, especially if you're not making
an AMP config.  The default -1 means this patch would break booting with
such a tree.

If we don't want to record the PIR of the first CPU to enter as the boot
CPU (is the concern implementations where the CPU node's reg is not the
same as what's in PIR?), how about just having a variable that gets set
before releasing secondaries?  If you're in the boot entry code and that
variable is set, you're a secondary.  Or, use a distinct release address
for secondaries rather than __early_start.

-Scott