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

Re: [PATCH v2 1/6] x86/cpu-policy: define bits of leaf 6


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Wed, 10 Dec 2025 13:37:54 +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=pIPqpbdKTsK3FQeIqYMORvxpJqjA3Cbq4RtGZ/o4C5c=; b=HMONwWHefrxbLYieCVTk/vd7+kagXySMGo5YwkZ7ccqUPcUypgqICdQIjC3bwIWqKo673NZ8wM+xRBvL4WAKpxi2OvfrNEFGjERYdU+p7nqaJpheegGPPozUDHreBp5OAyRL7BH8icK1NcH5eUIaCmhl4hkagm73K7X20Tvom3V1rvesT0CeeV+xapdTgyQW1c9WZvehxYt4wJUB4JSaL+aitAuuaKTQmemvj5xQCsh8admZTV3V80mhMSjVPBNPfNl3kFGY/Jab0BnRV48bwHciE86QsJf7W2vhW+1dT+/LpcrrfmRefFXYIhRybvN2REDNTGe3l3nRI+gAPTYTrw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hds4VoQtTcVRZ/9xDS6ZHab7LCDJ1JwXxmzBcvficxjVM5KFSEerS1VXs2g8Ko6zDlOxQce4HPizY0FSyx8hfWVEjFBuFvFa+6Qwfj2L6PDbEN6Gb98XhTi2O4HInc3hK7rs1u14W/ueXyJDJbZR9gH1cvvxj8++xq6ouIdzkEIIFf23wXZatej3GxwGXHLppiQ2ouJcl24nXfdw2iTQ086ORVtR9tk9qLCpC8TH1MRHsqibUsF5Dc1pFgq1aUaOGRekJ+hi0aJozSikhIKmc1dUrKxfmI5fR8ml7UGX4BxMgUoJc6y7vufB3b5vuOh/vCi5xF95j28BcuPBSvaIQw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 10 Dec 2025 13:38:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 24/11/2025 12:23 pm, Jan Beulich wrote:
> ... as far as we presently use them in the codebase.
>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> ---
> Or should we make both parts proper featureset elements? At least
> APERFMPERF could likely be made visible to guests (in principle).
> ---
> v2: Use bool and unions.
>
> --- a/xen/include/xen/lib/x86/cpu-policy.h
> +++ b/xen/include/xen/lib/x86/cpu-policy.h
> @@ -121,7 +121,46 @@ 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 - Therm/Perf. */
> +            union {
> +                uint32_t _6a;
> +                struct {
> +                    bool :1,
> +                        turbo:1,
> +                        arat:1,
> +                        :1,
> +                        :1,
> +                        :1,
> +                        :1,
> +                        hwp:1,
> +                        hwp_notification:1,
> +                        hwp_activity_window:1,
> +                        hwp_epp:1,
> +                        hwp_plr:1,
> +                        :1,
> +                        hdc:1,
> +                        :1,
> +                        :1,
> +                        hwp_peci:1,
> +                        :1,
> +                        :1,
> +                        hw_feedback:1;
> +                };
> +            };
> +            union {
> +                uint32_t _6b;
> +            };
> +            union {
> +                uint32_t _6c;
> +                struct {
> +                    bool aperfmperf:1;
> +                };
> +            };
> +            union {
> +                uint32_t _6d;
> +            };

The _6[a-d] variables are only needed for the featureset <-> policy
conversion which isn't the case here (notice how you don't need it the
series), and we're unlikely to want in the future.

This wants to read:

            /* Leaf 0x6 - Therm/Perf. */
            bool :1,
                turbo:1,
                arat:1,
                :1,
                :1,
                :1,
                :1,
                hwp:1,
                hwp_notification:1,
                hwp_activity_window:1,
                hwp_epp:1,
                hwp_plr:1,
                :1,
                hdc:1,
                :1,
                :1,
                hwp_peci:1,
                :1,
                :1,
                hw_feedback:1;
            uint32_t :32; /* b */
            bool aperfmperf:1;
            uint32_t :32; /* d */

and with that, Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>



 


Rackspace

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