Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177543789
D6566.1794675145.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D6566.1794675145.diff
View Options
Index: head/sys/dev/hyperv/vmbus/hv_et.c
===================================================================
--- head/sys/dev/hyperv/vmbus/hv_et.c
+++ head/sys/dev/hyperv/vmbus/hv_et.c
@@ -37,12 +37,17 @@
#include <sys/time.h>
#include <sys/timeet.h>
-#include "hv_vmbus_priv.h"
+#include <dev/hyperv/vmbus/hv_vmbus_priv.h>
+#include <dev/hyperv/vmbus/hyperv_reg.h>
#define HV_TIMER_FREQUENCY (10 * 1000 * 1000LL) /* 100ns period */
#define HV_MAX_DELTA_TICKS 0xffffffffLL
#define HV_MIN_DELTA_TICKS 1LL
+#define MSR_HV_STIMER0_CFG_SINT \
+ ((((uint64_t)HV_VMBUS_TIMER_SINT) << MSR_HV_STIMER_CFG_SINT_SHIFT) & \
+ MSR_HV_STIMER_CFG_SINT_MASK)
+
static struct eventtimer *et;
static inline uint64_t
@@ -57,18 +62,15 @@
static int
hv_et_start(struct eventtimer *et, sbintime_t firsttime, sbintime_t periodtime)
{
- union hv_timer_config timer_cfg;
- uint64_t current;
+ uint64_t current, config;
- timer_cfg.as_uint64 = 0;
- timer_cfg.auto_enable = 1;
- timer_cfg.sintx = HV_VMBUS_TIMER_SINT;
+ config = MSR_HV_STIMER_CFG_AUTOEN | MSR_HV_STIMER0_CFG_SINT;
- current = rdmsr(HV_X64_MSR_TIME_REF_COUNT);
+ current = rdmsr(MSR_HV_TIME_REF_COUNT);
current += sbintime2tick(firsttime);
- wrmsr(HV_X64_MSR_STIMER0_CONFIG, timer_cfg.as_uint64);
- wrmsr(HV_X64_MSR_STIMER0_COUNT, current);
+ wrmsr(MSR_HV_STIMER0_CONFIG, config);
+ wrmsr(MSR_HV_STIMER0_COUNT, current);
return (0);
}
@@ -76,8 +78,8 @@
static int
hv_et_stop(struct eventtimer *et)
{
- wrmsr(HV_X64_MSR_STIMER0_CONFIG, 0);
- wrmsr(HV_X64_MSR_STIMER0_COUNT, 0);
+ wrmsr(MSR_HV_STIMER0_CONFIG, 0);
+ wrmsr(MSR_HV_STIMER0_COUNT, 0);
return (0);
}
Index: head/sys/dev/hyperv/vmbus/hv_hv.c
===================================================================
--- head/sys/dev/hyperv/vmbus/hv_hv.c
+++ head/sys/dev/hyperv/vmbus/hv_hv.c
@@ -91,8 +91,7 @@
static u_int
hv_get_timecount(struct timecounter *tc)
{
- u_int now = rdmsr(HV_X64_MSR_TIME_REF_COUNT);
- return (now);
+ return rdmsr(MSR_HV_TIME_REF_COUNT);
}
/**
Index: head/sys/dev/hyperv/vmbus/hyperv_reg.h
===================================================================
--- head/sys/dev/hyperv/vmbus/hyperv_reg.h
+++ head/sys/dev/hyperv/vmbus/hyperv_reg.h
@@ -54,6 +54,8 @@
#define MSR_HV_VP_INDEX 0x40000002
+#define MSR_HV_TIME_REF_COUNT 0x40000020
+
#define MSR_HV_SCONTROL 0x40000080
#define MSR_HV_SCTRL_ENABLE 0x0001ULL
#define MSR_HV_SCTRL_RSVD_MASK 0xfffffffffffffffeULL
@@ -77,6 +79,16 @@
#define MSR_HV_SINT_RSVD_MASK (MSR_HV_SINT_RSVD1_MASK | \
MSR_HV_SINT_RSVD2_MASK)
+#define MSR_HV_STIMER0_CONFIG 0x400000b0
+#define MSR_HV_STIMER_CFG_ENABLE 0x0001ULL
+#define MSR_HV_STIMER_CFG_PERIODIC 0x0002ULL
+#define MSR_HV_STIMER_CFG_LAZY 0x0004ULL
+#define MSR_HV_STIMER_CFG_AUTOEN 0x0008ULL
+#define MSR_HV_STIMER_CFG_SINT_MASK 0x000f0000ULL
+#define MSR_HV_STIMER_CFG_SINT_SHIFT 16
+
+#define MSR_HV_STIMER0_COUNT 0x400000b1
+
/*
* CPUID leaves
*/
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 14, 4:52 PM (9 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41728126
Default Alt Text
D6566.1794675145.diff (2 KB)
Attached To
Mode
D6566: hyperv: Move timer related MSRs into hyperv_reg.h
Attached
Detach File
Event Timeline