Patchwork sparc,leon: sparc-leon specific SRMMU initialization and bootup fixes.

login
register
mail settings
Submitter Konrad Eisele
Date June 23, 2009, 8:46 a.m.
Message ID <1245746797-26545-5-git-send-email-konrad@gaisler.com>
Download mbox | patch
Permalink /patch/29044/
State Superseded
Delegated to: David Miller
Headers show

Comments

Konrad Eisele - June 23, 2009, 8:46 a.m.
From: Konrad Eisele <konrad@gaisler.com>

The sparc-leon caches are virtually tagged so a flush is needed on ctx
switch.

Signed-off-by: Konrad Eisele <konrad@gaisler.com>
---
 arch/sparc/mm/srmmu.c |   50 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)
Florian Fainelli - June 23, 2009, 8:50 a.m.
Le Tuesday 23 June 2009 10:46:37 konrad@gaisler.com, vous avez écrit :
> From: Konrad Eisele <konrad@gaisler.com>
>
> The sparc-leon caches are virtually tagged so a flush is needed on ctx
> switch.
>
> Signed-off-by: Konrad Eisele <konrad@gaisler.com>

[snip]

> @@ -1992,6 +2035,13 @@ static void __init get_srmmu_type(void)
>  	psr_typ = (psr >> 28) & 0xf;
>  	psr_vers = (psr >> 24) & 0xf;
>
> +	if (sparc_cpu_model == sparc_leon) {
> +		psr_typ = 0xf;	/* hardcoded ids for older models/simulators */
> +		psr_vers = 2;
> +		init_leon();
> +		return;
> +	}
> +
>  	/* First, check for HyperSparc or Cypress. */
>  	if(mod_typ == 1) {
>  		switch(mod_rev) {

The comment is now wrong, should be "First, check for Leon" and move to the 
check on sparc_cpu_model of course.
Konrad Eisele - June 23, 2009, 8:58 a.m.
Florian Fainelli wrote:
> Le Tuesday 23 June 2009 10:46:37 konrad@gaisler.com, vous avez écrit :
>> From: Konrad Eisele <konrad@gaisler.com>
>>
>> The sparc-leon caches are virtually tagged so a flush is needed on ctx
>> switch.
>>
>> Signed-off-by: Konrad Eisele <konrad@gaisler.com>
> 
> [snip]
> 
>> @@ -1992,6 +2035,13 @@ static void __init get_srmmu_type(void)
>>  	psr_typ = (psr >> 28) & 0xf;
>>  	psr_vers = (psr >> 24) & 0xf;
>>
>> +	if (sparc_cpu_model == sparc_leon) {
>> +		psr_typ = 0xf;	/* hardcoded ids for older models/simulators */
>> +		psr_vers = 2;
>> +		init_leon();
>> +		return;
>> +	}
>> +
>>  	/* First, check for HyperSparc or Cypress. */
>>  	if(mod_typ == 1) {
>>  		switch(mod_rev) {
> 
> The comment is now wrong, should be "First, check for Leon" and move to the 
> check on sparc_cpu_model of course.

Thanks, I'll change that in the next round.

-- Konrad

--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index ade4eb3..52a6025 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -46,6 +46,7 @@ 
 #include <asm/tsunami.h>
 #include <asm/swift.h>
 #include <asm/turbosparc.h>
+#include <asm/leon.h>
 
 #include <asm/btfixup.h>
 
@@ -569,6 +570,9 @@  static void srmmu_switch_mm(struct mm_struct *old_mm, struct mm_struct *mm,
 		srmmu_ctxd_set(&srmmu_context_table[mm->context], mm->pgd);
 	}
 
+	if (sparc_cpu_model == sparc_leon)
+		leon_switch_mm();
+
 	if (is_hypersparc)
 		hyper_flush_whole_icache();
 
@@ -1977,6 +1981,45 @@  static void __init init_viking(void)
 	poke_srmmu = poke_viking;
 }
 
+#ifdef CONFIG_SPARC_LEON
+
+void __init poke_leonsparc(void)
+{
+}
+
+void __init init_leon(void)
+{
+
+	srmmu_name = "Leon";
+
+	BTFIXUPSET_CALL(flush_cache_all, leon_flush_cache_all,
+			BTFIXUPCALL_NORM);
+	BTFIXUPSET_CALL(flush_cache_mm, leon_flush_cache_all,
+			BTFIXUPCALL_NORM);
+	BTFIXUPSET_CALL(flush_cache_page, leon_flush_pcache_all,
+			BTFIXUPCALL_NORM);
+	BTFIXUPSET_CALL(flush_cache_range, leon_flush_cache_all,
+			BTFIXUPCALL_NORM);
+	BTFIXUPSET_CALL(flush_page_for_dma, leon_flush_dcache_all,
+			BTFIXUPCALL_NORM);
+
+	BTFIXUPSET_CALL(flush_tlb_all, leon_flush_tlb_all, BTFIXUPCALL_NORM);
+	BTFIXUPSET_CALL(flush_tlb_mm, leon_flush_tlb_all, BTFIXUPCALL_NORM);
+	BTFIXUPSET_CALL(flush_tlb_page, leon_flush_tlb_all, BTFIXUPCALL_NORM);
+	BTFIXUPSET_CALL(flush_tlb_range, leon_flush_tlb_all, BTFIXUPCALL_NORM);
+
+	BTFIXUPSET_CALL(__flush_page_to_ram, leon_flush_cache_all,
+			BTFIXUPCALL_NOP);
+	BTFIXUPSET_CALL(flush_sig_insns, leon_flush_cache_all, BTFIXUPCALL_NOP);
+
+	poke_srmmu = poke_leonsparc;
+
+	srmmu_cache_pagetables = 0;
+
+	leon_flush_during_switch = leon_flush_needed();
+}
+#endif
+
 /* Probe for the srmmu chip version. */
 static void __init get_srmmu_type(void)
 {
@@ -1992,6 +2035,13 @@  static void __init get_srmmu_type(void)
 	psr_typ = (psr >> 28) & 0xf;
 	psr_vers = (psr >> 24) & 0xf;
 
+	if (sparc_cpu_model == sparc_leon) {
+		psr_typ = 0xf;	/* hardcoded ids for older models/simulators */
+		psr_vers = 2;
+		init_leon();
+		return;
+	}
+
 	/* First, check for HyperSparc or Cypress. */
 	if(mod_typ == 1) {
 		switch(mod_rev) {