hv.c 15 KB

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