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/mips64/include | |
parent | 9300643b1fd7b4deadca89da4d58a5b8debb934d (diff) |
MP-safe pmap implemented, enable IPI in interrupt handler to avoid deadlock.
ok miod@
Diffstat (limited to 'sys/arch/mips64/include')
-rw-r--r-- | sys/arch/mips64/include/atomic.h | 20 | ||||
-rw-r--r-- | sys/arch/mips64/include/cpu.h | 18 | ||||
-rw-r--r-- | sys/arch/mips64/include/pmap.h | 9 |
3 files changed, 36 insertions, 11 deletions
diff --git a/sys/arch/mips64/include/atomic.h b/sys/arch/mips64/include/atomic.h index ea4a2a7f121..7731a67baaa 100644 --- a/sys/arch/mips64/include/atomic.h +++ b/sys/arch/mips64/include/atomic.h @@ -1,4 +1,4 @@ -/* $OpenBSD: atomic.h,v 1.5 2009/11/27 00:08:27 syuu Exp $ */ +/* $OpenBSD: atomic.h,v 1.6 2009/12/28 06:55:27 syuu Exp $ */ /* Public Domain */ @@ -7,6 +7,24 @@ #if defined(_KERNEL) +/* wait until the bits to set are clear, and set them */ +static __inline void +atomic_wait_and_setbits_int(__volatile unsigned int *uip, unsigned int v) +{ + unsigned int tmp0, tmp1; + + __asm__ __volatile__ ( + "1: ll %0, 0(%2)\n" + " and %1, %0, %3\n" + " bnez %1, 1b\n" + " or %0, %3, %0\n" + " sc %0, 0(%2)\n" + " beqz %0, 1b\n" + " nop\n" : + "=&r"(tmp0), "=&r"(tmp1) : + "r"(uip), "r"(v) : "memory"); +} + static __inline void atomic_setbits_int(__volatile unsigned int *uip, unsigned int v) { diff --git a/sys/arch/mips64/include/cpu.h b/sys/arch/mips64/include/cpu.h index 34cb7ecc529..66ddd69cd42 100644 --- a/sys/arch/mips64/include/cpu.h +++ b/sys/arch/mips64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.48 2009/12/25 21:02:13 miod Exp $ */ +/* $OpenBSD: cpu.h,v 1.49 2009/12/28 06:55:27 syuu Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -384,7 +384,7 @@ struct cpu_info { u_int32_t ci_pendingticks; #ifdef MULTIPROCESSOR u_long ci_flags; /* flags; see below */ - struct intrhand *ci_ipiih; + struct intrhand ci_ipiih; #endif }; @@ -416,12 +416,12 @@ void cpu_boot_secondary_processors(void); vaddr_t smp_malloc(size_t); #define MIPS64_IPI_NOP 0x00000001 -#define MIPS64_NIPIS 1 /* must not exceed 32 */ +#define MIPS64_IPI_RENDEZVOUS 0x00000002 +#define MIPS64_NIPIS 2 /* must not exceed 32 */ -void mips64_ipi_init(void); -void mips64_send_ipi(unsigned int, unsigned int); -void mips64_broadcast_ipi(unsigned int); -void mips64_multicast_ipi(unsigned int, unsigned int); +void mips64_ipi_init(void); +void mips64_send_ipi(unsigned int, unsigned int); +void smp_rendezvous_cpus(unsigned long, void (*)(void *), void *arg); #include <sys/mplock.h> #else @@ -479,7 +479,11 @@ extern int int_nest_cntr; * Notify the current process (p) that it has a signal pending, * process as soon as possible. */ +#ifdef MULTIPROCESSOR +#define signotify(p) (aston(p), cpu_unidle(p->p_cpu)) +#else #define signotify(p) aston(p) +#endif #define aston(p) p->p_md.md_astpending = 1 diff --git a/sys/arch/mips64/include/pmap.h b/sys/arch/mips64/include/pmap.h index 002dcb012d1..98006ad6889 100644 --- a/sys/arch/mips64/include/pmap.h +++ b/sys/arch/mips64/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.16 2009/12/07 18:58:32 miod Exp $ */ +/* $OpenBSD: pmap.h,v 1.17 2009/12/28 06:55:27 syuu Exp $ */ /* * Copyright (c) 1987 Carnegie-Mellon University @@ -98,8 +98,9 @@ typedef struct pmap { int pm_count; /* pmap reference count */ simple_lock_data_t pm_lock; /* lock on pmap */ struct pmap_statistics pm_stats; /* pmap statistics */ - u_int pm_tlbpid; /* address space tag */ - u_int pm_tlbgen; /* TLB PID generation number */ + u_int pm_tlbpid[MAXCPUS]; /* address space tag */ + u_int pm_tlbgen[MAXCPUS]; /* TLB PID generation number */ + int pm_active; struct segtab *pm_segtab; /* pointers to pages of PTEs */ } *pmap_t; @@ -136,6 +137,8 @@ void pmap_page_cache(vm_page_t, int); #define pmap_unuse_final(p) do { /* nothing yet */ } while (0) #define pmap_remove_holes(map) do { /* nothing */ } while (0) +void pmap_update_user_page(pmap_t, vaddr_t, pt_entry_t); +void pmap_update_kernel_page(vaddr_t, pt_entry_t); #endif /* _KERNEL */ #endif /* !_MIPS_PMAP_H_ */ |