Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp794823iog; Wed, 15 Jun 2022 12:29:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sI1EqZWCA0/yv4e/X++1+hb3SkkS895QYDnuqZvrkcfjjScG1TKjj+j5RlfTU4CQqbYh4y X-Received: by 2002:a17:906:804a:b0:70c:1dac:9bb8 with SMTP id x10-20020a170906804a00b0070c1dac9bb8mr1260357ejw.92.1655321359635; Wed, 15 Jun 2022 12:29:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655321359; cv=none; d=google.com; s=arc-20160816; b=nyNYp8DNt1ybHoPt4w0tRpmjWny/1xQrMx9yx8zxgm2ZEIRDIAGhXTUklOx6sGQEFT DG1bqXWV/Nml975lu6nIfmN3IV094u2J3379EJu71tXAPhBJEniQkP5cj8Bs45gvPF17 MxAQLZPAf1Dxju5LbIKoeeI9Orllp6XfHoL2St8U9QFwPlcyDTV+6I2WkwmS4Tv4NhSk aUT1pZJxxKCAuAiYDY2U04BxXU+Jlh/U8B1ltXwY1gdDBb8ttzcRRQgB4/OdifkEptsh E6eZKJh6yAy5/xEkffRFQaOLvL8FnNrIltO1WeNWQnvQI3Po5MhG+FSpUqbhvJaPtHTZ n35A== 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=B1SFZ6MZWRb+dA4s/bCJZ/ZRO+w+dyhlktivoc3kZFU=; b=YCNzX5tz6N+oxBbqGgfuJI9TH3PZaZr5AbSHYffCrCg0cG+RkQENAFMXS9StsaBpyv fPUzmMVPemM6j2RxQxFCzbAUpdbM3GvCxEJXMRQv235N1hHIqaCNQMRW5xHctz5udMOi CMfjD/6XO9GGBOpYSnxL/Ydb6ndh8yRn6ukGIl3caQBK4UKUzF9a6pPNaAg6yuSLP9bM PDJHqwtyqQwi5azuCn7oCF9qyaQaVtR0zxZawy8XnZtZW/23SCQUfjpnxwFKZgaiD7Hy VHJpTbhFWSgYjEMiwjzIukRWIIo7kLVM1pAy9gWhQVWUXULFhDq3DKEWRHc1FXxfoKLX w3/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa12-20020a1709076d0c00b006fa51d2401bsi18050538ejc.174.2022.06.15.12.28.53; Wed, 15 Jun 2022 12:29:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358454AbiFOS2y (ORCPT + 99 others); Wed, 15 Jun 2022 14:28:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241911AbiFOS2u (ORCPT ); Wed, 15 Jun 2022 14:28:50 -0400 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C41703C499; Wed, 15 Jun 2022 11:28:49 -0700 (PDT) Received: by mail-wr1-f41.google.com with SMTP id c21so16512570wrb.1; Wed, 15 Jun 2022 11:28:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=B1SFZ6MZWRb+dA4s/bCJZ/ZRO+w+dyhlktivoc3kZFU=; b=kpmoCEusZIUb5cAtZvecB91+JUuCEJJSF39RxiQxrd0dLbg/59ReB6RSrwcMc/SBRF 49zPlC2I1JJk3GZh0BbmixH/jO4ZKbEw4NRziRoMGEAksMFeyMxMjnw6lLyKAFYwvxKu YK2j1zlwUhWSbKq2cdNNlUrsM2WYRwXlEgrCZLgHmXQCrx52b6rviYf8M3ZaXiZUFSBJ wetzU8SWwGLh++So50oe0EneSutVBlSFam4VeX2e84hc7R2bV9bE8naTeL3HKPtrnFna 0P3SWueuH3886IG2bu8IbhfW7ZW+pWRMQwFGCqJvudIbFG3i/BsXy/5n4oqLmiVLULtU kl3w== X-Gm-Message-State: AJIora9z0pRTxy4FB8YrPxOZZwuRqJFQHNjgWt70jHVVxtPLeuRsfheK NuwxnBDE+/kOxIVRtaDVM6c= X-Received: by 2002:adf:fd0a:0:b0:210:32dc:7519 with SMTP id e10-20020adffd0a000000b0021032dc7519mr1043351wrr.181.1655317728299; Wed, 15 Jun 2022 11:28:48 -0700 (PDT) Received: from liuwe-devbox-debian-v2 ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id j20-20020a5d6e54000000b00212a83b93f3sm15386971wrz.88.2022.06.15.11.28.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jun 2022 11:28:47 -0700 (PDT) Date: Wed, 15 Jun 2022 18:28:46 +0000 From: Wei Liu To: "Michael Kelley (LINUX)" Cc: Tianyu Lan , KY Srinivasan , Haiyang Zhang , Stephen Hemminger , "wei.liu@kernel.org" , Dexuan Cui , "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "hpa@zytor.com" , Tianyu Lan , "linux-hyperv@vger.kernel.org" , "linux-kernel@vger.kernel.org" , vkuznets , "parri.andrea@gmail.com" , "thomas.lendacky@amd.com" Subject: Re: [PATCH V3] x86/Hyper-V: Add SEV negotiate protocol support in Isolation VM Message-ID: <20220615182846.oliacmkrivhh5kx7@liuwe-devbox-debian-v2> References: <20220614014553.1915929-1-ltykernel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 14, 2022 at 04:50:36PM +0000, Michael Kelley (LINUX) wrote: > From: Tianyu Lan Sent: Monday, June 13, 2022 6:46 PM > > > > Hyper-V Isolation VM current code uses sev_es_ghcb_hv_call() > > to read/write MSR via GHCB page and depends on the sev code. > > This may cause regression when sev code changes interface > > design. > > > > The latest SEV-ES code requires to negotiate GHCB version before > > reading/writing MSR via GHCB page and sev_es_ghcb_hv_call() doesn't > > work for Hyper-V Isolation VM. Add Hyper-V ghcb related implementation > > to decouple SEV and Hyper-V code. Negotiate GHCB version in the > > hyperv_init() and use the version to communicate with Hyper-V > > in the ghcb hv call function. > > > > Fixes: 2ea29c5abbc2 ("x86/sev: Save the negotiated GHCB version") > > Signed-off-by: Tianyu Lan > > --- > > Change since v1: > > - Negotiate ghcb version in Hyper-V init. > > - use native_wrmsrl() instead of native_wrmsr() in the > > wr_ghcb_msr(). > > --- > > arch/x86/hyperv/hv_init.c | 6 +++ > > arch/x86/hyperv/ivm.c | 84 ++++++++++++++++++++++++++++++--- > > arch/x86/include/asm/mshyperv.h | 4 ++ > > 3 files changed, 88 insertions(+), 6 deletions(-) > > > > Reviewed-by: Michael Kelley > Applied to hyperv-fixes. Thanks.