Skip to contentSkip to conversation

sparc-leon specific SRMMU initialization

PATCH In review Konrad Eisele 3 participants 7 messages Jun 9, 2009 – Jun 11, 2009 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

PATCH 7/7 sparc-leon specific SRMMU initialization

From 070d1215c236a01aad7eff61858744a6b05ea1ca Mon Sep 17 00:00:00 2001
From: Konrad Eisele <[email protected]>
Date: Tue, 9 Jun 2009 13:07:17 +0200
Subject: [PATCH 7/7] sparc-leon specific SRMMU initialization and bootup fixes. The sparc-leon caches are
virtually tagged so a flush is needed on ctx
switch.

---
 arch/sparc/mm/srmmu.c |   67 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 67 insertions(+), 0 deletions(-)
arch/sparc/mm/srmmu.c +67 -0
index 06c9a7d..7bf9ecd 100644
@@ -46,6 +46,10 @@ #include <asm/tsunami.h>
 #include <asm/swift.h>
 #include <asm/turbosparc.h>
 
+#if defined(CONFIG_LEON)
+#include <asm/leon.h>
+#endif
+
 #include <asm/btfixup.h>
 
 enum mbus_module srmmu_modtype;
@@ -568,6 +572,11 @@ static void srmmu_switch_mm(struct mm_st
 		srmmu_ctxd_set(&srmmu_context_table[mm->context], mm->pgd);
 	}
 
+#if defined(CONFIG_LEON)
+	flush_tlb_mm(0);
+	if (leon_flush_during_switch)
+		leon_flush_cache_all();
+#endif
 	if (is_hypersparc)
 		hyper_flush_whole_icache();
 
@@ -1976,6 +1985,57 @@ #endif
 	poke_srmmu = poke_viking;
 }
 
