Subject: Re: port-shark/22355 [was: Help needed to fix NetBSD/shark]
To: None <chris@dokein.co.uk, jmmv84@gmail.com>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-arm
Date: 08/05/2007 05:22:49
I wrote:

> chris@dokein.co.uk wrote:
> 
> > That's definetly wrong.  jmmv's found that the attached isa_irq.S patch
> > helps, but still causes hangs.
> 
> Hmm, the patch makes kernel boot into single user
> (i.e. now it can mount nfsroot via dhcp),
> but it hangs during /etc/rc script.
> 
> There is no assertion in cpu_idle(9) and
> I can't get ddb(4) prompt even on serial console,
> so maybe it's a different problem. (spl race?)

The attached one seems working fine.

Calling raisespl()/splx() from irq_entry() might be problematic?
(note I have few knowledge about ARM asm..)
---
Izumi Tsutsui


Index: shark/isa/isa_irq.S
===================================================================
RCS file: /cvsroot/src/sys/arch/shark/isa/isa_irq.S,v
retrieving revision 1.7
diff -u -r1.7 isa_irq.S
--- shark/isa/isa_irq.S	9 Mar 2007 19:21:59 -0000	1.7
+++ shark/isa/isa_irq.S	4 Aug 2007 19:57:21 -0000
@@ -116,6 +116,9 @@
 Lspl_masks:
 	.word	_C_LABEL(spl_masks)
 
+Lspl_mask:
+	.word	_C_LABEL(spl_mask)	/* irq's allowed at current spl level */
+
 /*
  * Register usage
  *
@@ -201,6 +204,11 @@
 	/* r9 = SPL level of highest priority interrupt */
 	add	r9, r9, #1
 	ldr	r2, [r7, r9, lsl #2]
+
+	/* Set spl_mask per the highest priority */
+	ldr	r3, Lspl_mask
+	str	r2, [r3]
+
 	mvn	r2, r2
 	orr	r0, r0, r2
 
@@ -270,6 +278,12 @@
 	ldr	r1, Lcurrent_spl_level
 	str	r2, [r1]
 
+	/* Restore spl_mask for the previous current_spl_level */
+	ldr	r7, Lspl_masks
+	ldr	r1, [r7, r2, lsl #2]
+	ldr	r0, Lspl_mask
+	str	r1, [r0]
+
 	/* Restore previous disabled mask */
 	ldmfd	sp!, {r2}
 	ldr	r1, Ldisabled_mask
@@ -297,9 +311,6 @@
 	/* NOT REACHED */
 	b	. - 8
 
-Lspl_mask:
-	.word	_C_LABEL(spl_mask)	/* irq's allowed at current spl level */
-
 Lcurrent_mask:
 	.word	_C_LABEL(current_mask)	/* irq's that are usable */