Received: by 2002:ac8:5491:0:b0:40f:fb00:664b with SMTP id h17csp640379qtq; Thu, 10 Aug 2023 11:20:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFQtVEJF6u+MrdqCE0IDbKEGhQtg/naIbsxlwjsw6xDBNGyXpPLCj47sI2Kokp0xLRLcwLJ X-Received: by 2002:a05:6402:511:b0:523:338b:7977 with SMTP id m17-20020a056402051100b00523338b7977mr2662802edv.9.1691691638003; Thu, 10 Aug 2023 11:20:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691691637; cv=none; d=google.com; s=arc-20160816; b=y3flyND1C+cm0Y9buqSTRnAYs3976kH0Yc0WLTU7EFQ7+seB3TfgkgG6Lg1AddtCiK XDgePASQg5B/UvMvDMrdaDc7+GxwZ3BAsQ+lS74yEREwe35RtvhHPk8/J+sfw55/TzVV Gfzkvi1rYfLa/JYVjkqQjB8gJTmuEsCvb+7j/2KrdAam9C1ErJpALmBKOuEHQDdiw2ic l2RqBYcdXuluPUxpdFJSwTKr56vTKTddXoJxJ1EY/MkUZTdMnAt5bMqS3kToAY9P3Ess 418jwy/4mZd6Pvq8mThjtaXe/KcwIUGgaSW+AgIFwx41c4jBLVsmsK2VTZ5yOALhL9vr +32A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=LBxuuRBGx37tQ5XIQd6hBtuu9RLCe7TcvWshiqvJ6Ig=; fh=LQwMXAl/YGo1Q35uHfI9LXwhVQ3cIdejE6SXpF9nh3g=; b=QUXodRMeb+kqTYIrqy3z/+ky/nRCMHzewzp20otgkQC8Qe646DBSJr6roUvx3V+zqK 86QAi1X/lOlt52uHq9Rp47yVqgu1TtjotM8CmPr+O75atH3Vqowoygh/PNGcKRrzyvF9 b1iUOpmsMVCsD6DZR+U57xnrEFVwqFnhxgr4AQEEF69HnHgBvLYp9sA5TvSAG8EEIew3 txX9IuSY85+oSX38FbdYXX7knvOjUJp+OpMka5EsvZx9h2Zvyqhc199SSL9CHeUWENa4 XvjAr8jidnYHnePhf4foBDiOkCO1JQ5nOXK7X55d4EMv1ijYmud/9+kU1bBi7S8PiKaT aNvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=hgQ8PWMk; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l7-20020a056402028700b005233556d127si1940569edv.357.2023.08.10.11.20.12; Thu, 10 Aug 2023 11:20:37 -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; dkim=pass header.i=@gmail.com header.s=20221208 header.b=hgQ8PWMk; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232940AbjHJQWs (ORCPT + 99 others); Thu, 10 Aug 2023 12:22:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229871AbjHJQWr (ORCPT ); Thu, 10 Aug 2023 12:22:47 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D6F9A8; Thu, 10 Aug 2023 09:22:47 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1bdaeb0f29aso2876975ad.2; Thu, 10 Aug 2023 09:22:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691684566; x=1692289366; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=LBxuuRBGx37tQ5XIQd6hBtuu9RLCe7TcvWshiqvJ6Ig=; b=hgQ8PWMkP2K0rSExr6a+qhX3F0ukmJLk0DfQrMX1iZo+xMyjKV9CoZegiNwm+EcG+r zJbcpKajI7y/wOrYxn+4CTSYBa+rUKUg6kHN8bfWMB1iblfeFHeDKSsshGJhRKLAkElF ejsC3aZtMvpojv5MhEsuJfIp4KENrn5ODkvDR+l/5ANrP2Cky6o9GIohuhthkV6umPf7 32dAvU0TjigyGZ+tWhm8zVhyJsdVXVEzndpZTF97gZ1uGQuLkBzLQbshAg/oTAz58itK M4gc0zvUwbNGRbczqVL42RQtQ9U6fuS6EFUsGw6XUAsbxeJ5PhMD479ITmKOn1RFKMiv j4Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691684566; x=1692289366; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=LBxuuRBGx37tQ5XIQd6hBtuu9RLCe7TcvWshiqvJ6Ig=; b=iOcWVnjqO6k4bmTI6zPV8z9guLXTFkPwLdAam5CnLJdsUP7TErL3GinLpybHortwGG Y3lr7AxKV1o4iOKlO1EuagFly5HFr2wST5xzwmiCLF0qqAAgOHFTeqj/RBsdXBvNzGiZ y/brzYYGHsoce5KxDGdLYx58iG5QPadfQUbfF54lOdCzms2Jr9Z0lmH9lPCdTjyVlZnn KWh7dbDqGEJh8IhDekhjaU0nOOzebqG2lkxM+p9m0IdOlWPM1j+6FCI57luzt1voKV5A Me6XFGh/rgSkA30PpKMtXnd0YY5EHwJ3Lx+6y2ibx7bCxX09wXNnzyAzc6ykYAfZYkk+ QLOQ== X-Gm-Message-State: AOJu0Yzb0ZPrqkL8zVAPQUh0qqtAX0cHFvsIK3dHxcYPE6PV43fBnpmq BdaV5ZHjtyIoJgl18gpASko= X-Received: by 2002:a17:902:bd4c:b0:1b1:99c9:8ce1 with SMTP id b12-20020a170902bd4c00b001b199c98ce1mr2330144plx.51.1691684566496; Thu, 10 Aug 2023 09:22:46 -0700 (PDT) Received: from ?IPV6:2404:f801:0:5:8000::75b? ([2404:f801:9000:18:efec::75b]) by smtp.gmail.com with ESMTPSA id y6-20020a17090322c600b001b9c960ffeasm1981122plg.47.2023.08.10.09.22.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Aug 2023 09:22:46 -0700 (PDT) Message-ID: Date: Fri, 11 Aug 2023 00:22:36 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [EXTERNAL] [PATCH V2 2/9] x86/hyperv: Set Virtual Trust Level in VMBus init message To: Wei Liu , Saurabh Singh Sengar Cc: KY Srinivasan , Haiyang Zhang , Dexuan Cui , "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "hpa@zytor.com" , "daniel.lezcano@linaro.org" , "arnd@arndb.de" , "Michael Kelley (LINUX)" , Tianyu Lan , "linux-arch@vger.kernel.org" , "linux-hyperv@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "vkuznets@redhat.com" References: <20230627032248.2170007-1-ltykernel@gmail.com> <20230627032248.2170007-3-ltykernel@gmail.com> From: Tianyu Lan In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 8/7/2023 12:48 PM, Wei Liu wrote: > On Fri, Jul 07, 2023 at 09:07:54AM +0000, Saurabh Singh Sengar wrote: >> >> >>> + >>> + ret = hv_do_hypercall(control, input, output); >>> + if (hv_result_success(ret)) >>> + vtl = output->as64.low & HV_X64_VTL_MASK; >>> + else >>> + pr_err("Hyper-V: failed to get VTL! %lld", ret); >> >> In case of error this function will return vtl=0, which can be the valid value of vtl. >> I suggest we initialize vtl with -1 so and then check for its return. >> >> This could be a good utility function which can be used for any Hyper-V VTL system, so think >> of making it global ? >> > > Tianyu -- your thought on this? In current user cases, the guest only runs in VTL0 and Hyper-V may return VTL error in some cases but kernel still may run with 0 as VTL. I just sent out v5 and set VTL to 0 by default if fail to get VTL from Hyper-V and give out a warning log. The get_vtl() is only called on enlightened SEV-SNP guest. If there is new case that needs handle the error from Hyper-V when call VTL hvcall, we may add the logic later.