+#if defined(CONFIG_LEON)
+
+extern void leon_flush_icache_all(void);
+extern void leon_flush_dcache_all(void);
+extern void leon_flush_pcache_all(struct vm_area_struct *vma,
+				  unsigned long page);
+extern void leon_flush_cache_all(void);
+extern void leon_flush_tlb_all(void);
+extern int leon_flush_during_switch ;
+extern int leon_flush_needed(void);
+extern void leon_flush_pcache_all(struct vm_area_struct *vma,
+				  unsigned long page);
+
+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)
 {
@@ -1991,6 +2051,13 @@ static void __init get_srmmu_type(void)
 	psr_typ = (psr >> 28) & 0xf;
 	psr_vers = (psr >> 24) & 0xf;
 
+#ifdef CONFIG_LEON
+	psr_typ = 0xf;	/* hardcoded ids for older models/simulators */
+	psr_vers = 2;
+	init_leon();
+	return;
+#endif
+
 	/* First, check for HyperSparc or Cypress. */
 	if(mod_typ == 1) {
 		switch(mod_rev) {
Signature · 1 line
1.4.2.1

From 070d1215c236a01aad7eff61858744a6b05ea1ca Mon Sep 17 00:00:00 2001
From: Konrad Eisele <[email protected]>
Date: Tue, 9 Jun 2009 13:07:17 +0200
Subject: [PATCH 7/7] sparc-leon specific SRMMU initialization and bootup fixes. The sparc-leon caches are
virtually tagged so a flush is needed on ctx
switch.

---
 arch/sparc/mm/srmmu.c |   67 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 67 insertions(+), 0 deletions(-)
arch/sparc/mm/srmmu.c +67 -0

91 lines not on this page · raw message

Signature · 1 line
1.4.2.1
#1 lore raw
Quoted 19 lines · Konrad Eisele

From 070d1215c236a01aad7eff61858744a6b05ea1ca Mon Sep 17 00:00:00 2001
From: Konrad Eisele <[email protected]>
Date: Tue, 9 Jun 2009 13:07:17 +0200
Subject: [PATCH 7/7] sparc-leon specific SRMMU initialization and bootup fixes. The sparc-leon caches are
virtually tagged so a flush is needed on ctx
switch.

---
 arch/sparc/mm/srmmu.c |   67 
 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 67 insertions(+), 0 deletions(-)
arch/sparc/mm/srmmu.c +0 -0
index 06c9a7d..7bf9ecd 100644

arch/sparc/mm/srmmu.c #include <asm/tsunami.h> · line 51

Quoted 6 lines
arch/sparc/mm/srmmu.c +3 -0
@@ -46,6 +46,10 @@ #include <asm/tsunami.h>
 #include <asm/swift.h>
 #include <asm/turbosparc.h>
 
+#if defined(CONFIG_LEON)
+#include <asm/leon.h>
+#endif

Follow the correct order of includes and drop the ifdefs.

Quoted 23 lines
arch/sparc/mm/srmmu.c +9 -0
+
 #include <asm/btfixup.h>
 
 enum mbus_module srmmu_modtype;
@@ -568,6 +572,11 @@ static void srmmu_switch_mm(struct mm_st
 		srmmu_ctxd_set(&srmmu_context_table[mm->context], mm->pgd);
 	}
 
+#if defined(CONFIG_LEON)
+	flush_tlb_mm(0);
+	if (leon_flush_during_switch)
+		leon_flush_cache_all();
+#endif
 	if (is_hypersparc)
 		hyper_flush_whole_icache();
 
@@ -1976,6 +1985,57 @@ #endif
 	poke_srmmu = poke_viking;
 }
 
+#if defined(CONFIG_LEON)
+
+extern void leon_flush_icache_all(void);

arch/sparc/mm/srmmu.c #endif · line 2000

Quoted 10 lines
arch/sparc/mm/srmmu.c +10 -0
+extern void leon_flush_dcache_all(void);
+extern void leon_flush_pcache_all(struct vm_area_struct *vma,
+				  unsigned long page);
+extern void leon_flush_cache_all(void);
+extern void leon_flush_tlb_all(void);
+extern int leon_flush_during_switch ;
+extern int leon_flush_needed(void);
+extern void leon_flush_pcache_all(struct vm_area_struct *vma,
+				  unsigned long page);
+

This is not a .h file.

Quoted 48 lines
arch/sparc/mm/srmmu.c +38 -0
+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)
{

arch/sparc/mm/srmmu.c +0 -0
@@ -1991,6 +2051,13 @@ static void __init get_srmmu_type(void)
 	psr_typ = (psr >> 28) & 0xf;
 	psr_vers = (psr >> 24) & 0xf;
 

arch/sparc/mm/srmmu.c static void __init get_srmmu_type(void) · line 2063

Quoted 10 lines
arch/sparc/mm/srmmu.c +7 -0
+#ifdef CONFIG_LEON
+	psr_typ = 0xf;	/* hardcoded ids for older models/simulators */
+	psr_vers = 2;
+	init_leon();
+	return;
+#endif
+
 	/* First, check for HyperSparc or Cypress. */
 	if(mod_typ = 1) {
 		switch(mod_rev) {

Sam

#2 lore raw

PATCH 7/7 sparc-leon specific SRMMU initialization and

In reply to Konrad Eisele

From: Konrad Eisele <[email protected]>

Quoted 6 lines
Quoted 6 lines
(quoted diff) +6 -0
+#if defined(CONFIG_LEON)
+
+extern void leon_flush_icache_all(void);
+extern void leon_flush_dcache_all(void);
+extern void leon_flush_pcache_all(struct vm_area_struct *vma,
+				  unsigned long page);
Quoted 8 lines

Review

Quoted 7 lines
(quoted diff) +7 -0
+extern void leon_flush_cache_all(void);
+extern void leon_flush_tlb_all(void);
+extern int leon_flush_during_switch ;
+extern int leon_flush_needed(void);
+extern void leon_flush_pcache_all(struct vm_area_struct *vma,
+				  unsigned long page);
+

This is not a .h file.

The other cpu types like viking do it the same way. If I'd include the definitions in leon.h I'll also have to define struct vm_area_struct etc. That makes it ugly. I think in this case a exception can be made (viking etc also got it)

sparc-leon specific SRMMU initialization and
bootup fixes. The sparc-leon caches are virtually tagged so a flush is needed on ctx switch.

---
 arch/sparc/mm/srmmu.c |   67 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 67 insertions(+), 0 deletions(-)
arch/sparc/mm/srmmu.c +67 -0
index 06c9a7d..0cf201b 100644
@@ -46,6 +46,10 @@ #include <asm/tsunami.h>
 #include <asm/swift.h>
 #include <asm/turbosparc.h>
 
+#ifdef CONFIG_SPARC_LEON
+#include <asm/leon.h>
+#endif
+
 #include <asm/btfixup.h>
 
 enum mbus_module srmmu_modtype;
@@ -568,6 +572,11 @@ static void srmmu_switch_mm(struct mm_st
 		srmmu_ctxd_set(&srmmu_context_table[mm->context], mm->pgd);
 	}
 
+#ifdef CONFIG_SPARC_LEON
+	flush_tlb_mm(0);
+	if (leon_flush_during_switch)
+		leon_flush_cache_all();
+#endif
 	if (is_hypersparc)
 		hyper_flush_whole_icache();
 
@@ -1976,6 +1985,57 @@ #endif
 	poke_srmmu = poke_viking;
 }
 
+#ifdef CONFIG_SPARC_LEON
+
+extern void leon_flush_icache_all(void);
+extern void leon_flush_dcache_all(void);
+extern void leon_flush_pcache_all(struct vm_area_struct *vma,
+				  unsigned long page);
+extern void leon_flush_cache_all(void);
+extern void leon_flush_tlb_all(void);
+extern int leon_flush_during_switch ;
+extern int leon_flush_needed(void);
+extern void leon_flush_pcache_all(struct vm_area_struct *vma,
+				  unsigned long page);
+
+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)
 {
@@ -1991,6 +2051,13 @@ static void __init get_srmmu_type(void)
 	psr_typ = (psr >> 28) & 0xf;
 	psr_vers = (psr >> 24) & 0xf;
 
+#ifdef CONFIG_SPARC_LEON
+	psr_typ = 0xf;	/* hardcoded ids for older models/simulators */
+	psr_vers = 2;
+	init_leon();
+	return;
+#endif
+
 	/* First, check for HyperSparc or Cypress. */
 	if(mod_typ = 1) {
 		switch(mod_rev) {
Signature · 1 line
1.4.2.1
#3 lore raw

Re: [PATCH 7/7] sparc-leon specific SRMMU initialization and

In reply to Konrad Eisele

Konrad,

A couple of comments.

Quoted 14 lines · On Wed, Jun 10, 2009 at 20:24, <[email protected]> wrote:

From: Konrad Eisele <[email protected]>

sparc-leon specific SRMMU initialization and
bootup fixes. The sparc-leon caches are virtually tagged so a flush is needed on ctx switch.
---
 arch/sparc/mm/srmmu.c |   67 +++++++++++++++++++++++++++++++++++++++++++++++++

 1 files changed, 67 insertions(+), 0 deletions(-)
arch/sparc/mm/srmmu.c +0 -0
index 06c9a7d..0cf201b 100644

arch/sparc/mm/srmmu.c #include <asm/tsunami.h> · line 52

Quoted 7 lines
arch/sparc/mm/srmmu.c +4 -0
@@ -46,6 +46,10 @@ #include <asm/tsunami.h>
  #include <asm/swift.h>
  #include <asm/turbosparc.h>
 
+#ifdef CONFIG_SPARC_LEON
+#include <asm/leon.h>
+#endif
+

Hm, you don't need to ifdef this anymore =)

Quoted 5 lines
arch/sparc/mm/srmmu.c +0 -0
  #include <asm/btfixup.h>
 
  enum mbus_module srmmu_modtype;
@@ -568,6 +572,11 @@ static void srmmu_switch_mm(struct mm_st
                srmmu_ctxd_set(&srmmu_context_table[mm->context], mm->pgd);

arch/sparc/mm/srmmu.c static void srmmu_switch_mm(struct mm_st · line 582

Quoted 10 lines
arch/sparc/mm/srmmu.c +5 -0
        }
 
+#ifdef CONFIG_SPARC_LEON
+       flush_tlb_mm(0);
+       if (leon_flush_during_switch)
+               leon_flush_cache_all();
+#endif
        if (is_hypersparc)
                hyper_flush_whole_icache();
 

Hmm... it would be nice to match the style of the statement after this, something like:

if (is_leon) {
    flush_tlb_mm(0);
    if (leon_flush_during_switch)
        leon_flush_cache_all();
}

But that would mean that the leon_flush_during_switch and leon_flush_cache_all() would have to be defined for the non-SPARC_LEON case, which isn't what you're trying to do here, however if leon_flush_cache_all() is defined as a blank function, the compiler *should* optimise all this away.

Thanks,

Signature · 4 lines
Julian Calaby

Email: [email protected]
.Plan: http://sites.google.com/site/juliancalaby/
#4 lore raw

Re: [PATCH 7/7] sparc-leon specific SRMMU initialization and

In reply to Konrad Eisele
Quoted 23 lines

arch/sparc/mm/srmmu.c static void srmmu_switch_mm(struct mm_st · line 582

Quoted 13 lines

enum mbus_module srmmu_modtype;

arch/sparc/mm/srmmu.c +5 -0
@@ -568,6 +572,11 @@ static void srmmu_switch_mm(struct mm_st
               srmmu_ctxd_set(&srmmu_context_table[mm->context], mm->pgd);
       }
 
+#ifdef CONFIG_SPARC_LEON
+       flush_tlb_mm(0);
+       if (leon_flush_during_switch)
+               leon_flush_cache_all();
+#endif
       if (is_hypersparc)
               hyper_flush_whole_icache();
 

Hmm... it would be nice to match the style of the statement after this, something like:

if (is_leon) {
    flush_tlb_mm(0);
    if (leon_flush_during_switch)
        leon_flush_cache_all();
}
Quoted 6 lines

But that would mean that the leon_flush_during_switch and leon_flush_cache_all() would have to be defined for the non-SPARC_LEON case, which isn't what you're trying to do here, however if leon_flush_cache_all() is defined as a blank function, the compiler *should* optimise all this away.

I'm not shure what to do here. I wonder weather
if (is_leon) {
is better than a
#ifdef CONFIG_SPARC_LEON
it seems to me that the later is better.
It seems to me that in case of the former you have to have the implicit knowledge that the compiler will optimize away the function calls (and you have to search your way through the source code to come to a conclusion that it will), and this is quite more complex and disturbing than a #ifdef. I'd think #ifdef CONFIG_SPARC_LEON is much cleaner.
Moreover it is not in line with the general strategy: to make leon-specific parts be only compiled in when CONFIG_SPARC_LEON is defined. Then all leon_mm.c and leon_kernel.c should also be compiled in always and protected with is_leon() instead of only compiling it in the CONFIG_SPARC_LEON case...

But, hey, he, who checkes in, decides. Maybe Dave Miller can say how it should be. -- Konrad

#5 lore raw

Re: [PATCH 7/7] sparc-leon specific SRMMU initialization and

In reply to Konrad Eisele
Quoted 48 lines · Konrad Eisele
Quoted 23 lines

arch/sparc/mm/srmmu.c static void srmmu_switch_mm(struct mm_st · line 582

Quoted 13 lines

 enum mbus_module srmmu_modtype;

arch/sparc/mm/srmmu.c +5 -0
@@ -568,6 +572,11 @@ static void srmmu_switch_mm(struct mm_st
               srmmu_ctxd_set(&srmmu_context_table[mm->context], mm->pgd);
       }
 
+#ifdef CONFIG_SPARC_LEON
+       flush_tlb_mm(0);
+       if (leon_flush_during_switch)
+               leon_flush_cache_all();
+#endif
       if (is_hypersparc)
               hyper_flush_whole_icache();
 

Hmm... it would be nice to match the style of the statement after this, something like:

if (is_leon) {
   flush_tlb_mm(0);
   if (leon_flush_during_switch)
       leon_flush_cache_all();
}

Quoted 6 lines

But that would mean that the leon_flush_during_switch and leon_flush_cache_all() would have to be defined for the non-SPARC_LEON case, which isn't what you're trying to do here, however if leon_flush_cache_all() is defined as a blank function, the compiler *should* optimise all this away.

I'm not shure what to do here. I wonder weather
if (is_leon) {
is better than a
#ifdef CONFIG_SPARC_LEON
it seems to me that the later is better.
It seems to me that in case of the former you have to have the implicit knowledge that  the compiler will optimize away the function calls (and you have  to search your way through the source code to come to a conclusion  that it will), and this is quite more complex and disturbing than a #ifdef. I'd think #ifdef CONFIG_SPARC_LEON is much cleaner.
Moreover it is not in line with the general strategy: to make leon-specific parts be only compiled in when CONFIG_SPARC_LEON is defined. Then  all leon_mm.c
and leon_kernel.c should also be compiled in always and protected with is_leon()
instead of only compiling it in the CONFIG_SPARC_LEON case...

Quoted 2 lines

But, hey, he, who checkes in, decides. Maybe Dave Miller can say how it should be.

I should possibly explain myself here a little.

My agenda with hacking on SparcLinux is to get 32-bit Sparc fully tested and working with current kernel releases. (At the moment, I've completed phase 1, getting the hardware and am slowly working on phase 2, getting it to boot.)

My methodology is to decrease the 32-bit specific parts of the code to the absolute minimum, whilst removing ifdef guards where possible to allow other methods, e.g. Kconfig, to choose which bits are compiled or not, with the end goal being that there is little difference between a 32-bit kernel and a 64-bit kernel.

As I cast my eye over all these changes for SPARC LEON, I'm looking at the code in exactly the same way, asking myself the question "How can we merge this code into the existing code leaving little special-case code?"

I understand your goals with this - get LEON support upstream, don't break existing systems - and I understand your methodology - making your changes disappear when SPARC_LEON is unset - but I *know* that I'll be submitting patches to do exactly what I'm talking about once I'm hacking at this again.

Back to the code.

As for leon_kernel.c and leon_mm.c, they shouldn't be compiled unless CONFIG_LEON is set, exactly as you have it now.

As for this code, the cleanest option I see is to make leon_init() and leon_flush_cache_all() no-ops (or empty macros) when CONFIG_LEON isn't set. My rationale for this is simple: support for HyperSPARC CPUs adds some "dead" code on my MicroSPARC / SuperSPARC machines, and yet it cannot be compiled out, so why should LEON CPUs be treated any differently?

As for things like new hardware or new bus types, they add little bulk, so I see no reason to cut them out when CONFIG_LEON isn't set. - and for all we know, AMBA bus may become the emerging standard for open source SPARC systems, not just LEON.

Thanks for understanding =)

Signature · 4 lines
Julian Calaby

Email: [email protected]
.Plan: http://sites.google.com/site/juliancalaby/
#6 lore raw

Re: [PATCH 7/7] sparc-leon specific SRMMU initialization and

In reply to Konrad Eisele
Quoted 10 lines

As for leon_kernel.c and leon_mm.c, they shouldn't be compiled unless CONFIG_LEON is set, exactly as you have it now.

As for this code, the cleanest option I see is to make leon_init() and leon_flush_cache_all() no-ops (or empty macros) when CONFIG_LEON isn't set. My rationale for this is simple: support for HyperSPARC CPUs adds some "dead" code on my MicroSPARC / SuperSPARC machines, and yet it cannot be compiled out, so why should LEON CPUs be treated any differently?

Quoted 7 lines

As for things like new hardware or new bus types, they add little bulk, so I see no reason to cut them out when CONFIG_LEON isn't set. - and for all we know, AMBA bus may become the emerging standard for open source SPARC systems, not just LEON.

Thanks for understanding =)

Ok, then I'll do a is_leon approach and include the ambapp bus too, removing the ifdef. I'll wait for some more comments before I'll post yet enother round of patches, maybe next week.
-- Konrad