[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171014092139.iw4mnrir52pket4n@pd.tnic>
Date: Sat, 14 Oct 2017 11:21:39 +0200
From: Borislav Petkov <bp@...en8.de>
To: Brijesh Singh <brijesh.singh@....com>
Cc: x86@...nel.org, kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Radim Krčmář <rkrcmar@...hat.com>,
Joerg Roedel <joro@...tes.org>, Borislav Petkov <bp@...e.de>,
Tom Lendacky <thomas.lendacky@....com>
Subject: Re: [Part2 PATCH v5 17/31] KVM: SVM: Add KVM_SEV_INIT command
On Wed, Oct 04, 2017 at 08:13:58AM -0500, Brijesh Singh wrote:
> The command initializes the SEV platform context and allocates a new ASID
> for this guest from the SEV ASID pool. The firmware must be initialized
> before we issue any guest launch commands to create a new memory encryption
> context.
>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: "H. Peter Anvin" <hpa@...or.com>
> Cc: Paolo Bonzini <pbonzini@...hat.com>
> Cc: "Radim Krčmář" <rkrcmar@...hat.com>
> Cc: Joerg Roedel <joro@...tes.org>
> Cc: Borislav Petkov <bp@...e.de>
> Cc: Tom Lendacky <thomas.lendacky@....com>
> Cc: x86@...nel.org
> Cc: kvm@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org
> Signed-off-by: Brijesh Singh <brijesh.singh@....com>
> ---
> arch/x86/include/asm/kvm_host.h | 7 ++
> arch/x86/kvm/svm.c | 189 +++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 195 insertions(+), 1 deletion(-)
Just minor cleanups. With those applied:
Reviewed-by: Borislav Petkov <bp@...e.de>
---
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 26380627e7f9..7b3b199e15a1 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1189,8 +1189,8 @@ static __init int svm_hardware_setup(void)
static int sev_platform_get_state(int *state, int *error)
{
- int ret;
struct sev_data_status *data;
+ int ret;
data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data)
@@ -1201,7 +1201,7 @@ static int sev_platform_get_state(int *state, int *error)
*state = data->state;
pr_info_once("SEV firmware major %d minor %d build %d\n",
- data->api_major, data->api_minor, data->build);
+ data->api_major, data->api_minor, data->build);
kfree(data);
return ret;
@@ -5577,6 +5577,7 @@ static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp)
sev->active = true;
sev->asid = asid;
+
return 0;
e_shutdown:
@@ -5598,17 +5599,19 @@ static int svm_mem_enc_op(struct kvm *kvm, void __user *argp)
mutex_lock(&kvm->lock);
switch (sev_cmd.id) {
- case KVM_SEV_INIT: {
+ case KVM_SEV_INIT:
r = sev_guest_init(kvm, &sev_cmd);
break;
- }
+
default:
break;
}
mutex_unlock(&kvm->lock);
+
if (copy_to_user(argp, &sev_cmd, sizeof(struct kvm_sev_cmd)))
r = -EFAULT;
+
return r;
}
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
Powered by blists - more mailing lists