Re: [PATCH 8/9] x86/hreset: Configure history reset

From: Ricardo Neri
Date: Sat Feb 03 2024 - 22:54:43 EST


On Sat, Feb 03, 2024 at 10:38:57AM +0100, Borislav Petkov wrote:
> On Fri, Feb 02, 2024 at 08:05:14PM -0800, Ricardo Neri wrote:
> > +static __always_inline void setup_hreset(struct cpuinfo_x86 *c)
> > +{
> > + if (!cpu_feature_enabled(X86_FEATURE_HRESET))
> > + return;
> > +
> > + /*
> > + * Use on all CPUs the hardware history features that the boot
> > + * CPU supports.
> > + */
> > + if (c == &boot_cpu_data)
> > + hardware_history_features = cpuid_ebx(0x20);
>
> That's not what this does - that sets hardware_history_features on the
> BSP.

I meant to say that we will use the features that the BSP supports and
use them to configure all other CPUs. I will reword the comment to make
this clear.

>
> Why isn't this whole thing called in bsp_init_intel()?

The register MSR_IA32_HW_HRESET_ENABLE needs to be configured on each CPU.

I can set hardware_history_features from bsp_init_intel() but I still
need to call setup_hreset() on every CPU.