From nobody Sat May 11 12:21:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=templeofstupid.com) ARC-Seal: i=2; a=rsa-sha256; t=1674671656; cv=pass; d=zohomail.com; s=zohoarc; b=Aur/+o33b6CWAGHdJcH5S40zLMmQi+RkrAllyYmNJsYqZq8nhgXlzC+WkIFnpAhAX8R+E31v44myCTVYGJr+k6IyyydQcNpBBcCn1YtAP9x1lhwtaw0fhZ4znAY7amyIfct7QobNUaoSVzuTOhUXZmMhNAaU+xrUZmVYNbqT1M8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674671656; h=Content-Type: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=eqyFtuln9teDjnwVY8VK7WjssFBHkmh8oTKDG+ZK2Dg=; b=JjXiR+18ooukBp5ef1bDDEbjf7jtZsgsIugyPS3IVR4gE6c4N5l62X+b/tdQ4VC/8347CKeQgXOLehThYLPwDPM0mrm4kbWvK3oUZzO/UTpRCmO3g1V1g6AlU1020HmMUNue6ohuMxxmjH0efWFxf464hWJGTXClhXnDnOLCXgs= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=templeofstupid.com) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1674671656516472.97098668984484; Wed, 25 Jan 2023 10:34:16 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.484521.751133 (Exim 4.92) (envelope-from ) id 1pKkaf-0004s4-47; Wed, 25 Jan 2023 18:33:45 +0000 Received: by outflank-mailman (output) from mailman id 484521.751133; Wed, 25 Jan 2023 18:33:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pKkaf-0004rx-18; Wed, 25 Jan 2023 18:33:45 +0000 Received: by outflank-mailman (input) for mailman id 484521; Wed, 25 Jan 2023 18:33:44 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pKkad-0004rn-Uo for xen-devel@lists.xenproject.org; Wed, 25 Jan 2023 18:33:43 +0000 Received: from crocodile.elm.relay.mailchannels.net (crocodile.elm.relay.mailchannels.net [23.83.212.45]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c98d1fd9-9cde-11ed-91b6-6bf2151ebd3b; Wed, 25 Jan 2023 19:33:41 +0100 (CET) Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 25BFC881D46 for ; Wed, 25 Jan 2023 18:33:39 +0000 (UTC) Received: from pdx1-sub0-mail-a306.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 8EC9C881C5C for ; Wed, 25 Jan 2023 18:33:38 +0000 (UTC) Received: from pdx1-sub0-mail-a306.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.126.30.49 (trex/6.7.1); Wed, 25 Jan 2023 18:33:38 +0000 Received: from kmjvbox (c-76-102-200-71.hsd1.ca.comcast.net [76.102.200.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kjlx@templeofstupid.com) by pdx1-sub0-mail-a306.dreamhost.com (Postfix) with ESMTPSA id 4P2CCQ1YPDzK3 for ; Wed, 25 Jan 2023 10:33:38 -0800 (PST) Received: from johansen (uid 1000) (envelope-from kjlx@templeofstupid.com) id e00e2 by kmjvbox (DragonFly Mail Agent v0.12); Wed, 25 Jan 2023 10:33:37 -0800 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c98d1fd9-9cde-11ed-91b6-6bf2151ebd3b X-Sender-Id: dreamhost|x-authsender|kjlx@templeofstupid.com ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1674671618; a=rsa-sha256; cv=none; b=0RcDVdnfrfpZO++0fp/wERntWG6DUztZnG2iq28H16d12M7DJEGQQoj1QheyUuXcgnMhPA nkv+xt4MRVjEIEKg+t6WaZfh14lmJj0isg1S1dI8RbMD813+1d4iJoOZaZ2cPdzfmW66ea 4OE6hO/TowJHfI5vo+cI9M9QMg1MUAV8ank6MUmpIeU6M4HfxYuJL45dZUZGd5ZQxbVm2Z QsL4MnEa5PaNVUoFMAIeW41ZuJkdvRe4kP3c7QuV+LHqxhb2F/9gHOt5FQ8G1lPQFTaajb zPIfHEilx2e4rMdPOab3CleXm6o15uVgEBEZS7hJGY3lrIMRiDEViUaHXYqo+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1674671618; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=eqyFtuln9teDjnwVY8VK7WjssFBHkmh8oTKDG+ZK2Dg=; b=iooMJgKXGkqohds3FAEuulD2ymWzfGD8M8Q/jP9FiKGctDuiUS1NE+CdwS4Tf4u1fMWHiT FnAxR06uOCsFohEA/nc8YjyI/puk0ctlmOTHEvBuqvY60N2oX8F9j6pG0d8flTkP66WcIz UZafvLARpFUMbVO9HwRPtngvctong+lJ5dl3VaZF+0BX2GtfODy7DUuE4P621DNw/LHjfw u+I0A702GgqNvuaulE/f0vPBAKdJffyqG0qXLA+NKWL8P0IJmk6Ic7CS5bTfobaEP6+1OX Fr/sPuV8WoMBf+7R3d580dR55eHnBstUCYXqGEvk3saIsKhh/a6wyurhMiOCbA== ARC-Authentication-Results: i=1; rspamd-65f5b7cf85-z6rsq; auth=pass smtp.auth=dreamhost smtp.mailfrom=kjlx@templeofstupid.com X-Sender-Id: dreamhost|x-authsender|kjlx@templeofstupid.com X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|kjlx@templeofstupid.com X-MailChannels-Auth-Id: dreamhost X-Cure-Gusty: 65b9a5b53bc53093_1674671618808_1379431902 X-MC-Loop-Signature: 1674671618808:1002556764 X-MC-Ingress-Time: 1674671618808 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=templeofstupid.com; s=dreamhost; t=1674671618; bh=eqyFtuln9teDjnwVY8VK7WjssFBHkmh8oTKDG+ZK2Dg=; h=Date:From:To:Cc:Subject:Content-Type; b=jTYoayBwAJyox93l/wMGptzqafXCYrPR9Oascr3rXA8ynmDNqiGto3CJNq1wd80ic fEZEVmdZtOW06CnMG4XZFajP6M+zd341nk89Nb+q0GyISCnGfzx4lc4uiwut3n734C Blo3ouPHsd60YXfSE+Rlas1IaH1a2b8Blg/z4zu8= Date: Wed, 25 Jan 2023 10:33:37 -0800 From: Krister Johansen To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , Roger Pau =?utf-8?B?TW9ubsOp?= , Wei Liu , Juergen Gross , Boris Ostrovsky , David Reaver Subject: [PATCH v2] xen/x86: public: add TSC defines for cpuid leaf 4 Message-ID: <20230125183337.GC1963@templeofstupid.com> References: <20230124223531.GB1962@templeofstupid.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230124223531.GB1962@templeofstupid.com> X-ZohoMail-DKIM: fail (Signature length not correct: got 128 but was expecting 256) X-ZM-MESSAGEID: 1674671657916100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Cpuid leaf 4 contains information about how the state of the tsc, its mode, and some additional information. A commit that is queued for linux would like to use this to determine whether the tsc mode has been set to 'no emulation' in order to make some decisions about which clocksource is more reliable. Expose this information in the public API headers so that they can subsequently be imported into linux and used there. Link: https://lore.kernel.org/xen-devel/eda8d9f2-3013-1b68-0df8-64d7f13ee35= e@suse.com/ Link: https://lore.kernel.org/xen-devel/0835453d-9617-48d5-b2dc-77a2ac298ba= d@oracle.com/ Signed-off-by: Krister Johansen --- v2: - Fix whitespace between comment and #defines (feedback from Jan Beulich) - Add tsc mode 3: no emulate TSC_AUX (feedback from Jan Beulich) --- xen/include/public/arch-x86/cpuid.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xen/include/public/arch-x86/cpuid.h b/xen/include/public/arch-= x86/cpuid.h index 7ecd16ae05..090f7f0034 100644 --- a/xen/include/public/arch-x86/cpuid.h +++ b/xen/include/public/arch-x86/cpuid.h @@ -72,6 +72,14 @@ * Sub-leaf 2: EAX: host tsc frequency in kHz */ =20 +#define XEN_CPUID_TSC_EMULATED (1u << 0) +#define XEN_CPUID_HOST_TSC_RELIABLE (1u << 1) +#define XEN_CPUID_RDTSCP_INSTR_AVAIL (1u << 2) +#define XEN_CPUID_TSC_MODE_DEFAULT (0) +#define XEN_CPUID_TSC_MODE_EMULATE (1u) +#define XEN_CPUID_TSC_MODE_NOEMULATE (2u) +#define XEN_CPUID_TSC_MODE_NOEMULATE_TSC_AUX (3u) + /* * Leaf 5 (0x40000x04) * HVM-specific features --=20 2.25.1