summaryrefslogtreecommitdiffstats
path: root/sys/dev/hyperv/include
diff options
context:
space:
mode:
authorsephe <sephe@FreeBSD.org>2017-01-04 01:58:38 +0000
committersephe <sephe@FreeBSD.org>2017-01-04 01:58:38 +0000
commit923185c1556e28efc10e1d35ad9c829c7bf02ab1 (patch)
tree8c9b642ae9f21a497a9d336ff2fb7a53c12085b2 /sys/dev/hyperv/include
parentf62d0b4bab6ac849b8f3d48130c5efc979c42b61 (diff)
downloadFreeBSD-src-923185c1556e28efc10e1d35ad9c829c7bf02ab1.zip
FreeBSD-src-923185c1556e28efc10e1d35ad9c829c7bf02ab1.tar.gz
MFC 310048,310101
310048 hyperv: Implement "enlightened" time counter, which is rdtsc based. Reviewed by: kib Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8763 310101 hyperv: Allow userland to ro-mmap reference TSC page This paves way to implement VDSO for the enlightened time counter. Reviewed by: kib Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8768
Diffstat (limited to 'sys/dev/hyperv/include')
-rw-r--r--sys/dev/hyperv/include/hyperv.h32
1 files changed, 27 insertions, 5 deletions
diff --git a/sys/dev/hyperv/include/hyperv.h b/sys/dev/hyperv/include/hyperv.h
index c5e7dec..0eda9f0 100644
--- a/sys/dev/hyperv/include/hyperv.h
+++ b/sys/dev/hyperv/include/hyperv.h
@@ -31,10 +31,10 @@
#ifndef _HYPERV_H_
#define _HYPERV_H_
-#include <sys/param.h>
+#ifdef _KERNEL
-#include <vm/vm.h>
-#include <vm/pmap.h>
+#include <sys/param.h>
+#include <sys/systm.h>
#define MSR_HV_TIME_REF_COUNT 0x40000020
@@ -45,6 +45,7 @@
#define CPUID_HV_MSR_HYPERCALL 0x0020 /* MSR_HV_GUEST_OS_ID
* MSR_HV_HYPERCALL */
#define CPUID_HV_MSR_VP_INDEX 0x0040 /* MSR_HV_VP_INDEX */
+#define CPUID_HV_MSR_REFERENCE_TSC 0x0200 /* MSR_HV_REFERENCE_TSC */
#define CPUID_HV_MSR_GUEST_IDLE 0x0400 /* MSR_HV_GUEST_IDLE */
#ifndef NANOSEC
@@ -53,14 +54,35 @@
#define HYPERV_TIMER_NS_FACTOR 100ULL
#define HYPERV_TIMER_FREQ (NANOSEC / HYPERV_TIMER_NS_FACTOR)
+#endif /* _KERNEL */
+
+#define HYPERV_REFTSC_DEVNAME "hv_tsc"
+
+/*
+ * Hyper-V Reference TSC
+ */
+struct hyperv_reftsc {
+ volatile uint32_t tsc_seq;
+ volatile uint32_t tsc_rsvd1;
+ volatile uint64_t tsc_scale;
+ volatile int64_t tsc_ofs;
+} __packed __aligned(PAGE_SIZE);
+#ifdef CTASSERT
+CTASSERT(sizeof(struct hyperv_reftsc) == PAGE_SIZE);
+#endif
+
+#ifdef _KERNEL
+
struct hyperv_guid {
- uint8_t hv_guid[16];
+ uint8_t hv_guid[16];
} __packed;
-#define HYPERV_GUID_STRLEN 40
+#define HYPERV_GUID_STRLEN 40
int hyperv_guid2str(const struct hyperv_guid *, char *, size_t);
extern u_int hyperv_features; /* CPUID_HV_MSR_ */
+#endif /* _KERNEL */
+
#endif /* _HYPERV_H_ */
OpenPOWER on IntegriCloud