Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp692892pxx; Wed, 28 Oct 2020 14:41:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztyrJdQuPH7GOXcn+fGR+VulG9XKA8e5WehAG7uAc8RJkjM/TY79ZmpLT84S1PAu/gtTYo X-Received: by 2002:a50:8125:: with SMTP id 34mr1003375edc.39.1603921279919; Wed, 28 Oct 2020 14:41:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603921279; cv=none; d=google.com; s=arc-20160816; b=k8aTSVdbqlFJto2Xc4ZFojMKOPiJoDnyVa39bgfxeS8lMoTOYHbqsqXhOLuMLYHbJQ KdRLc5WXStDBtvT5nG7bM1AxUsgtfZtBvQMRrzZj31cXC5nIl/b1UqYvHF2KjZPyeQc9 vCzybM0toxkciYK3ND3PPb5TdeaeCtEeJFW3iox4dnjodl5KBL8A17z9SlaasAMXApVK pFC4g3lLR4L2AtoAaJcf0CIgOxm91tVuYoJiBdGBizrBHwCfHtxZglynbXHrqXKHe7ec /KxWBYZBo+32SEv07jRWCd4QQUM1nQpcHxiZlYUfTT5HB65jvenVJXY9by+sF0BwNGkZ Y0/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=8RKVzA+vjsz7qvsBhnvLWycI0EDYp3zJjS6r1quv/0I=; b=x3JwuzeqdqIH8znXcjbAzROBwKDmSiuuY6MHgidtKZLeXXL9K7tDjJhTMzSPRvzCDR X9NMAsT0q0uCEuBE2Mz4tOqyxne+15sgG95mstxsScwRS8s+sH0yN/Qb4nkDUtVIJSPa ALOfTFwxD/s/gV6xUy+OcdYmDyyrDEAiLZDoYUFN37I+NCN/a9bzo92+ATG89HTaSQKG muntU7SBA98yxR7eHajwHZdwxKbf8311NN92LAs3+dKbBpUM1fx3YNq28uygWUDr7/k4 t7aA7slxp89MWDEtOHODB1npQoMG6OoazubkHP4lrGnXDF89AngmJqf27cgU4+a9qygW Opmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=uSuWUfIQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp16si434395ejc.178.2020.10.28.14.40.56; Wed, 28 Oct 2020 14:41:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=uSuWUfIQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725932AbgJ1BiV (ORCPT + 99 others); Tue, 27 Oct 2020 21:38:21 -0400 Received: from mail-yb1-f195.google.com ([209.85.219.195]:42195 "EHLO mail-yb1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1832988AbgJ0XO2 (ORCPT ); Tue, 27 Oct 2020 19:14:28 -0400 Received: by mail-yb1-f195.google.com with SMTP id a12so2673469ybg.9 for ; Tue, 27 Oct 2020 16:14:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8RKVzA+vjsz7qvsBhnvLWycI0EDYp3zJjS6r1quv/0I=; b=uSuWUfIQOOnvG4/9uPrMbn+WKtotJk+5aLhIdzmvRxKs8TtqZJOMVYqvqIw9zWpOPj sPnVPfk3Losq5Xu5ezACYwxFkhnL/7c3Jln9ChCRBdXLDgqI2TvJleZ3tF2+znFAW5hW YMqocqurj9ZB3e/tpfciWF6VkRtLGrSpLWGAtyJf/nM6r90610szaPSZwhShLikftUlg lrMSN0VPm9np2lgFP9ftmZ9kimMFc2tsQWpRdZN/mFT4oxlgZ0XcDYC7fYAb2g31L6w5 pRJm8Vy9VQtXq/rSE5+LD7xC49/AjjfQMYfsfpa4Dy4XzFmb2B3zUBNGcEwV5vwNFZg7 n2VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8RKVzA+vjsz7qvsBhnvLWycI0EDYp3zJjS6r1quv/0I=; b=X8ctr9yO8UlsdNb3HD+9sstyAvOxiW5SMJd+cyt0uBomlwh1j0sYb8TS9pyWPbO/ti ekZkZk8QWFtueW5CY+6pdW6pocGPWofwvOjJwWs3Lrdun2Zli0Mp86MBkPOd3lxkpswF qnwg0O1dS6Zw4927nMbfEgjP7BHmmRktZvUbybtkQhI+uyJISC0Iwe/goM4CwV9qxPLX Jh0r3gTmBy3Nuj6ROkmC4RLS37gOcDcCkJrxE/Sw8xTb8lARqYOOo7UTLKJRf+sGjV3l z631NRPyYkrkzEMYpVB79HHTZHhyJxlMkB349iQTyPYkC7kJQwm9ApRC83DkDaL74E1Q kXqw== X-Gm-Message-State: AOAM532qiANFee9NN3Kz7KN2tYccVpcDsZJOAKV+0HRJkFy82V/gFr86 W1R1WOa/Q7YWMZDZdqHSKxh7wC37xJPaNbmZSxGMCK6TmzZXnc6a X-Received: by 2002:a5b:ad1:: with SMTP id a17mr6326666ybr.85.1603840466816; Tue, 27 Oct 2020 16:14:26 -0700 (PDT) MIME-Version: 1.0 References: <20200907131613.12703-64-joro@8bytes.org> <159972972598.20229.12880317872521101289.tip-bot2@tip-bot2> In-Reply-To: From: Erdem Aktas Date: Tue, 27 Oct 2020 16:14:15 -0700 Message-ID: Subject: Re: [tip: x86/seves] x86/kvm: Add KVM-specific VMMCALL handling under SEV-ES To: linux-kernel@vger.kernel.org, "Lendacky, Thomas" Cc: linux-tip-commits@vger.kernel.org, Joerg Roedel , Borislav Petkov , x86 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [resending in plain/text, sorry for double sending] It seems to me that the kvm_sev_es_hcall_prepare is leaking more information than it is needed. Is this an expected behavior? -Erdem > > On Thu, Sep 10, 2020 at 2:39 AM tip-bot2 for Tom Lendacky wrote: >> >> The following commit has been merged into the x86/seves branch of tip: >> >> Commit-ID: 99419b251e5427b89dbfae103d8a2f469efaa4b2 >> Gitweb: https://git.kernel.org/tip/99419b251e5427b89dbfae103d8a2f469efaa4b2 >> Author: Tom Lendacky >> AuthorDate: Mon, 07 Sep 2020 15:16:04 +02:00 >> Committer: Borislav Petkov >> CommitterDate: Wed, 09 Sep 2020 11:33:20 +02:00 >> >> x86/kvm: Add KVM-specific VMMCALL handling under SEV-ES >> >> Implement the callbacks to copy the processor state required by KVM to >> the GHCB. >> >> Signed-off-by: Tom Lendacky >> [ jroedel@suse.de: - Split out of a larger patch >> - Adapt to different callback functions ] >> Co-developed-by: Joerg Roedel >> Signed-off-by: Joerg Roedel >> Signed-off-by: Borislav Petkov >> Link: https://lkml.kernel.org/r/20200907131613.12703-64-joro@8bytes.org >> --- >> arch/x86/kernel/kvm.c | 35 +++++++++++++++++++++++++++++------ >> 1 file changed, 29 insertions(+), 6 deletions(-) >> >> diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c >> index 08320b0..0f95972 100644 >> --- a/arch/x86/kernel/kvm.c >> +++ b/arch/x86/kernel/kvm.c >> @@ -36,6 +36,8 @@ >> #include >> #include >> #include >> +#include >> +#include >> >> DEFINE_STATIC_KEY_FALSE(kvm_async_pf_enabled); >> >> @@ -746,13 +748,34 @@ static void __init kvm_init_platform(void) >> x86_platform.apic_post_init = kvm_apic_init; >> } >> >> +#if defined(CONFIG_AMD_MEM_ENCRYPT) >> +static void kvm_sev_es_hcall_prepare(struct ghcb *ghcb, struct pt_regs *regs) >> +{ >> + /* RAX and CPL are already in the GHCB */ >> + ghcb_set_rbx(ghcb, regs->bx); >> + ghcb_set_rcx(ghcb, regs->cx); >> + ghcb_set_rdx(ghcb, regs->dx); >> + ghcb_set_rsi(ghcb, regs->si); >> +} >> + >> +static bool kvm_sev_es_hcall_finish(struct ghcb *ghcb, struct pt_regs *regs) >> +{ >> + /* No checking of the return state needed */ >> + return true; >> +} >> +#endif >> + >> const __initconst struct hypervisor_x86 x86_hyper_kvm = { >> - .name = "KVM", >> - .detect = kvm_detect, >> - .type = X86_HYPER_KVM, >> - .init.guest_late_init = kvm_guest_init, >> - .init.x2apic_available = kvm_para_available, >> - .init.init_platform = kvm_init_platform, >> + .name = "KVM", >> + .detect = kvm_detect, >> + .type = X86_HYPER_KVM, >> + .init.guest_late_init = kvm_guest_init, >> + .init.x2apic_available = kvm_para_available, >> + .init.init_platform = kvm_init_platform, >> +#if defined(CONFIG_AMD_MEM_ENCRYPT) >> + .runtime.sev_es_hcall_prepare = kvm_sev_es_hcall_prepare, >> + .runtime.sev_es_hcall_finish = kvm_sev_es_hcall_finish, >> +#endif >> }; >> >> static __init int activate_jump_labels(void)