x86 bug fix for -rc1
Fix for a bug in "-cpu max" that breaks libvirt usage of query-cpu-model-expansion. -----BEGIN PGP SIGNATURE----- iQIcBAABCAAGBQJZeODwAAoJECgHk2+YTcWmSPsQALAiv1pAUfXmKbhionOX3NTA mrGzKItg1eyRQw2n83z/S9AzSWTgPEKban5e+7JvJvJMzHMgs6ug3xS/F3U02Z8b TvBX0qN/cZCuSrxcDs7H1dujfuYJKoBekUVeiiCifJRINuWR1Y2rgPLFnEkCTh+w dRqhm2x3PpdmSgdKeQQM3mCC3pFwYmzkPtC08bbnJ2kAzw8B8Pgu2gA4ttFqHaVK JbUXxdYA6qZdVAUa9OHlP54NVh34jzK8piptpTOBgHXK7dKuEMLLE32j9St5oy3r SdPu81pJ66i45rkm3cQuatbjYCupA7cVgg/LMUWSTMPbmbAw2dcmvkzQAK178jD3 sASvhJn36hd2GHiC2mLfeQ75IN7SA7Zk/R397cl72fubVi/pW21QHNy3DBsnMVI9 iclwpZm7/k/goBegsqIA3Tr8LzN/YdOkhkpzyA1OpVtMsjcdlHNzokZmFT55wfTA cCZu+OwQdhyFyJJvc5ZOWVDLm2ezwQkJ1CldBlFOHD2CCTYunp/M0u6TdRyI3lN/ gdAdy1Ws5og5hVw6d7npDLPgqdszPAaMrQTxKr4SqDi66qy/MvLY/zWDn0PgRxur EyyXjnPCuDlzoWneh6yhNRUifGQcQ6v3bSf6kYCZLJRwIM82iSnH0cHljgp6LTND YMjnawcJNUJk4euBnAoy =41wG -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-request' into staging x86 bug fix for -rc1 Fix for a bug in "-cpu max" that breaks libvirt usage of query-cpu-model-expansion. # gpg: Signature made Wed 26 Jul 2017 19:35:28 BST # gpg: using RSA key 0x2807936F984DC5A6 # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6 * remotes/ehabkost/tags/x86-pull-request: target/i386: Don't use x86_cpu_load_def() on "max" CPU model target/i386: Define CPUID_MODEL_ID_SZ macro target/i386: Use host_vendor_fms() in max_x86_cpu_initfn() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
2dca6d9e7e
@ -1585,6 +1585,17 @@ static bool lmce_supported(void)
|
||||
return !!(mce_cap & MCG_LMCE_P);
|
||||
}
|
||||
|
||||
#define CPUID_MODEL_ID_SZ 48
|
||||
|
||||
/**
|
||||
* cpu_x86_fill_model_id:
|
||||
* Get CPUID model ID string from host CPU.
|
||||
*
|
||||
* @str should have at least CPUID_MODEL_ID_SZ bytes
|
||||
*
|
||||
* The function does NOT add a null terminator to the string
|
||||
* automatically.
|
||||
*/
|
||||
static int cpu_x86_fill_model_id(char *str)
|
||||
{
|
||||
uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0;
|
||||
@ -1633,20 +1644,21 @@ static void max_x86_cpu_initfn(Object *obj)
|
||||
cpu->max_features = true;
|
||||
|
||||
if (kvm_enabled()) {
|
||||
X86CPUDefinition host_cpudef = { };
|
||||
uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0;
|
||||
char vendor[CPUID_VENDOR_SZ + 1] = { 0 };
|
||||
char model_id[CPUID_MODEL_ID_SZ + 1] = { 0 };
|
||||
int family, model, stepping;
|
||||
|
||||
host_cpuid(0x0, 0, &eax, &ebx, &ecx, &edx);
|
||||
x86_cpu_vendor_words2str(host_cpudef.vendor, ebx, edx, ecx);
|
||||
host_vendor_fms(vendor, &family, &model, &stepping);
|
||||
|
||||
host_cpuid(0x1, 0, &eax, &ebx, &ecx, &edx);
|
||||
host_cpudef.family = ((eax >> 8) & 0x0F) + ((eax >> 20) & 0xFF);
|
||||
host_cpudef.model = ((eax >> 4) & 0x0F) | ((eax & 0xF0000) >> 12);
|
||||
host_cpudef.stepping = eax & 0x0F;
|
||||
cpu_x86_fill_model_id(model_id);
|
||||
|
||||
cpu_x86_fill_model_id(host_cpudef.model_id);
|
||||
|
||||
x86_cpu_load_def(cpu, &host_cpudef, &error_abort);
|
||||
object_property_set_str(OBJECT(cpu), vendor, "vendor", &error_abort);
|
||||
object_property_set_int(OBJECT(cpu), family, "family", &error_abort);
|
||||
object_property_set_int(OBJECT(cpu), model, "model", &error_abort);
|
||||
object_property_set_int(OBJECT(cpu), stepping, "stepping",
|
||||
&error_abort);
|
||||
object_property_set_str(OBJECT(cpu), model_id, "model-id",
|
||||
&error_abort);
|
||||
|
||||
env->cpuid_min_level =
|
||||
kvm_arch_get_supported_cpuid(s, 0x0, 0, R_EAX);
|
||||
|
Loading…
Reference in New Issue
Block a user