diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-09-13 11:53:17 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-09-13 11:53:17 +0000 |
commit | 7c24d456bba7b0456f58a1b0fa01497fc5ed434e (patch) | |
tree | ad6a20a8404f9079469539dcf8f2dbc46b41ed26 /sys/arch/i386 | |
parent | 4fbdfac128ca3db37fe934ae30cbf755b331b1dc (diff) |
add an ipi for wbinvd and a linux style wbinvd_on_all_cpus() function
ok kettenis@ deraadt@
Diffstat (limited to 'sys/arch/i386')
-rw-r--r-- | sys/arch/i386/i386/cpu.c | 11 | ||||
-rw-r--r-- | sys/arch/i386/i386/ipifuncs.c | 10 | ||||
-rw-r--r-- | sys/arch/i386/include/cpufunc.h | 13 | ||||
-rw-r--r-- | sys/arch/i386/include/intrdefs.h | 7 |
4 files changed, 35 insertions, 6 deletions
diff --git a/sys/arch/i386/i386/cpu.c b/sys/arch/i386/i386/cpu.c index 3d39111b0be..592eeb1862a 100644 --- a/sys/arch/i386/i386/cpu.c +++ b/sys/arch/i386/i386/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.104 2020/05/29 04:42:23 deraadt Exp $ */ +/* $OpenBSD: cpu.c,v 1.105 2020/09/13 11:53:16 jsg Exp $ */ /* $NetBSD: cpu.c,v 1.1.2.7 2000/06/26 02:04:05 sommerfeld Exp $ */ /*- @@ -920,3 +920,12 @@ cpu_update_nmi_cr3(vaddr_t cr3) CPU_INFO_FOREACH(cii, ci) ci->ci_nmi_tss->tss_cr3 = cr3; } + +#ifdef MULTIPROCESSOR +int +wbinvd_on_all_cpus(void) +{ + i386_broadcast_ipi(I386_IPI_WBINVD); + return 0; +} +#endif diff --git a/sys/arch/i386/i386/ipifuncs.c b/sys/arch/i386/i386/ipifuncs.c index 6b705741d37..aada9fb54d1 100644 --- a/sys/arch/i386/i386/ipifuncs.c +++ b/sys/arch/i386/i386/ipifuncs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipifuncs.c,v 1.32 2019/01/18 01:34:50 pd Exp $ */ +/* $OpenBSD: ipifuncs.c,v 1.33 2020/09/13 11:53:16 jsg Exp $ */ /* $NetBSD: ipifuncs.c,v 1.1.2.3 2000/06/26 02:04:06 sommerfeld Exp $ */ /*- @@ -56,6 +56,7 @@ void i386_ipi_nop(struct cpu_info *); void i386_ipi_halt(struct cpu_info *); +void i386_ipi_wbinvd(struct cpu_info *); #if NNPX > 0 void i386_ipi_synch_fpu(struct cpu_info *); @@ -89,6 +90,7 @@ void (*ipifunc[I386_NIPI])(struct cpu_info *) = NULL, #endif i386_setperf_ipi, + i386_ipi_wbinvd, }; void @@ -140,6 +142,12 @@ i386_ipi_reload_mtrr(struct cpu_info *ci) #endif void +i386_ipi_wbinvd(struct cpu_info *ci) +{ + wbinvd(); +} + +void i386_spurious(void) { printf("spurious intr\n"); diff --git a/sys/arch/i386/include/cpufunc.h b/sys/arch/i386/include/cpufunc.h index 6346bbce32a..098b5982d20 100644 --- a/sys/arch/i386/include/cpufunc.h +++ b/sys/arch/i386/include/cpufunc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpufunc.h,v 1.32 2019/06/28 21:54:05 bluhm Exp $ */ +/* $OpenBSD: cpufunc.h,v 1.33 2020/09/13 11:53:16 jsg Exp $ */ /* $NetBSD: cpufunc.h,v 1.8 1994/10/27 04:15:59 cgd Exp $ */ /* @@ -197,6 +197,17 @@ wbinvd(void) __asm volatile("wbinvd" : : : "memory"); } +#ifdef MULTIPROCESSOR +int wbinvd_on_all_cpus(void); +#else +static inline int +wbinvd_on_all_cpus(void) +{ + wbinvd(); + return 0; +} +#endif + static __inline void clflush(u_int32_t addr) { diff --git a/sys/arch/i386/include/intrdefs.h b/sys/arch/i386/include/intrdefs.h index 26dac01251e..8a271605015 100644 --- a/sys/arch/i386/include/intrdefs.h +++ b/sys/arch/i386/include/intrdefs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intrdefs.h,v 1.17 2019/01/18 01:34:50 pd Exp $ */ +/* $OpenBSD: intrdefs.h,v 1.18 2020/09/13 11:53:16 jsg Exp $ */ /* $NetBSD: intrdefs.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */ #ifndef _I386_INTRDEFS_H @@ -116,13 +116,14 @@ #define I386_IPI_GDT 0x00000020 #define I386_IPI_DDB 0x00000040 /* synchronize while in ddb */ #define I386_IPI_SETPERF 0x00000080 +#define I386_IPI_WBINVD 0x00000100 -#define I386_NIPI 8 +#define I386_NIPI 9 #define I386_IPI_NAMES { "halt IPI", "nop IPI", "FPU flush IPI", \ "FPU synch IPI", \ "MTRR update IPI", "GDT update IPI", \ - "DDB IPI", "setperf IPI" } + "DDB IPI", "setperf IPI", "wbinvd IPI" } #define IREENT_MAGIC 0x18041969 |