Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5158871pxj; Wed, 9 Jun 2021 10:27:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMlMBV5Gf+Lvg7VGxRV9UkbdRhzY4hO3N5GxVD5rsexPAT4+wZueeGcTVgVNQcZm0Ezn1h X-Received: by 2002:aa7:d612:: with SMTP id c18mr557045edr.80.1623259620859; Wed, 09 Jun 2021 10:27:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623259620; cv=none; d=google.com; s=arc-20160816; b=Al9rK15DEsbq6kzPYwIQ/2OcC9GQuScW9KOTUnrtpKaOG1CTLnrdS6snX8am1SmtFQ iymewApdzOoKGASK13LrM0lGN6FeCeYr05o0KRxo8vsu/fJiuG85z7cOCwWTsiuRmJ+I L9iyTe58zgvRJr71yC9yCEsm9OBW7D3nD2dtgo6BAAOqSKV9ZNGQtLkS3tCBaH8CPXE0 OvXAcssC7s6p0P1IGzuK30/+oFyqA4Ef7X5UtbFjKMX5cp1YGTq7p67WFbKlei/ElZjL Z62iMPL4ipQYdSomwZ+Zb84v00BR2evuVWGMaFh+I91CF3xpleywEE50cW6yREgJL5B2 +6Fg== 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; bh=vewMX8j3nwapQYqsOcpMN6I5OgCylgiNxW8MtYUtqTw=; b=FNuBdHl+QBV117OYI1OZpOz2uTWSkpyieP62XPVJ8LKUEw/k9kG5PMoBPrIOYYbVhr VpiAnQIO5pEo3B5L55WAQG8ye76D0lQu7pUOvrVwCe9jP3uDvXhbqu8znAyN0XGfT7S8 bEbeX9S/62EobWj4xXyg9qlUh3F6vRSFnq7ccbrEPF12n5hESXSskljbbQxVODryGMgz aghzlLVAx4v5gc7hC9KycxLAeadxDmE4qocCb86Mh5U6DJqBtfJh6Qb3Jqatl0pZl4EY TX2WBpr+sSv2gjJ+1wkFVKnj4hhX33PYGSvaeMQqbAAvzusGQGL66gu8cy7rKrCUI/6K bN3w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f23si154505edv.591.2021.06.09.10.26.31; Wed, 09 Jun 2021 10:27:00 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233343AbhFIMka (ORCPT + 99 others); Wed, 9 Jun 2021 08:40:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232932AbhFIMk2 (ORCPT ); Wed, 9 Jun 2021 08:40:28 -0400 Received: from theia.8bytes.org (8bytes.org [IPv6:2a01:238:4383:600:38bc:a715:4b6d:a889]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BC14C061574; Wed, 9 Jun 2021 05:38:33 -0700 (PDT) Received: by theia.8bytes.org (Postfix, from userid 1000) id 99A0E36A; Wed, 9 Jun 2021 14:38:30 +0200 (CEST) Date: Wed, 9 Jun 2021 14:38:29 +0200 From: Joerg Roedel 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, bp@alien8.de, x86@kernel.org, hpa@zytor.com, arnd@arndb.de, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, akpm@linux-foundation.org, kirill.shutemov@linux.intel.com, rppt@kernel.org, hannes@cmpxchg.org, cai@lca.pw, krish.sadhukhan@oracle.com, saravanand@fb.com, Tianyu.Lan@microsoft.com, konrad.wilk@oracle.com, hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com, boris.ostrovsky@oracle.com, jgross@suse.com, sstabellini@kernel.org, will@kernel.org, xen-devel@lists.xenproject.org, davem@davemloft.net, kuba@kernel.org, jejb@linux.ibm.com, martin.petersen@oracle.com, iommu@lists.linux-foundation.org, linux-arch@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, netdev@vger.kernel.org, vkuznets@redhat.com, thomas.lendacky@amd.com, brijesh.singh@amd.com, sunilmut@microsoft.com Subject: Re: [RFC PATCH V3 01/11] x86/HV: Initialize GHCB page in Isolation VM Message-ID: References: <20210530150628.2063957-1-ltykernel@gmail.com> <20210530150628.2063957-2-ltykernel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210530150628.2063957-2-ltykernel@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 30, 2021 at 11:06:18AM -0400, Tianyu Lan wrote: > From: Tianyu Lan > > Hyper-V exposes GHCB page via SEV ES GHCB MSR for SNP guest > to communicate with hypervisor. Map GHCB page for all > cpus to read/write MSR register and submit hvcall request > via GHCB. > > Signed-off-by: Tianyu Lan > --- > arch/x86/hyperv/hv_init.c | 60 ++++++++++++++++++++++++++++++--- > arch/x86/include/asm/mshyperv.h | 2 ++ > include/asm-generic/mshyperv.h | 2 ++ > 3 files changed, 60 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c > index bb0ae4b5c00f..dc74d01cb859 100644 > --- a/arch/x86/hyperv/hv_init.c > +++ b/arch/x86/hyperv/hv_init.c > @@ -60,6 +60,9 @@ static int hv_cpu_init(unsigned int cpu) > struct hv_vp_assist_page **hvp = &hv_vp_assist_page[smp_processor_id()]; > void **input_arg; > struct page *pg; > + u64 ghcb_gpa; > + void *ghcb_va; > + void **ghcb_base; Any reason you can't reuse the SEV-ES support code in the Linux kernel? It already has code to setup GHCBs for all vCPUs. I see that you don't need #VC handling in your SNP VMs because of the paravisor running underneath it, but just re-using the GHCB setup code shouldn't be too hard. Regards, Joerg