Linux MIPS Architecture development
 help / color / mirror / Atom feed
* SMTC Patch
@ 2007-05-29 13:42 Kevin D. Kissell
  2007-05-31 16:13 ` Ralf Baechle
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin D. Kissell @ 2007-05-29 13:42 UTC (permalink / raw)
  To: linux-mips

[-- Attachment #1: Type: text/plain, Size: 779 bytes --]

The attached patch fixes some problems with the linux-mips.org
2.6.21 kernel for SMTC kernels for the Malta platform.

The fix to smtc.c just eliminates a warning that crept in.

The fixes to traps.c eliminate a hypothetical problem with
out-of-bounds arguments (which were being reported, but acted
upon anyway, which was somewhat insane) and a real one with
PageMask going uninitialized in VPE 1 on any MIPS MT processor
that doesn't reset PageMask to a sane value, which the archtecture
does not require.

The restoration of the #define in mips-boards/generic/time.c
is necessary to make the Malta SMTC kernel build.  If whoever
deleted it has a good reason for it not to be done the way it's
done, that's OK, but *some* definition must be provided.

			Regards,

			Kevin K.

[-- Attachment #2: smtc_patch_29052007 --]
[-- Type: text/plain, Size: 2002 bytes --]

diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index b361edb..21eb599 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -611,12 +611,12 @@ void smtc_cpus_done(void)
 int setup_irq_smtc(unsigned int irq, struct irqaction * new,
 			unsigned long hwmask)
 {
+#ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG
 	unsigned int vpe = current_cpu_data.vpe_id;
 
-	irq_hwmask[irq] = hwmask;
-#ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG
 	vpemask[vpe][irq - MIPSCPU_INT_BASE] = 1;
 #endif
+	irq_hwmask[irq] = hwmask;
 
 	return setup_irq(irq, new);
 }
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 48c8b25..b42db85 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1190,10 +1190,12 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
 
 		memcpy (b, &except_vec_vi, handler_len);
 #ifdef CONFIG_MIPS_MT_SMTC
-		if (n > 7)
+		if (n < 8) {
+			w = (u32 *)(b + mori_offset);
+			*w = (*w & 0xffff0000) | (0x100 << n);
+		} else {
 			printk("Vector index %d exceeds SMTC maximum\n", n);
-		w = (u32 *)(b + mori_offset);
-		*w = (*w & 0xffff0000) | (0x100 << n);
+		}
 #endif /* CONFIG_MIPS_MT_SMTC */
 		w = (u32 *)(b + lui_offset);
 		*w = (*w & 0xffff0000) | (((u32)handler >> 16) & 0xffff);
@@ -1383,6 +1385,13 @@ void __init per_cpu_trap_init(void)
 		cpu_cache_init();
 		tlb_init();
 #ifdef CONFIG_MIPS_MT_SMTC
+	} else if(!secondaryTC) {
+	/*
+	 * First TC in non-boot VPE must do subset of tlb_init()
+	 * for MMU countrol registers.
+	 */
+		write_c0_pagemask(PM_DEFAULT_MASK);
+		write_c0_wired(0);
 	}
 #endif /* CONFIG_MIPS_MT_SMTC */
 }
diff --git a/arch/mips/mips-boards/generic/time.c b/arch/mips/mips-boards/generic/time.c
index f0366af..2f73c34 100644
--- a/arch/mips/mips-boards/generic/time.c
+++ b/arch/mips/mips-boards/generic/time.c
@@ -51,6 +51,8 @@
 #include <asm/mips-boards/seadint.h>
 #endif
 
+#define CPUCTR_IMASKBIT (0x100 << MIPSCPU_INT_CPUCTR)
+
 unsigned long cpu_khz;
 
 static int mips_cpu_timer_irq;

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

* Re: SMTC Patch
  2007-05-29 13:42 SMTC Patch Kevin D. Kissell
@ 2007-05-31 16:13 ` Ralf Baechle
  0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2007-05-31 16:13 UTC (permalink / raw)
  To: Kevin D. Kissell; +Cc: linux-mips

On Tue, May 29, 2007 at 03:42:48PM +0200, Kevin D. Kissell wrote:

> The attached patch fixes some problems with the linux-mips.org
> 2.6.21 kernel for SMTC kernels for the Malta platform.
> 
> The fix to smtc.c just eliminates a warning that crept in.
> 
> The fixes to traps.c eliminate a hypothetical problem with
> out-of-bounds arguments (which were being reported, but acted
> upon anyway, which was somewhat insane)

set_vi_srs_handler is a void function, so currently can't return an
error either and not scribbling around isn't really a solution either
because no matter waht, for a vector number >= 8 won't work right.
So I went for a more drastic solution using BUG_ON().

> and a real one with
> PageMask going uninitialized in VPE 1 on any MIPS MT processor
> that doesn't reset PageMask to a sane value, which the archtecture
> does not require.
> 
> The restoration of the #define in mips-boards/generic/time.c
> is necessary to make the Malta SMTC kernel build.  If whoever
> deleted it has a good reason for it not to be done the way it's
> done, that's OK, but *some* definition must be provided.

I really don't see why we should fix code that writes r/o bits in a
failed attempt to do something that already happens elsewhere, so I
applied the patch which Chris sent in private.

Btw, your patch was dealing with four separate issues.  Would be kind of
handy if something like that would be submitted as four separate patches.

  Ralf

PS: A Signed-off-by: line please!

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

end of thread, other threads:[~2007-05-31 16:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-29 13:42 SMTC Patch Kevin D. Kissell
2007-05-31 16:13 ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox