Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp790641pxb; Thu, 15 Apr 2021 06:45:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiwlG7yLLpk8bw+N+hRoMWeK/Hck0jWxvndfbReLid7g8Bs2JxxJlb025dKJ/bm5B5SV3i X-Received: by 2002:a63:1e4d:: with SMTP id p13mr3596969pgm.238.1618494307982; Thu, 15 Apr 2021 06:45:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618494307; cv=none; d=google.com; s=arc-20160816; b=kr8Cmsy//qMIfWjwzmTJ2fbeq2BzxSarMgAGSYfkqqv/7HjQb6TBBBXDR206uX9Uyu u26we45e1/MVUDwwF5jOKlmjRkANFviUQXksffCRiCO8vcNL/ZSLCxfjJnDAGcWSXpYC IJtwohaUWy66iGaGLBOOisvZ0cMFSmkBxY4pS7O3elVAKC484zynOOOXoWb9gABCGZI1 7zwrrJIHO+enj11UzqQdnN6JxyAYJ3EeIV0BhxuW0pNJv66PamFki01dAE8nQL/ecOZ0 wO/XkiCOGdPyjzwyFcnqoIfkT+P3GiCWA+VMj3k/j6ME3GgoymGy3sY3IGITORViZ0mY ZzXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=zgpGiyGDi60pFC4qD9nG0XS7yB8eDhV4EULVqhMuJOw=; b=DgKpTJw43oEudXXjE9WwM/M6oRi9+rw2fH5VKHDSTiUfAsM81kBTkXt5fZcrsNBlon PX2re0BcXF0KcbcU/Rqz7XeIp0vbBxpePKl9VmA/LBkMIlhZhlXXgKqwxFvzDdqVT1id OLf2mgBFcVmgt6ljs0c+qAfCgDSKsgE+q7mCcGiLiVi9SCVKHLNX9DapDXpOTlP9/Hg0 klM8HLGq15hITMoWn/RwV54aKDziB+G3IXaSjDBYonOovK144qBEWB++EVkaoxqoOPyG 8UrEARjahfkvpbCVdUlSaAaQZ0jyjXPNr/9pQ5EVmbunevxvb6GgrZIaHcLghpDdQLuh 8ycw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=r013N275; 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=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e16si2978089pjr.88.2021.04.15.06.44.55; Thu, 15 Apr 2021 06:45:07 -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=@linux.microsoft.com header.s=default header.b=r013N275; 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=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233476AbhDONo0 (ORCPT + 99 others); Thu, 15 Apr 2021 09:44:26 -0400 Received: from linux.microsoft.com ([13.77.154.182]:41532 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233389AbhDONoV (ORCPT ); Thu, 15 Apr 2021 09:44:21 -0400 Received: from viremana-dev.fwjladdvyuiujdukmejncen4mf.xx.internal.cloudapp.net (unknown [13.66.132.26]) by linux.microsoft.com (Postfix) with ESMTPSA id A2E4820B8002; Thu, 15 Apr 2021 06:43:57 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com A2E4820B8002 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1618494237; bh=zgpGiyGDi60pFC4qD9nG0XS7yB8eDhV4EULVqhMuJOw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r013N2753/Bt4Mz7SOGaPTdZktqIW+RyyfknILC0UhlgvO2sy45QDHjH/numJGnm6 1B74ebXrBxviT5EL//+CgA8XCGAkNTPP2xUOV8jFPMfIXuonIHKtDIVFml2juoyZWR 8rnpghLmpk3IKeUPqs6ZUnskABrFtS6p3IndWIyo= From: Vineeth Pillai To: Lan Tianyu , Michael Kelley , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Wei Liu , Stephen Hemminger , Haiyang Zhang Cc: Vineeth Pillai , "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 Subject: [PATCH v2 1/7] hyperv: Detect Nested virtualization support for SVM Date: Thu, 15 Apr 2021 13:43:36 +0000 Message-Id: <9d12558549bc0c6f179b26f5b16c751bdfab3f74.1618492553.git.viremana@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Detect nested features exposed by Hyper-V if SVM is enabled. Signed-off-by: Vineeth Pillai --- arch/x86/kernel/cpu/mshyperv.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c index 3546d3e21787..c6f812851e37 100644 --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c @@ -252,6 +252,7 @@ static void __init hv_smp_prepare_cpus(unsigned int max_cpus) static void __init ms_hyperv_init_platform(void) { + int hv_max_functions_eax; int hv_host_info_eax; int hv_host_info_ebx; int hv_host_info_ecx; @@ -269,6 +270,8 @@ static void __init ms_hyperv_init_platform(void) ms_hyperv.misc_features = cpuid_edx(HYPERV_CPUID_FEATURES); ms_hyperv.hints = cpuid_eax(HYPERV_CPUID_ENLIGHTMENT_INFO); + hv_max_functions_eax = cpuid_eax(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS); + pr_info("Hyper-V: privilege flags low 0x%x, high 0x%x, hints 0x%x, misc 0x%x\n", ms_hyperv.features, ms_hyperv.priv_high, ms_hyperv.hints, ms_hyperv.misc_features); @@ -298,8 +301,7 @@ static void __init ms_hyperv_init_platform(void) /* * Extract host information. */ - if (cpuid_eax(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS) >= - HYPERV_CPUID_VERSION) { + if (hv_max_functions_eax >= HYPERV_CPUID_VERSION) { hv_host_info_eax = cpuid_eax(HYPERV_CPUID_VERSION); hv_host_info_ebx = cpuid_ebx(HYPERV_CPUID_VERSION); hv_host_info_ecx = cpuid_ecx(HYPERV_CPUID_VERSION); @@ -325,9 +327,11 @@ static void __init ms_hyperv_init_platform(void) ms_hyperv.isolation_config_a, ms_hyperv.isolation_config_b); } - if (ms_hyperv.hints & HV_X64_ENLIGHTENED_VMCS_RECOMMENDED) { + if (hv_max_functions_eax >= HYPERV_CPUID_NESTED_FEATURES) { ms_hyperv.nested_features = cpuid_eax(HYPERV_CPUID_NESTED_FEATURES); + pr_info("Hyper-V: Nested features: 0x%x\n", + ms_hyperv.nested_features); } /* -- 2.25.1