From nobody Mon Feb 9 16:19:40 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1576680221; cv=none; d=zohomail.com; s=zohoarc; b=V4UNcu/iUsXtVJGnSkQlKPpPdmvbiH2cw+/OvrbUkva4KKGgJiC9ULUlt3DTFzmSIRVjzadmh9h410lZiI0F6Vt0eDWq9SyvBnhWFYKbKo8a4zpyTirKcMi7re1CfqxISglBqXR66ghuLoaGpQFmedHKWqWkTAPLyhFu5D2vN6E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576680221; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bvxJ80j0KNNhvUDR2yOxcyQDvzEKQGmJUEp141I9gEI=; b=PEraEROQSkaWa5iImpTvtzin9+B4AQyqhuzF81qowP3+sLQ9VTUkryurCJjowMuoTxnaJtamkp/h6AdVo0vDB5MG28SlRHvVlC6RRHoF5rGDYsidKo+mgm7OrbXIksQ7Oir0hphqABO264VeBoW0F1ixh/SzfziGApZ1DYpgAzg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1576680221917159.06829956611352; Wed, 18 Dec 2019 06:43:41 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ihaXd-0004Z9-8U; Wed, 18 Dec 2019 14:43:09 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ihaXb-0004YR-Qd for xen-devel@lists.xenproject.org; Wed, 18 Dec 2019 14:43:07 +0000 Received: from mail-wm1-x344.google.com (unknown [2a00:1450:4864:20::344]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a4d68d2c-21a4-11ea-b6f1-bc764e2007e4; Wed, 18 Dec 2019 14:42:41 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id m24so2097142wmc.3 for ; Wed, 18 Dec 2019 06:42:41 -0800 (PST) Received: from debian.mshome.net (38.163.200.146.dyn.plus.net. [146.200.163.38]) by smtp.gmail.com with ESMTPSA id p17sm2724894wmk.30.2019.12.18.06.42.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2019 06:42:40 -0800 (PST) X-Inumbo-ID: a4d68d2c-21a4-11ea-b6f1-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BPQxGbYWCz/cDrvGjrtCt3X0aC5XW0YsyQfUDvPNuVA=; b=OcgOCgxFGYca3uDJ6ajjb51HjPU2jYLzYXm26zTldWgmYC5dxl2fTkDg13c3iZYmhg WxieShw19YHzqgPta9RX3LEdSDnyF9NGhPcQFjSRrRicr1EazrVJytdWMavGVlmJl02A +iOaSopGHQkZ0rf2lHtuQpvUI+0NMZjneB6Sn5HI5ivgeuH8IohE8cmBqyhEDTEoe+nB e/xlnd6tlIbCxTQb2CQi6pWqrLVWsbGafsCm2m66hhj6O1Ue6RIG5wgBZusbS3wWjEyH JWsALqkFJcAMpL6/Q2km06tUvFpxu7DozmSddqRZHokJFJBz3LCL2ybmN/LwWz/jTT4e sZ7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=BPQxGbYWCz/cDrvGjrtCt3X0aC5XW0YsyQfUDvPNuVA=; b=knAbfbakrUyXzQTgAQgkvobMVew63aARDEpqGMSivUFFssg1Y0y8LQpsQdC8Sth10K Le9q8A5yCW47kwpSd6RQ8H9bbn45OzeEtvPfPDv3FbvRDeMNB/zJZkpswTxGkgQu0MmT GwEGqMNGk+Cx4jKp6zBM8cr2kGznQaIEyrJkgjMFvyiqFWfy3Gjqb0v3QsdSzk3Er4/v udkJiQSD6jbQ30cO7/C7ZbYqX2/MaYNpaRH6h1a2YXEs3Ybok6DT2F0q2zbhPRPFx1SX h49ApqVCPTzgAAhcpaxdMYpO1kRdC/woGPfLBxC+OoEGgcWOvcCsu5rZnyELzBppbPJ/ ErUQ== X-Gm-Message-State: APjAAAXfzLdSd/g4w/v+SuWHffvYKmUhNlHodqCfrzW6clxmYhrr5SKe sAgYJNh70yaTTg5vFBjdALK7hJq3 X-Google-Smtp-Source: APXvYqyjO7SfPknIFIm91rNcXZ4zuJx78QNgVB54GQEsV6IoxMJRWOKf/pDolK7ViAL7HnjumeVHRg== X-Received: by 2002:a1c:81c9:: with SMTP id c192mr3743069wmd.44.1576680160761; Wed, 18 Dec 2019 06:42:40 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Wed, 18 Dec 2019 14:42:32 +0000 Message-Id: <20191218144233.15372-6-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191218144233.15372-1-liuwe@microsoft.com> References: <20191218144233.15372-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 5/6] x86/hyperv: extract more information from Hyper-V X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Wei Liu , Wei Liu , Andrew Cooper , Paul Durrant , Michael Kelley , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Provide a structure to store that information. The structure will be accessed from other places later so make it public. Signed-off-by: Wei Liu Acked-by: Jan Beulich --- xen/arch/x86/guest/hyperv/hyperv.c | 17 +++++++++++++++++ xen/include/asm-x86/guest/hyperv.h | 12 ++++++++++++ 2 files changed, 29 insertions(+) diff --git a/xen/arch/x86/guest/hyperv/hyperv.c b/xen/arch/x86/guest/hyperv= /hyperv.c index b82ae3833f..2e70b4aa82 100644 --- a/xen/arch/x86/guest/hyperv/hyperv.c +++ b/xen/arch/x86/guest/hyperv/hyperv.c @@ -21,6 +21,9 @@ #include =20 #include +#include + +struct ms_hyperv_info __read_mostly ms_hyperv; =20 static const struct hypervisor_ops ops =3D { .name =3D "Hyper-V", @@ -40,6 +43,20 @@ const struct hypervisor_ops *__init hyperv_probe(void) if ( eax !=3D 0x31237648 ) /* Hv#1 */ return NULL; =20 + /* Extract more information from Hyper-V */ + cpuid(HYPERV_CPUID_FEATURES, &eax, &ebx, &ecx, &edx); + ms_hyperv.features =3D eax; + ms_hyperv.misc_features =3D edx; + + ms_hyperv.hints =3D cpuid_eax(HYPERV_CPUID_ENLIGHTMENT_INFO); + + if ( ms_hyperv.hints & HV_X64_ENLIGHTENED_VMCS_RECOMMENDED ) + ms_hyperv.nested_features =3D cpuid_eax(HYPERV_CPUID_NESTED_FEATUR= ES); + + cpuid(HYPERV_CPUID_IMPLEMENT_LIMITS, &eax, &ebx, &ecx, &edx); + ms_hyperv.max_vp_index =3D eax; + ms_hyperv.max_lp_index =3D ebx; + return &ops; } =20 diff --git a/xen/include/asm-x86/guest/hyperv.h b/xen/include/asm-x86/guest= /hyperv.h index 3f88b94c77..cc21b9abfc 100644 --- a/xen/include/asm-x86/guest/hyperv.h +++ b/xen/include/asm-x86/guest/hyperv.h @@ -21,8 +21,20 @@ =20 #ifdef CONFIG_HYPERV_GUEST =20 +#include + #include =20 +struct ms_hyperv_info { + uint32_t features; + uint32_t misc_features; + uint32_t hints; + uint32_t nested_features; + uint32_t max_vp_index; + uint32_t max_lp_index; +}; +extern struct ms_hyperv_info ms_hyperv; + const struct hypervisor_ops *hyperv_probe(void); =20 #else --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel