libvirt/SOURCES/conf-cpu-Introduce-virCPUDefListFeatures.patch
eabdullin 2daa9ba65a - cpu: x86: Add support for adding features to existing CPU models
- qemu: domain: Check arch in qemuDomainMakeCPUMigratable
- conf: cpu: Introduce virCPUDefListFeatures
- qemu: domain: Drop added features from migratable CPU
- Add vmx-* features to Broadwell*
- Add vmx-* features to Cascadelake*
- Add vmx-* features to Conroe
- Add vmx-* features to Cooperlake
- Add vmx-* features to core2duo
- Add vmx-* features to Haswell*
- Add vmx-* features to Icelake*
- Add vmx-* features to IvyBridge*
- Add vmx-* features to kvm*
- Add vmx-* features to Nehalem*
- Add vmx-* features to Penryn
- Add vmx-* features to SandyBridge*
- Add vmx-* features to SapphireRapids
- Add vmx-* features to Skylake*
- Add vmx-* features to Snowridge
- Add vmx-* features to Westmere*
- qemu: virtiofs: do not crash if cgroups are missing
- qemu: virtiofs: set correct label when creating the socket
- qemu: virtiofs: error out if getting the group or user name fails
2024-04-30 21:06:27 +03:00

79 lines
2.2 KiB
Diff

From 577c4ca414b26c8586f2586978e55c948bec0a32 Mon Sep 17 00:00:00 2001
From: Jiri Denemark <jdenemar@redhat.com>
Date: Mon, 11 Mar 2024 15:37:32 +0100
Subject: [PATCH] conf: cpu: Introduce virCPUDefListFeatures
The function returns a list of explicitly mentioned features in the CPU
definition.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
---
src/conf/cpu_conf.c | 24 ++++++++++++++++++++++++
src/conf/cpu_conf.h | 3 +++
src/libvirt_private.syms | 1 +
3 files changed, 28 insertions(+)
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 6e6e1b9a897..4dca7e57ec7 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -982,6 +982,30 @@ virCPUDefFindFeature(const virCPUDef *def,
}
+/**
+ * virCPUDefListExplicitFeatures:
+ * @def: CPU definition
+ *
+ * Provides a list of feature names explicitly mentioned in the CPU definition
+ * regardless of the policy. The caller is responsible for freeing the list.
+ *
+ * Returns a NULL-terminated list of feature names.
+ */
+char **
+virCPUDefListExplicitFeatures(const virCPUDef *def)
+{
+ char **list;
+ size_t i;
+
+ list = g_new0(char *, def->nfeatures + 1);
+
+ for (i = 0; i < def->nfeatures; i++)
+ list[i] = g_strdup(def->features[i].name);
+
+ return list;
+}
+
+
int
virCPUDefFilterFeatures(virCPUDef *cpu,
virCPUDefFeatureFilter filter,
diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h
index 2694022fed1..b10c23ee828 100644
--- a/src/conf/cpu_conf.h
+++ b/src/conf/cpu_conf.h
@@ -270,6 +270,9 @@ virCPUDefCheckFeatures(virCPUDef *cpu,
void *opaque,
char ***features);
+char **
+virCPUDefListExplicitFeatures(const virCPUDef *def);
+
virCPUDef **
virCPUDefListParse(const char **xmlCPUs,
unsigned int ncpus,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 98a925933ef..6b6bcc368ac 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -111,6 +111,7 @@ virCPUDefFree;
virCPUDefFreeFeatures;
virCPUDefFreeModel;
virCPUDefIsEqual;
+virCPUDefListExplicitFeatures;
virCPUDefListFree;
virCPUDefListParse;
virCPUDefNew;