|
|
43fe83 |
From 678e17ff7fc2c4ef74a832cbfe25ebfd22f7fde4 Mon Sep 17 00:00:00 2001
|
|
|
43fe83 |
Message-Id: <678e17ff7fc2c4ef74a832cbfe25ebfd22f7fde4.1383922566.git.jdenemar@redhat.com>
|
|
|
43fe83 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
43fe83 |
Date: Fri, 8 Nov 2013 12:33:19 +0100
|
|
|
43fe83 |
Subject: [PATCH] cpu: x86: Rename struct cpuX86Data as virCPUx86Data
|
|
|
43fe83 |
|
|
|
43fe83 |
https://bugzilla.redhat.com/show_bug.cgi?id=1008989
|
|
|
43fe83 |
|
|
|
43fe83 |
(cherry picked from commit 0c63d120042d444f178cfdd521aa2a41d49ad570)
|
|
|
43fe83 |
|
|
|
43fe83 |
Conflicts:
|
|
|
43fe83 |
src/cpu/cpu_x86.c - d694ae0c55b4cd1349f6 not backported
|
|
|
43fe83 |
|
|
|
43fe83 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
43fe83 |
---
|
|
|
43fe83 |
src/cpu/cpu.h | 2 +-
|
|
|
43fe83 |
src/cpu/cpu_x86.c | 82 +++++++++++++++++++++++++-------------------------
|
|
|
43fe83 |
src/cpu/cpu_x86_data.h | 3 +-
|
|
|
43fe83 |
3 files changed, 44 insertions(+), 43 deletions(-)
|
|
|
43fe83 |
|
|
|
43fe83 |
diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h
|
|
|
43fe83 |
index 7417f92..ad6ccfb 100644
|
|
|
43fe83 |
--- a/src/cpu/cpu.h
|
|
|
43fe83 |
+++ b/src/cpu/cpu.h
|
|
|
43fe83 |
@@ -37,7 +37,7 @@ typedef virCPUData *virCPUDataPtr;
|
|
|
43fe83 |
struct _virCPUData {
|
|
|
43fe83 |
virArch arch;
|
|
|
43fe83 |
union {
|
|
|
43fe83 |
- struct cpuX86Data *x86;
|
|
|
43fe83 |
+ virCPUx86Data *x86;
|
|
|
43fe83 |
struct cpuPPCData ppc;
|
|
|
43fe83 |
/* generic driver needs no data */
|
|
|
43fe83 |
} data;
|
|
|
43fe83 |
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
|
43fe83 |
index e8e996e..94ba7a4 100644
|
|
|
43fe83 |
--- a/src/cpu/cpu_x86.c
|
|
|
43fe83 |
+++ b/src/cpu/cpu_x86.c
|
|
|
43fe83 |
@@ -51,7 +51,7 @@ struct x86_vendor {
|
|
|
43fe83 |
|
|
|
43fe83 |
struct x86_feature {
|
|
|
43fe83 |
char *name;
|
|
|
43fe83 |
- struct cpuX86Data *data;
|
|
|
43fe83 |
+ virCPUx86Data *data;
|
|
|
43fe83 |
|
|
|
43fe83 |
struct x86_feature *next;
|
|
|
43fe83 |
};
|
|
|
43fe83 |
@@ -59,7 +59,7 @@ struct x86_feature {
|
|
|
43fe83 |
struct x86_model {
|
|
|
43fe83 |
char *name;
|
|
|
43fe83 |
const struct x86_vendor *vendor;
|
|
|
43fe83 |
- struct cpuX86Data *data;
|
|
|
43fe83 |
+ virCPUx86Data *data;
|
|
|
43fe83 |
|
|
|
43fe83 |
struct x86_model *next;
|
|
|
43fe83 |
};
|
|
|
43fe83 |
@@ -80,7 +80,7 @@ enum compare_result {
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
struct data_iterator {
|
|
|
43fe83 |
- struct cpuX86Data *data;
|
|
|
43fe83 |
+ virCPUx86Data *data;
|
|
|
43fe83 |
int pos;
|
|
|
43fe83 |
bool extended;
|
|
|
43fe83 |
};
|
|
|
43fe83 |
@@ -150,7 +150,7 @@ static virCPUx86CPUID *
|
|
|
43fe83 |
x86DataCpuidNext(struct data_iterator *iterator)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
virCPUx86CPUID *ret;
|
|
|
43fe83 |
- struct cpuX86Data *data = iterator->data;
|
|
|
43fe83 |
+ virCPUx86Data *data = iterator->data;
|
|
|
43fe83 |
|
|
|
43fe83 |
if (!data)
|
|
|
43fe83 |
return NULL;
|
|
|
43fe83 |
@@ -178,7 +178,7 @@ x86DataCpuidNext(struct data_iterator *iterator)
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
static virCPUx86CPUID *
|
|
|
43fe83 |
-x86DataCpuid(const struct cpuX86Data *data,
|
|
|
43fe83 |
+x86DataCpuid(const virCPUx86Data *data,
|
|
|
43fe83 |
uint32_t function)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
virCPUx86CPUID *cpuids;
|
|
|
43fe83 |
@@ -204,7 +204,7 @@ x86DataCpuid(const struct cpuX86Data *data,
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
static void
|
|
|
43fe83 |
-x86DataFree(struct cpuX86Data *data)
|
|
|
43fe83 |
+x86DataFree(virCPUx86Data *data)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
if (data == NULL)
|
|
|
43fe83 |
return;
|
|
|
43fe83 |
@@ -216,7 +216,7 @@ x86DataFree(struct cpuX86Data *data)
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
static virCPUDataPtr
|
|
|
43fe83 |
-x86MakeCPUData(virArch arch, struct cpuX86Data **data)
|
|
|
43fe83 |
+x86MakeCPUData(virArch arch, virCPUx86Data **data)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
virCPUDataPtr cpuData;
|
|
|
43fe83 |
|
|
|
43fe83 |
@@ -241,10 +241,10 @@ x86FreeCPUData(virCPUDataPtr data)
|
|
|
43fe83 |
}
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
-static struct cpuX86Data *
|
|
|
43fe83 |
-x86DataCopy(const struct cpuX86Data *data)
|
|
|
43fe83 |
+static virCPUx86Data *
|
|
|
43fe83 |
+x86DataCopy(const virCPUx86Data *data)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
- struct cpuX86Data *copy = NULL;
|
|
|
43fe83 |
+ virCPUx86Data *copy = NULL;
|
|
|
43fe83 |
size_t i;
|
|
|
43fe83 |
|
|
|
43fe83 |
if (VIR_ALLOC(copy) < 0
|
|
|
43fe83 |
@@ -267,7 +267,7 @@ x86DataCopy(const struct cpuX86Data *data)
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
static int
|
|
|
43fe83 |
-x86DataExpand(struct cpuX86Data *data,
|
|
|
43fe83 |
+x86DataExpand(virCPUx86Data *data,
|
|
|
43fe83 |
int basic_by,
|
|
|
43fe83 |
int extended_by)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
@@ -296,7 +296,7 @@ x86DataExpand(struct cpuX86Data *data,
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
static int
|
|
|
43fe83 |
-x86DataAddCpuid(struct cpuX86Data *data,
|
|
|
43fe83 |
+x86DataAddCpuid(virCPUx86Data *data,
|
|
|
43fe83 |
const virCPUx86CPUID *cpuid)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
unsigned int basic_by = 0;
|
|
|
43fe83 |
@@ -324,8 +324,8 @@ x86DataAddCpuid(struct cpuX86Data *data,
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
static int
|
|
|
43fe83 |
-x86DataAdd(struct cpuX86Data *data1,
|
|
|
43fe83 |
- const struct cpuX86Data *data2)
|
|
|
43fe83 |
+x86DataAdd(virCPUx86Data *data1,
|
|
|
43fe83 |
+ const virCPUx86Data *data2)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
size_t i;
|
|
|
43fe83 |
|
|
|
43fe83 |
@@ -349,8 +349,8 @@ x86DataAdd(struct cpuX86Data *data1,
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
static void
|
|
|
43fe83 |
-x86DataSubtract(struct cpuX86Data *data1,
|
|
|
43fe83 |
- const struct cpuX86Data *data2)
|
|
|
43fe83 |
+x86DataSubtract(virCPUx86Data *data1,
|
|
|
43fe83 |
+ const virCPUx86Data *data2)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
size_t i;
|
|
|
43fe83 |
unsigned int len;
|
|
|
43fe83 |
@@ -370,8 +370,8 @@ x86DataSubtract(struct cpuX86Data *data1,
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
static void
|
|
|
43fe83 |
-x86DataIntersect(struct cpuX86Data *data1,
|
|
|
43fe83 |
- const struct cpuX86Data *data2)
|
|
|
43fe83 |
+x86DataIntersect(virCPUx86Data *data1,
|
|
|
43fe83 |
+ const virCPUx86Data *data2)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
struct data_iterator iter = DATA_ITERATOR_INIT(data1);
|
|
|
43fe83 |
virCPUx86CPUID *cpuid1;
|
|
|
43fe83 |
@@ -388,7 +388,7 @@ x86DataIntersect(struct cpuX86Data *data1,
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
static bool
|
|
|
43fe83 |
-x86DataIsEmpty(struct cpuX86Data *data)
|
|
|
43fe83 |
+x86DataIsEmpty(virCPUx86Data *data)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
struct data_iterator iter = DATA_ITERATOR_INIT(data);
|
|
|
43fe83 |
|
|
|
43fe83 |
@@ -397,11 +397,11 @@ x86DataIsEmpty(struct cpuX86Data *data)
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
static bool
|
|
|
43fe83 |
-x86DataIsSubset(const struct cpuX86Data *data,
|
|
|
43fe83 |
- const struct cpuX86Data *subset)
|
|
|
43fe83 |
+x86DataIsSubset(const virCPUx86Data *data,
|
|
|
43fe83 |
+ const virCPUx86Data *subset)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
|
|
|
43fe83 |
- struct data_iterator iter = DATA_ITERATOR_INIT((struct cpuX86Data *)subset);
|
|
|
43fe83 |
+ struct data_iterator iter = DATA_ITERATOR_INIT((virCPUx86Data *)subset);
|
|
|
43fe83 |
const virCPUx86CPUID *cpuid;
|
|
|
43fe83 |
const virCPUx86CPUID *cpuidSubset;
|
|
|
43fe83 |
|
|
|
43fe83 |
@@ -419,7 +419,7 @@ x86DataIsSubset(const struct cpuX86Data *data,
|
|
|
43fe83 |
static int
|
|
|
43fe83 |
x86DataToCPUFeatures(virCPUDefPtr cpu,
|
|
|
43fe83 |
int policy,
|
|
|
43fe83 |
- struct cpuX86Data *data,
|
|
|
43fe83 |
+ virCPUx86Data *data,
|
|
|
43fe83 |
const struct x86_map *map)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
const struct x86_feature *feature = map->features;
|
|
|
43fe83 |
@@ -439,7 +439,7 @@ x86DataToCPUFeatures(virCPUDefPtr cpu,
|
|
|
43fe83 |
|
|
|
43fe83 |
/* also removes bits corresponding to vendor string from data */
|
|
|
43fe83 |
static const struct x86_vendor *
|
|
|
43fe83 |
-x86DataToVendor(struct cpuX86Data *data,
|
|
|
43fe83 |
+x86DataToVendor(virCPUx86Data *data,
|
|
|
43fe83 |
const struct x86_map *map)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
const struct x86_vendor *vendor = map->vendors;
|
|
|
43fe83 |
@@ -459,13 +459,13 @@ x86DataToVendor(struct cpuX86Data *data,
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
static virCPUDefPtr
|
|
|
43fe83 |
-x86DataToCPU(const struct cpuX86Data *data,
|
|
|
43fe83 |
+x86DataToCPU(const virCPUx86Data *data,
|
|
|
43fe83 |
const struct x86_model *model,
|
|
|
43fe83 |
const struct x86_map *map)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
virCPUDefPtr cpu;
|
|
|
43fe83 |
- struct cpuX86Data *copy = NULL;
|
|
|
43fe83 |
- struct cpuX86Data *modelData = NULL;
|
|
|
43fe83 |
+ virCPUx86Data *copy = NULL;
|
|
|
43fe83 |
+ virCPUx86Data *modelData = NULL;
|
|
|
43fe83 |
const struct x86_vendor *vendor;
|
|
|
43fe83 |
|
|
|
43fe83 |
if (VIR_ALLOC(cpu) < 0 ||
|
|
|
43fe83 |
@@ -640,7 +640,7 @@ x86FeatureFind(const struct x86_map *map,
|
|
|
43fe83 |
static char *
|
|
|
43fe83 |
x86FeatureNames(const struct x86_map *map,
|
|
|
43fe83 |
const char *separator,
|
|
|
43fe83 |
- struct cpuX86Data *data)
|
|
|
43fe83 |
+ virCPUx86Data *data)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
virBuffer ret = VIR_BUFFER_INITIALIZER;
|
|
|
43fe83 |
bool first = true;
|
|
|
43fe83 |
@@ -1171,7 +1171,7 @@ x86CPUDataParse(const char *xmlStr)
|
|
|
43fe83 |
xmlXPathContextPtr ctxt = NULL;
|
|
|
43fe83 |
xmlNodePtr *nodes = NULL;
|
|
|
43fe83 |
virCPUDataPtr cpuData = NULL;
|
|
|
43fe83 |
- struct cpuX86Data *data = NULL;
|
|
|
43fe83 |
+ virCPUx86Data *data = NULL;
|
|
|
43fe83 |
virCPUx86CPUID cpuid;
|
|
|
43fe83 |
size_t i;
|
|
|
43fe83 |
int n;
|
|
|
43fe83 |
@@ -1218,7 +1218,7 @@ cleanup:
|
|
|
43fe83 |
/* A helper macro to exit the cpu computation function without writing
|
|
|
43fe83 |
* redundant code:
|
|
|
43fe83 |
* MSG: error message
|
|
|
43fe83 |
- * CPU_DEF: a struct cpuX86Data pointer with flags that are conflicting
|
|
|
43fe83 |
+ * CPU_DEF: a virCPUx86Data pointer with flags that are conflicting
|
|
|
43fe83 |
* RET: return code to set
|
|
|
43fe83 |
*
|
|
|
43fe83 |
* This macro generates the error string outputs it into logs.
|
|
|
43fe83 |
@@ -1352,7 +1352,7 @@ x86Compute(virCPUDefPtr host,
|
|
|
43fe83 |
}
|
|
|
43fe83 |
|
|
|
43fe83 |
if (guest != NULL) {
|
|
|
43fe83 |
- struct cpuX86Data *guestData;
|
|
|
43fe83 |
+ virCPUx86Data *guestData;
|
|
|
43fe83 |
|
|
|
43fe83 |
if ((guest_model = x86ModelCopy(host_model)) == NULL)
|
|
|
43fe83 |
goto error;
|
|
|
43fe83 |
@@ -1413,7 +1413,7 @@ x86GuestData(virCPUDefPtr host,
|
|
|
43fe83 |
|
|
|
43fe83 |
static int
|
|
|
43fe83 |
x86Decode(virCPUDefPtr cpu,
|
|
|
43fe83 |
- const struct cpuX86Data *data,
|
|
|
43fe83 |
+ const virCPUx86Data *data,
|
|
|
43fe83 |
const char **models,
|
|
|
43fe83 |
unsigned int nmodels,
|
|
|
43fe83 |
const char *preferred)
|
|
|
43fe83 |
@@ -1523,13 +1523,13 @@ x86DecodeCPUData(virCPUDefPtr cpu,
|
|
|
43fe83 |
}
|
|
|
43fe83 |
|
|
|
43fe83 |
|
|
|
43fe83 |
-static struct cpuX86Data *
|
|
|
43fe83 |
+static virCPUx86Data *
|
|
|
43fe83 |
x86EncodePolicy(const virCPUDefPtr cpu,
|
|
|
43fe83 |
const struct x86_map *map,
|
|
|
43fe83 |
enum virCPUFeaturePolicy policy)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
struct x86_model *model;
|
|
|
43fe83 |
- struct cpuX86Data *data = NULL;
|
|
|
43fe83 |
+ virCPUx86Data *data = NULL;
|
|
|
43fe83 |
|
|
|
43fe83 |
if (!(model = x86ModelFromCPU(cpu, map, policy)))
|
|
|
43fe83 |
return NULL;
|
|
|
43fe83 |
@@ -1553,12 +1553,12 @@ x86Encode(virArch arch,
|
|
|
43fe83 |
virCPUDataPtr *vendor)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
struct x86_map *map = NULL;
|
|
|
43fe83 |
- struct cpuX86Data *data_forced = NULL;
|
|
|
43fe83 |
- struct cpuX86Data *data_required = NULL;
|
|
|
43fe83 |
- struct cpuX86Data *data_optional = NULL;
|
|
|
43fe83 |
- struct cpuX86Data *data_disabled = NULL;
|
|
|
43fe83 |
- struct cpuX86Data *data_forbidden = NULL;
|
|
|
43fe83 |
- struct cpuX86Data *data_vendor = NULL;
|
|
|
43fe83 |
+ virCPUx86Data *data_forced = NULL;
|
|
|
43fe83 |
+ virCPUx86Data *data_required = NULL;
|
|
|
43fe83 |
+ virCPUx86Data *data_optional = NULL;
|
|
|
43fe83 |
+ virCPUx86Data *data_disabled = NULL;
|
|
|
43fe83 |
+ virCPUx86Data *data_forbidden = NULL;
|
|
|
43fe83 |
+ virCPUx86Data *data_vendor = NULL;
|
|
|
43fe83 |
int ret = -1;
|
|
|
43fe83 |
|
|
|
43fe83 |
if (forced)
|
|
|
43fe83 |
@@ -1734,7 +1734,7 @@ static virCPUDataPtr
|
|
|
43fe83 |
x86NodeData(void)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
virCPUDataPtr cpuData = NULL;
|
|
|
43fe83 |
- struct cpuX86Data *data;
|
|
|
43fe83 |
+ virCPUx86Data *data;
|
|
|
43fe83 |
int ret;
|
|
|
43fe83 |
|
|
|
43fe83 |
if (VIR_ALLOC(data) < 0)
|
|
|
43fe83 |
diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h
|
|
|
43fe83 |
index acb7c32..5910ea9 100644
|
|
|
43fe83 |
--- a/src/cpu/cpu_x86_data.h
|
|
|
43fe83 |
+++ b/src/cpu/cpu_x86_data.h
|
|
|
43fe83 |
@@ -38,7 +38,8 @@ struct _virCPUx86CPUID {
|
|
|
43fe83 |
# define CPUX86_BASIC 0x0
|
|
|
43fe83 |
# define CPUX86_EXTENDED 0x80000000
|
|
|
43fe83 |
|
|
|
43fe83 |
-struct cpuX86Data {
|
|
|
43fe83 |
+typedef struct _virCPUx86Data virCPUx86Data;
|
|
|
43fe83 |
+struct _virCPUx86Data {
|
|
|
43fe83 |
size_t basic_len;
|
|
|
43fe83 |
virCPUx86CPUID *basic;
|
|
|
43fe83 |
size_t extended_len;
|
|
|
43fe83 |
--
|
|
|
43fe83 |
1.8.4.2
|
|
|
43fe83 |
|