|
32 | 32 | #include <asm/nmi.h>
|
33 | 33 | #include <clocksource/hyperv_timer.h>
|
34 | 34 | #include <asm/numa.h>
|
| 35 | +#include <asm/svm.h> |
35 | 36 |
|
36 | 37 | /* Is Linux running as the root partition? */
|
37 | 38 | bool hv_root_partition;
|
@@ -574,11 +575,31 @@ static bool __init ms_hyperv_msi_ext_dest_id(void)
|
574 | 575 | return eax & HYPERV_VS_PROPERTIES_EAX_EXTENDED_IOAPIC_RTE;
|
575 | 576 | }
|
576 | 577 |
|
| 578 | +#ifdef CONFIG_AMD_MEM_ENCRYPT |
| 579 | +static void hv_sev_es_hcall_prepare(struct ghcb *ghcb, struct pt_regs *regs) |
| 580 | +{ |
| 581 | + /* RAX and CPL are already in the GHCB */ |
| 582 | + ghcb_set_rcx(ghcb, regs->cx); |
| 583 | + ghcb_set_rdx(ghcb, regs->dx); |
| 584 | + ghcb_set_r8(ghcb, regs->r8); |
| 585 | +} |
| 586 | + |
| 587 | +static bool hv_sev_es_hcall_finish(struct ghcb *ghcb, struct pt_regs *regs) |
| 588 | +{ |
| 589 | + /* No checking of the return state needed */ |
| 590 | + return true; |
| 591 | +} |
| 592 | +#endif |
| 593 | + |
577 | 594 | const __initconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
|
578 | 595 | .name = "Microsoft Hyper-V",
|
579 | 596 | .detect = ms_hyperv_platform,
|
580 | 597 | .type = X86_HYPER_MS_HYPERV,
|
581 | 598 | .init.x2apic_available = ms_hyperv_x2apic_available,
|
582 | 599 | .init.msi_ext_dest_id = ms_hyperv_msi_ext_dest_id,
|
583 | 600 | .init.init_platform = ms_hyperv_init_platform,
|
| 601 | +#ifdef CONFIG_AMD_MEM_ENCRYPT |
| 602 | + .runtime.sev_es_hcall_prepare = hv_sev_es_hcall_prepare, |
| 603 | + .runtime.sev_es_hcall_finish = hv_sev_es_hcall_finish, |
| 604 | +#endif |
584 | 605 | };
|
0 commit comments