diff options
author | Takuya ASADA <syuu@cvs.openbsd.org> | 2009-12-28 06:55:28 +0000 |
---|---|---|
committer | Takuya ASADA <syuu@cvs.openbsd.org> | 2009-12-28 06:55:28 +0000 |
commit | b2b08df5c106c5e8cac2811d8df5c66fe96004c3 (patch) | |
tree | 9ea97733d69606eaa53618f04917521648c68814 /sys/arch/sgi | |
parent | 9300643b1fd7b4deadca89da4d58a5b8debb934d (diff) |
MP-safe pmap implemented, enable IPI in interrupt handler to avoid deadlock.
ok miod@
Diffstat (limited to 'sys/arch/sgi')
-rw-r--r-- | sys/arch/sgi/include/intr.h | 10 | ||||
-rw-r--r-- | sys/arch/sgi/include/mutex.h | 5 | ||||
-rw-r--r-- | sys/arch/sgi/sgi/intr_template.c | 18 | ||||
-rw-r--r-- | sys/arch/sgi/sgi/ip30_machdep.c | 12 |
4 files changed, 31 insertions, 14 deletions
diff --git a/sys/arch/sgi/include/intr.h b/sys/arch/sgi/include/intr.h index 03f7706f7f3..b9048294b45 100644 --- a/sys/arch/sgi/include/intr.h +++ b/sys/arch/sgi/include/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.39 2009/12/02 01:52:28 syuu Exp $ */ +/* $OpenBSD: intr.h,v 1.40 2009/12/28 06:55:27 syuu Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -186,6 +186,14 @@ void set_intr(int, uint32_t, uint32_t(*)(uint32_t, struct trap_frame *)); uint32_t updateimask(uint32_t); void dosoftint(void); +#ifdef MULTIPROCESSOR +#if defined (TGT_OCTANE) +#define ENABLEIPI() updateimask(~CR_INT_2) /* enable IPI interrupt level */ +#else +#error MULTIPROCESSOR kernel not supported on this configuration +#endif +#endif + #endif /* _LOCORE */ #endif /* _MACHINE_INTR_H_ */ diff --git a/sys/arch/sgi/include/mutex.h b/sys/arch/sgi/include/mutex.h index 1d84c23882d..490d62b4f5c 100644 --- a/sys/arch/sgi/include/mutex.h +++ b/sys/arch/sgi/include/mutex.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.h,v 1.5 2009/11/04 02:26:24 syuu Exp $ */ +/* $OpenBSD: mutex.h,v 1.6 2009/12/28 06:55:27 syuu Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -28,9 +28,6 @@ #ifndef _MACHINE_MUTEX_H_ #define _MACHINE_MUTEX_H_ -/* - * Simple non-mp implementation. - */ struct mutex { int mtx_lock; int mtx_wantipl; diff --git a/sys/arch/sgi/sgi/intr_template.c b/sys/arch/sgi/sgi/intr_template.c index 84da344c1ba..f9adce561b2 100644 --- a/sys/arch/sgi/sgi/intr_template.c +++ b/sys/arch/sgi/sgi/intr_template.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intr_template.c,v 1.8 2009/12/02 01:52:28 syuu Exp $ */ +/* $OpenBSD: intr_template.c,v 1.9 2009/12/28 06:55:27 syuu Exp $ */ /* * Copyright (c) 2009 Miodrag Vallat. @@ -150,15 +150,31 @@ INTR_FUNCTIONNAME(uint32_t hwpend, struct trap_frame *frame) rc = 0; for (ih = INTR_HANDLER(bitno); ih != NULL; ih = ih->ih_next) { +#ifdef MULTIPROCESSOR + u_int32_t sr; +#endif #if defined(INTR_HANDLER_SKIP) if (INTR_HANDLER_SKIP(ih) != 0) continue; #endif splraise(ih->ih_level); +#ifdef MULTIPROCESSOR + if (ih->ih_level < IPL_IPI) { + sr = getsr(); + ENABLEIPI(); + __mp_lock(&kernel_lock); + } +#endif if ((*ih->ih_fun)(ih->ih_arg) != 0) { rc = 1; atomic_add_uint64(&ih->ih_count.ec_count, 1); } +#ifdef MULTIPROCESSOR + if (ih->ih_level < IPL_IPI) { + __mp_unlock(&kernel_lock); + setsr(sr); + } +#endif __asm__ (".set noreorder\n"); ci->ci_ipl = ipl; __asm__ ("sync\n\t.set reorder\n"); diff --git a/sys/arch/sgi/sgi/ip30_machdep.c b/sys/arch/sgi/sgi/ip30_machdep.c index 6b637e778d9..7367c9bbe10 100644 --- a/sys/arch/sgi/sgi/ip30_machdep.c +++ b/sys/arch/sgi/sgi/ip30_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip30_machdep.c,v 1.27 2009/12/07 19:05:59 miod Exp $ */ +/* $OpenBSD: ip30_machdep.c,v 1.28 2009/12/28 06:55:27 syuu Exp $ */ /* * Copyright (c) 2008, 2009 Miodrag Vallat. @@ -377,6 +377,7 @@ void hw_cpu_hatch(struct cpu_info *ci) { int cpuid = ci->ci_cpuid; + int s; /* * Make sure we can access the extended address space. @@ -405,7 +406,7 @@ hw_cpu_hatch(struct cpu_info *ci) tlb_flush(sys_config.cpu[cpuid].tlbsize); tlb_set_wired(sys_config.cpu[cpuid].tlbwired); - tlb_set_pid(1); + tlb_set_pid(0); /* * Turn off bootstrap exception vectors. @@ -428,19 +429,14 @@ hw_cpu_hatch(struct cpu_info *ci) spl0(); (void)updateimask(0); -#ifdef notyet SCHED_LOCK(s); cpu_switchto(NULL, sched_chooseproc()); -#else - for(;;) - ; -#endif } int hw_ipi_intr_establish(int (*func)(void *), u_long cpuid) { return xheart_intr_establish(func, (void *)cpuid, HEART_ISR_IPI(cpuid), - IPL_IPI, NULL, curcpu()->ci_ipiih); + IPL_IPI, NULL, &curcpu()->ci_ipiih); }; void hw_ipi_intr_set(u_long cpuid) |