diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml index 08aded2f1cb0129ef2133eb322d2f6817a8db099..1ddc55ff5e340f49f99e77af9d55fc01856cc550 100644 --- a/src/cpu/cpu_map.xml +++ b/src/cpu/cpu_map.xml @@ -6,351 +6,351 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index f2492b5511fe9c768e0925f6581fa7f0ef7ed714..bc71734d170b93af24c3c7ef1388b7ff1ba4c43c 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -68,24 +68,24 @@ struct _virCPUx86KVMFeature { static const virCPUx86KVMFeature x86_kvm_features[] = { - {VIR_CPU_x86_KVM_CLOCKSOURCE, { .function = 0x40000001, .eax = 0x00000001 }}, - {VIR_CPU_x86_KVM_NOP_IO_DELAY, { .function = 0x40000001, .eax = 0x00000002 }}, - {VIR_CPU_x86_KVM_MMU_OP, { .function = 0x40000001, .eax = 0x00000004 }}, - {VIR_CPU_x86_KVM_CLOCKSOURCE2, { .function = 0x40000001, .eax = 0x00000008 }}, - {VIR_CPU_x86_KVM_ASYNC_PF, { .function = 0x40000001, .eax = 0x00000010 }}, - {VIR_CPU_x86_KVM_STEAL_TIME, { .function = 0x40000001, .eax = 0x00000020 }}, - {VIR_CPU_x86_KVM_PV_EOI, { .function = 0x40000001, .eax = 0x00000040 }}, - {VIR_CPU_x86_KVM_PV_UNHALT, { .function = 0x40000001, .eax = 0x00000080 }}, + {VIR_CPU_x86_KVM_CLOCKSOURCE, { .eax_in = 0x40000001, .eax = 0x00000001 }}, + {VIR_CPU_x86_KVM_NOP_IO_DELAY, { .eax_in = 0x40000001, .eax = 0x00000002 }}, + {VIR_CPU_x86_KVM_MMU_OP, { .eax_in = 0x40000001, .eax = 0x00000004 }}, + {VIR_CPU_x86_KVM_CLOCKSOURCE2, { .eax_in = 0x40000001, .eax = 0x00000008 }}, + {VIR_CPU_x86_KVM_ASYNC_PF, { .eax_in = 0x40000001, .eax = 0x00000010 }}, + {VIR_CPU_x86_KVM_STEAL_TIME, { .eax_in = 0x40000001, .eax = 0x00000020 }}, + {VIR_CPU_x86_KVM_PV_EOI, { .eax_in = 0x40000001, .eax = 0x00000040 }}, + {VIR_CPU_x86_KVM_PV_UNHALT, { .eax_in = 0x40000001, .eax = 0x00000080 }}, {VIR_CPU_x86_KVM_CLOCKSOURCE_STABLE_BIT, - { .function = 0x40000001, .eax = 0x01000000 }}, - {VIR_CPU_x86_KVM_HV_RUNTIME, { .function = 0x40000003, .eax = 0x00000001 }}, - {VIR_CPU_x86_KVM_HV_SYNIC, { .function = 0x40000003, .eax = 0x00000004 }}, - {VIR_CPU_x86_KVM_HV_STIMER, { .function = 0x40000003, .eax = 0x00000008 }}, - {VIR_CPU_x86_KVM_HV_RELAXED, { .function = 0x40000003, .eax = 0x00000020 }}, - {VIR_CPU_x86_KVM_HV_SPINLOCK, { .function = 0x40000003, .eax = 0x00000022 }}, - {VIR_CPU_x86_KVM_HV_VAPIC, { .function = 0x40000003, .eax = 0x00000030 }}, - {VIR_CPU_x86_KVM_HV_VPINDEX, { .function = 0x40000003, .eax = 0x00000040 }}, - {VIR_CPU_x86_KVM_HV_RESET, { .function = 0x40000003, .eax = 0x00000080 }}, + { .eax_in = 0x40000001, .eax = 0x01000000 }}, + {VIR_CPU_x86_KVM_HV_RUNTIME, { .eax_in = 0x40000003, .eax = 0x00000001 }}, + {VIR_CPU_x86_KVM_HV_SYNIC, { .eax_in = 0x40000003, .eax = 0x00000004 }}, + {VIR_CPU_x86_KVM_HV_STIMER, { .eax_in = 0x40000003, .eax = 0x00000008 }}, + {VIR_CPU_x86_KVM_HV_RELAXED, { .eax_in = 0x40000003, .eax = 0x00000020 }}, + {VIR_CPU_x86_KVM_HV_SPINLOCK, { .eax_in = 0x40000003, .eax = 0x00000022 }}, + {VIR_CPU_x86_KVM_HV_VAPIC, { .eax_in = 0x40000003, .eax = 0x00000030 }}, + {VIR_CPU_x86_KVM_HV_VPINDEX, { .eax_in = 0x40000003, .eax = 0x00000040 }}, + {VIR_CPU_x86_KVM_HV_RESET, { .eax_in = 0x40000003, .eax = 0x00000080 }}, }; typedef struct _virCPUx86Model virCPUx86Model; @@ -203,9 +203,9 @@ virCPUx86CPUIDSorter(const void *a, const void *b) virCPUx86CPUID *da = (virCPUx86CPUID *) a; virCPUx86CPUID *db = (virCPUx86CPUID *) b; - if (da->function > db->function) + if (da->eax_in > db->eax_in) return 1; - else if (da->function < db->function) + else if (da->eax_in < db->eax_in) return -1; return 0; @@ -232,12 +232,12 @@ x86DataCpuidNext(virCPUx86DataIteratorPtr iterator) static virCPUx86CPUID * x86DataCpuid(const virCPUx86Data *data, - uint32_t function) + uint32_t eax_in) { size_t i; for (i = 0; i < data->len; i++) { - if (data->data[i].function == function) + if (data->data[i].eax_in == eax_in) return data->data + i; } @@ -307,7 +307,7 @@ virCPUx86DataAddCPUID(virCPUx86Data *data, { virCPUx86CPUID *existing; - if ((existing = x86DataCpuid(data, cpuid->function))) { + if ((existing = x86DataCpuid(data, cpuid->eax_in))) { x86cpuidSetBits(existing, cpuid); } else { if (VIR_APPEND_ELEMENT_COPY(data->data, data->len, @@ -331,7 +331,7 @@ x86DataAdd(virCPUx86Data *data1, virCPUx86CPUID *cpuid2; while ((cpuid2 = x86DataCpuidNext(&iter))) { - cpuid1 = x86DataCpuid(data1, cpuid2->function); + cpuid1 = x86DataCpuid(data1, cpuid2->eax_in); if (cpuid1) { x86cpuidSetBits(cpuid1, cpuid2); @@ -354,7 +354,7 @@ x86DataSubtract(virCPUx86Data *data1, virCPUx86CPUID *cpuid2; while ((cpuid1 = x86DataCpuidNext(&iter))) { - cpuid2 = x86DataCpuid(data2, cpuid1->function); + cpuid2 = x86DataCpuid(data2, cpuid1->eax_in); x86cpuidClearBits(cpuid1, cpuid2); } } @@ -369,7 +369,7 @@ x86DataIntersect(virCPUx86Data *data1, virCPUx86CPUID *cpuid2; while ((cpuid1 = x86DataCpuidNext(&iter))) { - cpuid2 = x86DataCpuid(data2, cpuid1->function); + cpuid2 = x86DataCpuid(data2, cpuid1->eax_in); if (cpuid2) x86cpuidAndBits(cpuid1, cpuid2); else @@ -397,7 +397,7 @@ x86DataIsSubset(const virCPUx86Data *data, const virCPUx86CPUID *cpuidSubset; while ((cpuidSubset = x86DataCpuidNext(&iter))) { - if (!(cpuid = x86DataCpuid(data, cpuidSubset->function)) || + if (!(cpuid = x86DataCpuid(data, cpuidSubset->eax_in)) || !x86cpuidMatchMasked(cpuid, cpuidSubset)) return false; } @@ -438,7 +438,7 @@ x86DataToVendor(const virCPUx86Data *data, for (i = 0; i < map->nvendors; i++) { virCPUx86VendorPtr vendor = map->vendors[i]; - if ((cpuid = x86DataCpuid(data, vendor->cpuid.function)) && + if ((cpuid = x86DataCpuid(data, vendor->cpuid.eax_in)) && x86cpuidMatchMasked(cpuid, &vendor->cpuid)) { x86cpuidClearBits(cpuid, &vendor->cpuid); return vendor; @@ -553,7 +553,7 @@ x86VendorParse(xmlXPathContextPtr ctxt, goto error; } - vendor->cpuid.function = 0; + vendor->cpuid.eax_in = 0; vendor->cpuid.ebx = virReadBufInt32LE(string); vendor->cpuid.edx = virReadBufInt32LE(string + 4); vendor->cpuid.ecx = virReadBufInt32LE(string + 8); @@ -667,23 +667,25 @@ static int x86ParseCPUID(xmlXPathContextPtr ctxt, virCPUx86CPUID *cpuid) { - unsigned long fun, eax, ebx, ecx, edx; - int ret_fun, ret_eax, ret_ebx, ret_ecx, ret_edx; + unsigned long eax_in; + unsigned long eax, ebx, ecx, edx; + int ret_eax_in, ret_eax, ret_ebx, ret_ecx, ret_edx; memset(cpuid, 0, sizeof(*cpuid)); - fun = eax = ebx = ecx = edx = 0; - ret_fun = virXPathULongHex("string(@function)", ctxt, &fun); + eax_in = 0; + eax = ebx = ecx = edx = 0; + ret_eax_in = virXPathULongHex("string(@eax_in)", ctxt, &eax_in); ret_eax = virXPathULongHex("string(@eax)", ctxt, &eax); ret_ebx = virXPathULongHex("string(@ebx)", ctxt, &ebx); ret_ecx = virXPathULongHex("string(@ecx)", ctxt, &ecx); ret_edx = virXPathULongHex("string(@edx)", ctxt, &edx); - if (ret_fun < 0 || ret_eax == -2 || ret_ebx == -2 - || ret_ecx == -2 || ret_edx == -2) + if (ret_eax_in < 0 || + ret_eax == -2 || ret_ebx == -2 || ret_ecx == -2 || ret_edx == -2) return -1; - cpuid->function = fun; + cpuid->eax_in = eax_in; cpuid->eax = eax; cpuid->ebx = ebx; cpuid->ecx = ecx; @@ -966,7 +968,7 @@ x86ModelCompare(virCPUx86ModelPtr model1, while ((cpuid1 = x86DataCpuidNext(&iter1))) { virCPUx86CompareResult match = SUPERSET; - if ((cpuid2 = x86DataCpuid(model2->data, cpuid1->function))) { + if ((cpuid2 = x86DataCpuid(model2->data, cpuid1->eax_in))) { if (x86cpuidMatch(cpuid1, cpuid2)) continue; else if (!x86cpuidMatchMasked(cpuid1, cpuid2)) @@ -982,7 +984,7 @@ x86ModelCompare(virCPUx86ModelPtr model1, while ((cpuid2 = x86DataCpuidNext(&iter2))) { virCPUx86CompareResult match = SUBSET; - if ((cpuid1 = x86DataCpuid(model1->data, cpuid2->function))) { + if ((cpuid1 = x86DataCpuid(model1->data, cpuid2->eax_in))) { if (x86cpuidMatch(cpuid2, cpuid1)) continue; else if (!x86cpuidMatchMasked(cpuid2, cpuid1)) @@ -1272,10 +1274,10 @@ x86CPUDataFormat(const virCPUData *data) virBufferAddLit(&buf, "\n"); while ((cpuid = x86DataCpuidNext(&iter))) { virBufferAsprintf(&buf, - " \n", - cpuid->function, + cpuid->eax_in, cpuid->eax, cpuid->ebx, cpuid->ecx, cpuid->edx); } virBufferAddLit(&buf, "\n"); @@ -1884,7 +1886,7 @@ cpuidCall(virCPUx86CPUID *cpuid) "=b" (cpuid->ebx), "=c" (cpuid->ecx), "=d" (cpuid->edx) - : "a" (cpuid->function)); + : "a" (cpuid->eax_in)); # else /* we need to avoid direct use of ebx for CPUID output as it is used * for global offset table on i386 with -fPIC @@ -1900,7 +1902,7 @@ cpuidCall(virCPUx86CPUID *cpuid) "=r" (cpuid->ebx), "=c" (cpuid->ecx), "=d" (cpuid->edx) - : "a" (cpuid->function) + : "a" (cpuid->eax_in) : "cc"); # endif } @@ -1917,7 +1919,7 @@ cpuidSet(uint32_t base, virCPUx86Data *data) max = cpuid.eax; for (i = base; i <= max; i++) { - cpuid.function = i; + cpuid.eax_in = i; cpuidCall(&cpuid); if (virCPUx86DataAddCPUID(data, &cpuid) < 0) return -1; diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h index 777cc8d4a4f5b601cccdaab1009d9a373cb63edd..ca87bc5e30a21aaee44db76d505e015f5e569ced 100644 --- a/src/cpu/cpu_x86_data.h +++ b/src/cpu/cpu_x86_data.h @@ -28,7 +28,7 @@ typedef struct _virCPUx86CPUID virCPUx86CPUID; struct _virCPUx86CPUID { - uint32_t function; + uint32_t eax_in; uint32_t eax; uint32_t ebx; uint32_t ecx; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 585b8822dc9265ba80ce0b4d7a4e7b44cea4aa0c..874ed24b52df71c804ae65bd12b07af068eefd1c 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6363,7 +6363,7 @@ qemuMonitorJSONParseCPUx86FeatureWord(virJSONValuePtr data, virCPUx86CPUID *cpuid) { const char *reg; - unsigned long long fun; + unsigned long long eax_in; unsigned long long features; memset(cpuid, 0, sizeof(*cpuid)); @@ -6373,7 +6373,7 @@ qemuMonitorJSONParseCPUx86FeatureWord(virJSONValuePtr data, _("missing cpuid-register in CPU data")); return -1; } - if (virJSONValueObjectGetNumberUlong(data, "cpuid-input-eax", &fun) < 0) { + if (virJSONValueObjectGetNumberUlong(data, "cpuid-input-eax", &eax_in) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing or invalid cpuid-input-eax in CPU data")); return -1; @@ -6384,7 +6384,7 @@ qemuMonitorJSONParseCPUx86FeatureWord(virJSONValuePtr data, return -1; } - cpuid->function = fun; + cpuid->eax_in = eax_in; if (STREQ(reg, "EAX")) { cpuid->eax = features; } else if (STREQ(reg, "EBX")) { diff --git a/tests/qemumonitorjsondata/qemumonitorjson-getcpu-full.data b/tests/qemumonitorjsondata/qemumonitorjson-getcpu-full.data index bba8d31b08a361c2cf5f0e6c5e011734849c6060..87a8fb180a430a1451a1aaf06dfe5156f8602661 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-getcpu-full.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-getcpu-full.data @@ -1,5 +1,5 @@ - - - + + + diff --git a/tests/qemumonitorjsondata/qemumonitorjson-getcpu-host.data b/tests/qemumonitorjsondata/qemumonitorjson-getcpu-host.data index 98b9e7c6e6d0ce6f335dd89524f91d45e7c001ee..83bafe1dd2ffcf553fdcc03b8e14d3294e5b8b1a 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-getcpu-host.data +++ b/tests/qemumonitorjsondata/qemumonitorjson-getcpu-host.data @@ -1,6 +1,6 @@ - - - - + + + +