|
|
6d1f90 |
From 0631e5e7cf7042841d3de563e8c59a74f43b1d68 Mon Sep 17 00:00:00 2001
|
|
|
6d1f90 |
Message-Id: <0631e5e7cf7042841d3de563e8c59a74f43b1d68@dist-git>
|
|
|
6d1f90 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
6d1f90 |
Date: Fri, 22 Nov 2019 11:19:20 +0100
|
|
|
6d1f90 |
Subject: [PATCH] cpu_conf: Pass policy to CPU feature filtering callbacks
|
|
|
6d1f90 |
MIME-Version: 1.0
|
|
|
6d1f90 |
Content-Type: text/plain; charset=UTF-8
|
|
|
6d1f90 |
Content-Transfer-Encoding: 8bit
|
|
|
6d1f90 |
|
|
|
6d1f90 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
6d1f90 |
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
|
6d1f90 |
(cherry picked from commit 668797dc5cb474585609559dbe610e09517e23e6)
|
|
|
6d1f90 |
|
|
|
6d1f90 |
https://bugzilla.redhat.com/show_bug.cgi?id=1775133
|
|
|
6d1f90 |
https://bugzilla.redhat.com/show_bug.cgi?id=1775134
|
|
|
6d1f90 |
https://bugzilla.redhat.com/show_bug.cgi?id=1775137
|
|
|
6d1f90 |
|
|
|
6d1f90 |
Conflicts:
|
|
|
6d1f90 |
src/cpu/cpu_x86.c
|
|
|
6d1f90 |
src/qemu/qemu_capabilities.c
|
|
|
6d1f90 |
- no glib stuff downstream
|
|
|
6d1f90 |
|
|
|
6d1f90 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
6d1f90 |
Message-Id: <e980b2de9220b207c5ce05e978e799c0be53d445.1574417839.git.jdenemar@redhat.com>
|
|
|
6d1f90 |
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
6d1f90 |
---
|
|
|
6d1f90 |
src/conf/cpu_conf.c | 6 +++---
|
|
|
6d1f90 |
src/conf/cpu_conf.h | 1 +
|
|
|
6d1f90 |
src/cpu/cpu_x86.c | 13 ++++++++++++-
|
|
|
6d1f90 |
src/cpu/cpu_x86.h | 2 ++
|
|
|
6d1f90 |
src/qemu/qemu_capabilities.c | 1 +
|
|
|
6d1f90 |
src/qemu/qemu_capabilities.h | 1 +
|
|
|
6d1f90 |
6 files changed, 20 insertions(+), 4 deletions(-)
|
|
|
6d1f90 |
|
|
|
6d1f90 |
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
|
|
|
6d1f90 |
index 4cccea9981..d4e3c81145 100644
|
|
|
6d1f90 |
--- a/src/conf/cpu_conf.c
|
|
|
6d1f90 |
+++ b/src/conf/cpu_conf.c
|
|
|
6d1f90 |
@@ -135,7 +135,7 @@ virCPUDefCopyModelFilter(virCPUDefPtr dst,
|
|
|
6d1f90 |
dst->nfeatures = 0;
|
|
|
6d1f90 |
|
|
|
6d1f90 |
for (i = 0; i < src->nfeatures; i++) {
|
|
|
6d1f90 |
- if (filter && !filter(src->features[i].name, opaque))
|
|
|
6d1f90 |
+ if (filter && !filter(src->features[i].name, src->features[i].policy, opaque))
|
|
|
6d1f90 |
continue;
|
|
|
6d1f90 |
|
|
|
6d1f90 |
n = dst->nfeatures++;
|
|
|
6d1f90 |
@@ -858,7 +858,7 @@ virCPUDefFilterFeatures(virCPUDefPtr cpu,
|
|
|
6d1f90 |
size_t i = 0;
|
|
|
6d1f90 |
|
|
|
6d1f90 |
while (i < cpu->nfeatures) {
|
|
|
6d1f90 |
- if (filter(cpu->features[i].name, opaque)) {
|
|
|
6d1f90 |
+ if (filter(cpu->features[i].name, cpu->features[i].policy, opaque)) {
|
|
|
6d1f90 |
i++;
|
|
|
6d1f90 |
continue;
|
|
|
6d1f90 |
}
|
|
|
6d1f90 |
@@ -893,7 +893,7 @@ virCPUDefCheckFeatures(virCPUDefPtr cpu,
|
|
|
6d1f90 |
*features = NULL;
|
|
|
6d1f90 |
|
|
|
6d1f90 |
for (i = 0; i < cpu->nfeatures; i++) {
|
|
|
6d1f90 |
- if (filter(cpu->features[i].name, opaque)) {
|
|
|
6d1f90 |
+ if (filter(cpu->features[i].name, cpu->features[i].policy, opaque)) {
|
|
|
6d1f90 |
if (virStringListAdd(&list, cpu->features[i].name) < 0)
|
|
|
6d1f90 |
return -1;
|
|
|
6d1f90 |
n++;
|
|
|
6d1f90 |
diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h
|
|
|
6d1f90 |
index cba0ec7c81..687e1b09d2 100644
|
|
|
6d1f90 |
--- a/src/conf/cpu_conf.h
|
|
|
6d1f90 |
+++ b/src/conf/cpu_conf.h
|
|
|
6d1f90 |
@@ -162,6 +162,7 @@ virCPUDefCopyModel(virCPUDefPtr dst,
|
|
|
6d1f90 |
* Returns true if feature @name should copied, false otherwise.
|
|
|
6d1f90 |
*/
|
|
|
6d1f90 |
typedef bool (*virCPUDefFeatureFilter)(const char *name,
|
|
|
6d1f90 |
+ virCPUFeaturePolicy policy,
|
|
|
6d1f90 |
void *opaque);
|
|
|
6d1f90 |
|
|
|
6d1f90 |
int
|
|
|
6d1f90 |
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
|
6d1f90 |
index 9104bdbf1e..cf5ef442e7 100644
|
|
|
6d1f90 |
--- a/src/cpu/cpu_x86.c
|
|
|
6d1f90 |
+++ b/src/cpu/cpu_x86.c
|
|
|
6d1f90 |
@@ -3260,6 +3260,15 @@ virCPUx86ExpandFeatures(virCPUDefPtr cpu)
|
|
|
6d1f90 |
}
|
|
|
6d1f90 |
|
|
|
6d1f90 |
|
|
|
6d1f90 |
+static bool
|
|
|
6d1f90 |
+x86FeatureFilterMigratable(const char *name,
|
|
|
6d1f90 |
+ virCPUFeaturePolicy policy ATTRIBUTE_UNUSED,
|
|
|
6d1f90 |
+ void *cpu_map)
|
|
|
6d1f90 |
+{
|
|
|
6d1f90 |
+ return x86FeatureIsMigratable(name, cpu_map);
|
|
|
6d1f90 |
+}
|
|
|
6d1f90 |
+
|
|
|
6d1f90 |
+
|
|
|
6d1f90 |
static virCPUDefPtr
|
|
|
6d1f90 |
virCPUx86CopyMigratable(virCPUDefPtr cpu)
|
|
|
6d1f90 |
{
|
|
|
6d1f90 |
@@ -3273,7 +3282,7 @@ virCPUx86CopyMigratable(virCPUDefPtr cpu)
|
|
|
6d1f90 |
return NULL;
|
|
|
6d1f90 |
|
|
|
6d1f90 |
if (virCPUDefCopyModelFilter(copy, cpu, false,
|
|
|
6d1f90 |
- x86FeatureIsMigratable, map) < 0)
|
|
|
6d1f90 |
+ x86FeatureFilterMigratable, map) < 0)
|
|
|
6d1f90 |
goto error;
|
|
|
6d1f90 |
|
|
|
6d1f90 |
return copy;
|
|
|
6d1f90 |
@@ -3408,6 +3417,7 @@ virCPUx86FeatureIsMSR(const char *name)
|
|
|
6d1f90 |
*/
|
|
|
6d1f90 |
bool
|
|
|
6d1f90 |
virCPUx86FeatureFilterSelectMSR(const char *name,
|
|
|
6d1f90 |
+ virCPUFeaturePolicy policy ATTRIBUTE_UNUSED,
|
|
|
6d1f90 |
void *opaque ATTRIBUTE_UNUSED)
|
|
|
6d1f90 |
{
|
|
|
6d1f90 |
return virCPUx86FeatureIsMSR(name);
|
|
|
6d1f90 |
@@ -3424,6 +3434,7 @@ virCPUx86FeatureFilterSelectMSR(const char *name,
|
|
|
6d1f90 |
*/
|
|
|
6d1f90 |
bool
|
|
|
6d1f90 |
virCPUx86FeatureFilterDropMSR(const char *name,
|
|
|
6d1f90 |
+ virCPUFeaturePolicy policy ATTRIBUTE_UNUSED,
|
|
|
6d1f90 |
void *opaque ATTRIBUTE_UNUSED)
|
|
|
6d1f90 |
{
|
|
|
6d1f90 |
return !virCPUx86FeatureIsMSR(name);
|
|
|
6d1f90 |
diff --git a/src/cpu/cpu_x86.h b/src/cpu/cpu_x86.h
|
|
|
6d1f90 |
index 5126679985..866fe17e88 100644
|
|
|
6d1f90 |
--- a/src/cpu/cpu_x86.h
|
|
|
6d1f90 |
+++ b/src/cpu/cpu_x86.h
|
|
|
6d1f90 |
@@ -46,9 +46,11 @@ int virCPUx86DataSetVendor(virCPUDataPtr cpuData,
|
|
|
6d1f90 |
const char *vendor);
|
|
|
6d1f90 |
|
|
|
6d1f90 |
bool virCPUx86FeatureFilterSelectMSR(const char *name,
|
|
|
6d1f90 |
+ virCPUFeaturePolicy policy,
|
|
|
6d1f90 |
void *opaque);
|
|
|
6d1f90 |
|
|
|
6d1f90 |
bool virCPUx86FeatureFilterDropMSR(const char *name,
|
|
|
6d1f90 |
+ virCPUFeaturePolicy policy,
|
|
|
6d1f90 |
void *opaque);
|
|
|
6d1f90 |
|
|
|
6d1f90 |
#endif /* __VIR_CPU_X86_H__ */
|
|
|
6d1f90 |
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
|
|
6d1f90 |
index fbfe74d45b..c25d8c3e1a 100644
|
|
|
6d1f90 |
--- a/src/qemu/qemu_capabilities.c
|
|
|
6d1f90 |
+++ b/src/qemu/qemu_capabilities.c
|
|
|
6d1f90 |
@@ -2753,6 +2753,7 @@ virQEMUCapsProbeQMPSEVCapabilities(virQEMUCapsPtr qemuCaps,
|
|
|
6d1f90 |
|
|
|
6d1f90 |
bool
|
|
|
6d1f90 |
virQEMUCapsCPUFilterFeatures(const char *name,
|
|
|
6d1f90 |
+ virCPUFeaturePolicy policy ATTRIBUTE_UNUSED,
|
|
|
6d1f90 |
void *opaque)
|
|
|
6d1f90 |
{
|
|
|
6d1f90 |
virArch *arch = opaque;
|
|
|
6d1f90 |
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
|
|
|
6d1f90 |
index 1767b2ab6c..a4055d5458 100644
|
|
|
6d1f90 |
--- a/src/qemu/qemu_capabilities.h
|
|
|
6d1f90 |
+++ b/src/qemu/qemu_capabilities.h
|
|
|
6d1f90 |
@@ -629,6 +629,7 @@ bool virQEMUCapsGuestIsNative(virArch host,
|
|
|
6d1f90 |
virArch guest);
|
|
|
6d1f90 |
|
|
|
6d1f90 |
bool virQEMUCapsCPUFilterFeatures(const char *name,
|
|
|
6d1f90 |
+ virCPUFeaturePolicy policy,
|
|
|
6d1f90 |
void *opaque);
|
|
|
6d1f90 |
|
|
|
6d1f90 |
const char *
|
|
|
6d1f90 |
--
|
|
|
6d1f90 |
2.24.0
|
|
|
6d1f90 |
|