public inbox for openbmc@ozlabs.org
 help / color / mirror / Atom feed
From: "Winiarska, Iwona" <iwona.winiarska@intel.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>
Cc: "linux@roeck-us.net" <linux@roeck-us.net>,
	"linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>,
	"bp@alien8.de" <bp@alien8.de>, "x86@kernel.org" <x86@kernel.org>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"Luck, Tony" <tony.luck@intel.com>,
	"Mehta, Sohil" <sohil.mehta@intel.com>,
	"tglx@kernel.org" <tglx@kernel.org>,
	"openbmc@lists.ozlabs.org" <openbmc@lists.ozlabs.org>
Subject: Re: [PATCH] [v2] peci: Remove dependency on x86 CPU variables
Date: Tue, 24 Feb 2026 21:21:08 +0000	[thread overview]
Message-ID: <f3620dfead291503fd3b487b362f69ee3e4ea961.camel@intel.com> (raw)
In-Reply-To: <20260220175121.C16ADAAA@davehans-spike.ostc.intel.com>

On Fri, 2026-02-20 at 09:51 -0800, Dave Hansen wrote:
> 
> From: Dave Hansen <dave.hansen@linux.intel.com>
> 
> tl;dr: The non-x86 PECI driver #includes an arch/x86 header.  This is
> ostensibly to avoid duplicating CPU model number constants, but the
> result is complexity and duplicated *code* which is a far worse fate
> than duplicated constants.
> 
> Remove the PECI dependency on arch/x86 by adding a list of supported
> "target" CPU models in the driver.
> 
> This is only compile tested.
> 
> Long version:
> 
> == Background ==
> 
> The "PECI" driver runs on non-x86 hardware inside an x86 system.  It
> talks to the x86 CPU. The PECI hardware has different features based on
> platform generations and uses the CPU model to control feature
> detections.
> 
> Basically, instead of a PCI or USB device ID that a USB or PCI driver
> would use, the PECI driver uses the CPU model (and family).
> 
> The arch/x86 code unsurprisingly has a list of CPU model numbers and the
> PECI code currently reuses that list. But the arch/x86 list is
> maintained in the "Display" format which is different than the binary
> format that CPUID (and PECI hardware) uses.
> 
> == Problem ==
> 
> The end result is that the PECI code #includes the arch/x86 constants
> header and then duplicates some code that transforms the CPUID to the
> "Display" format. This is fragile because it's easy for us x86 folks to
> break the PECI driver when assuming that arch/x86 is x86-only.
> 
> == Solution ==
> 
> Remove the arch/x86 dependency. Instead of duplicating the
> CPUID=>Display functionality, just duplicate the constants.
> 
> Also rename the formerly "x86_vfm" variables. They are not in the VFM
> format any longer. They are purely device IDs.  Name them appropriately.
> 
> The result is a net code removal. The only downside is that the PECI
> folks need to add a #define whenever there is a new CPU model. But, they
> need to go add new CPU model to the driver explicitly *anyway*.
> 
> == Notes ==
> 
> One little wrinkle in this is that the CPU identifier that comes back
> from the PECI hardware contains the CPU stepping just like
> CPUID.01H:EAX. But the stepping is ignored by the PECI driver.
> 
> So, the PECI_INTEL_* identifiers are just defined with the stepping
> shifted off the beginning. They could have been defined with a 0 there
> and then have the stepping masked somewhere.
> 
> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
> Reviewed-by: Sohil Mehta <sohil.mehta@intel.com>
> Cc: Iwona Winiarska <iwona.winiarska@intel.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: linux-hwmon@vger.kernel.org
> Cc: openbmc@lists.ozlabs.org
> Cc: Tony Luck <tony.luck@intel.com>
> Cc: x86@kernel.org
> Cc: Thomas Gleixner <tglx@kernel.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> 

For v3, feel free to add

Reviewed-by: Iwona Winiarska <iwona.winiarska@intel.com>

Thanks
-Iwona


      parent reply	other threads:[~2026-02-24 21:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-20 17:51 [PATCH] [v2] peci: Remove dependency on x86 CPU variables Dave Hansen
2026-02-20 18:00 ` Guenter Roeck
2026-02-20 18:14 ` Sohil Mehta
2026-02-20 18:20   ` Dave Hansen
2026-02-24 21:21 ` Winiarska, Iwona [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f3620dfead291503fd3b487b362f69ee3e4ea961.camel@intel.com \
    --to=iwona.winiarska@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mingo@redhat.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=sohil.mehta@intel.com \
    --cc=tglx@kernel.org \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox