Loading microcode can cause new features to appear. This has happened
routinely since Spectre/Meltdown, and even the presence of new status bits can
sometimes mean the administrator has no further actions to perform.
Conversely, loading microcode can occasionally cause features to disappear.
As with livepatching, it is very much the administrators responsibility to
confirm that a late microcode load is safe on the intended system before
rolling it out in production.
Refresh the raw CPU policy after late microcode load appears to have done
something, so xen-cpuid can reflect the updated state of the system.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
#include <asm/setup.h>
#include <asm/xstate.h>
-struct cpu_policy __ro_after_init raw_cpu_policy;
+struct cpu_policy __read_mostly raw_cpu_policy;
struct cpu_policy __ro_after_init host_cpu_policy;
#ifdef CONFIG_PV
struct cpu_policy __ro_after_init pv_max_cpu_policy;
}
}
-static void __init calculate_raw_policy(void)
+void calculate_raw_cpu_policy(void)
{
struct cpu_policy *p = &raw_cpu_policy;
void __init init_guest_cpu_policies(void)
{
- calculate_raw_policy();
+ calculate_raw_cpu_policy();
calculate_host_policy();
if ( IS_ENABLED(CONFIG_PV) )
#include <xen/watchdog.h>
#include <asm/apic.h>
+#include <asm/cpu-policy.h>
#include <asm/delay.h>
#include <asm/nmi.h>
#include <asm/processor.h>
spin_lock(µcode_mutex);
microcode_update_cache(patch);
spin_unlock(µcode_mutex);
+
+ /* Refresh the raw CPU policy, in case the features have changed. */
+ calculate_raw_cpu_policy();
}
else
microcode_free_patch(patch);
/* Clamp the CPUID policy to reality. */
void recalculate_cpuid_policy(struct domain *d);
+/*
+ * Collect the raw CPUID and MSR values. Called during boot, and after late
+ * microcode loading.
+ */
+void calculate_raw_cpu_policy(void);
+
#endif /* X86_CPU_POLICY_H */