x86_cpuid_policy_fill_native(p);
- p->x86_vendor = boot_cpu_data.x86_vendor;
+ /* Nothing good will come from Xen and libx86 disagreeing on vendor. */
+ ASSERT(p->x86_vendor == boot_cpu_data.x86_vendor);
}
static void __init calculate_host_policy(void)
/**
* Fill a CPUID policy using the native CPUID instruction.
*
- * No sanitisation is performed. Values may be influenced by a hypervisor or
- * from masking/faulting configuration.
+ * No sanitisation is performed, but synthesised values are calculated.
+ * Values may be influenced by a hypervisor or from masking/faulting
+ * configuration.
*/
void x86_cpuid_policy_fill_native(struct cpuid_policy *p);
* incoming leaf is out of range of cpuid_policy, in which case the optional
* err_* pointers are filled to aid diagnostics.
*
- * No content validation of in-range leaves is performed.
+ * No content validation of in-range leaves is performed. Synthesised data is
+ * recalculated.
*/
int x86_cpuid_copy_from_buffer(struct cpuid_policy *policy,
const cpuid_leaf_buffer_t leaves,
return X86_VENDOR_UNKNOWN;
}
+/* Recalculate the content in a CPUID policy which is derived from raw data. */
+static void recalculate_synth(struct cpuid_policy *p)
+{
+ p->x86_vendor = x86_cpuid_lookup_vendor(
+ p->basic.vendor_ebx, p->basic.vendor_ecx, p->basic.vendor_edx);
+}
+
void x86_cpuid_policy_fill_native(struct cpuid_policy *p)
{
unsigned int i;
for ( i = 1; i < min_t(unsigned int, ARRAY_SIZE(p->extd.raw),
p->extd.max_leaf + 1 - 0x80000000); ++i )
cpuid_leaf(0x80000000 + i, &p->extd.raw[i]);
+
+ recalculate_synth(p);
}
const uint32_t *x86_cpuid_lookup_deep_deps(uint32_t feature)
}
}
+ recalculate_synth(p);
+
return 0;
out_of_range: