|
|
c480ed |
From 74ecc2a0c728cf59279c61e1e9837423c72182e9 Mon Sep 17 00:00:00 2001
|
|
|
c480ed |
Message-Id: <74ecc2a0c728cf59279c61e1e9837423c72182e9@dist-git>
|
|
|
c480ed |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c480ed |
Date: Fri, 21 Jun 2019 09:25:24 +0200
|
|
|
c480ed |
Subject: [PATCH] cpu_x86: Rename virCPUx86DataItem variables
|
|
|
c480ed |
MIME-Version: 1.0
|
|
|
c480ed |
Content-Type: text/plain; charset=UTF-8
|
|
|
c480ed |
Content-Transfer-Encoding: 8bit
|
|
|
c480ed |
|
|
|
c480ed |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c480ed |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c480ed |
(cherry picked from commit 6c22b329d5bc592a390bd4d802c55a2a44af750e)
|
|
|
c480ed |
|
|
|
c480ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1697627
|
|
|
c480ed |
|
|
|
c480ed |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c480ed |
Message-Id: <570635ac7fb5f7a6514072ee4b871eb4d08f65bc.1561068591.git.jdenemar@redhat.com>
|
|
|
c480ed |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c480ed |
---
|
|
|
c480ed |
src/cpu/cpu_x86.c | 128 +++++++++++++++++++++++-----------------------
|
|
|
c480ed |
1 file changed, 64 insertions(+), 64 deletions(-)
|
|
|
c480ed |
|
|
|
c480ed |
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
|
c480ed |
index 6e1fb37d20..74f4083aac 100644
|
|
|
c480ed |
--- a/src/cpu/cpu_x86.c
|
|
|
c480ed |
+++ b/src/cpu/cpu_x86.c
|
|
|
c480ed |
@@ -327,13 +327,13 @@ x86DataCpuidNext(virCPUx86DataIteratorPtr iterator)
|
|
|
c480ed |
|
|
|
c480ed |
static virCPUx86DataItemPtr
|
|
|
c480ed |
x86DataCpuid(const virCPUx86Data *data,
|
|
|
c480ed |
- const virCPUx86DataItem *cpuid)
|
|
|
c480ed |
+ const virCPUx86DataItem *item)
|
|
|
c480ed |
{
|
|
|
c480ed |
size_t i;
|
|
|
c480ed |
|
|
|
c480ed |
for (i = 0; i < data->len; i++) {
|
|
|
c480ed |
- if (data->items[i].cpuid.eax_in == cpuid->cpuid.eax_in &&
|
|
|
c480ed |
- data->items[i].cpuid.ecx_in == cpuid->cpuid.ecx_in)
|
|
|
c480ed |
+ if (data->items[i].cpuid.eax_in == item->cpuid.eax_in &&
|
|
|
c480ed |
+ data->items[i].cpuid.ecx_in == item->cpuid.ecx_in)
|
|
|
c480ed |
return data->items + i;
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
@@ -379,15 +379,15 @@ x86DataCopy(virCPUx86Data *dst, const virCPUx86Data *src)
|
|
|
c480ed |
|
|
|
c480ed |
static int
|
|
|
c480ed |
virCPUx86DataAddCPUIDInt(virCPUx86Data *data,
|
|
|
c480ed |
- const virCPUx86DataItem *cpuid)
|
|
|
c480ed |
+ const virCPUx86DataItem *item)
|
|
|
c480ed |
{
|
|
|
c480ed |
virCPUx86DataItemPtr existing;
|
|
|
c480ed |
|
|
|
c480ed |
- if ((existing = x86DataCpuid(data, cpuid))) {
|
|
|
c480ed |
- x86cpuidSetBits(&existing->cpuid, &cpuid->cpuid);
|
|
|
c480ed |
+ if ((existing = x86DataCpuid(data, item))) {
|
|
|
c480ed |
+ x86cpuidSetBits(&existing->cpuid, &item->cpuid);
|
|
|
c480ed |
} else {
|
|
|
c480ed |
if (VIR_APPEND_ELEMENT_COPY(data->items, data->len,
|
|
|
c480ed |
- *((virCPUx86DataItemPtr)cpuid)) < 0)
|
|
|
c480ed |
+ *((virCPUx86DataItemPtr)item)) < 0)
|
|
|
c480ed |
return -1;
|
|
|
c480ed |
|
|
|
c480ed |
qsort(data->items, data->len,
|
|
|
c480ed |
@@ -403,16 +403,16 @@ x86DataAdd(virCPUx86Data *data1,
|
|
|
c480ed |
const virCPUx86Data *data2)
|
|
|
c480ed |
{
|
|
|
c480ed |
virCPUx86DataIterator iter = virCPUx86DataIteratorInit(data2);
|
|
|
c480ed |
- virCPUx86DataItemPtr cpuid1;
|
|
|
c480ed |
- virCPUx86DataItemPtr cpuid2;
|
|
|
c480ed |
+ virCPUx86DataItemPtr item1;
|
|
|
c480ed |
+ virCPUx86DataItemPtr item2;
|
|
|
c480ed |
|
|
|
c480ed |
- while ((cpuid2 = x86DataCpuidNext(&iter))) {
|
|
|
c480ed |
- cpuid1 = x86DataCpuid(data1, cpuid2);
|
|
|
c480ed |
+ while ((item2 = x86DataCpuidNext(&iter))) {
|
|
|
c480ed |
+ item1 = x86DataCpuid(data1, item2);
|
|
|
c480ed |
|
|
|
c480ed |
- if (cpuid1) {
|
|
|
c480ed |
- x86cpuidSetBits(&cpuid1->cpuid, &cpuid2->cpuid);
|
|
|
c480ed |
+ if (item1) {
|
|
|
c480ed |
+ x86cpuidSetBits(&item1->cpuid, &item2->cpuid);
|
|
|
c480ed |
} else {
|
|
|
c480ed |
- if (virCPUx86DataAddCPUIDInt(data1, cpuid2) < 0)
|
|
|
c480ed |
+ if (virCPUx86DataAddCPUIDInt(data1, item2) < 0)
|
|
|
c480ed |
return -1;
|
|
|
c480ed |
}
|
|
|
c480ed |
}
|
|
|
c480ed |
@@ -426,12 +426,12 @@ x86DataSubtract(virCPUx86Data *data1,
|
|
|
c480ed |
const virCPUx86Data *data2)
|
|
|
c480ed |
{
|
|
|
c480ed |
virCPUx86DataIterator iter = virCPUx86DataIteratorInit(data1);
|
|
|
c480ed |
- virCPUx86DataItemPtr cpuid1;
|
|
|
c480ed |
- virCPUx86DataItemPtr cpuid2;
|
|
|
c480ed |
+ virCPUx86DataItemPtr item1;
|
|
|
c480ed |
+ virCPUx86DataItemPtr item2;
|
|
|
c480ed |
|
|
|
c480ed |
- while ((cpuid1 = x86DataCpuidNext(&iter))) {
|
|
|
c480ed |
- if ((cpuid2 = x86DataCpuid(data2, cpuid1)))
|
|
|
c480ed |
- x86cpuidClearBits(&cpuid1->cpuid, &cpuid2->cpuid);
|
|
|
c480ed |
+ while ((item1 = x86DataCpuidNext(&iter))) {
|
|
|
c480ed |
+ if ((item2 = x86DataCpuid(data2, item1)))
|
|
|
c480ed |
+ x86cpuidClearBits(&item1->cpuid, &item2->cpuid);
|
|
|
c480ed |
}
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
@@ -441,15 +441,15 @@ x86DataIntersect(virCPUx86Data *data1,
|
|
|
c480ed |
const virCPUx86Data *data2)
|
|
|
c480ed |
{
|
|
|
c480ed |
virCPUx86DataIterator iter = virCPUx86DataIteratorInit(data1);
|
|
|
c480ed |
- virCPUx86DataItemPtr cpuid1;
|
|
|
c480ed |
- virCPUx86DataItemPtr cpuid2;
|
|
|
c480ed |
+ virCPUx86DataItemPtr item1;
|
|
|
c480ed |
+ virCPUx86DataItemPtr item2;
|
|
|
c480ed |
|
|
|
c480ed |
- while ((cpuid1 = x86DataCpuidNext(&iter))) {
|
|
|
c480ed |
- cpuid2 = x86DataCpuid(data2, cpuid1);
|
|
|
c480ed |
- if (cpuid2)
|
|
|
c480ed |
- x86cpuidAndBits(&cpuid1->cpuid, &cpuid2->cpuid);
|
|
|
c480ed |
+ while ((item1 = x86DataCpuidNext(&iter))) {
|
|
|
c480ed |
+ item2 = x86DataCpuid(data2, item1);
|
|
|
c480ed |
+ if (item2)
|
|
|
c480ed |
+ x86cpuidAndBits(&item1->cpuid, &item2->cpuid);
|
|
|
c480ed |
else
|
|
|
c480ed |
- x86cpuidClearBits(&cpuid1->cpuid, &cpuid1->cpuid);
|
|
|
c480ed |
+ x86cpuidClearBits(&item1->cpuid, &item1->cpuid);
|
|
|
c480ed |
}
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
@@ -469,12 +469,12 @@ x86DataIsSubset(const virCPUx86Data *data,
|
|
|
c480ed |
{
|
|
|
c480ed |
|
|
|
c480ed |
virCPUx86DataIterator iter = virCPUx86DataIteratorInit((virCPUx86Data *)subset);
|
|
|
c480ed |
- const virCPUx86DataItem *cpuid;
|
|
|
c480ed |
- const virCPUx86DataItem *cpuidSubset;
|
|
|
c480ed |
+ const virCPUx86DataItem *item;
|
|
|
c480ed |
+ const virCPUx86DataItem *itemSubset;
|
|
|
c480ed |
|
|
|
c480ed |
- while ((cpuidSubset = x86DataCpuidNext(&iter))) {
|
|
|
c480ed |
- if (!(cpuid = x86DataCpuid(data, cpuidSubset)) ||
|
|
|
c480ed |
- !x86cpuidMatchMasked(&cpuid->cpuid, &cpuidSubset->cpuid))
|
|
|
c480ed |
+ while ((itemSubset = x86DataCpuidNext(&iter))) {
|
|
|
c480ed |
+ if (!(item = x86DataCpuid(data, itemSubset)) ||
|
|
|
c480ed |
+ !x86cpuidMatchMasked(&item->cpuid, &itemSubset->cpuid))
|
|
|
c480ed |
return false;
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
@@ -509,14 +509,14 @@ static virCPUx86VendorPtr
|
|
|
c480ed |
x86DataToVendor(const virCPUx86Data *data,
|
|
|
c480ed |
virCPUx86MapPtr map)
|
|
|
c480ed |
{
|
|
|
c480ed |
- virCPUx86DataItemPtr cpuid;
|
|
|
c480ed |
+ virCPUx86DataItemPtr item;
|
|
|
c480ed |
size_t i;
|
|
|
c480ed |
|
|
|
c480ed |
for (i = 0; i < map->nvendors; i++) {
|
|
|
c480ed |
virCPUx86VendorPtr vendor = map->vendors[i];
|
|
|
c480ed |
- if ((cpuid = x86DataCpuid(data, &vendor->data)) &&
|
|
|
c480ed |
- x86cpuidMatchMasked(&cpuid->cpuid, &vendor->data.cpuid)) {
|
|
|
c480ed |
- x86cpuidClearBits(&cpuid->cpuid, &vendor->data.cpuid);
|
|
|
c480ed |
+ if ((item = x86DataCpuid(data, &vendor->data)) &&
|
|
|
c480ed |
+ x86cpuidMatchMasked(&item->cpuid, &vendor->data.cpuid)) {
|
|
|
c480ed |
+ x86cpuidClearBits(&item->cpuid, &vendor->data.cpuid);
|
|
|
c480ed |
return vendor;
|
|
|
c480ed |
}
|
|
|
c480ed |
}
|
|
|
c480ed |
@@ -626,12 +626,12 @@ static uint32_t
|
|
|
c480ed |
x86DataToSignature(const virCPUx86Data *data)
|
|
|
c480ed |
{
|
|
|
c480ed |
virCPUx86DataItem leaf1 = CPUID(.eax_in = 0x1);
|
|
|
c480ed |
- virCPUx86DataItemPtr cpuid;
|
|
|
c480ed |
+ virCPUx86DataItemPtr item;
|
|
|
c480ed |
|
|
|
c480ed |
- if (!(cpuid = x86DataCpuid(data, &leaf1)))
|
|
|
c480ed |
+ if (!(item = x86DataCpuid(data, &leaf1)))
|
|
|
c480ed |
return 0;
|
|
|
c480ed |
|
|
|
c480ed |
- return cpuid->cpuid.eax & SIGNATURE_MASK;
|
|
|
c480ed |
+ return item->cpuid.eax & SIGNATURE_MASK;
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
|
|
|
c480ed |
@@ -639,9 +639,9 @@ static int
|
|
|
c480ed |
x86DataAddSignature(virCPUx86Data *data,
|
|
|
c480ed |
uint32_t signature)
|
|
|
c480ed |
{
|
|
|
c480ed |
- virCPUx86DataItem cpuid = CPUID(.eax_in = 0x1, .eax = signature);
|
|
|
c480ed |
+ virCPUx86DataItem leaf1 = CPUID(.eax_in = 0x1, .eax = signature);
|
|
|
c480ed |
|
|
|
c480ed |
- return virCPUx86DataAddCPUIDInt(data, &cpuid);
|
|
|
c480ed |
+ return virCPUx86DataAddCPUIDInt(data, &leaf1);
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
|
|
|
c480ed |
@@ -905,7 +905,7 @@ x86FeatureParse(xmlXPathContextPtr ctxt,
|
|
|
c480ed |
virCPUx86MapPtr map = data;
|
|
|
c480ed |
xmlNodePtr *nodes = NULL;
|
|
|
c480ed |
virCPUx86FeaturePtr feature;
|
|
|
c480ed |
- virCPUx86DataItem cpuid;
|
|
|
c480ed |
+ virCPUx86DataItem item;
|
|
|
c480ed |
size_t i;
|
|
|
c480ed |
int n;
|
|
|
c480ed |
char *str = NULL;
|
|
|
c480ed |
@@ -942,13 +942,13 @@ x86FeatureParse(xmlXPathContextPtr ctxt,
|
|
|
c480ed |
|
|
|
c480ed |
for (i = 0; i < n; i++) {
|
|
|
c480ed |
ctxt->node = nodes[i];
|
|
|
c480ed |
- if (x86ParseCPUID(ctxt, &cpuid) < 0) {
|
|
|
c480ed |
+ if (x86ParseCPUID(ctxt, &item) < 0) {
|
|
|
c480ed |
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
c480ed |
_("Invalid cpuid[%zu] in %s feature"),
|
|
|
c480ed |
i, feature->name);
|
|
|
c480ed |
goto cleanup;
|
|
|
c480ed |
}
|
|
|
c480ed |
- if (virCPUx86DataAddCPUIDInt(&feature->data, &cpuid))
|
|
|
c480ed |
+ if (virCPUx86DataAddCPUIDInt(&feature->data, &item))
|
|
|
c480ed |
goto cleanup;
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
@@ -1148,16 +1148,16 @@ x86ModelCompare(virCPUx86ModelPtr model1,
|
|
|
c480ed |
virCPUx86CompareResult result = EQUAL;
|
|
|
c480ed |
virCPUx86DataIterator iter1 = virCPUx86DataIteratorInit(&model1->data);
|
|
|
c480ed |
virCPUx86DataIterator iter2 = virCPUx86DataIteratorInit(&model2->data);
|
|
|
c480ed |
- virCPUx86DataItemPtr cpuid1;
|
|
|
c480ed |
- virCPUx86DataItemPtr cpuid2;
|
|
|
c480ed |
+ virCPUx86DataItemPtr item1;
|
|
|
c480ed |
+ virCPUx86DataItemPtr item2;
|
|
|
c480ed |
|
|
|
c480ed |
- while ((cpuid1 = x86DataCpuidNext(&iter1))) {
|
|
|
c480ed |
+ while ((item1 = x86DataCpuidNext(&iter1))) {
|
|
|
c480ed |
virCPUx86CompareResult match = SUPERSET;
|
|
|
c480ed |
|
|
|
c480ed |
- if ((cpuid2 = x86DataCpuid(&model2->data, cpuid1))) {
|
|
|
c480ed |
- if (x86cpuidMatch(&cpuid1->cpuid, &cpuid2->cpuid))
|
|
|
c480ed |
+ if ((item2 = x86DataCpuid(&model2->data, item1))) {
|
|
|
c480ed |
+ if (x86cpuidMatch(&item1->cpuid, &item2->cpuid))
|
|
|
c480ed |
continue;
|
|
|
c480ed |
- else if (!x86cpuidMatchMasked(&cpuid1->cpuid, &cpuid2->cpuid))
|
|
|
c480ed |
+ else if (!x86cpuidMatchMasked(&item1->cpuid, &item2->cpuid))
|
|
|
c480ed |
match = SUBSET;
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
@@ -1167,13 +1167,13 @@ x86ModelCompare(virCPUx86ModelPtr model1,
|
|
|
c480ed |
return UNRELATED;
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
- while ((cpuid2 = x86DataCpuidNext(&iter2))) {
|
|
|
c480ed |
+ while ((item2 = x86DataCpuidNext(&iter2))) {
|
|
|
c480ed |
virCPUx86CompareResult match = SUBSET;
|
|
|
c480ed |
|
|
|
c480ed |
- if ((cpuid1 = x86DataCpuid(&model1->data, cpuid2))) {
|
|
|
c480ed |
- if (x86cpuidMatch(&cpuid2->cpuid, &cpuid1->cpuid))
|
|
|
c480ed |
+ if ((item1 = x86DataCpuid(&model1->data, item2))) {
|
|
|
c480ed |
+ if (x86cpuidMatch(&item2->cpuid, &item1->cpuid))
|
|
|
c480ed |
continue;
|
|
|
c480ed |
- else if (!x86cpuidMatchMasked(&cpuid2->cpuid, &cpuid1->cpuid))
|
|
|
c480ed |
+ else if (!x86cpuidMatchMasked(&item2->cpuid, &item1->cpuid))
|
|
|
c480ed |
match = SUPERSET;
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
@@ -1484,7 +1484,7 @@ virCPUx86DataParse(xmlXPathContextPtr ctxt)
|
|
|
c480ed |
{
|
|
|
c480ed |
xmlNodePtr *nodes = NULL;
|
|
|
c480ed |
virCPUDataPtr cpuData = NULL;
|
|
|
c480ed |
- virCPUx86DataItem cpuid;
|
|
|
c480ed |
+ virCPUx86DataItem item;
|
|
|
c480ed |
size_t i;
|
|
|
c480ed |
int n;
|
|
|
c480ed |
|
|
|
c480ed |
@@ -1500,12 +1500,12 @@ virCPUx86DataParse(xmlXPathContextPtr ctxt)
|
|
|
c480ed |
|
|
|
c480ed |
for (i = 0; i < n; i++) {
|
|
|
c480ed |
ctxt->node = nodes[i];
|
|
|
c480ed |
- if (x86ParseCPUID(ctxt, &cpuid) < 0) {
|
|
|
c480ed |
+ if (x86ParseCPUID(ctxt, &item) < 0) {
|
|
|
c480ed |
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
c480ed |
_("failed to parse cpuid[%zu]"), i);
|
|
|
c480ed |
goto error;
|
|
|
c480ed |
}
|
|
|
c480ed |
- if (virCPUx86DataAddCPUID(cpuData, &cpuid) < 0)
|
|
|
c480ed |
+ if (virCPUx86DataAddCPUID(cpuData, &item) < 0)
|
|
|
c480ed |
goto error;
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
@@ -2382,10 +2382,10 @@ cpuidSetLeaf12(virCPUDataPtr data,
|
|
|
c480ed |
{
|
|
|
c480ed |
virCPUx86DataItem item = CPUID(.eax_in = 0x7);
|
|
|
c480ed |
virCPUx86CPUIDPtr cpuid = &item.cpuid;
|
|
|
c480ed |
- virCPUx86DataItemPtr cpuid7;
|
|
|
c480ed |
+ virCPUx86DataItemPtr leaf7;
|
|
|
c480ed |
|
|
|
c480ed |
- if (!(cpuid7 = x86DataCpuid(&data->data.x86, &item)) ||
|
|
|
c480ed |
- !(cpuid7->cpuid.ebx & (1 << 2)))
|
|
|
c480ed |
+ if (!(leaf7 = x86DataCpuid(&data->data.x86, &item)) ||
|
|
|
c480ed |
+ !(leaf7->cpuid.ebx & (1 << 2)))
|
|
|
c480ed |
return 0;
|
|
|
c480ed |
|
|
|
c480ed |
if (virCPUx86DataAddCPUID(data, subLeaf0) < 0)
|
|
|
c480ed |
@@ -3078,9 +3078,9 @@ virCPUx86ValidateFeatures(virCPUDefPtr cpu)
|
|
|
c480ed |
|
|
|
c480ed |
int
|
|
|
c480ed |
virCPUx86DataAddCPUID(virCPUDataPtr cpuData,
|
|
|
c480ed |
- const virCPUx86DataItem *cpuid)
|
|
|
c480ed |
+ const virCPUx86DataItem *item)
|
|
|
c480ed |
{
|
|
|
c480ed |
- return virCPUx86DataAddCPUIDInt(&cpuData->data.x86, cpuid);
|
|
|
c480ed |
+ return virCPUx86DataAddCPUIDInt(&cpuData->data.x86, item);
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
|
|
|
c480ed |
@@ -3112,12 +3112,12 @@ int
|
|
|
c480ed |
virCPUx86DataSetVendor(virCPUDataPtr cpuData,
|
|
|
c480ed |
const char *vendor)
|
|
|
c480ed |
{
|
|
|
c480ed |
- virCPUx86DataItem cpuid = CPUID(0);
|
|
|
c480ed |
+ virCPUx86DataItem item = CPUID(0);
|
|
|
c480ed |
|
|
|
c480ed |
- if (virCPUx86VendorToCPUID(vendor, &cpuid) < 0)
|
|
|
c480ed |
+ if (virCPUx86VendorToCPUID(vendor, &item) < 0)
|
|
|
c480ed |
return -1;
|
|
|
c480ed |
|
|
|
c480ed |
- return virCPUx86DataAddCPUID(cpuData, &cpuid);
|
|
|
c480ed |
+ return virCPUx86DataAddCPUID(cpuData, &item);
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
|
|
|
c480ed |
--
|
|
|
c480ed |
2.22.0
|
|
|
c480ed |
|