Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36865 )
Change subject: mb/google/hatch: Override CPU flex ratio ......................................................................
Patch Set 9:
So, is it just the ratio that should be active while that vboot code runs or is there another effect of flex ratio that helps here?
this needs a soft reset to apply new flex ratio. hence its better we set this early.
Sorry, I'm not asking how to use flex ratio. I'm asking if flex ratio is really needed.
As i understand overriding CPU strap is the only option to tell CPU to running at different speed
Well, that depends on the definition of "running at different speed". If it is about the core's clock, EIST can be used. Generally, not saying this is what you should do, as I've not yet figured out how it interacts with Speed Shift.
Also as i told we are trying to minimize the platform (+SOC) power consumption in FW boot hence trying not to boot using non-turbo max.
I'm asking because flex ratio seems to have some side effects that might need more attention.
I don't get this part, can you please help to explain about side effect?
It changes CPUID and MSR values that otherwise can't be changed (mostly to align multiple processor packages, is what I found in documentation). This affects all the code in coreboot that reads those registers. For instance, I suspect that our ACPI p-state table generation might be wrong of flex ratio is used.
We are running full BAT with CPU bench marking to see if any issue. Although i don't think that matter.
It might not. There is a lot of dead, broken code for these platforms, it seems. EIST is not enabled on any of them and enabling doesn't work. So no p-state tables are generated at all. That should be safe :)
And if just changing the frequency is enough, we could just set a different speed-step state with a single MSR write, no?
Are you referring at EIST here ?
Yes. In `soc/intel/cannonlake/cpu.c` we're already calling cpu_set_max_ratio(). This is the first place I would expect someone to change the ratio. I don't know how (if) it is affected by flex ratio, btw.
EIST is not active as we are using hardware managed P-state and we are in BIOS space where EIST has any role to play
EIST has a role in BIOS space. If you look for "max efficiency boot" for instance in the BIOS Spec. It tells us to use EIST to put the BSP into HFM and the APs into LFM, so the BSP can use most power. I think this is why we are calling cpu_set_max_ratio().
However, with EIST disabled, this might just do nothing.
I don't yet understand the role of HWP (Speed Shift) during boot. All documentation I read so far seems to assume that the OS configures it before it kicks in. So with EIST disabled, is it possible that we run all cores at the same frequency? I guess it doesn't matter because the APs are parked anyway. But it seems to me, that we could use EIST during boot for your frequency change and HWP for the OS. It seems less invasive than repurposing flex ratio.