-
Notifications
You must be signed in to change notification settings - Fork 23
drivers: hv: Support for SNP Secure AVIC #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
dbdf85c
194ef61
ef73a32
704e6a0
74d154e
4d255b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -291,6 +291,45 @@ static void snp_cleanup_vmsa(struct sev_es_save_area *vmsa) | |
| free_page((unsigned long)vmsa); | ||
| } | ||
|
|
||
| enum es_result hv_set_savic_backing_page(u64 gfn) | ||
| { | ||
| u64 control = HV_HYPERCALL_REP_COMP_1 | HVCALL_SET_VP_REGISTERS; | ||
| struct hv_set_vp_registers_input *input = | ||
| (struct hv_set_vp_registers_input *) | ||
| ((u8 *)hv_vp_early_input_arg + smp_processor_id() * PAGE_SIZE); | ||
| union hv_x64_register_sev_gpa_page value; | ||
| unsigned long flags; | ||
| int retry = 5; | ||
| u64 ret; | ||
|
|
||
| local_irq_save(flags); | ||
|
|
||
| value.enabled = 1; | ||
| value.reserved = 0; | ||
| value.pagenumber = gfn; | ||
|
|
||
| memset(input, 0, struct_size(input, element, 1)); | ||
| input->header.partitionid = HV_PARTITION_ID_SELF; | ||
| input->header.vpindex = HV_VP_INDEX_SELF; | ||
| input->header.inputvtl = ms_hyperv.vtl; | ||
| input->element[0].name = HV_X64_REGISTER_SEV_AVIC_GPA; | ||
| input->element[0].value.reg64 = value.u64; | ||
|
|
||
| do { | ||
| ret = hv_do_hypercall(control, input, NULL); | ||
| } while (ret == HV_STATUS_TIME_OUT && retry--); | ||
|
Comment on lines
+296
to
+320
|
||
|
|
||
| if (!hv_result_success(ret)) | ||
| pr_err("Failed to set secure AVIC backing page %llx.\n", ret); | ||
|
|
||
| local_irq_restore(flags); | ||
|
|
||
| if (hv_result_success(ret)) | ||
| return ES_OK; | ||
| else | ||
| return ES_VMM_ERROR; | ||
| } | ||
|
|
||
| int hv_snp_boot_ap(u32 apic_id, unsigned long start_ip, unsigned int cpu) | ||
| { | ||
| struct sev_es_save_area *vmsa = (struct sev_es_save_area *) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.