Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp783945pxb; Thu, 21 Oct 2021 09:23:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztMLBBo/Fy66du/j4UF6UMmdrOLRmpCi214BaBWO7/+AA4WYV6+tYYpNhu+5kM+PRsA/kp X-Received: by 2002:a62:2944:0:b0:44d:b731:4228 with SMTP id p65-20020a622944000000b0044db7314228mr6620471pfp.9.1634833424770; Thu, 21 Oct 2021 09:23:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634833424; cv=none; d=google.com; s=arc-20160816; b=bAZM9BpxdOq09Gq3QTpE6Vc7Ua8RywMT+dID47u8/0Hcv7fTNitUsqGLrA/W8vfIfd 2B/R2XqRr1Fk+nwRuikQ8Y5BN9d2Au0ym8jMngTt8w/PdIAburkhRa3Fw8sygviirXhC dudnKCc4AUt8e3bio0URNgullhXmlCxOm/WteOQ56dFKrMsalRL5ThQf8nxEgQpvICUg KoQM2pyX/TEGdadb9zc2rrjtcPdGVS8UC3gkbMahbn82bjADGClpYhctOy/DMotGegFB Ksj6otVGOc0vei/BU7l9gBSyRvsV/gEDpMWRxk/98tbLNFOS+MsvUy+bHQvXq3YPB35v A0uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=s9B7TcJbpJamc03KXDCXQuXf1+/ogvmvN6UH47r0t44=; b=itw5QR1ZNi18mzQiPhPSepR1LE8cJuNWm6U1Cw7FIBF/5hFP7USJOsDWHh3NWiRU3r m56GjB9e1Lkzki69OLDAECifaxb6Xf5c4yG9thloWxR/JLqrJgnNHNqArfqgFj30m70X ciQuzQLFGE7+LMchufG9FFS7nB2mJL8PctN/OqvH9N2EEdC/4FJTPj3U/Sw1eqx+auam uRoEsUPTYNxzdlDSligy3WH4aAglMjfpoxUgMvOaKThQWRTdi8iAB/2I91M9+4Lja8Ef /is2RRwnorv4xt6KlnW3IVm5djowjiQCIl5Dj/+6tJr8ygh/+Syb3dmiP5c29BpeytPe CEQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=ViCKbfkr; 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=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z2si8731151pgu.168.2021.10.21.09.23.30; Thu, 21 Oct 2021 09:23:44 -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=@alien8.de header.s=dkim header.b=ViCKbfkr; 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=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231558AbhJUQYr (ORCPT + 99 others); Thu, 21 Oct 2021 12:24:47 -0400 Received: from mail.skyhub.de ([5.9.137.197]:45878 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230072AbhJUQYq (ORCPT ); Thu, 21 Oct 2021 12:24:46 -0400 Received: from zn.tnic (p200300ec2f191200ee5ad10a1c627015.dip0.t-ipconnect.de [IPv6:2003:ec:2f19:1200:ee5a:d10a:1c62:7015]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 229661EC011B; Thu, 21 Oct 2021 18:22:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1634833349; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=s9B7TcJbpJamc03KXDCXQuXf1+/ogvmvN6UH47r0t44=; b=ViCKbfkrxBNFBw9sV4dQEIRuYioGwgmaVA8GvvP+1GAYxiIAzKzmb9Rie6jAt9cV5OrGsU HtSbyZJdONQ2tN3ELB2DRGPD/mr3vaOmS5XQoSlGJkpzXo49ujTlMTwkbgprJPAkI1yxSN 2b1jb3B/MwUtUKcSij1cujLYU/sAmlE= Date: Thu, 21 Oct 2021 18:22:26 +0200 From: Borislav Petkov To: Tianyu Lan Cc: kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, tglx@linutronix.de, mingo@redhat.com, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, davem@davemloft.net, kuba@kernel.org, gregkh@linuxfoundation.org, arnd@arndb.de, brijesh.singh@amd.com, jroedel@suse.de, Tianyu.Lan@microsoft.com, thomas.lendacky@amd.com, rientjes@google.com, pgonda@google.com, akpm@linux-foundation.org, kirill.shutemov@linux.intel.com, rppt@kernel.org, saravanand@fb.com, aneesh.kumar@linux.ibm.com, hannes@cmpxchg.org, tj@kernel.org, michael.h.kelley@microsoft.com, linux-arch@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, vkuznets@redhat.com, konrad.wilk@oracle.com, hch@lst.de, robin.murphy@arm.com, joro@8bytes.org, parri.andrea@gmail.com, dave.hansen@intel.com Subject: Re: [PATCH V8 5/9] x86/sev-es: Expose sev_es_ghcb_hv_call() to call ghcb hv call out of sev code Message-ID: References: <20211021154110.3734294-1-ltykernel@gmail.com> <20211021154110.3734294-6-ltykernel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20211021154110.3734294-6-ltykernel@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 21, 2021 at 11:41:05AM -0400, Tianyu Lan wrote: > diff --git a/arch/x86/kernel/sev-shared.c b/arch/x86/kernel/sev-shared.c > index ea9abd69237e..368ed36971e3 100644 > --- a/arch/x86/kernel/sev-shared.c > +++ b/arch/x86/kernel/sev-shared.c > @@ -124,10 +124,9 @@ static enum es_result verify_exception_info(struct ghcb *ghcb, struct es_em_ctxt > return ES_VMM_ERROR; > } > > -static enum es_result sev_es_ghcb_hv_call(struct ghcb *ghcb, > - struct es_em_ctxt *ctxt, > - u64 exit_code, u64 exit_info_1, > - u64 exit_info_2) > +enum es_result sev_es_ghcb_hv_call(struct ghcb *ghcb, bool set_ghcb_msr, > + struct es_em_ctxt *ctxt, u64 exit_code, > + u64 exit_info_1, u64 exit_info_2) > { > /* Fill in protocol and format specifiers */ > ghcb->protocol_version = GHCB_PROTOCOL_MAX; > @@ -137,7 +136,15 @@ static enum es_result sev_es_ghcb_hv_call(struct ghcb *ghcb, > ghcb_set_sw_exit_info_1(ghcb, exit_info_1); > ghcb_set_sw_exit_info_2(ghcb, exit_info_2); > > - sev_es_wr_ghcb_msr(__pa(ghcb)); > + /* > + * Hyper-V unenlightened guests use a paravisor for communicating and > + * GHCB pages are being allocated and set up by that paravisor. Linux > + * should not change ghcb page pa in such case and so add set_ghcb_msr "... not change the GHCB page's physical address." Remove the "so add... " rest. Otherwise, LGTM. Do you want me to take it through the tip tree? Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette