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

Re: [RFC PATCH for-4.22 1/2] x86/platform: Expose DTS sensors MSR


  • To: Teddy Astie <teddy.astie@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 27 Oct 2025 19:38:03 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FnHKvsfdcH9jYQssrwlJXPo2iLs37/NgP4O/Q2+PlFU=; b=BuUJSAduOVsYgC16k732I6D0dstCb7RWqjIGE8QtPbXPFR0V7T1XVeqZyvBZaI31LaXOaL2DJ6SfplSOmXZiOQcADlNQ2+QDcIW2+LpKxfBOcIxSE61a2Pqw4VIc7bVbUz/6mUrY9DuRXnM08zzUmRj8/ZVbrek1JUAsa9NavF3Y4hqhbr08Y6E4bV4jqeRa/QfiWRleJXSojOF4SCEbBwDBpTYaDuMcE9AvXIZaUYkhsZ5b1Cz/lKQbE2iZ01usNQ7XpKuzb6haSF1wJ3ixEVbyUXK+2HP/ABG506moKQiKWw6Ls2Uw3yngVJH9PgUf09RnDTSzknp9N4+Ro/fmNw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AH8tQheWQ2oAxyQsZadDfAgaZj2vTwS2kpZMHYsXf6RNtj0vDbfgqMHIz/y2gZX63zO0pJzUlespmlmtnZlduGddfNeNqNSDfa662hn/2uEUeCLeL8Hfjwr70OzUsrUCfjfu0MZFucuSrb6f+r516CDTIrgnAXIzoJa3T/FNy/C0Yb8eHsmBEMtI0nv5nlZdn0fRnZEBSLN6gs7li+5QdlMDLsHqcI7h2hOzV+lILTHgSdVyt26d5o4a9T0PbCy70Q5bskFhf1kmgjnmXBYuyLKsPjMY0DVjQ4/b4b20VLwUTPniiKYZMgEPOzhYsLqHLCHCRt1zR6YVhwXua6rqaw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 27 Oct 2025 19:38:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 27/10/2025 5:26 pm, Teddy Astie wrote:
> I'm not a fan of doing a inline cpuid check here, but I don't have a
> better approach in mind.

I'm not sure if there's enough information in leaf 6 to justify putting
it fully into the CPUID infrastructure.

But, if you do something like this:

diff --git a/xen/include/xen/lib/x86/cpu-policy.h 
b/xen/include/xen/lib/x86/cpu-policy.h
index f94f23e159d2..d02fe4d22151 100644
--- a/xen/include/xen/lib/x86/cpu-policy.h
+++ b/xen/include/xen/lib/x86/cpu-policy.h
@@ -121,7 +121,13 @@ struct cpu_policy
             uint64_t :64, :64; /* Leaf 0x3 - PSN. */
             uint64_t :64, :64; /* Leaf 0x4 - Structured Cache. */
             uint64_t :64, :64; /* Leaf 0x5 - MONITOR. */
-            uint64_t :64, :64; /* Leaf 0x6 - Therm/Perf. */
+
+            /* Leaf 0x6 - Thermal and Perf. */
+            struct {
+                bool /* a */ dts:1;
+                uint32_t /* b */:32, /* c */:32, /* d */:32;
+            };
+
             uint64_t :64, :64; /* Leaf 0x7 - Structured Features. */
             uint64_t :64, :64; /* Leaf 0x8 - rsvd */
             uint64_t :64, :64; /* Leaf 0x9 - DCA */


then ...

> diff --git a/xen/arch/x86/platform_hypercall.c 
> b/xen/arch/x86/platform_hypercall.c
> index 79bb99e0b6..3190803cc2 100644
> --- a/xen/arch/x86/platform_hypercall.c
> +++ b/xen/arch/x86/platform_hypercall.c
> @@ -86,6 +86,12 @@ static bool msr_read_allowed(unsigned int msr)
>  
>      case MSR_MCU_OPT_CTRL:
>          return cpu_has_srbds_ctrl;
> +    

You've added trailing whitespace here.

> +    case MSR_IA32_TEMPERATURE_TARGET:
> +    case MSR_IA32_THERM_STATUS:
> +    case MSR_IA32_PACKAGE_THERM_STATUS:
> +        return boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
> +            (cpuid_eax(0x6) & 0x1); /* Digital temperature sensor */

... you ought to be able to use host_policy.basic.dts here.  In
principle the Intel check can be dropped too.

~Andrew



 


Rackspace

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