Re: V240 Status?

Takeshi Nakayama <[email protected]>
Newsgroups gmane.os.netbsd.ports.sparc64
Message-ID <[email protected]>
>>> Martin Husemann <[email protected]> wrote

> On Tue, Jan 22, 2013 at 07:50:08PM +0900, Takeshi Nakayama wrote:
> > Other idea is just schedule a softint in IPI-handler:
> 
> I prefer to do the full TRAP_SETUP() dance (and move the function to locore.s),
> which will make it usefull for future work with other target functions, e.g.
> if we convert fpu handling to pcu(9).

Sure.

Btw, I just wrote the code realize my idea.  It will be useful
temporary to make the fssconfig work.

-- Takeshi Nakayama
sparc64-xcall-fix.diff (text/plain, 3.5 KB)
Index: include/cpu.h
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc64/include/cpu.h,v
retrieving revision 1.100
diff -u -d -r1.100 cpu.h
--- include/cpu.h	9 Nov 2012 10:05:59 -0000	1.100
+++ include/cpu.h	22 Jan 2013 12:48:16 -0000
@@ -134,6 +134,7 @@
 	/* Interrupts */
 	struct intrhand		*ci_intrpending[16];
 	struct intrhand		*ci_tick_ih;
+	struct intrhand		*ci_xcall_ih;
 
 	/* Event counters */
 	struct evcnt		ci_tick_evcnt;
Index: sparc64/cpu.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc64/sparc64/cpu.c,v
retrieving revision 1.103
diff -u -d -r1.103 cpu.c
--- sparc64/cpu.c	8 Nov 2012 00:34:38 -0000	1.103
+++ sparc64/cpu.c	22 Jan 2013 12:48:16 -0000
@@ -285,6 +285,7 @@
 	evcnt_attach_dynamic(&ci->ci_tick_evcnt, EVCNT_TYPE_INTR, NULL,
 			     device_xname(dev), "timer");
 	mutex_init(&ci->ci_ctx_lock, MUTEX_SPIN, IPL_VM);
+	ci->ci_xcall_ih = sparc_softintr_establish(PIL_HIGH, NULL, NULL);
 
 	clk = prom_getpropint(node, "clock-frequency", 0);
 	if (clk == 0) {
Index: sparc64/genassym.cf
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc64/sparc64/genassym.cf,v
retrieving revision 1.66
diff -u -d -r1.66 genassym.cf
--- sparc64/genassym.cf	20 Jul 2011 12:06:00 -0000	1.66
+++ sparc64/genassym.cf	22 Jan 2013 12:48:16 -0000
@@ -160,6 +160,7 @@
 define	CI_IDEPTH	offsetof(struct cpu_info, ci_idepth)
 define	CI_INTRPENDING	offsetof(struct cpu_info, ci_intrpending)
 define	CI_TICK_IH	offsetof(struct cpu_info, ci_tick_ih)
+define	CI_XCALL_IH	offsetof(struct cpu_info, ci_xcall_ih)
 define	CI_CTXBUSY	offsetof(struct cpu_info, ci_ctxbusy)
 define	CI_TSB_DMMU	offsetof(struct cpu_info, ci_tsb_dmmu)
 define	CI_TSB_IMMU	offsetof(struct cpu_info, ci_tsb_immu)
Index: sparc64/locore.s
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc64/sparc64/locore.s,v
retrieving revision 1.345
diff -u -d -r1.345 locore.s
--- sparc64/locore.s	10 Nov 2012 01:47:25 -0000	1.345
+++ sparc64/locore.s	22 Jan 2013 12:48:17 -0000
@@ -3130,6 +3130,7 @@
 	inc	%g1
 	stx	%g1, [%g5 + IH_CNT]
 
+	.globl	setup_sparcintr
 setup_sparcintr:
 	LDPTR	[%g5+IH_PEND], %g6	! Read pending flag
 	brnz,pn	%g6, ret_from_intr_vector ! Skip it if it's running
Index: sparc64/mp_subr.S
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc64/sparc64/mp_subr.S,v
retrieving revision 1.3
diff -u -d -r1.3 mp_subr.S
--- sparc64/mp_subr.S	12 Jul 2011 07:51:34 -0000	1.3
+++ sparc64/mp_subr.S	22 Jan 2013 12:48:17 -0000
@@ -418,14 +418,12 @@
  *	%g3 = single argument to called function
  */
 ENTRY(sparc64_ipi_ccall)
-	save %sp, -CC64FSZ-16, %sp			! create a stack frame
-	stx %g2, [%fp + BIAS -16 + 0]			! save function pointer
-	stx %g3, [%fp + BIAS -16 + 8]			! and argument
-	wrpr    %g0, PSTATE_KERN, %pstate		! switch globals
-	ldx [%fp + BIAS -16 + 0], %l0			! reload function
-	call %l0					! call function
-	 ldx [%fp + BIAS -16 + 8], %o0			! reload argument 
-	restore						! pop stack frame
-	ba,a	ret_from_intr_vector			! and return from IPI
+	sethi	%hi(CPUINFO_VA+CI_XCALL_IH), %g6	! curcpu()->ci_xcall_ih
+	LDPTR	[%g6 + %lo(CPUINFO_VA+CI_XCALL_IH)], %g5
+	LDPTR	[%g5 + IH_PEND], %g6			! read pending flag
+	brnz,pn	%g6, ret_from_intr_vector		! skip if it's running
 	 nop
+	STPTR	%g2, [%g5 + IH_FUN]			! set func and arg
+	ba,pt	%icc, setup_sparcintr
+	 STPTR	%g3, [%g5 + IH_ARG]
 #endif
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.