* [PATCH v2 1/2] MIPS: Add definitions of SegCtl registers and use them
@ 2016-05-18 16:12 Matt Redfearn
2016-05-18 16:12 ` [PATCH v2 2/2] MIPS: CPS: Copy EVA configuration when starting secondary VPs Matt Redfearn
0 siblings, 1 reply; 4+ messages in thread
From: Matt Redfearn @ 2016-05-18 16:12 UTC (permalink / raw)
To: Ralf Baechle
Cc: Matt Redfearn, linux-mips, Joshua Kinard, linux-kernel,
James Hogan, Chris Packham, Paul Burton
The SegCtl registers are standard for MIPSr3..MIPSr5. Add definitions of
these registers and use them rather than constants
Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
---
Changes in v2: None
arch/mips/include/asm/mach-malta/kernel-entry-init.h | 6 +++---
arch/mips/include/asm/mipsregs.h | 3 +++
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/arch/mips/include/asm/mach-malta/kernel-entry-init.h b/arch/mips/include/asm/mach-malta/kernel-entry-init.h
index 0cf8622db27f..ab03eb3fadac 100644
--- a/arch/mips/include/asm/mach-malta/kernel-entry-init.h
+++ b/arch/mips/include/asm/mach-malta/kernel-entry-init.h
@@ -56,7 +56,7 @@
(0 << MIPS_SEGCFG_PA_SHIFT) | \
(1 << MIPS_SEGCFG_EU_SHIFT)) << 16)
or t0, t2
- mtc0 t0, $5, 2
+ mtc0 t0, CP0_SEGCTL0
/* SegCtl1 */
li t0, ((MIPS_SEGCFG_MUSUK << MIPS_SEGCFG_AM_SHIFT) | \
@@ -67,7 +67,7 @@
(0 << MIPS_SEGCFG_PA_SHIFT) | \
(1 << MIPS_SEGCFG_EU_SHIFT)) << 16)
ins t0, t1, 16, 3
- mtc0 t0, $5, 3
+ mtc0 t0, CP0_SEGCTL1
/* SegCtl2 */
li t0, ((MIPS_SEGCFG_MUSUK << MIPS_SEGCFG_AM_SHIFT) | \
@@ -77,7 +77,7 @@
(4 << MIPS_SEGCFG_PA_SHIFT) | \
(1 << MIPS_SEGCFG_EU_SHIFT)) << 16)
or t0, t2
- mtc0 t0, $5, 4
+ mtc0 t0, CP0_SEGCTL2
jal mips_ihb
mfc0 t0, $16, 5
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
index 3ad19ad04d8a..639137f12f1a 100644
--- a/arch/mips/include/asm/mipsregs.h
+++ b/arch/mips/include/asm/mipsregs.h
@@ -48,6 +48,9 @@
#define CP0_CONF $3
#define CP0_CONTEXT $4
#define CP0_PAGEMASK $5
+#define CP0_SEGCTL0 $5, 2
+#define CP0_SEGCTL1 $5, 3
+#define CP0_SEGCTL2 $5, 4
#define CP0_WIRED $6
#define CP0_INFO $7
#define CP0_HWRENA $7, 0
--
2.5.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] MIPS: CPS: Copy EVA configuration when starting secondary VPs.
2016-05-18 16:12 [PATCH v2 1/2] MIPS: Add definitions of SegCtl registers and use them Matt Redfearn
@ 2016-05-18 16:12 ` Matt Redfearn
2016-05-18 22:34 ` Paul Burton
0 siblings, 1 reply; 4+ messages in thread
From: Matt Redfearn @ 2016-05-18 16:12 UTC (permalink / raw)
To: Ralf Baechle
Cc: Matt Redfearn, linux-mips, linux-kernel, Markos Chandras,
Paul Burton
When starting secondary VPEs which support EVA and the SegCtl registers,
copy the memory segmentation configuration from the running VPE to ensure
that all VPEs in the core have a consistent virtual memory map.
The EVA configuration of secondary cores is dealt with when starting the
core via the CM.
Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
---
Changes in v2:
- Skip check for config3 existing - we know it must to be doing
multithreading
- Use a unique lable name in the function
arch/mips/kernel/cps-vec.S | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/arch/mips/kernel/cps-vec.S b/arch/mips/kernel/cps-vec.S
index ac81edd44563..f8eae9189e38 100644
--- a/arch/mips/kernel/cps-vec.S
+++ b/arch/mips/kernel/cps-vec.S
@@ -431,6 +431,21 @@ LEAF(mips_cps_boot_vpes)
mfc0 t0, CP0_CONFIG
mttc0 t0, CP0_CONFIG
+ /*
+ * Copy the EVA config from this VPE if the CPU supports it.
+ * CONFIG3 must exist to be running MT startup - just read it.
+ */
+ mfc0 t0, CP0_CONFIG, 3
+ and t0, t0, MIPS_CONF3_SC
+ beqz t0, 3f
+ nop
+ mfc0 t0, CP0_SEGCTL0
+ mttc0 t0, CP0_SEGCTL0
+ mfc0 t0, CP0_SEGCTL1
+ mttc0 t0, CP0_SEGCTL1
+ mfc0 t0, CP0_SEGCTL2
+ mttc0 t0, CP0_SEGCTL2
+3:
/* Ensure no software interrupts are pending */
mttc0 zero, CP0_CAUSE
mttc0 zero, CP0_STATUS
--
2.5.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 2/2] MIPS: CPS: Copy EVA configuration when starting secondary VPs.
2016-05-18 16:12 ` [PATCH v2 2/2] MIPS: CPS: Copy EVA configuration when starting secondary VPs Matt Redfearn
@ 2016-05-18 22:34 ` Paul Burton
2016-05-19 7:06 ` Matt Redfearn
0 siblings, 1 reply; 4+ messages in thread
From: Paul Burton @ 2016-05-18 22:34 UTC (permalink / raw)
To: Matt Redfearn; +Cc: Ralf Baechle, linux-mips, linux-kernel
On Wed, May 18, 2016 at 05:12:36PM +0100, Matt Redfearn wrote:
> When starting secondary VPEs which support EVA and the SegCtl registers,
> copy the memory segmentation configuration from the running VPE to ensure
> that all VPEs in the core have a consistent virtual memory map.
>
> The EVA configuration of secondary cores is dealt with when starting the
> core via the CM.
>
> Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
> ---
>
> Changes in v2:
> - Skip check for config3 existing - we know it must to be doing
> multithreading
> - Use a unique lable name in the function
>
> arch/mips/kernel/cps-vec.S | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/arch/mips/kernel/cps-vec.S b/arch/mips/kernel/cps-vec.S
> index ac81edd44563..f8eae9189e38 100644
> --- a/arch/mips/kernel/cps-vec.S
> +++ b/arch/mips/kernel/cps-vec.S
> @@ -431,6 +431,21 @@ LEAF(mips_cps_boot_vpes)
> mfc0 t0, CP0_CONFIG
> mttc0 t0, CP0_CONFIG
>
> + /*
> + * Copy the EVA config from this VPE if the CPU supports it.
> + * CONFIG3 must exist to be running MT startup - just read it.
> + */
> + mfc0 t0, CP0_CONFIG, 3
> + and t0, t0, MIPS_CONF3_SC
Tiny nit - I'd prefer "andi" here since we're using an immediate. The
assembler will figure it out though, so it's not a big deal.
For both in the series:
Reviewed-by: Paul Burton <paul.burton@imgtec.com>
Thanks,
Paul
> + beqz t0, 3f
> + nop
> + mfc0 t0, CP0_SEGCTL0
> + mttc0 t0, CP0_SEGCTL0
> + mfc0 t0, CP0_SEGCTL1
> + mttc0 t0, CP0_SEGCTL1
> + mfc0 t0, CP0_SEGCTL2
> + mttc0 t0, CP0_SEGCTL2
> +3:
> /* Ensure no software interrupts are pending */
> mttc0 zero, CP0_CAUSE
> mttc0 zero, CP0_STATUS
> --
> 2.5.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v2 2/2] MIPS: CPS: Copy EVA configuration when starting secondary VPs.
2016-05-18 22:34 ` Paul Burton
@ 2016-05-19 7:06 ` Matt Redfearn
0 siblings, 0 replies; 4+ messages in thread
From: Matt Redfearn @ 2016-05-19 7:06 UTC (permalink / raw)
To: Paul Burton; +Cc: Ralf Baechle, linux-mips, linux-kernel
Hi Paul,
On 18/05/16 23:34, Paul Burton wrote:
> On Wed, May 18, 2016 at 05:12:36PM +0100, Matt Redfearn wrote:
>> When starting secondary VPEs which support EVA and the SegCtl registers,
>> copy the memory segmentation configuration from the running VPE to ensure
>> that all VPEs in the core have a consistent virtual memory map.
>>
>> The EVA configuration of secondary cores is dealt with when starting the
>> core via the CM.
>>
>> Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
>> ---
>>
>> Changes in v2:
>> - Skip check for config3 existing - we know it must to be doing
>> multithreading
>> - Use a unique lable name in the function
>>
>> arch/mips/kernel/cps-vec.S | 15 +++++++++++++++
>> 1 file changed, 15 insertions(+)
>>
>> diff --git a/arch/mips/kernel/cps-vec.S b/arch/mips/kernel/cps-vec.S
>> index ac81edd44563..f8eae9189e38 100644
>> --- a/arch/mips/kernel/cps-vec.S
>> +++ b/arch/mips/kernel/cps-vec.S
>> @@ -431,6 +431,21 @@ LEAF(mips_cps_boot_vpes)
>> mfc0 t0, CP0_CONFIG
>> mttc0 t0, CP0_CONFIG
>>
>> + /*
>> + * Copy the EVA config from this VPE if the CPU supports it.
>> + * CONFIG3 must exist to be running MT startup - just read it.
>> + */
>> + mfc0 t0, CP0_CONFIG, 3
>> + and t0, t0, MIPS_CONF3_SC
> Tiny nit - I'd prefer "andi" here since we're using an immediate. The
> assembler will figure it out though, so it's not a big deal.
Yeah, I would have too, and I did have that to start off with, but the
assembler gave me:
arch/mips/kernel/cps-vec.S: Assembler messages:
arch/mips/kernel/cps-vec.S:450: Error: operand 3 out of range `andi
$8,$8,((1)<<25)'
So I fell back to letting the assembler generate the LUI and AND.
>
> For both in the series:
>
> Reviewed-by: Paul Burton <paul.burton@imgtec.com>
Thanks Paul,
Matt
> Thanks,
> Paul
>
>> + beqz t0, 3f
>> + nop
>> + mfc0 t0, CP0_SEGCTL0
>> + mttc0 t0, CP0_SEGCTL0
>> + mfc0 t0, CP0_SEGCTL1
>> + mttc0 t0, CP0_SEGCTL1
>> + mfc0 t0, CP0_SEGCTL2
>> + mttc0 t0, CP0_SEGCTL2
>> +3:
>> /* Ensure no software interrupts are pending */
>> mttc0 zero, CP0_CAUSE
>> mttc0 zero, CP0_STATUS
>> --
>> 2.5.0
>>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-05-19 7:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-18 16:12 [PATCH v2 1/2] MIPS: Add definitions of SegCtl registers and use them Matt Redfearn
2016-05-18 16:12 ` [PATCH v2 2/2] MIPS: CPS: Copy EVA configuration when starting secondary VPs Matt Redfearn
2016-05-18 22:34 ` Paul Burton
2016-05-19 7:06 ` Matt Redfearn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox