linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Clean up CP0 hwrena code in traps.c
@ 2009-05-13 22:57 David Daney
  2009-05-13 22:59 ` [PATCH 1/2] MIPS: Allow CPU specific overriding of CP0 hwrena impl bits David Daney
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: David Daney @ 2009-05-13 22:57 UTC (permalink / raw)
  To: Ralf Baechle, linux-mips

There is an ugly #ifdef CONFIG_CPU_CAVIUM_OCTEON in the middle of
traps.c.  We can get rid of it if we add a cpu feature for
implementation dependent hwrena bits.  The first patch adds the
feature macro and the second removes the #ifdef by setting the feature
for Octeon.

I will reply with the two patches.

David Daney (2):
  MIPS: Allow CPU specific overriding of CP0 hwrena impl bits.
  MIPS: Move Cavium CP0 hwrena impl bits to cpu-feature-overrides.h

 arch/mips/include/asm/cpu-features.h               |    4 ++++
 .../asm/mach-cavium-octeon/cpu-feature-overrides.h |    1 +
 arch/mips/kernel/traps.c                           |    6 +-----
 3 files changed, 6 insertions(+), 5 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] MIPS: Allow CPU specific overriding of CP0 hwrena impl bits.
  2009-05-13 22:57 [PATCH 0/2] Clean up CP0 hwrena code in traps.c David Daney
@ 2009-05-13 22:59 ` David Daney
  2009-05-13 22:59 ` [PATCH 2/2] MIPS: Move Cavium CP0 hwrena impl bits to cpu-feature-overrides.h David Daney
  2009-06-16 10:31 ` [PATCH 0/2] Clean up CP0 hwrena code in traps.c Ralf Baechle
  2 siblings, 0 replies; 4+ messages in thread
From: David Daney @ 2009-05-13 22:59 UTC (permalink / raw)
  To: linux-mips, ralf; +Cc: David Daney

Some CPUs have implementation dependent rdhwr registers.  Allow them
to be enabled on a per CPU basis.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 arch/mips/include/asm/cpu-features.h |    4 ++++
 arch/mips/kernel/traps.c             |    2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
index 1cba4b2..8ab1d12 100644
--- a/arch/mips/include/asm/cpu-features.h
+++ b/arch/mips/include/asm/cpu-features.h
@@ -234,4 +234,8 @@
 #define cpu_scache_line_size()	cpu_data[0].scache.linesz
 #endif
 
+#ifndef cpu_hwrena_impl_bits
+#define cpu_hwrena_impl_bits		0
+#endif
+
 #endif /* __ASM_CPU_FEATURES_H */
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index c3cc42e..efcb509 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1541,7 +1541,7 @@ void __cpuinit per_cpu_trap_init(void)
 			 status_set);
 
 	if (cpu_has_mips_r2) {
-		unsigned int enable = 0x0000000f;
+		unsigned int enable = 0x0000000f | cpu_hwrena_impl_bits;
 
 		if (!noulri && cpu_has_userlocal)
 			enable |= (1 << 29);
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] MIPS: Move Cavium CP0 hwrena impl bits to cpu-feature-overrides.h
  2009-05-13 22:57 [PATCH 0/2] Clean up CP0 hwrena code in traps.c David Daney
  2009-05-13 22:59 ` [PATCH 1/2] MIPS: Allow CPU specific overriding of CP0 hwrena impl bits David Daney
@ 2009-05-13 22:59 ` David Daney
  2009-06-16 10:31 ` [PATCH 0/2] Clean up CP0 hwrena code in traps.c Ralf Baechle
  2 siblings, 0 replies; 4+ messages in thread
From: David Daney @ 2009-05-13 22:59 UTC (permalink / raw)
  To: linux-mips, ralf; +Cc: David Daney

We had an ugly #ifdef for Cavium Octeon hwrena bits in traps.c, remove
it to mach-cavium-octeon/cpu-feature-overrides.h

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 .../asm/mach-cavium-octeon/cpu-feature-overrides.h |    1 +
 arch/mips/kernel/traps.c                           |    4 ----
 2 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h b/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h
index bb291f4..3d83075 100644
--- a/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h
+++ b/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h
@@ -53,6 +53,7 @@
 #define cpu_has_userlocal	0
 #define cpu_has_vint		0
 #define cpu_has_veic		0
+#define cpu_hwrena_impl_bits	0xc0000000
 #define ARCH_HAS_READ_CURRENT_TIMER 1
 #define ARCH_HAS_IRQ_PER_CPU	1
 #define ARCH_HAS_SPINLOCK_PREFETCH 1
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index efcb509..295a584 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1549,10 +1549,6 @@ void __cpuinit per_cpu_trap_init(void)
 		write_c0_hwrena(enable);
 	}
 
-#ifdef CONFIG_CPU_CAVIUM_OCTEON
-	write_c0_hwrena(0xc000000f); /* Octeon has register 30 and 31 */
-#endif
-
 #ifdef CONFIG_MIPS_MT_SMTC
 	if (!secondaryTC) {
 #endif /* CONFIG_MIPS_MT_SMTC */
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] Clean up CP0 hwrena code in traps.c
  2009-05-13 22:57 [PATCH 0/2] Clean up CP0 hwrena code in traps.c David Daney
  2009-05-13 22:59 ` [PATCH 1/2] MIPS: Allow CPU specific overriding of CP0 hwrena impl bits David Daney
  2009-05-13 22:59 ` [PATCH 2/2] MIPS: Move Cavium CP0 hwrena impl bits to cpu-feature-overrides.h David Daney
@ 2009-06-16 10:31 ` Ralf Baechle
  2 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2009-06-16 10:31 UTC (permalink / raw)
  To: David Daney; +Cc: linux-mips

On Wed, May 13, 2009 at 03:57:59PM -0700, David Daney wrote:

> There is an ugly #ifdef CONFIG_CPU_CAVIUM_OCTEON in the middle of
> traps.c.  We can get rid of it if we add a cpu feature for
> implementation dependent hwrena bits.  The first patch adds the
> feature macro and the second removes the #ifdef by setting the feature
> for Octeon.

I was wondering if maybe this should be a per-CPU thing but then again
hitting such a highly assymetric system is unlikely even in the embedded
world.

Thanks, queued for 2.6.31,

  Ralf

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-16 10:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-13 22:57 [PATCH 0/2] Clean up CP0 hwrena code in traps.c David Daney
2009-05-13 22:59 ` [PATCH 1/2] MIPS: Allow CPU specific overriding of CP0 hwrena impl bits David Daney
2009-05-13 22:59 ` [PATCH 2/2] MIPS: Move Cavium CP0 hwrena impl bits to cpu-feature-overrides.h David Daney
2009-06-16 10:31 ` [PATCH 0/2] Clean up CP0 hwrena code in traps.c Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).