On Thu, Jun 26, 2025 at 11:03:20AM +0300, Nikolay Borisov wrote: > > > On 6/24/25 17:16, Yazen Ghannam wrote: > > The __mcheck_cpu_init_early() function was introduced so that some > > vendor-specific features are detected before the first MCA polling event > > done in __mcheck_cpu_init_generic(). > > > > Currently, __mcheck_cpu_init_early() is only used on AMD-based systems and > > additional code will be needed to support various system configurations. > > > > However, the current and future vendor-specific code should be done during > > vendor init. This keeps all the vendor code in a common location and > > simplifies the generic init flow. > > > > Move all the __mcheck_cpu_init_early() code into mce_amd_feature_init(). > > > > Also, move __mcheck_cpu_init_generic() after > > __mcheck_cpu_init_prepare_banks() so that MCA is enabled after the first > > MCA polling event. > > > > Additionally, this brings the MCA init flow closer to what is described > > in the x86 docs. > > > > The AMD PPRs say > > "The operating system must initialize the MCA_CONFIG registers prior to > > initialization of the MCA_CTL registers. > > > > The MCA_CTL registers must be initialized prior to enabling the error > > reporting banks in MCG_CTL". > > > > However, the Intel SDM "Machine-Check Initialization Pseudocode" says > > MCG_CTL first then MCi_CTL. > > > > But both agree that CR4.MCE should be set last. > > > > Reviewed-by: Qiuxu Zhuo <qiuxu.zhuo@xxxxxxxxx> > > Tested-by: Tony Luck <tony.luck@xxxxxxxxx> > > Reviewed-by: Tony Luck <tony.luck@xxxxxxxxx> > > Signed-off-by: Yazen Ghannam <yazen.ghannam@xxxxxxx> > > > IMO the change which moves __mcheck_cpu_init_generic should be in a separate > patch so that in the changelog it's abundantly clear that it's a "world > switch" function and its invocation timing is important. > > <snip> > > > In any case: > > Reviewed-by: Nikolay Borisov <nik.borisov@xxxxxxxx> Thanks for the review. I can split this in the next revision if needed. Thanks, Yazen