|
34 | 34 | #include <clocksource/hyperv_timer.h> |
35 | 35 | #include <linux/highmem.h> |
36 | 36 |
|
37 | | -u64 hv_current_partition_id = ~0ull; |
38 | | -EXPORT_SYMBOL_GPL(hv_current_partition_id); |
39 | | - |
40 | 37 | void *hv_hypercall_pg; |
41 | 38 | EXPORT_SYMBOL_GPL(hv_hypercall_pg); |
42 | 39 |
|
@@ -93,7 +90,7 @@ static int hv_cpu_init(unsigned int cpu) |
93 | 90 | return 0; |
94 | 91 |
|
95 | 92 | hvp = &hv_vp_assist_page[cpu]; |
96 | | - if (hv_root_partition) { |
| 93 | + if (hv_root_partition()) { |
97 | 94 | /* |
98 | 95 | * For root partition we get the hypervisor provided VP assist |
99 | 96 | * page, instead of allocating a new page. |
@@ -245,7 +242,7 @@ static int hv_cpu_die(unsigned int cpu) |
245 | 242 |
|
246 | 243 | if (hv_vp_assist_page && hv_vp_assist_page[cpu]) { |
247 | 244 | union hv_vp_assist_msr_contents msr = { 0 }; |
248 | | - if (hv_root_partition) { |
| 245 | + if (hv_root_partition()) { |
249 | 246 | /* |
250 | 247 | * For root partition the VP assist page is mapped to |
251 | 248 | * hypervisor provided page, and thus we unmap the |
@@ -320,7 +317,7 @@ static int hv_suspend(void) |
320 | 317 | union hv_x64_msr_hypercall_contents hypercall_msr; |
321 | 318 | int ret; |
322 | 319 |
|
323 | | - if (hv_root_partition) |
| 320 | + if (hv_root_partition()) |
324 | 321 | return -EPERM; |
325 | 322 |
|
326 | 323 | /* |
@@ -393,24 +390,6 @@ static void __init hv_stimer_setup_percpu_clockev(void) |
393 | 390 | old_setup_percpu_clockev(); |
394 | 391 | } |
395 | 392 |
|
396 | | -static void __init hv_get_partition_id(void) |
397 | | -{ |
398 | | - struct hv_get_partition_id *output_page; |
399 | | - u64 status; |
400 | | - unsigned long flags; |
401 | | - |
402 | | - local_irq_save(flags); |
403 | | - output_page = *this_cpu_ptr(hyperv_pcpu_output_arg); |
404 | | - status = hv_do_hypercall(HVCALL_GET_PARTITION_ID, NULL, output_page); |
405 | | - if (!hv_result_success(status)) { |
406 | | - /* No point in proceeding if this failed */ |
407 | | - pr_err("Failed to get partition ID: %lld\n", status); |
408 | | - BUG(); |
409 | | - } |
410 | | - hv_current_partition_id = output_page->partition_id; |
411 | | - local_irq_restore(flags); |
412 | | -} |
413 | | - |
414 | 393 | #if IS_ENABLED(CONFIG_HYPERV_VTL_MODE) |
415 | 394 | static u8 __init get_vtl(void) |
416 | 395 | { |
@@ -539,7 +518,7 @@ void __init hyperv_init(void) |
539 | 518 | rdmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64); |
540 | 519 | hypercall_msr.enable = 1; |
541 | 520 |
|
542 | | - if (hv_root_partition) { |
| 521 | + if (hv_root_partition()) { |
543 | 522 | struct page *pg; |
544 | 523 | void *src; |
545 | 524 |
|
@@ -605,17 +584,15 @@ void __init hyperv_init(void) |
605 | 584 |
|
606 | 585 | register_syscore_ops(&hv_syscore_ops); |
607 | 586 |
|
608 | | - if (cpuid_ebx(HYPERV_CPUID_FEATURES) & HV_ACCESS_PARTITION_ID) |
| 587 | + if (ms_hyperv.priv_high & HV_ACCESS_PARTITION_ID) |
609 | 588 | hv_get_partition_id(); |
610 | 589 |
|
611 | | - BUG_ON(hv_root_partition && hv_current_partition_id == ~0ull); |
612 | | - |
613 | 590 | #ifdef CONFIG_PCI_MSI |
614 | 591 | /* |
615 | 592 | * If we're running as root, we want to create our own PCI MSI domain. |
616 | 593 | * We can't set this in hv_pci_init because that would be too late. |
617 | 594 | */ |
618 | | - if (hv_root_partition) |
| 595 | + if (hv_root_partition()) |
619 | 596 | x86_init.irqs.create_pci_msi_domain = hv_create_pci_msi_domain; |
620 | 597 | #endif |
621 | 598 |
|
|
0 commit comments