[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2] xen/x86: public: add TSC defines for cpuid leaf 4


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Krister Johansen <kjlx@xxxxxxxxxxxxxxxxxx>
  • Date: Wed, 25 Jan 2023 10:45:06 -0800
  • Arc-authentication-results: i=1; rspamd-6989874cc5-vfcqp; auth=pass smtp.auth=dreamhost smtp.mailfrom=kjlx@xxxxxxxxxxxxxxxxxx
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1674672308; 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:dkim-signature; bh=dwwSySAB0/noOy7j2ESEKeWWjrMfxpM7nNQbHo69AIU=; b=Sx50BYuCU9K4AzSxAjRIxlMX1HraVB4wVzDlta9Ie5Xiy1llqKot2YZ61xW3WuqEX3Ynmq 0Mt1n+wHMDbX7VV2Ie4+m60VoB/6OhvWm52kGb+FhS20NaPsnrotFJUUUMcbjM2J5MFb2J hAM0BZ0E8CQK32uy0V6S6wyyvUOW8eWfVh0718ip7nqBbzPvC2lfrmNf+Y9Piglv1hiVXt udfHrXgm4bp3krCayU/T8Nxf+rIRFzRg035mRyN3NZ+xuNLJokM351tCXts7grwgVV5o51 NLHYi8UNk+3vzFrMePHn5Oca+/Hud7JzGmlpL54saCMp+QJmjY5j9KY7DMSDjA==
  • Arc-seal: i=1; s=arc-2022; d=mailchannels.net; t=1674672308; a=rsa-sha256; cv=none; b=sHXSvZg6a4ESmjJMDTauMoz+oej81nxqM9LHKP0M5N1bYchPmFqQ1z12sRlki06O4/Yy8u fQioyNctYw7yLf3H3omMbI1IEn6bYPee2xkhAcGRnU9KRa0AD8/XvOVgZEB9f8RNTruJdz CxKztOuikyFXhxREeim5zJttpaeUkXMUGOo2+hoAxEMnKuKjAjOIL46HQKa3vHQLBMFP+Q nITR0DK6DZbH+h4lqmaK5Xpb47aYk+HifnGo8nL0fm8p4pwICvLnV/8hcTNAmS1qXt3jp7 aBVCOAuin2B1GIkd1hS71NUz1LFhUhMzAPC2bVap+Nn46SNLif5ws5CqF5Pi4w==
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, David Reaver <me@xxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 25 Jan 2023 18:45:26 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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-64d7f13ee35e@xxxxxxxx/
Link: 
https://lore.kernel.org/xen-devel/0835453d-9617-48d5-b2dc-77a2ac298bad@xxxxxxxxxx/
Signed-off-by: Krister Johansen <kjlx@xxxxxxxxxxxxxxxxxx>
---
v2.1:
  - Correct In-Reply-To header for proper threading
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
  */
 
+#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
-- 
2.25.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.