hv.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. /*
  2. * Copyright (c) 2009, Microsoft Corporation.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms and conditions of the GNU General Public License,
  6. * version 2, as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope it will be useful, but WITHOUT
  9. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. * more details.
  12. *
  13. * You should have received a copy of the GNU General Public License along with
  14. * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
  15. * Place - Suite 330, Boston, MA 02111-1307 USA.
  16. *
  17. * Authors:
  18. * Haiyang Zhang <haiyangz@microsoft.com>
  19. * Hank Janssen <hjanssen@microsoft.com>
  20. *
  21. */
  22. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  23. #include <linux/kernel.h>
  24. #include <linux/mm.h>
  25. #include <linux/slab.h>
  26. #include <linux/vmalloc.h>
  27. #include <linux/hyperv.h>
  28. #include <linux/version.h>
  29. #include <linux/interrupt.h>
  30. #include <linux/clockchips.h>
  31. #include <asm/hyperv.h>
  32. #include <asm/mshyperv.h>
  33. #include <asm/nospec-branch.h>
  34. #include "hyperv_vmbus.h"
  35. /* The one and only */
  36. struct hv_context hv_context = {
  37. .synic_initialized = false,
  38. .hypercall_page = NULL,
  39. };
  40. #define HV_TIMER_FREQUENCY (10 * 1000 * 1000) /* 100ns period */
  41. #define HV_MAX_MAX_DELTA_TICKS 0xffffffff
  42. #define HV_MIN_DELTA_TICKS 1
  43. /*
  44. * query_hypervisor_info - Get version info of the windows hypervisor
  45. */
  46. unsigned int host_info_eax;
  47. unsigned int host_info_ebx;
  48. unsigned int host_info_ecx;
  49. unsigned int host_info_edx;
  50. static int query_hypervisor_info(void)
  51. {
  52. unsigned int eax;
  53. unsigned int ebx;
  54. unsigned int ecx;
  55. unsigned int edx;
  56. unsigned int max_leaf;
  57. unsigned int op;
  58. /*
  59. * Its assumed that this is called after confirming that Viridian
  60. * is present. Query id and revision.
  61. */
  62. eax = 0;
  63. ebx = 0;
  64. ecx = 0;
  65. edx = 0;
  66. op = HVCPUID_VENDOR_MAXFUNCTION;
  67. cpuid(op, &eax, &ebx, &ecx, &edx);
  68. max_leaf = eax;
  69. if (max_leaf >= HVCPUID_VERSION) {
  70. eax = 0;
  71. ebx = 0;
  72. ecx = 0;
  73. edx = 0;
  74. op = HVCPUID_VERSION;
  75. cpuid(op, &eax, &ebx, &ecx, &edx);
  76. host_info_eax = eax;
  77. host_info_ebx = ebx;
  78. host_info_ecx = ecx;
  79. host_info_edx = edx;
  80. }
  81. return max_leaf;
  82. }
  83. /*
  84. * do_hypercall- Invoke the specified hypercall
  85. */
  86. static u64 do_hypercall(u64 control, void *input, void *output)
  87. {
  88. u64 input_address = (input) ? virt_to_phys(input) : 0;
  89. u64 output_address = (output) ? virt_to_phys(output) : 0;
  90. void *hypercall_page = hv_context.hypercall_page;
  91. #ifdef CONFIG_X86_64
  92. u64 hv_status = 0;
  93. if (!hypercall_page)
  94. return (u64)ULLONG_MAX;
  95. __asm__ __volatile__("mov %0, %%r8" : : "r" (output_address) : "r8");
  96. __asm__ __volatile__(CALL_NOSPEC :
  97. "=a" (hv_status) :
  98. "c" (control), "d" (input_address),
  99. THUNK_TARGET(hypercall_page));
  100. return hv_status;
  101. #else
  102. u32 control_hi = control >> 32;
  103. u32 control_lo = control & 0xFFFFFFFF;
  104. u32 hv_status_hi = 1;
  105. u32 hv_status_lo = 1;
  106. u32 input_address_hi = input_address >> 32;
  107. u32 input_address_lo = input_address & 0xFFFFFFFF;
  108. u32 output_address_hi = output_address >> 32;
  109. u32 output_address_lo = output_address & 0xFFFFFFFF;
  110. if (!hypercall_page)
  111. return (u64)ULLONG_MAX;
  112. __asm__ __volatile__ (CALL_NOSPEC : "=d"(hv_status_hi),
  113. "=a"(hv_status_lo) : "d" (control_hi),
  114. "a" (control_lo), "b" (input_address_hi),
  115. "c" (input_address_lo), "D"(output_address_hi),
  116. "S"(output_address_lo),
  117. THUNK_TARGET(hypercall_page));
  118. return hv_status_lo | ((u64)hv_status_hi << 32);
  119. #endif /* !x86_64 */
  120. }
  121. #ifdef CONFIG_X86_64
  122. static cycle_t read_hv_clock_tsc(struct clocksource *arg)
  123. {
  124. cycle_t current_tick;
  125. struct ms_hyperv_tsc_page *tsc_pg = hv_context.tsc_page;
  126. if (tsc_pg->tsc_sequence != -1) {
  127. /*
  128. * Use the tsc page to compute the value.
  129. */
  130. while (1) {
  131. cycle_t tmp;
  132. u32 sequence = tsc_pg->tsc_sequence;
  133. u64 cur_tsc;
  134. u64 scale = tsc_pg->tsc_scale;
  135. s64 offset = tsc_pg->tsc_offset;
  136. rdtscll(cur_tsc);
  137. /* current_tick = ((cur_tsc *scale) >> 64) + offset */
  138. asm("mulq %3"
  139. : "=d" (current_tick), "=a" (tmp)
  140. : "a" (cur_tsc), "r" (scale));
  141. current_tick += offset;
  142. if (tsc_pg->tsc_sequence == sequence)
  143. return current_tick;
  144. if (tsc_pg->tsc_sequence != -1)
  145. continue;
  146. /*
  147. * Fallback using MSR method.
  148. */
  149. break;
  150. }
  151. }
  152. rdmsrl(HV_X64_MSR_TIME_REF_COUNT, current_tick);
  153. return current_tick;
  154. }
  155. static struct clocksource hyperv_cs_tsc = {
  156. .name = "hyperv_clocksource_tsc_page",
  157. .rating = 425,
  158. .read = read_hv_clock_tsc,
  159. .mask = CLOCKSOURCE_MASK(64),
  160. .flags = CLOCK_SOURCE_IS_CONTINUOUS,
  161. };
  162. #endif
  163. /*
  164. * hv_init - Main initialization routine.
  165. *
  166. * This routine must be called before any other routines in here are called
  167. */
  168. int hv_init(void)
  169. {
  170. int max_leaf;
  171. union hv_x64_msr_hypercall_contents hypercall_msr;
  172. void *virtaddr = NULL;
  173. memset(hv_context.synic_event_page, 0, sizeof(void *) * NR_CPUS);
  174. memset(hv_context.synic_message_page, 0,
  175. sizeof(void *) * NR_CPUS);
  176. memset(hv_context.post_msg_page, 0,
  177. sizeof(void *) * NR_CPUS);
  178. memset(hv_context.vp_index, 0,
  179. sizeof(int) * NR_CPUS);
  180. memset(hv_context.event_dpc, 0,
  181. sizeof(void *) * NR_CPUS);
  182. memset(hv_context.clk_evt, 0,
  183. sizeof(void *) * NR_CPUS);
  184. max_leaf = query_hypervisor_info();
  185. /*
  186. * Write our OS ID.
  187. */
  188. hv_context.guestid = generate_guest_id(0, LINUX_VERSION_CODE, 0);
  189. wrmsrl(HV_X64_MSR_GUEST_OS_ID, hv_context.guestid);
  190. /* See if the hypercall page is already set */
  191. rdmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
  192. virtaddr = __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL_RX);
  193. if (!virtaddr)
  194. goto cleanup;
  195. hypercall_msr.enable = 1;
  196. hypercall_msr.guest_physical_address = vmalloc_to_pfn(virtaddr);
  197. wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
  198. /* Confirm that hypercall page did get setup. */
  199. hypercall_msr.as_uint64 = 0;
  200. rdmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
  201. if (!hypercall_msr.enable)
  202. goto cleanup;
  203. hv_context.hypercall_page = virtaddr;
  204. #ifdef CONFIG_X86_64
  205. if (ms_hyperv.features & HV_X64_MSR_REFERENCE_TSC_AVAILABLE) {
  206. union hv_x64_msr_hypercall_contents tsc_msr;
  207. void *va_tsc;
  208. va_tsc = __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL);
  209. if (!va_tsc)
  210. goto cleanup;
  211. hv_context.tsc_page = va_tsc;
  212. rdmsrl(HV_X64_MSR_REFERENCE_TSC, tsc_msr.as_uint64);
  213. tsc_msr.enable = 1;
  214. tsc_msr.guest_physical_address = vmalloc_to_pfn(va_tsc);
  215. wrmsrl(HV_X64_MSR_REFERENCE_TSC, tsc_msr.as_uint64);
  216. clocksource_register_hz(&hyperv_cs_tsc, NSEC_PER_SEC/100);
  217. }
  218. #endif
  219. return 0;
  220. cleanup:
  221. if (virtaddr) {
  222. if (hypercall_msr.enable) {
  223. hypercall_msr.as_uint64 = 0;
  224. wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
  225. }
  226. vfree(virtaddr);
  227. }
  228. return -ENOTSUPP;
  229. }
  230. /*
  231. * hv_cleanup - Cleanup routine.
  232. *
  233. * This routine is called normally during driver unloading or exiting.
  234. */
  235. void hv_cleanup(bool crash)
  236. {
  237. union hv_x64_msr_hypercall_contents hypercall_msr;
  238. /* Reset our OS id */
  239. wrmsrl(HV_X64_MSR_GUEST_OS_ID, 0);
  240. if (hv_context.hypercall_page) {
  241. hypercall_msr.as_uint64 = 0;
  242. wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
  243. if (!crash)
  244. vfree(hv_context.hypercall_page);
  245. hv_context.hypercall_page = NULL;
  246. }
  247. #ifdef CONFIG_X86_64
  248. /*
  249. * Cleanup the TSC page based CS.
  250. */
  251. if (ms_hyperv.features & HV_X64_MSR_REFERENCE_TSC_AVAILABLE) {
  252. /*
  253. * Crash can happen in an interrupt context and unregistering
  254. * a clocksource is impossible and redundant in this case.
  255. */
  256. if (!oops_in_progress) {
  257. clocksource_change_rating(&hyperv_cs_tsc, 10);
  258. clocksource_unregister(&hyperv_cs_tsc);
  259. }
  260. hypercall_msr.as_uint64 = 0;
  261. wrmsrl(HV_X64_MSR_REFERENCE_TSC, hypercall_msr.as_uint64);
  262. if (!crash) {
  263. vfree(hv_context.tsc_page);
  264. hv_context.tsc_page = NULL;
  265. }
  266. }
  267. #endif
  268. }
  269. /*
  270. * hv_post_message - Post a message using the hypervisor message IPC.
  271. *
  272. * This involves a hypercall.
  273. */
  274. int hv_post_message(union hv_connection_id connection_id,
  275. enum hv_message_type message_type,
  276. void *payload, size_t payload_size)
  277. {
  278. struct hv_input_post_message *aligned_msg;
  279. u16 status;
  280. if (payload_size > HV_MESSAGE_PAYLOAD_BYTE_COUNT)
  281. return -EMSGSIZE;
  282. aligned_msg = (struct hv_input_post_message *)
  283. hv_context.post_msg_page[get_cpu()];
  284. aligned_msg->connectionid = connection_id;
  285. aligned_msg->reserved = 0;
  286. aligned_msg->message_type = message_type;
  287. aligned_msg->payload_size = payload_size;
  288. memcpy((void *)aligned_msg->payload, payload, payload_size);
  289. status = do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL)
  290. & 0xFFFF;
  291. put_cpu();
  292. return status;
  293. }
  294. /*
  295. * hv_signal_event -
  296. * Signal an event on the specified connection using the hypervisor event IPC.
  297. *
  298. * This involves a hypercall.
  299. */
  300. u16 hv_signal_event(void *con_id)
  301. {
  302. u16 status;
  303. status = (do_hypercall(HVCALL_SIGNAL_EVENT, con_id, NULL) & 0xFFFF);
  304. return status;
  305. }
  306. static int hv_ce_set_next_event(unsigned long delta,
  307. struct clock_event_device *evt)
  308. {
  309. cycle_t current_tick;
  310. WARN_ON(!clockevent_state_oneshot(evt));
  311. rdmsrl(HV_X64_MSR_TIME_REF_COUNT, current_tick);
  312. current_tick += delta;
  313. wrmsrl(HV_X64_MSR_STIMER0_COUNT, current_tick);
  314. return 0;
  315. }
  316. static int hv_ce_shutdown(struct clock_event_device *evt)
  317. {
  318. wrmsrl(HV_X64_MSR_STIMER0_COUNT, 0);
  319. wrmsrl(HV_X64_MSR_STIMER0_CONFIG, 0);
  320. return 0;
  321. }
  322. static int hv_ce_set_oneshot(struct clock_event_device *evt)
  323. {
  324. union hv_timer_config timer_cfg;
  325. timer_cfg.enable = 1;
  326. timer_cfg.auto_enable = 1;
  327. timer_cfg.sintx = VMBUS_MESSAGE_SINT;
  328. wrmsrl(HV_X64_MSR_STIMER0_CONFIG, timer_cfg.as_uint64);
  329. return 0;
  330. }
  331. static void hv_init_clockevent_device(struct clock_event_device *dev, int cpu)
  332. {
  333. dev->name = "Hyper-V clockevent";
  334. dev->features = CLOCK_EVT_FEAT_ONESHOT;
  335. dev->cpumask = cpumask_of(cpu);
  336. dev->rating = 1000;
  337. /*
  338. * Avoid settint dev->owner = THIS_MODULE deliberately as doing so will
  339. * result in clockevents_config_and_register() taking additional
  340. * references to the hv_vmbus module making it impossible to unload.
  341. */
  342. dev->set_state_shutdown = hv_ce_shutdown;
  343. dev->set_state_oneshot = hv_ce_set_oneshot;
  344. dev->set_next_event = hv_ce_set_next_event;
  345. }
  346. int hv_synic_alloc(void)
  347. {
  348. size_t size = sizeof(struct tasklet_struct);
  349. size_t ced_size = sizeof(struct clock_event_device);
  350. int cpu;
  351. hv_context.hv_numa_map = kzalloc(sizeof(struct cpumask) * nr_node_ids,
  352. GFP_ATOMIC);
  353. if (hv_context.hv_numa_map == NULL) {
  354. pr_err("Unable to allocate NUMA map\n");
  355. goto err;
  356. }
  357. for_each_present_cpu(cpu) {
  358. hv_context.event_dpc[cpu] = kmalloc(size, GFP_ATOMIC);
  359. if (hv_context.event_dpc[cpu] == NULL) {
  360. pr_err("Unable to allocate event dpc\n");
  361. goto err;
  362. }
  363. tasklet_init(hv_context.event_dpc[cpu], vmbus_on_event, cpu);
  364. hv_context.clk_evt[cpu] = kzalloc(ced_size, GFP_ATOMIC);
  365. if (hv_context.clk_evt[cpu] == NULL) {
  366. pr_err("Unable to allocate clock event device\n");
  367. goto err;
  368. }
  369. hv_init_clockevent_device(hv_context.clk_evt[cpu], cpu);
  370. hv_context.synic_message_page[cpu] =
  371. (void *)get_zeroed_page(GFP_ATOMIC);
  372. if (hv_context.synic_message_page[cpu] == NULL) {
  373. pr_err("Unable to allocate SYNIC message page\n");
  374. goto err;
  375. }
  376. hv_context.synic_event_page[cpu] =
  377. (void *)get_zeroed_page(GFP_ATOMIC);
  378. if (hv_context.synic_event_page[cpu] == NULL) {
  379. pr_err("Unable to allocate SYNIC event page\n");
  380. goto err;
  381. }
  382. hv_context.post_msg_page[cpu] =
  383. (void *)get_zeroed_page(GFP_ATOMIC);
  384. if (hv_context.post_msg_page[cpu] == NULL) {
  385. pr_err("Unable to allocate post msg page\n");
  386. goto err;
  387. }
  388. INIT_LIST_HEAD(&hv_context.percpu_list[cpu]);
  389. }
  390. return 0;
  391. err:
  392. return -ENOMEM;
  393. }
  394. static void hv_synic_free_cpu(int cpu)
  395. {
  396. kfree(hv_context.event_dpc[cpu]);
  397. kfree(hv_context.clk_evt[cpu]);
  398. if (hv_context.synic_event_page[cpu])
  399. free_page((unsigned long)hv_context.synic_event_page[cpu]);
  400. if (hv_context.synic_message_page[cpu])
  401. free_page((unsigned long)hv_context.synic_message_page[cpu]);
  402. if (hv_context.post_msg_page[cpu])
  403. free_page((unsigned long)hv_context.post_msg_page[cpu]);
  404. }
  405. void hv_synic_free(void)
  406. {
  407. int cpu;
  408. kfree(hv_context.hv_numa_map);
  409. for_each_present_cpu(cpu)
  410. hv_synic_free_cpu(cpu);
  411. }
  412. /*
  413. * hv_synic_init - Initialize the Synthethic Interrupt Controller.
  414. *
  415. * If it is already initialized by another entity (ie x2v shim), we need to
  416. * retrieve the initialized message and event pages. Otherwise, we create and
  417. * initialize the message and event pages.
  418. */
  419. void hv_synic_init(void *arg)
  420. {
  421. u64 version;
  422. union hv_synic_simp simp;
  423. union hv_synic_siefp siefp;
  424. union hv_synic_sint shared_sint;
  425. union hv_synic_scontrol sctrl;
  426. u64 vp_index;
  427. int cpu = smp_processor_id();
  428. if (!hv_context.hypercall_page)
  429. return;
  430. /* Check the version */
  431. rdmsrl(HV_X64_MSR_SVERSION, version);
  432. /* Setup the Synic's message page */
  433. rdmsrl(HV_X64_MSR_SIMP, simp.as_uint64);
  434. simp.simp_enabled = 1;
  435. simp.base_simp_gpa = virt_to_phys(hv_context.synic_message_page[cpu])
  436. >> PAGE_SHIFT;
  437. wrmsrl(HV_X64_MSR_SIMP, simp.as_uint64);
  438. /* Setup the Synic's event page */
  439. rdmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64);
  440. siefp.siefp_enabled = 1;
  441. siefp.base_siefp_gpa = virt_to_phys(hv_context.synic_event_page[cpu])
  442. >> PAGE_SHIFT;
  443. wrmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64);
  444. /* Setup the shared SINT. */
  445. rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
  446. shared_sint.as_uint64 = 0;
  447. shared_sint.vector = HYPERVISOR_CALLBACK_VECTOR;
  448. shared_sint.masked = false;
  449. shared_sint.auto_eoi = true;
  450. wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
  451. /* Enable the global synic bit */
  452. rdmsrl(HV_X64_MSR_SCONTROL, sctrl.as_uint64);
  453. sctrl.enable = 1;
  454. wrmsrl(HV_X64_MSR_SCONTROL, sctrl.as_uint64);
  455. hv_context.synic_initialized = true;
  456. /*
  457. * Setup the mapping between Hyper-V's notion
  458. * of cpuid and Linux' notion of cpuid.
  459. * This array will be indexed using Linux cpuid.
  460. */
  461. rdmsrl(HV_X64_MSR_VP_INDEX, vp_index);
  462. hv_context.vp_index[cpu] = (u32)vp_index;
  463. /*
  464. * Register the per-cpu clockevent source.
  465. */
  466. if (ms_hyperv.features & HV_X64_MSR_SYNTIMER_AVAILABLE)
  467. clockevents_config_and_register(hv_context.clk_evt[cpu],
  468. HV_TIMER_FREQUENCY,
  469. HV_MIN_DELTA_TICKS,
  470. HV_MAX_MAX_DELTA_TICKS);
  471. return;
  472. }
  473. /*
  474. * hv_synic_clockevents_cleanup - Cleanup clockevent devices
  475. */
  476. void hv_synic_clockevents_cleanup(void)
  477. {
  478. int cpu;
  479. if (!(ms_hyperv.features & HV_X64_MSR_SYNTIMER_AVAILABLE))
  480. return;
  481. for_each_online_cpu(cpu)
  482. clockevents_unbind_device(hv_context.clk_evt[cpu], cpu);
  483. }
  484. /*
  485. * hv_synic_cleanup - Cleanup routine for hv_synic_init().
  486. */
  487. void hv_synic_cleanup(void *arg)
  488. {
  489. union hv_synic_sint shared_sint;
  490. union hv_synic_simp simp;
  491. union hv_synic_siefp siefp;
  492. union hv_synic_scontrol sctrl;
  493. int cpu = smp_processor_id();
  494. if (!hv_context.synic_initialized)
  495. return;
  496. /* Turn off clockevent device */
  497. if (ms_hyperv.features & HV_X64_MSR_SYNTIMER_AVAILABLE)
  498. hv_ce_shutdown(hv_context.clk_evt[cpu]);
  499. rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
  500. shared_sint.masked = 1;
  501. /* Need to correctly cleanup in the case of SMP!!! */
  502. /* Disable the interrupt */
  503. wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
  504. rdmsrl(HV_X64_MSR_SIMP, simp.as_uint64);
  505. simp.simp_enabled = 0;
  506. simp.base_simp_gpa = 0;
  507. wrmsrl(HV_X64_MSR_SIMP, simp.as_uint64);
  508. rdmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64);
  509. siefp.siefp_enabled = 0;
  510. siefp.base_siefp_gpa = 0;
  511. wrmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64);
  512. /* Disable the global synic bit */
  513. rdmsrl(HV_X64_MSR_SCONTROL, sctrl.as_uint64);
  514. sctrl.enable = 0;
  515. wrmsrl(HV_X64_MSR_SCONTROL, sctrl.as_uint64);
  516. }