From nobody Mon Feb 9 07:06:01 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=1578067791; cv=none; d=zohomail.com; s=zohoarc; b=bRyCpMcRgijszcJ+8ykKq37HGQjL5HSe0gy/kOFblUDbnlAXfq6FtJQTXny0eNwFBk+TRXqJcVt2Ucb4HmdQj6srgX1Yu/B5l6tHIYyRZLzKy+JmlKBpZj2hMOE5C80Atmy9wDCzXpeGdhABTT4WnevnRrEb1pfOgxYxddoB5II= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578067791; 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=y5G4VNzrEwnq4KoISEaPIESvc621xYIUZ0faA8DBkBE=; b=jZTVA0glBXzH8xZP9jRPqHG4kn0gS6zpcbyMgdD1KTk3zJb3N+wk1QC7+zLbhSWuP6N7qFz0qYUmZCS4bjOPPQp6XgtRNGXpo4qEvojsQ2ccVMuKTiyqkfzieukr9bl2WEh9lCns/m/vSL28yOwc74OYBjiG3ia9uh1P2JKwCQY= 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 1578067791276695.2848234100315; Fri, 3 Jan 2020 08:09:51 -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 1inPVc-0005Rk-KJ; Fri, 03 Jan 2020 16:09:08 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1inPVb-0005RW-KW for xen-devel@lists.xenproject.org; Fri, 03 Jan 2020 16:09:07 +0000 Received: from mail-wr1-x42a.google.com (unknown [2a00:1450:4864:20::42a]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 5939d5d0-2e43-11ea-88e7-bc764e2007e4; Fri, 03 Jan 2020 16:08:58 +0000 (UTC) Received: by mail-wr1-x42a.google.com with SMTP id y17so42927624wrh.5 for ; Fri, 03 Jan 2020 08:08:58 -0800 (PST) Received: from localhost.localdomain (38.163.200.146.dyn.plus.net. [146.200.163.38]) by smtp.gmail.com with ESMTPSA id z11sm61000235wrt.82.2020.01.03.08.08.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 08:08:57 -0800 (PST) X-Inumbo-ID: 5939d5d0-2e43-11ea-88e7-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=lOdhYFEVelSK6Ytux96+pcbc6B3h71rDSrm39/P7N80=; b=RQoC+pso/dCEYUaDHg9flDKa37SjRprUJMgemtpKRxCsPrvxs9iJkn7WeC7HPW0Ylv ctfJD4pZLNqk8J7cnwGjzIhrTxkvNvkpCI6qfv3noYM21lC3ah0jlh9Pu8LzgaEo9OCI R4fV0hlpTKt07b58i16PSq/+49RFYSIBEhZgjwW/45syTKuV/Uj0O60/HLaOpTYxY8Nl ZaNl66pPGp+mdqB4o9WMNzEIQZXuEnuKjTfV6hOTTAQddUrTvg75IueLOlm22Yqkte1F rZvrmpjoC+fm4z0BkHdj66WPLdYU/LEpPwYOMzElxnsLyht8XbA4d3xAQlarb6O9QSx7 kJ/w== 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=lOdhYFEVelSK6Ytux96+pcbc6B3h71rDSrm39/P7N80=; b=IzKTxuluHu1IaPwIfVz5S0B0OLlh17gULalhXUtTbp7BKyLhI/aEyTbVaG+V1+8QUG pdVJ50UStmUB9qjXIe4IJona4lnZ5WAuhhxiWbOo+VSzIUQcR75rdSnryBNypzfyDQvj +7TkqA63e4OYcuDNtnY5vS+k5ebpdyrqVYR3qMeAKFct2GQ+tnZIdMARmb2zOI07ow3j WrsSiT5u3qC85/JcUMXH6DEEtxmSbytYAOWF9tYBMOK4qGO62mk4aqCJLRPHGpnwPQCv GhrzFDk0zS8H+RjeYgY0HcB5t1j/hrAy3t4ZV3LAiGQg3Ox+WJw3tCc7JXzGnfUT2bjr ByzA== X-Gm-Message-State: APjAAAXe085P6ZdNT/jZsM0zglcuhjsWOcAwJh5jclWmTzImnquXVxGA 0fMmLTcIhhkGf1H5FErP0IFD2zVIERIRFQ== X-Google-Smtp-Source: APXvYqwdsSwb9hd2N7DiC6+ZLYhBc1aNVFNbCK+TvaRkPAFWFvi8P4cLv1psIRtr5DGKdEpmHEKg5w== X-Received: by 2002:adf:df8e:: with SMTP id z14mr87620646wrl.190.1578067737706; Fri, 03 Jan 2020 08:08:57 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Fri, 3 Jan 2020 16:08:19 +0000 Message-Id: <20200103160825.19377-3-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200103160825.19377-1-liuwe@microsoft.com> References: <20200103160825.19377-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 2/8] x86/hyperv: detect absolutely necessary MSRs 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 , Paul Durrant , Andrew Cooper , 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) If they are not available, disable Hyper-V related features. Signed-off-by: Wei Liu --- v2: 1. Fix comment style --- xen/arch/x86/guest/hyperv/hyperv.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/xen/arch/x86/guest/hyperv/hyperv.c b/xen/arch/x86/guest/hyperv= /hyperv.c index 2e70b4aa82..8d38313d7a 100644 --- a/xen/arch/x86/guest/hyperv/hyperv.c +++ b/xen/arch/x86/guest/hyperv/hyperv.c @@ -32,6 +32,8 @@ static const struct hypervisor_ops ops =3D { const struct hypervisor_ops *__init hyperv_probe(void) { uint32_t eax, ebx, ecx, edx; + uint64_t required_msrs =3D HV_X64_MSR_HYPERCALL_AVAILABLE | + HV_X64_MSR_VP_INDEX_AVAILABLE; =20 cpuid(0x40000000, &eax, &ebx, &ecx, &edx); if ( !((ebx =3D=3D 0x7263694d) && /* "Micr" */ @@ -57,6 +59,16 @@ const struct hypervisor_ops *__init hyperv_probe(void) ms_hyperv.max_vp_index =3D eax; ms_hyperv.max_lp_index =3D ebx; =20 + if ( (ms_hyperv.features & required_msrs) !=3D required_msrs ) + { + /* + * Oops, required MSRs are not available. Treat this as + * "Hyper-V is not available". + */ + memset(&ms_hyperv, 0, sizeof(ms_hyperv)); + return NULL; + } + return &ops; } =20 --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel