microcode_resume_cpu(0);
+ if ( !recheck_cpu_features(0) )
+ panic("Missing previously available feature(s).");
+
ci->bti_ist_info = default_bti_ist_info;
asm volatile (ALTERNATIVE("", "wrmsr", X86_FEATURE_XEN_IBRS_SET)
:: "a" (SPEC_CTRL_IBRS), "c" (MSR_SPEC_CTRL), "d" (0)
printk("\n");
#endif
+ if (system_state == SYS_STATE_resume)
+ return;
+
/*
* On SMP, boot_cpu_data holds the common feature set between
* all CPUs; so make sure that we indicate which features are
calculate_hvm_max_policy();
}
+bool recheck_cpu_features(unsigned int cpu)
+{
+ bool okay = true;
+ struct cpuinfo_x86 c;
+ const struct cpuinfo_x86 *bsp = &boot_cpu_data;
+ unsigned int i;
+
+ identify_cpu(&c);
+
+ for ( i = 0; i < NCAPINTS; ++i )
+ {
+ if ( !(~c.x86_capability[i] & bsp->x86_capability[i]) )
+ continue;
+
+ printk(XENLOG_ERR "CPU%u: cap[%2u] is %08x (expected %08x)\n",
+ cpu, i, c.x86_capability[i], bsp->x86_capability[i]);
+ okay = false;
+ }
+
+ return okay;
+}
+
const uint32_t *lookup_deep_deps(uint32_t feature)
{
static const struct {
cpu_data[cpu] = boot_cpu_data;
}
-static void smp_store_cpu_info(int id)
+static bool smp_store_cpu_info(unsigned int id)
{
unsigned int socket;
- identify_cpu(&cpu_data[id]);
+ if ( system_state != SYS_STATE_resume )
+ identify_cpu(&cpu_data[id]);
+ else if ( !recheck_cpu_features(id) )
+ return false;
socket = cpu_to_socket(id);
if ( !socket_cpumask[socket] )
socket_cpumask[socket] = secondary_socket_cpumask;
secondary_socket_cpumask = NULL;
}
+
+ return true;
}
/*
setup_local_APIC();
/* Save our processor parameters. */
- smp_store_cpu_info(cpu);
+ if ( !smp_store_cpu_info(cpu) )
+ {
+ printk("CPU%u: Failed to validate features - not coming back online\n",
+ cpu);
+ cpu_error = -ENXIO;
+ goto halt;
+ }
if ( (rc = hvm_cpu_up()) != 0 )
{
printk("CPU%d: Failed to initialise HVM. Not coming online.\n", cpu);
cpu_error = rc;
+ halt:
clear_local_APIC();
spin_debug_enable();
cpu_exit_clear(cpu);
extern struct cpuid_policy raw_cpuid_policy, host_cpuid_policy,
pv_max_cpuid_policy, hvm_max_cpuid_policy;
+/* Check that all previously present features are still available. */
+bool recheck_cpu_features(unsigned int cpu);
+
/* Allocate and initialise a CPUID policy suitable for the domain. */
int init_domain_cpuid_policy(struct domain *d);