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

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


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • From: Krister Johansen <kjlx@xxxxxxxxxxxxxxxxxx>
  • Date: Tue, 24 Jan 2023 14:35:16 -0800
  • Arc-authentication-results: i=1; rspamd-69c95c757c-zt9v2; 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=1674599719; 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: dkim-signature; bh=/rnaVJdqABJD+0Xa4hNZqIvtAk2JjITERqbT0AFef+k=; b=VUFhB5qbzhlhyxCFK4du1nPoFYemSHM+zkdVetC6i/UY3ceoG3ObHByafFHRUp+m0ZCyt3 sVyVUXu5CtGCRkgMDkaw9xj6vUEYqXqmfX+uTjmIxebOojPZaJtAKLqQi9ZiZivmk1STLa 6ZY/vEn7oyeP3GIBBgcMiQfCbh62uDah0IJK+tCbTWzQYadT27USkgYJKX5Z+3wedAsGeK gLqx6FmoV2LHn0JtQIHlp2mpO2ZD5Xy/ipSYkO8lZ0zEHuhPUZ8PjOPxYW2hVqyZc3b1Zb /Nea1MV9K62x30UttDjjdBQVgL9lRuqfsNEUmBjfYcNY41OTFNJd34mDwAusZA==
  • Arc-seal: i=1; s=arc-2022; d=mailchannels.net; t=1674599719; a=rsa-sha256; cv=none; b=na7ndZ/tJ7Wzepuo09WIEZUPa2Ur3Nxjlfe1JykQ1vtDWhf9zu8yhW74wmJAcL/nNge5ai YKnJn+4WiBi7+slkin556bmHu4jzJF5T+Jheji9RMHDStEDYGpXuWBRUnTwbPCp/AkPh2z v1vPHYfsXLWoWIHNvGuNt9+xU+3vOXCmtfRF+fwSJzlWBqVowtRNzRaIl0FwJUodbqRJp2 1JaanLK5a8LXWfYupXZWBAdoQph+SWIcXbbO4ADNLXH51iWfcXWsbadb2CiAfb2XXZ9crw FuFqEYWFhxvGlfBGjYl0H7Lquj7uM3OG5YF1Q154/NFC9u0r0crbO8NQx4PaJA==
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Juergen Gross <jgross@xxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, David Reaver <me@xxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 24 Jan 2023 22:35:35 +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>
---
 xen/include/public/arch-x86/cpuid.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/include/public/arch-x86/cpuid.h 
b/xen/include/public/arch-x86/cpuid.h
index 7ecd16ae05..97dc970417 100644
--- a/xen/include/public/arch-x86/cpuid.h
+++ b/xen/include/public/arch-x86/cpuid.h
@@ -71,6 +71,12 @@
  *             EDX: shift amount for tsc->ns conversion
  * 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)
 
 /*
  * Leaf 5 (0x40000x04)
-- 
2.25.1




 


Rackspace

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