public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Schiller <ms@dev.tdt.de>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Len Brown <lenb@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Florian Eckert <fe@dev.tdt.de>
Subject: Re: [PATCH 2/2] x86/cpu/intel: Add EIST workaround for Lightning Mountain.
Date: Mon, 09 Mar 2026 10:30:24 +0100	[thread overview]
Message-ID: <de11475f9544847664dcce44747c5b50@dev.tdt.de> (raw)
In-Reply-To: <ffb7e798-e8c7-4728-b699-6c885be61136@intel.com>

On 2026-03-06 17:54, Dave Hansen wrote:
> So what's weird about these systems? Do they not have a "normal" BIOS
> based on the Intel reference one?

That's right, the Lightning Mountain SoC is an x86 (Atom) system, but
it doesn't have a classic BIOS.


> I don't know much about this specific feature, but this patch is doing
> some unusual things. I'll elaborate below:
> 
>> diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
>> index 
>> 98ae4c37c93eccf775d5632acf122603a19918a8..e49df04e8d491158cc48f8d8bef824c434256d09 
>> 100644
>> --- a/arch/x86/kernel/cpu/intel.c
>> +++ b/arch/x86/kernel/cpu/intel.c
>> @@ -466,6 +466,29 @@ static void intel_workarounds(struct cpuinfo_x86 
>> *c)
>>  #else
>>  static void intel_workarounds(struct cpuinfo_x86 *c)
>>  {
>> +	u64 misc_enable;
>> +
>> +	/*
>> +	 * Intel / MaxLinear Lightning Mountain workaround to enable 
>> Enhanced
>> +	 * Intel SpeedStep Technology (EIST) for each cpu. Otherwise, the
>> +	 * frequency on some cpus is locked to the minimum value of 624 MHz.
>> +	 * This usually would be the job of the BIOS / bootloader, but 
>> U-Boot
>> +	 * only enables it on the cpu on which it is running.
>> +	 */
>> +	if (c->x86_vfm == INTEL_ATOM_AIRMONT_NP) {
> 
> Model checks area kinda a last resort. A quick search in the SDM found:
> 
> CPUID.01H:ECX[7]: If 1, supports Enhanced Intel SpeedStep® technology.
> 
> But there's other chit chat in the "Runtime Mutable CPUID Fields"
> section that makes it seem that it's not a really feature enumeration
> bit, but a flag to tell if the BIOS enabled it:
> 
> 	CPUID.01H:ECX[7] -- This feature flag reflects the setting in
> 			    IA32_MISC_ENABLE[16]
> 
> But the plot thickens because the *existing* code does this:
> 
> static int centrino_cpu_init(struct cpufreq_policy *policy)
> {
> ...
>         /* Only Intel makes Enhanced Speedstep-capable CPUs */
>         if (cpu->x86_vendor != X86_VENDOR_INTEL ||
>             !cpu_has(cpu, X86_FEATURE_EST))
>                 return -ENODEV;
> ...
>         if (!(l & MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP)) {
> 
> Which, again, makes it seem like X86_FEATURE_EST (aka. 
> CPUID.01H:ECX[7])
> tells you if the MSR bit is supported, not whether it is enabled.
> 
> I'd tend to trust the existing kernel code over quibbling with the SDM
> wording in general. It's also possible the old code was just confused 
> or
> something was buggy.
> 
>> +		rdmsrq(MSR_IA32_MISC_ENABLE, misc_enable);
>> +		if (!(misc_enable & MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP)) {
>> +			misc_enable |= MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP;
>> +			wrmsrq(MSR_IA32_MISC_ENABLE, misc_enable);
>> +
>> +			/* check to see if it was enabled successfully */
>> +			rdmsrq(MSR_IA32_MISC_ENABLE, misc_enable);
>> +			if (!(misc_enable & MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP)) {
>> +				pr_info("CPU%d: Can't enable Enhanced SpeedStep\n",
>> +					c->cpu_index);
>> +			}
>> +		}
>> +	}
>>  }
> 
> 
> This is also not written in the normal kernel style which minimizes
> indentation. For instance, the function should have opened with:
> 
> 	if (c->x86_vfm != INTEL_ATOM_AIRMONT_NP)
> 		return;
> 
> It also needs to be reconciled with centrino_cpu_init() (at least).
> Having *a* single place to go in and say "If this CPU supports 'EST',
> turn it on" would be a minimal refactoring that could be shared by your
> new workaround and the old centrino code.
> 
> centrino_cpu_init() does look gated on X86_FEATURE_EST already, though
> because of the centrino_ids[]. So, you still need to figure out the
> interaction with X86_FEATURE_EST for when you call the workaround.

As you already noted, EIST is also enabled in the Intel Enhanced
SpeedStep (deprecated) "speedstep-centrino.c" driver. It is also
enabled in the VIA C7 Enhanced PowerSaver driver "e_powersaver.c".

The question now is whether and where this is best handled centrally.

  reply	other threads:[~2026-03-09  9:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-06  8:27 [PATCH 0/2] x86/cpu: P-state support for Lightning Mountain Martin Schiller
2026-03-06  8:27 ` [PATCH 1/2] cpufreq: intel_pstate: Add Lightning Mountain support Martin Schiller
2026-03-06  8:27 ` [PATCH 2/2] x86/cpu/intel: Add EIST workaround for Lightning Mountain Martin Schiller
2026-03-06 16:54   ` Dave Hansen
2026-03-09  9:30     ` Martin Schiller [this message]
2026-03-06 17:59 ` [PATCH 0/2] x86/cpu: P-state support " Rafael J. Wysocki
2026-03-09  6:53   ` Martin Schiller
2026-03-09 15:57     ` srinivas pandruvada
2026-03-17  6:53       ` Martin Schiller

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=de11475f9544847664dcce44747c5b50@dev.tdt.de \
    --to=ms@dev.tdt.de \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=fe@dev.tdt.de \
    --cc=hpa@zytor.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rafael@kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=tglx@kernel.org \
    --cc=viresh.kumar@linaro.org \
    --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