From: Matthew McClintock <hidden> Date: 2011-10-25 22:54:13
This is listed as a requirement after issuing a core reset to
properly clear pending interrupts
Signed-off-by: Matthew McClintock <redacted>
---
arch/powerpc/sysdev/mpic.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
@@ -1748,6 +1748,7 @@ void mpic_reset_core(int cpu)structmpic*mpic=mpic_primary;u32pir;intcpuid=get_hard_smp_processor_id(cpu);+inti;/* Set target bit for core reset */pir=mpic_read(mpic->gregs,MPIC_INFO(GREG_PROCESSOR_INIT));
@@ -1759,6 +1760,12 @@ void mpic_reset_core(int cpu)pir&=~(1<<cpuid);mpic_write(mpic->gregs,MPIC_INFO(GREG_PROCESSOR_INIT),pir);mpic_read(mpic->gregs,MPIC_INFO(GREG_PROCESSOR_INIT));++/* Perform 15 EOI on each reset core to clear pending interrupts */+for(i=0;i<15;i++){+_mpic_write(mpic->reg_type,&mpic->cpuregs[cpuid],+MPIC_CPU_EOI,0);+}}#endif /* CONFIG_SMP */
From: Matthew McClintock <hidden> Date: 2011-10-25 22:54:14
This is not strictly required, because this iterates over logical
cpus and they are not (currently) discontigous. But, it's cleaner
code and more obvious what is going on
Signed-off-by: Matthew McClintock <redacted>
---
arch/powerpc/platforms/85xx/smp.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
From: Matthew McClintock <hidden> Date: 2011-10-25 22:54:15
Currently, we assume the first CPU to come up is the boot cpu. Instead
we can use the boot_cpu_phys from the device tree.
Signed-off-by: Matthew McClintock <redacted>
---
arch/powerpc/kernel/asm-offsets.c | 4 ++++
arch/powerpc/kernel/head_fsl_booke.S | 9 ++-------
2 files changed, 6 insertions(+), 7 deletions(-)
@@ -166,11 +167,8 @@ _ENTRY(__early_start)/*Checktoseeifwe're the second processor, and jump*tothesecondary_startcodeifso*/-lisr24,boot_cpuid@h-orir24,r24,boot_cpuid@l-lwzr24,0(r24)-cmpwir24,-1mfsprr24,SPRN_PIR+cmpwr22,r24bne__secondary_start#endif
From: Matthew McClintock <hidden> Date: 2011-10-25 22:55:13
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 completely 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.
Signed-off-by: Matthew McClintock <redacted>
---
Could also just change boot_cpuid every to init_thread_info.cpu instead
of using this define
This is only tested on 32-bit parts, only compiled on 64-bit
arch/powerpc/include/asm/smp.h | 2 +-
arch/powerpc/kernel/setup_32.c | 7 ++++---
arch/powerpc/kernel/setup_64.c | 1 -
3 files changed, 5 insertions(+), 5 deletions(-)
@@ -46,10 +46,11 @@externvoidbootx_init(unsignedlongr4,unsignedlongphys);-intboot_cpuid=-1;-EXPORT_SYMBOL_GPL(boot_cpuid);-intboot_cpuid_phys;+/* we need a place to store phys cpu for non-SMP case */+#ifndef CONFIG_SMP+intboot_cpuid_phys=-1;EXPORT_SYMBOL_GPL(boot_cpuid_phys);+#endifintsmp_hw_index[NR_CPUS];
struct mpic *mpic =3D mpic_primary;
u32 pir;
int cpuid =3D get_hard_smp_processor_id(cpu);
+ int i;
=20
/* Set target bit for core reset */
pir =3D mpic_read(mpic->gregs, MPIC_INFO(GREG_PROCESSOR_INIT));
From: Matthew McClintock <hidden> Date: 2011-10-26 18:13:27
This is listed as a requirement for Freescale CoreNet based devices (e.g
p4080ds with MPIC v4.x) after issuing a core reset to properly clear pending
interrupts.
Signed-off-by: Matthew McClintock <redacted>
---
v2: Updated commit message
arch/powerpc/sysdev/mpic.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
@@ -1748,6 +1748,7 @@ void mpic_reset_core(int cpu)structmpic*mpic=mpic_primary;u32pir;intcpuid=get_hard_smp_processor_id(cpu);+inti;/* Set target bit for core reset */pir=mpic_read(mpic->gregs,MPIC_INFO(GREG_PROCESSOR_INIT));
@@ -1759,6 +1760,12 @@ void mpic_reset_core(int cpu)pir&=~(1<<cpuid);mpic_write(mpic->gregs,MPIC_INFO(GREG_PROCESSOR_INIT),pir);mpic_read(mpic->gregs,MPIC_INFO(GREG_PROCESSOR_INIT));++/* Perform 15 EOI on each reset core to clear pending interrupts */+for(i=0;i<15;i++){+_mpic_write(mpic->reg_type,&mpic->cpuregs[cpuid],+MPIC_CPU_EOI,0);+}}#endif /* CONFIG_SMP */
From: Matthew McClintock <hidden> Date: 2011-10-26 18:33:59
This is listed as a requirement for Freescale CoreNet based devices (e.g
p4080ds with MPIC v4.x) after issuing a core reset to properly clear pending
interrupts.
Signed-off-by: Matthew McClintock <redacted>
---
v2: Updated commit message
v3: Added detail in code comment as well
arch/powerpc/sysdev/mpic.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
@@ -1748,6 +1748,7 @@ void mpic_reset_core(int cpu)structmpic*mpic=mpic_primary;u32pir;intcpuid=get_hard_smp_processor_id(cpu);+inti;/* Set target bit for core reset */pir=mpic_read(mpic->gregs,MPIC_INFO(GREG_PROCESSOR_INIT));
@@ -1759,6 +1760,13 @@ void mpic_reset_core(int cpu)pir&=~(1<<cpuid);mpic_write(mpic->gregs,MPIC_INFO(GREG_PROCESSOR_INIT),pir);mpic_read(mpic->gregs,MPIC_INFO(GREG_PROCESSOR_INIT));++/* Perform 15 EOI on each reset core to clear pending interrupts.+*ThisisrequiredforFSLCoreNetbaseddevices*/+for(i=0;i<15;i++){+_mpic_write(mpic->reg_type,&mpic->cpuregs[cpuid],+MPIC_CPU_EOI,0);+}}#endif /* CONFIG_SMP */
From: Matthew McClintock <hidden> Date: 2011-10-26 18:47:15
This is listed as a requirement for Freescale CoreNet based devices (e.g
p4080ds with MPIC v4.x) after issuing a core reset to properly clear pending
interrupts.
Signed-off-by: Matthew McClintock <redacted>
---
v2: Updated commit message
v3: Added detail in code comment as well
v4: Check for MPIC_FSL in mpic->flags to determine if we need 15 EOIs
arch/powerpc/sysdev/mpic.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
@@ -1748,6 +1748,7 @@ void mpic_reset_core(int cpu)structmpic*mpic=mpic_primary;u32pir;intcpuid=get_hard_smp_processor_id(cpu);+inti;/* Set target bit for core reset */pir=mpic_read(mpic->gregs,MPIC_INFO(GREG_PROCESSOR_INIT));
@@ -1759,6 +1760,15 @@ void mpic_reset_core(int cpu)pir&=~(1<<cpuid);mpic_write(mpic->gregs,MPIC_INFO(GREG_PROCESSOR_INIT),pir);mpic_read(mpic->gregs,MPIC_INFO(GREG_PROCESSOR_INIT));++/* Perform 15 EOI on each reset core to clear pending interrupts.+*ThisisrequiredforFSLCoreNetbaseddevices*/+if(mpic->flags&MPIC_FSL){+for(i=0;i<15;i++){+_mpic_write(mpic->reg_type,&mpic->cpuregs[cpuid],+MPIC_CPU_EOI,0);+}+}}#endif /* CONFIG_SMP */
From: Kumar Gala <hidden> Date: 2011-11-03 18:00:24
On Oct 26, 2011, at 1:46 PM, Matthew McClintock wrote:
This is listed as a requirement for Freescale CoreNet based devices =
(e.g
p4080ds with MPIC v4.x) after issuing a core reset to properly clear =
pending
interrupts.
=20
Signed-off-by: Matthew McClintock <redacted>
---
v2: Updated commit message
v3: Added detail in code comment as well
v4: Check for MPIC_FSL in mpic->flags to determine if we need 15 EOIs
=20
arch/powerpc/sysdev/mpic.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
From: Kumar Gala <hidden> Date: 2011-11-03 18:00:44
On Oct 25, 2011, at 5:54 PM, Matthew McClintock wrote:
This is not strictly required, because this iterates over logical
cpus and they are not (currently) discontigous. But, it's cleaner
code and more obvious what is going on
Signed-off-by: Matthew McClintock <redacted>
---
arch/powerpc/platforms/85xx/smp.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2011-11-25 03:41:29
On Tue, 2011-10-25 at 17:54 -0500, 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
Breaks pseries build. Looks trivial but I haven't had a chance to fix
it (obvious one liner didn't do it and no time today).
Please re-submit fixed.
Cheers,
Ben.
quoted hunk
boot_cpudid_phys is not needed and can completely 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.
Signed-off-by: Matthew McClintock <redacted>
---
Could also just change boot_cpuid every to init_thread_info.cpu instead
of using this define
This is only tested on 32-bit parts, only compiled on 64-bit
arch/powerpc/include/asm/smp.h | 2 +-
arch/powerpc/kernel/setup_32.c | 7 ++++---
arch/powerpc/kernel/setup_64.c | 1 -
3 files changed, 5 insertions(+), 5 deletions(-)
@@ -46,10 +46,11 @@externvoidbootx_init(unsignedlongr4,unsignedlongphys);-intboot_cpuid=-1;-EXPORT_SYMBOL_GPL(boot_cpuid);-intboot_cpuid_phys;+/* we need a place to store phys cpu for non-SMP case */+#ifndef CONFIG_SMP+intboot_cpuid_phys=-1;EXPORT_SYMBOL_GPL(boot_cpuid_phys);+#endifintsmp_hw_index[NR_CPUS];
From: Matthew McClintock <hidden> Date: 2011-11-29 04:24:39
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.
Signed-off-by: Matthew McClintock <redacted>
---
v2: Fix compile issue for peries
Remove '-1' initial value
arch/powerpc/include/asm/smp.h | 2 +-
arch/powerpc/kernel/setup_32.c | 5 +++--
arch/powerpc/kernel/setup_64.c | 1 -
arch/powerpc/sysdev/xics/xics-common.c | 1 +
4 files changed, 5 insertions(+), 4 deletions(-)
@@ -46,10 +46,11 @@externvoidbootx_init(unsignedlongr4,unsignedlongphys);-intboot_cpuid=-1;-EXPORT_SYMBOL_GPL(boot_cpuid);+/* we need a place to store phys cpu for non-SMP case */+#ifndef CONFIG_SMPintboot_cpuid_phys;EXPORT_SYMBOL_GPL(boot_cpuid_phys);+#endifintsmp_hw_index[NR_CPUS];
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2011-12-16 03:13:07
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.
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...
Cheers,
Ben.
@@ -46,10 +46,11 @@externvoidbootx_init(unsignedlongr4,unsignedlongphys);-intboot_cpuid=-1;-EXPORT_SYMBOL_GPL(boot_cpuid);+/* we need a place to store phys cpu for non-SMP case */+#ifndef CONFIG_SMPintboot_cpuid_phys;EXPORT_SYMBOL_GPL(boot_cpuid_phys);+#endifintsmp_hw_index[NR_CPUS];
On Thu, Dec 15, 2011 at 9:12 PM, Benjamin Herrenschmidt
[off-list ref] wrote:
On Mon, 2011-11-28 at 22:24 -0600, Matthew McClintock wrote:
quoted
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.
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...
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2011-12-16 03:35:51
On Fri, 2011-12-16 at 03:29 +0000, McClintock Matthew-B29882 wrote:
On Thu, Dec 15, 2011 at 9:12 PM, Benjamin Herrenschmidt
[off-list ref] wrote:
quoted
On Mon, 2011-11-28 at 22:24 -0600, Matthew McClintock wrote:
quoted
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.
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...
From: Scott Wood <hidden> Date: 2011-12-16 21:29:59
On 12/15/2011 09:35 PM, Benjamin Herrenschmidt wrote:
On Fri, 2011-12-16 at 03:29 +0000, McClintock Matthew-B29882 wrote:
quoted
On Thu, Dec 15, 2011 at 9:12 PM, Benjamin Herrenschmidt
[off-list ref] wrote:
quoted
On Mon, 2011-11-28 at 22:24 -0600, Matthew McClintock wrote:
quoted
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?
quoted
quoted
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...
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
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2011-12-16 22:09:52
On Fri, 2011-12-16 at 15:29 -0600, Scott Wood wrote:
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.
Of course you can only do that on processors that have a reliable
PIR :-)
Cheers,
Ben.
On Fri, Dec 16, 2011 at 3:29 PM, Scott Wood [off-list ref] wrote=
:
On 12/15/2011 09:35 PM, Benjamin Herrenschmidt wrote:
quoted
On Fri, 2011-12-16 at 03:29 +0000, McClintock Matthew-B29882 wrote:
quoted
On Thu, Dec 15, 2011 at 9:12 PM, Benjamin Herrenschmidt
[off-list ref] wrote:
quoted
On Mon, 2011-11-28 at 22:24 -0600, Matthew McClintock wrote:
quoted
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?
The kernel won't boot if the order of the cpu nodes in the device tree
does not match the reg property. This can be fixed by using
init_thread_info.cpu instead of a separate variable - which seems to
be correct since we don't actually need a separate boot_cpuid variable
at all for powerpc. The correct initialization occurs in this scenario
in early_init_dt_scan_cpus(). (boot_cpuid maps to init_thread_info.cpu
via a define and could be just renamed everywhere in arch/powerpc/ )
quoted
quoted
quoted
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...
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. =A0The default -1 means this patch would break booting wit=
h
such a tree.
I can add a check here to see if the boot cpu in the device tree is -1
to assume this is the boot cpu in addition to the boot cpu matching
the PIR. This seems like the best approach to me, keep what I have in
these two patches and add this additional check to keep all device
tree's working properly.
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?),
This is something that has been fixed by using init_thread_info.cpu
above, we don't need to change the current method of booting we are
doing. I was just making some additional fixes Ben requested while I
was looking at the same code fix some kexec issues with device tree
ordering.
Basically (I think) all we need to fix the device tree order is the followi=
ng:
-extern int boot_cpuid;
+#define boot_cpuid (init_thread_info.cpu)
And all the other stuff could remain the same. That is we check some
variable and see if it's -1, if it is we are the boot cpu and we
change that variable to something else and the other cpus that boot
will know they are secondary cpus.
how about just having a variable that gets set
before releasing secondaries? =A0If you're in the boot entry code and tha=
t
variable is set, you're a secondary. =A0Or, use a distinct release addres=
s
for secondaries rather than __early_start.
The former method is the way things are working now, and the latter is
another possible solution which would require some more though/work
for me than the current changes.
-M=
From: Scott Wood <hidden> Date: 2011-12-20 19:28:06
On 12/20/2011 12:44 PM, McClintock Matthew-B29882 wrote:
On Fri, Dec 16, 2011 at 3:29 PM, Scott Wood [off-list ref] wrote:
quoted
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.
I can add a check here to see if the boot cpu in the device tree is -1
to assume this is the boot cpu in addition to the boot cpu matching
the PIR.
Won't that break on secondaries with a -1 dtb?
-Scott