summaryrefslogtreecommitdiff
path: root/sys/arch/amd64/include
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2019-03-25 18:48:13 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2019-03-25 18:48:13 +0000
commita0609559123abf99b9d87e3d84d1800d013d444d (patch)
tree021bc27d4d4bc2af4ad9d538020c6289874d41f8 /sys/arch/amd64/include
parentbd0a1a6eeaab32af58ae54b8dd1e1fe12b8a0163 (diff)
Fix pctr(4) issues with MP and suspend:
- use an IPI to notify other CPUs toi update CR4 and the MSRs - use the cpu(4) resume callback to restore the pctr(4) settings after suspend/hibernate ok kettenis@ deraadt@
Diffstat (limited to 'sys/arch/amd64/include')
-rw-r--r--sys/arch/amd64/include/intrdefs.h4
-rw-r--r--sys/arch/amd64/include/pctr.h19
2 files changed, 5 insertions, 18 deletions
diff --git a/sys/arch/amd64/include/intrdefs.h b/sys/arch/amd64/include/intrdefs.h
index cecb7061123..93c30ebd59c 100644
--- a/sys/arch/amd64/include/intrdefs.h
+++ b/sys/arch/amd64/include/intrdefs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intrdefs.h,v 1.19 2019/03/25 18:45:27 guenther Exp $ */
+/* $OpenBSD: intrdefs.h,v 1.20 2019/03/25 18:48:12 guenther Exp $ */
/* $NetBSD: intrdefs.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */
#ifndef _AMD64_INTRDEFS_H
@@ -76,7 +76,7 @@
#define X86_IPI_HALT 0x00000001
#define X86_IPI_NOP 0x00000002
-#define X86_IPI_TLB 0x00000010
+#define X86_IPI_PCTR 0x00000010
#define X86_IPI_MTRR 0x00000020
#define X86_IPI_SETPERF 0x00000040
#define X86_IPI_DDB 0x00000080
diff --git a/sys/arch/amd64/include/pctr.h b/sys/arch/amd64/include/pctr.h
index 65defd7d32d..5a0a14b40dc 100644
--- a/sys/arch/amd64/include/pctr.h
+++ b/sys/arch/amd64/include/pctr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pctr.h,v 1.5 2014/03/29 18:09:28 guenther Exp $ */
+/* $OpenBSD: pctr.h,v 1.6 2019/03/25 18:48:12 guenther Exp $ */
/*
* Pentium performance counter driver for OpenBSD.
@@ -69,25 +69,12 @@ struct pctrst {
#ifdef _KERNEL
-#define rdmsr(msr) \
-({ \
- u_int32_t hi, lo; \
- __asm volatile("rdmsr" \
- : "=d" (hi), "=a" (lo) : "c" (msr)); \
- ((u_int64_t)hi << 32) | (u_int64_t) lo; \
-})
-
-#define wrmsr(msr, v) \
-({ \
- __asm volatile("wrmsr" : \
- : "a" ((u_int64_t)v & 0xffffffff), \
- "d" ((u_int64_t)v >> 32), "c" (msr)); \
-})
-
void pctrattach(int);
int pctropen(dev_t, int, int, struct proc *);
int pctrclose(dev_t, int, int, struct proc *);
int pctrioctl(dev_t, u_long, caddr_t, int, struct proc *);
+void pctr_reload(struct cpu_info *);
+void pctr_resume(struct cpu_info *);
#endif /* _KERNEL */
#endif /* ! _MACHINE_PCTR_H_ */