From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 855D6C433ED for ; Thu, 8 Apr 2021 13:15:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5913D61151 for ; Thu, 8 Apr 2021 13:15:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231557AbhDHNQC (ORCPT ); Thu, 8 Apr 2021 09:16:02 -0400 Received: from linux.microsoft.com ([13.77.154.182]:34986 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229741AbhDHNQB (ORCPT ); Thu, 8 Apr 2021 09:16:01 -0400 Received: from [192.168.86.30] (c-73-38-52-84.hsd1.vt.comcast.net [73.38.52.84]) by linux.microsoft.com (Postfix) with ESMTPSA id 9246420B5680; Thu, 8 Apr 2021 06:15:48 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9246420B5680 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1617887750; bh=XZtRYq5agCaEslp2SkcIxFuSoTSHZxnoXDUN99ENL0M=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=GvyHAEg4gxRRvHJLEjU1/eh6x3wmXHkOv357f0YDONPqsL6y4qMEczVbayazjH1Bv Hs3/RiSDu8+uCxF3bF1/76pzWb2368cfPni8KfxPghJB9zCyZ7AfQfJ/w+bSOOpGkG Acj8eJwqkHh1BXE75Z4yWcBL1OG4d/w/HZ3dWvyM= Subject: Re: [PATCH 1/7] hyperv: Detect Nested virtualization support for SVM To: Vitaly Kuznetsov Cc: "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "K. Y. Srinivasan" , x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, Lan Tianyu , Michael Kelley , Paolo Bonzini , Sean Christopherson , Wanpeng Li , Jim Mattson , Joerg Roedel , Wei Liu , Stephen Hemminger , Haiyang Zhang References: <87lf9tavci.fsf@vitty.brq.redhat.com> From: Vineeth Pillai Message-ID: Date: Thu, 8 Apr 2021 09:15:47 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <87lf9tavci.fsf@vitty.brq.redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi Vitaly, On 4/8/21 7:06 AM, Vitaly Kuznetsov wrote: > - if (ms_hyperv.hints & HV_X64_ENLIGHTENED_VMCS_RECOMMENDED) { > + /* > + * AMD does not need enlightened VMCS as VMCB is already a > + * datastructure in memory. > Well, VMCS is also a structure in memory, isn't it? It's just that we > don't have a 'clean field' concept for it and we can't use normal memory > accesses. Yes, you are right. I was referring to the fact that we cant use normal memory accesses, but is a bit mis-worded. > >> We need to get the nested >> + * features if SVM is enabled. >> + */ >> + if (boot_cpu_has(X86_FEATURE_SVM) || >> + ms_hyperv.hints & HV_X64_ENLIGHTENED_VMCS_RECOMMENDED) { > Do I understand correctly that we can just look at CPUID.0x40000000.EAX > and in case it is >= 0x4000000A we can read HYPERV_CPUID_NESTED_FEATURES > leaf? I'd suggest we do that intead then. I agree, that is a better way to consolidate both the cases. Will change it in the next iteration. Probably the above code comment is not needed when we consolidate the cases here. Thanks, Vineeth