diff options
author | Brijesh Singh <brijesh.singh@amd.com> | 2017-12-04 17:57:36 +0100 |
---|---|---|
committer | Brijesh Singh <brijesh.singh@amd.com> | 2017-12-04 20:33:13 +0100 |
commit | 5bdb0e2fa45eb007a1cc630c6b520a638e60c1f6 (patch) | |
tree | df6315f0afa8695fd02486b0e6be1ffcb4e7b6dd | |
parent | KVM: SVM: Add support for KVM_SEV_LAUNCH_MEASURE command (diff) | |
download | linux-5bdb0e2fa45eb007a1cc630c6b520a638e60c1f6.tar.xz linux-5bdb0e2fa45eb007a1cc630c6b520a638e60c1f6.zip |
KVM: SVM: Add support for SEV LAUNCH_FINISH command
The command is used for finializing the SEV guest launch process.
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Borislav Petkov <bp@suse.de>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: x86@kernel.org
Cc: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Borislav Petkov <bp@suse.de>
-rw-r--r-- | arch/x86/kvm/svm.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 74e010e6b5b9..6a8d81311e9d 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -6113,6 +6113,26 @@ e_free: return ret; } +static int sev_launch_finish(struct kvm *kvm, struct kvm_sev_cmd *argp) +{ + struct kvm_sev_info *sev = &kvm->arch.sev_info; + struct sev_data_launch_finish *data; + int ret; + + if (!sev_guest(kvm)) + return -ENOTTY; + + data = kzalloc(sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + data->handle = sev->handle; + ret = sev_issue_cmd(kvm, SEV_CMD_LAUNCH_FINISH, data, &argp->error); + + kfree(data); + return ret; +} + static int svm_mem_enc_op(struct kvm *kvm, void __user *argp) { struct kvm_sev_cmd sev_cmd; @@ -6139,6 +6159,9 @@ static int svm_mem_enc_op(struct kvm *kvm, void __user *argp) case KVM_SEV_LAUNCH_MEASURE: r = sev_launch_measure(kvm, &sev_cmd); break; + case KVM_SEV_LAUNCH_FINISH: + r = sev_launch_finish(kvm, &sev_cmd); + break; default: r = -EINVAL; goto out; |