Message ID | 20230127185103.GB1955@templeofstupid.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [v3] xen/x86: public: add TSC defines for cpuid leaf 4 | expand |
On 27.01.2023 19:51, Krister Johansen wrote: > --- a/xen/include/public/arch-x86/cpuid.h > +++ b/xen/include/public/arch-x86/cpuid.h > @@ -72,6 +72,15 @@ > * 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_ALWAYS_EMULATE (1u) > +#define XEN_CPUID_TSC_MODE_NEVER_EMULATE (2u) > +#define XEN_CPUID_TSC_MODE_NEVER_EMULATE_TSC_AUX (3u) While perhaps it doesn't matter much with the mode no longer supported, I'd prefer if here we used the original name (PVRDTSCP) as well. Preferably with that adjustment (which once again I'd be happy to do while committing, albeit I'd like to wait with that until osstest is in a better mood again) Reviewed-by: Jan Beulich <jbeulich@suse.com> Jan
Hi Jan, On Mon, Jan 30, 2023 at 09:22:11AM +0100, Jan Beulich wrote: > On 27.01.2023 19:51, Krister Johansen wrote: > > --- a/xen/include/public/arch-x86/cpuid.h > > +++ b/xen/include/public/arch-x86/cpuid.h > > @@ -72,6 +72,15 @@ > > * 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_ALWAYS_EMULATE (1u) > > +#define XEN_CPUID_TSC_MODE_NEVER_EMULATE (2u) > > +#define XEN_CPUID_TSC_MODE_NEVER_EMULATE_TSC_AUX (3u) > > While perhaps it doesn't matter much with the mode no longer supported, > I'd prefer if here we used the original name (PVRDTSCP) as well. > Preferably with that adjustment (which once again I'd be happy to do > while committing, albeit I'd like to wait with that until osstest is in > a better mood again) > Reviewed-by: Jan Beulich <jbeulich@suse.com> Thanks for the additional feedback. I'll send you a v4 that makes the requested modification. -K
diff --git a/xen/include/public/arch-x86/cpuid.h b/xen/include/public/arch-x86/cpuid.h index 7ecd16ae05..3fbd912dcd 100644 --- a/xen/include/public/arch-x86/cpuid.h +++ b/xen/include/public/arch-x86/cpuid.h @@ -72,6 +72,15 @@ * 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_ALWAYS_EMULATE (1u) +#define XEN_CPUID_TSC_MODE_NEVER_EMULATE (2u) +#define XEN_CPUID_TSC_MODE_NEVER_EMULATE_TSC_AUX (3u) + /* * Leaf 5 (0x40000x04) * HVM-specific features
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@suse.com/ Link: https://lore.kernel.org/xen-devel/0835453d-9617-48d5-b2dc-77a2ac298bad@oracle.com/ Signed-off-by: Krister Johansen <kjlx@templeofstupid.com> --- v3 - Additional formating cleanups (feedback from Jan Buelich) - Ensure that TSC_MODE #defines match the names of those in time.h (feedback from Jan Buelich) 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 | 9 +++++++++ 1 file changed, 9 insertions(+)