* [PATCH 7/7] sparc-leon specific SRMMU initialization
@ 2009-06-09 11:22 Konrad Eisele
2009-06-09 20:16 ` Sam Ravnborg
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Konrad Eisele @ 2009-06-09 11:22 UTC (permalink / raw)
To: sparclinux
[-- Attachment #1: Type: text/plain, Size: 3230 bytes --]
From 070d1215c236a01aad7eff61858744a6b05ea1ca Mon Sep 17 00:00:00 2001
From: Konrad Eisele <konrad@gaisler.com>
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.
Signed-off-by: Konrad Eisele <konrad@gaisler.com>
---
arch/sparc/mm/srmmu.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index 06c9a7d..7bf9ecd 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -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) {
--
1.4.2.1
[-- Attachment #2: 0007-sparc-leon-specific-SRMMU-initialization-and.txt --]
[-- Type: text/plain, Size: 3215 bytes --]
From 070d1215c236a01aad7eff61858744a6b05ea1ca Mon Sep 17 00:00:00 2001
From: Konrad Eisele <konrad@gaisler.com>
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.
Signed-off-by: Konrad Eisele <konrad@gaisler.com>
---
arch/sparc/mm/srmmu.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index 06c9a7d..7bf9ecd 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -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) {
--
1.4.2.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 7/7] sparc-leon specific SRMMU initialization
2009-06-09 11:22 [PATCH 7/7] sparc-leon specific SRMMU initialization Konrad Eisele
@ 2009-06-09 20:16 ` Sam Ravnborg
2009-06-10 10:24 ` [PATCH 7/7] sparc-leon specific SRMMU initialization and konrad
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Sam Ravnborg @ 2009-06-09 20:16 UTC (permalink / raw)
To: sparclinux
On Tue, Jun 09, 2009 at 01:22:22PM +0200, Konrad Eisele wrote:
> From 070d1215c236a01aad7eff61858744a6b05ea1ca Mon Sep 17 00:00:00 2001
> From: Konrad Eisele <konrad@gaisler.com>
> 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.
>
> Signed-off-by: Konrad Eisele <konrad@gaisler.com>
> ---
> arch/sparc/mm/srmmu.c | 67
> +++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 67 insertions(+), 0 deletions(-)
>
> diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
> index 06c9a7d..7bf9ecd 100644
> --- a/arch/sparc/mm/srmmu.c
> +++ b/arch/sparc/mm/srmmu.c
> @@ -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.
> +
> #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);
> +
This is not a .h file.
> +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) {
Sam
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 7/7] sparc-leon specific SRMMU initialization and
2009-06-09 11:22 [PATCH 7/7] sparc-leon specific SRMMU initialization Konrad Eisele
2009-06-09 20:16 ` Sam Ravnborg
@ 2009-06-10 10:24 ` konrad
2009-06-10 23:54 ` Julian Calaby
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: konrad @ 2009-06-10 10:24 UTC (permalink / raw)
To: sparclinux
From: Konrad Eisele <konrad@gaisler.com>
>> +#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);
>> +
> 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(-)
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index 06c9a7d..0cf201b 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -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) {
--
1.4.2.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 7/7] sparc-leon specific SRMMU initialization and
2009-06-09 11:22 [PATCH 7/7] sparc-leon specific SRMMU initialization Konrad Eisele
2009-06-09 20:16 ` Sam Ravnborg
2009-06-10 10:24 ` [PATCH 7/7] sparc-leon specific SRMMU initialization and konrad
@ 2009-06-10 23:54 ` Julian Calaby
2009-06-11 6:58 ` Konrad Eisele
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Julian Calaby @ 2009-06-10 23:54 UTC (permalink / raw)
To: sparclinux
Konrad,
A couple of comments.
On Wed, Jun 10, 2009 at 20:24, <konrad@gaisler.com> wrote:
> From: Konrad Eisele <konrad@gaisler.com>
>
> 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(-)
>
> diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
> index 06c9a7d..0cf201b 100644
> --- a/arch/sparc/mm/srmmu.c
> +++ b/arch/sparc/mm/srmmu.c
> @@ -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 =)
> #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();
>
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,
--
Julian Calaby
Email: julian.calaby@gmail.com
.Plan: http://sites.google.com/site/juliancalaby/
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 7/7] sparc-leon specific SRMMU initialization and
2009-06-09 11:22 [PATCH 7/7] sparc-leon specific SRMMU initialization Konrad Eisele
` (2 preceding siblings ...)
2009-06-10 23:54 ` Julian Calaby
@ 2009-06-11 6:58 ` Konrad Eisele
2009-06-11 7:36 ` Julian Calaby
2009-06-11 7:50 ` Konrad Eisele
5 siblings, 0 replies; 7+ messages in thread
From: Konrad Eisele @ 2009-06-11 6:58 UTC (permalink / raw)
To: sparclinux
>> 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();
>>
>
> 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.
>
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
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 7/7] sparc-leon specific SRMMU initialization and
2009-06-09 11:22 [PATCH 7/7] sparc-leon specific SRMMU initialization Konrad Eisele
` (3 preceding siblings ...)
2009-06-11 6:58 ` Konrad Eisele
@ 2009-06-11 7:36 ` Julian Calaby
2009-06-11 7:50 ` Konrad Eisele
5 siblings, 0 replies; 7+ messages in thread
From: Julian Calaby @ 2009-06-11 7:36 UTC (permalink / raw)
To: sparclinux
On Thu, Jun 11, 2009 at 17:01, Konrad Eisele<konrad@gaisler.com> wrote:
>>> 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();
>>>
>>
>> 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.
>>
>
> 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.
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 =)
--
Julian Calaby
Email: julian.calaby@gmail.com
.Plan: http://sites.google.com/site/juliancalaby/
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 7/7] sparc-leon specific SRMMU initialization and
2009-06-09 11:22 [PATCH 7/7] sparc-leon specific SRMMU initialization Konrad Eisele
` (4 preceding siblings ...)
2009-06-11 7:36 ` Julian Calaby
@ 2009-06-11 7:50 ` Konrad Eisele
5 siblings, 0 replies; 7+ messages in thread
From: Konrad Eisele @ 2009-06-11 7:50 UTC (permalink / raw)
To: sparclinux
> 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 =)
>
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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-06-11 7:50 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-09 11:22 [PATCH 7/7] sparc-leon specific SRMMU initialization Konrad Eisele
2009-06-09 20:16 ` Sam Ravnborg
2009-06-10 10:24 ` [PATCH 7/7] sparc-leon specific SRMMU initialization and konrad
2009-06-10 23:54 ` Julian Calaby
2009-06-11 6:58 ` Konrad Eisele
2009-06-11 7:36 ` Julian Calaby
2009-06-11 7:50 ` Konrad Eisele
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.