Received: by 10.223.185.116 with SMTP id b49csp3983914wrg; Mon, 26 Feb 2018 09:13:11 -0800 (PST) X-Google-Smtp-Source: AG47ELvUSWLQYVbtZGIsHLv9/+zlqf9vCPYkcCzcg3GF3B++JEVSueQBne9fZgciLx6GYy5eDM7Z X-Received: by 10.101.75.18 with SMTP id r18mr2901300pgq.36.1519665191787; Mon, 26 Feb 2018 09:13:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519665191; cv=none; d=google.com; s=arc-20160816; b=chQUv5IldztFucbO3Y9+x2KDAIowcYMSUSG2GBfDGyuBrvAuSXRRSHhwRneP4Ld5nu TMEsNiY2k12Ya7yN8EW8tVjHUrVXFRoAE8MQ4qwcp+BxpJIlhWJVaLDXGnMV0OHvXP/k P0eeW8yjid4+/R4j0HaNDPqEJ12XWNt8Rw83eqWlJPSxyWeFkkj/3KllMUzXjL91uq0i n97E6DQihhhcSwrVJ04kfWbm56NiDoghPgRdCyAGPZmGu/DelVkbENlnTnlA/p3gL+NP fDkAcmRsci5+x7FRn+okNPrZ77ITMCOUrsane3m47xJHRf2su0GbfIMIuSDTzhQ2Yw0P xc/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=vhmFJqJ1ep2bzyxLYxHHduJ9+fmwWGrAmLmetTFnITg=; b=CInPdR5CRSz7t5me2wTpsA+GH1ZsUF1sP7yLbeLPNDI1/Rd7CxIOknJTAIxOa3jpUW dLLvmdPVTwlJZ2zl6zRKlAbg7hs704vn7K+eO31SaVvuUqybRI1JH2aVroSjxTOmTFjo TsSbH/MgFEehNMvC8k7o7Ku9ldbZAJS/X7u0K7v3HDlPL5Pxjj87ZcjEK2PL4T96ap6t 1ZL77gQSgbQSbBCdQTDkQCJF1dPhwR2QS8eA13C8cBew2KHz2VVqDFJklmzIpxr/hUHT 4t1JiqJ3IyFsX6eeUwUkuOCpXQIByAl7jc0AYZ56FrV58pFt/3V4Zg55HiGFLTDOsZHS uOIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k185si3392747pfc.277.2018.02.26.09.12.55; Mon, 26 Feb 2018 09:13:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751827AbeBZRLk (ORCPT + 99 others); Mon, 26 Feb 2018 12:11:40 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:39256 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751789AbeBZRLf (ORCPT ); Mon, 26 Feb 2018 12:11:35 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D27D1818AAF4; Mon, 26 Feb 2018 17:11:34 +0000 (UTC) Received: from vitty.brq.redhat.com (unknown [10.43.2.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id 116A410B0F26; Mon, 26 Feb 2018 17:11:32 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org Cc: x86@kernel.org, Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley (EOSG)" , Mohammed Gamal , Cathy Avery , Bandan Das , linux-kernel@vger.kernel.org Subject: [PATCH v2 4/5] x86/hyper-v: detect nested features Date: Mon, 26 Feb 2018 18:11:20 +0100 Message-Id: <20180226171121.18974-5-vkuznets@redhat.com> In-Reply-To: <20180226171121.18974-1-vkuznets@redhat.com> References: <20180226171121.18974-1-vkuznets@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 26 Feb 2018 17:11:34 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 26 Feb 2018 17:11:34 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'vkuznets@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org TLFS 5.0 says: "Support for an enlightened VMCS interface is reported with CPUID leaf 0x40000004. If an enlightened VMCS interface is supported, additional nested enlightenments may be discovered by reading the CPUID leaf 0x4000000A (see 2.4.11)." Signed-off-by: Vitaly Kuznetsov --- arch/x86/include/asm/mshyperv.h | 2 ++ arch/x86/kernel/cpu/mshyperv.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h index 778d2efd34f1..355844d5ac4f 100644 --- a/arch/x86/include/asm/mshyperv.h +++ b/arch/x86/include/asm/mshyperv.h @@ -26,12 +26,14 @@ enum hv_cpuid_function { HVCPUID_FEATURES = 0x40000003, HVCPUID_ENLIGHTENMENT_INFO = 0x40000004, HVCPUID_IMPLEMENTATION_LIMITS = 0x40000005, + HVCPUID_NESTED_FEATURES = 0x4000000A }; struct ms_hyperv_info { u32 features; u32 misc_features; u32 hints; + u32 nested_features; u32 max_vp_index; u32 max_lp_index; }; diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c index 9340f41ce8d3..7a387f7a28b8 100644 --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c @@ -207,6 +207,9 @@ static void __init ms_hyperv_init_platform(void) x86_platform.calibrate_cpu = hv_get_tsc_khz; } + if (ms_hyperv.hints & HV_X64_ENLIGHTENED_VMCS_RECOMMENDED) + ms_hyperv.nested_features = cpuid_eax(HVCPUID_NESTED_FEATURES); + #ifdef CONFIG_X86_LOCAL_APIC if (ms_hyperv.features & HV_X64_ACCESS_FREQUENCY_MSRS && ms_hyperv.misc_features & HV_FEATURE_FREQUENCY_MSRS_AVAILABLE) { -- 2.14.3