|
|
43fe83 |
From bc040f565387ba084c63c12610e44043a1840f01 Mon Sep 17 00:00:00 2001
|
|
|
43fe83 |
Message-Id: <bc040f565387ba084c63c12610e44043a1840f01.1383922566.git.jdenemar@redhat.com>
|
|
|
43fe83 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
43fe83 |
Date: Fri, 8 Nov 2013 12:33:18 +0100
|
|
|
43fe83 |
Subject: [PATCH] cpu: x86: Rename struct cpuX86cpuid as virCPUx86CPUID
|
|
|
43fe83 |
|
|
|
43fe83 |
https://bugzilla.redhat.com/show_bug.cgi?id=1008989
|
|
|
43fe83 |
|
|
|
43fe83 |
(cherry picked from commit 01fabe2eda94b3bc8f039e6a6cbf0aa29f03700b)
|
|
|
43fe83 |
|
|
|
43fe83 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
43fe83 |
---
|
|
|
43fe83 |
src/cpu/cpu_x86.c | 64 +++++++++++++++++++++++++-------------------------
|
|
|
43fe83 |
src/cpu/cpu_x86_data.h | 7 +++---
|
|
|
43fe83 |
2 files changed, 36 insertions(+), 35 deletions(-)
|
|
|
43fe83 |
|
|
|
43fe83 |
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
|
43fe83 |
index 0bc031b..e8e996e 100644
|
|
|
43fe83 |
--- a/src/cpu/cpu_x86.c
|
|
|
43fe83 |
+++ b/src/cpu/cpu_x86.c
|
|
|
43fe83 |
@@ -38,13 +38,13 @@
|
|
|
43fe83 |
|
|
|
43fe83 |
#define VENDOR_STRING_LENGTH 12
|
|
|
43fe83 |
|
|
|
43fe83 |
-static const struct cpuX86cpuid cpuidNull = { 0, 0, 0, 0, 0 };
|
|
|
43fe83 |
+static const virCPUx86CPUID cpuidNull = { 0, 0, 0, 0, 0 };
|
|
|
43fe83 |
|
|
|
43fe83 |
static const virArch archs[] = { VIR_ARCH_I686, VIR_ARCH_X86_64 };
|
|
|
43fe83 |
|
|
|
43fe83 |
struct x86_vendor {
|
|
|
43fe83 |
char *name;
|
|
|
43fe83 |
- struct cpuX86cpuid cpuid;
|
|
|
43fe83 |
+ virCPUx86CPUID cpuid;
|
|
|
43fe83 |
|
|
|
43fe83 |
struct x86_vendor *next;
|
|
|
43fe83 |
};
|
|
|
43fe83 |
@@ -91,8 +91,8 @@ struct data_iterator {
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
static int
|
|
|
43fe83 |
-x86cpuidMatch(const struct cpuX86cpuid *cpuid1,
|
|
|
43fe83 |
- const struct cpuX86cpuid *cpuid2)
|
|
|
43fe83 |
+x86cpuidMatch(const virCPUx86CPUID *cpuid1,
|
|
|
43fe83 |
+ const virCPUx86CPUID *cpuid2)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
return (cpuid1->eax == cpuid2->eax &&
|
|
|
43fe83 |
cpuid1->ebx == cpuid2->ebx &&
|
|
|
43fe83 |
@@ -102,8 +102,8 @@ x86cpuidMatch(const struct cpuX86cpuid *cpuid1,
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
static int
|
|
|
43fe83 |
-x86cpuidMatchMasked(const struct cpuX86cpuid *cpuid,
|
|
|
43fe83 |
- const struct cpuX86cpuid *mask)
|
|
|
43fe83 |
+x86cpuidMatchMasked(const virCPUx86CPUID *cpuid,
|
|
|
43fe83 |
+ const virCPUx86CPUID *mask)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
return ((cpuid->eax & mask->eax) == mask->eax &&
|
|
|
43fe83 |
(cpuid->ebx & mask->ebx) == mask->ebx &&
|
|
|
43fe83 |
@@ -113,8 +113,8 @@ x86cpuidMatchMasked(const struct cpuX86cpuid *cpuid,
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
static void
|
|
|
43fe83 |
-x86cpuidSetBits(struct cpuX86cpuid *cpuid,
|
|
|
43fe83 |
- const struct cpuX86cpuid *mask)
|
|
|
43fe83 |
+x86cpuidSetBits(virCPUx86CPUID *cpuid,
|
|
|
43fe83 |
+ const virCPUx86CPUID *mask)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
cpuid->eax |= mask->eax;
|
|
|
43fe83 |
cpuid->ebx |= mask->ebx;
|
|
|
43fe83 |
@@ -124,8 +124,8 @@ x86cpuidSetBits(struct cpuX86cpuid *cpuid,
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
static void
|
|
|
43fe83 |
-x86cpuidClearBits(struct cpuX86cpuid *cpuid,
|
|
|
43fe83 |
- const struct cpuX86cpuid *mask)
|
|
|
43fe83 |
+x86cpuidClearBits(virCPUx86CPUID *cpuid,
|
|
|
43fe83 |
+ const virCPUx86CPUID *mask)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
cpuid->eax &= ~mask->eax;
|
|
|
43fe83 |
cpuid->ebx &= ~mask->ebx;
|
|
|
43fe83 |
@@ -135,8 +135,8 @@ x86cpuidClearBits(struct cpuX86cpuid *cpuid,
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
static void
|
|
|
43fe83 |
-x86cpuidAndBits(struct cpuX86cpuid *cpuid,
|
|
|
43fe83 |
- const struct cpuX86cpuid *mask)
|
|
|
43fe83 |
+x86cpuidAndBits(virCPUx86CPUID *cpuid,
|
|
|
43fe83 |
+ const virCPUx86CPUID *mask)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
cpuid->eax &= mask->eax;
|
|
|
43fe83 |
cpuid->ebx &= mask->ebx;
|
|
|
43fe83 |
@@ -146,10 +146,10 @@ x86cpuidAndBits(struct cpuX86cpuid *cpuid,
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
/* skips all zero CPUID leafs */
|
|
|
43fe83 |
-static struct cpuX86cpuid *
|
|
|
43fe83 |
+static virCPUx86CPUID *
|
|
|
43fe83 |
x86DataCpuidNext(struct data_iterator *iterator)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
- struct cpuX86cpuid *ret;
|
|
|
43fe83 |
+ virCPUx86CPUID *ret;
|
|
|
43fe83 |
struct cpuX86Data *data = iterator->data;
|
|
|
43fe83 |
|
|
|
43fe83 |
if (!data)
|
|
|
43fe83 |
@@ -177,11 +177,11 @@ x86DataCpuidNext(struct data_iterator *iterator)
|
|
|
43fe83 |
}
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
-static struct cpuX86cpuid *
|
|
|
43fe83 |
+static virCPUx86CPUID *
|
|
|
43fe83 |
x86DataCpuid(const struct cpuX86Data *data,
|
|
|
43fe83 |
uint32_t function)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
- struct cpuX86cpuid *cpuids;
|
|
|
43fe83 |
+ virCPUx86CPUID *cpuids;
|
|
|
43fe83 |
int len;
|
|
|
43fe83 |
size_t i;
|
|
|
43fe83 |
|
|
|
43fe83 |
@@ -297,11 +297,11 @@ x86DataExpand(struct cpuX86Data *data,
|
|
|
43fe83 |
|
|
|
43fe83 |
static int
|
|
|
43fe83 |
x86DataAddCpuid(struct cpuX86Data *data,
|
|
|
43fe83 |
- const struct cpuX86cpuid *cpuid)
|
|
|
43fe83 |
+ const virCPUx86CPUID *cpuid)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
unsigned int basic_by = 0;
|
|
|
43fe83 |
unsigned int extended_by = 0;
|
|
|
43fe83 |
- struct cpuX86cpuid **cpuids;
|
|
|
43fe83 |
+ virCPUx86CPUID **cpuids;
|
|
|
43fe83 |
unsigned int pos;
|
|
|
43fe83 |
|
|
|
43fe83 |
if (cpuid->function < CPUX86_EXTENDED) {
|
|
|
43fe83 |
@@ -374,8 +374,8 @@ x86DataIntersect(struct cpuX86Data *data1,
|
|
|
43fe83 |
const struct cpuX86Data *data2)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
struct data_iterator iter = DATA_ITERATOR_INIT(data1);
|
|
|
43fe83 |
- struct cpuX86cpuid *cpuid1;
|
|
|
43fe83 |
- struct cpuX86cpuid *cpuid2;
|
|
|
43fe83 |
+ virCPUx86CPUID *cpuid1;
|
|
|
43fe83 |
+ virCPUx86CPUID *cpuid2;
|
|
|
43fe83 |
|
|
|
43fe83 |
while ((cpuid1 = x86DataCpuidNext(&iter))) {
|
|
|
43fe83 |
cpuid2 = x86DataCpuid(data2, cpuid1->function);
|
|
|
43fe83 |
@@ -402,8 +402,8 @@ x86DataIsSubset(const struct cpuX86Data *data,
|
|
|
43fe83 |
{
|
|
|
43fe83 |
|
|
|
43fe83 |
struct data_iterator iter = DATA_ITERATOR_INIT((struct cpuX86Data *)subset);
|
|
|
43fe83 |
- const struct cpuX86cpuid *cpuid;
|
|
|
43fe83 |
- const struct cpuX86cpuid *cpuidSubset;
|
|
|
43fe83 |
+ const virCPUx86CPUID *cpuid;
|
|
|
43fe83 |
+ const virCPUx86CPUID *cpuidSubset;
|
|
|
43fe83 |
|
|
|
43fe83 |
while ((cpuidSubset = x86DataCpuidNext(&iter))) {
|
|
|
43fe83 |
if (!(cpuid = x86DataCpuid(data, cpuidSubset->function)) ||
|
|
|
43fe83 |
@@ -443,7 +443,7 @@ x86DataToVendor(struct cpuX86Data *data,
|
|
|
43fe83 |
const struct x86_map *map)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
const struct x86_vendor *vendor = map->vendors;
|
|
|
43fe83 |
- struct cpuX86cpuid *cpuid;
|
|
|
43fe83 |
+ virCPUx86CPUID *cpuid;
|
|
|
43fe83 |
|
|
|
43fe83 |
while (vendor) {
|
|
|
43fe83 |
if ((cpuid = x86DataCpuid(data, vendor->cpuid.function)) &&
|
|
|
43fe83 |
@@ -667,7 +667,7 @@ x86FeatureNames(const struct x86_map *map,
|
|
|
43fe83 |
|
|
|
43fe83 |
static int
|
|
|
43fe83 |
x86ParseCPUID(xmlXPathContextPtr ctxt,
|
|
|
43fe83 |
- struct cpuX86cpuid *cpuid)
|
|
|
43fe83 |
+ virCPUx86CPUID *cpuid)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
unsigned long fun, eax, ebx, ecx, edx;
|
|
|
43fe83 |
int ret_fun, ret_eax, ret_ebx, ret_ecx, ret_edx;
|
|
|
43fe83 |
@@ -701,7 +701,7 @@ x86FeatureLoad(xmlXPathContextPtr ctxt,
|
|
|
43fe83 |
xmlNodePtr *nodes = NULL;
|
|
|
43fe83 |
xmlNodePtr ctxt_node = ctxt->node;
|
|
|
43fe83 |
struct x86_feature *feature;
|
|
|
43fe83 |
- struct cpuX86cpuid cpuid;
|
|
|
43fe83 |
+ virCPUx86CPUID cpuid;
|
|
|
43fe83 |
int ret = 0;
|
|
|
43fe83 |
size_t i;
|
|
|
43fe83 |
int n;
|
|
|
43fe83 |
@@ -914,8 +914,8 @@ x86ModelCompare(const struct x86_model *model1,
|
|
|
43fe83 |
enum compare_result result = EQUAL;
|
|
|
43fe83 |
struct data_iterator iter1 = DATA_ITERATOR_INIT(model1->data);
|
|
|
43fe83 |
struct data_iterator iter2 = DATA_ITERATOR_INIT(model2->data);
|
|
|
43fe83 |
- struct cpuX86cpuid *cpuid1;
|
|
|
43fe83 |
- struct cpuX86cpuid *cpuid2;
|
|
|
43fe83 |
+ virCPUx86CPUID *cpuid1;
|
|
|
43fe83 |
+ virCPUx86CPUID *cpuid2;
|
|
|
43fe83 |
|
|
|
43fe83 |
while ((cpuid1 = x86DataCpuidNext(&iter1))) {
|
|
|
43fe83 |
enum compare_result match = SUPERSET;
|
|
|
43fe83 |
@@ -1140,7 +1140,7 @@ static char *
|
|
|
43fe83 |
x86CPUDataFormat(const virCPUData *data)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
struct data_iterator iter = DATA_ITERATOR_INIT(data->data.x86);
|
|
|
43fe83 |
- struct cpuX86cpuid *cpuid;
|
|
|
43fe83 |
+ virCPUx86CPUID *cpuid;
|
|
|
43fe83 |
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
|
|
43fe83 |
|
|
|
43fe83 |
virBufferAddLit(&buf, "<cpudata arch='x86'>\n");
|
|
|
43fe83 |
@@ -1172,7 +1172,7 @@ x86CPUDataParse(const char *xmlStr)
|
|
|
43fe83 |
xmlNodePtr *nodes = NULL;
|
|
|
43fe83 |
virCPUDataPtr cpuData = NULL;
|
|
|
43fe83 |
struct cpuX86Data *data = NULL;
|
|
|
43fe83 |
- struct cpuX86cpuid cpuid;
|
|
|
43fe83 |
+ virCPUx86CPUID cpuid;
|
|
|
43fe83 |
size_t i;
|
|
|
43fe83 |
int n;
|
|
|
43fe83 |
|
|
|
43fe83 |
@@ -1674,7 +1674,7 @@ error:
|
|
|
43fe83 |
|
|
|
43fe83 |
#if HAVE_CPUID
|
|
|
43fe83 |
static inline void
|
|
|
43fe83 |
-cpuidCall(struct cpuX86cpuid *cpuid)
|
|
|
43fe83 |
+cpuidCall(virCPUx86CPUID *cpuid)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
# if __x86_64__
|
|
|
43fe83 |
asm("xor %%ebx, %%ebx;" /* clear the other registers as some cpuid */
|
|
|
43fe83 |
@@ -1708,11 +1708,11 @@ cpuidCall(struct cpuX86cpuid *cpuid)
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
static int
|
|
|
43fe83 |
-cpuidSet(uint32_t base, struct cpuX86cpuid **set)
|
|
|
43fe83 |
+cpuidSet(uint32_t base, virCPUx86CPUID **set)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
uint32_t max;
|
|
|
43fe83 |
uint32_t i;
|
|
|
43fe83 |
- struct cpuX86cpuid cpuid = { base, 0, 0, 0, 0 };
|
|
|
43fe83 |
+ virCPUx86CPUID cpuid = { base, 0, 0, 0, 0 };
|
|
|
43fe83 |
|
|
|
43fe83 |
cpuidCall(&cpuid);
|
|
|
43fe83 |
max = cpuid.eax - base;
|
|
|
43fe83 |
diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h
|
|
|
43fe83 |
index dc972a6..acb7c32 100644
|
|
|
43fe83 |
--- a/src/cpu/cpu_x86_data.h
|
|
|
43fe83 |
+++ b/src/cpu/cpu_x86_data.h
|
|
|
43fe83 |
@@ -26,7 +26,8 @@
|
|
|
43fe83 |
|
|
|
43fe83 |
# include <stdint.h>
|
|
|
43fe83 |
|
|
|
43fe83 |
-struct cpuX86cpuid {
|
|
|
43fe83 |
+typedef struct _virCPUx86CPUID virCPUx86CPUID;
|
|
|
43fe83 |
+struct _virCPUx86CPUID {
|
|
|
43fe83 |
uint32_t function;
|
|
|
43fe83 |
uint32_t eax;
|
|
|
43fe83 |
uint32_t ebx;
|
|
|
43fe83 |
@@ -39,9 +40,9 @@ struct cpuX86cpuid {
|
|
|
43fe83 |
|
|
|
43fe83 |
struct cpuX86Data {
|
|
|
43fe83 |
size_t basic_len;
|
|
|
43fe83 |
- struct cpuX86cpuid *basic;
|
|
|
43fe83 |
+ virCPUx86CPUID *basic;
|
|
|
43fe83 |
size_t extended_len;
|
|
|
43fe83 |
- struct cpuX86cpuid *extended;
|
|
|
43fe83 |
+ virCPUx86CPUID *extended;
|
|
|
43fe83 |
};
|
|
|
43fe83 |
|
|
|
43fe83 |
#endif /* __VIR_CPU_X86_DATA_H__ */
|
|
|
43fe83 |
--
|
|
|
43fe83 |
1.8.4.2
|
|
|
43fe83 |
|