}
+static bool
+qemuProcessDropUnknownCPUFeatures(const char *name,
+ virCPUFeaturePolicy policy,
+ void *opaque)
+{
+ const char **features = opaque;
+
+ if (policy != VIR_CPU_FEATURE_DISABLE &&
+ policy != VIR_CPU_FEATURE_FORBID)
+ return true;
+
+ if (virStringListHasString(features, name))
+ return true;
+
+ /* Features unknown to QEMU are implicitly disabled, we can just drop them
+ * from the definition. */
+ return false;
+}
+
+
static int
qemuProcessUpdateGuestCPU(virDomainDefPtr def,
virQEMUCapsPtr qemuCaps,
&def->os.arch) < 0)
return -1;
+ if (ARCH_IS_X86(def->os.arch)) {
+ VIR_AUTOSTRINGLIST features = NULL;
+
+ if (virQEMUCapsGetCPUFeatures(qemuCaps, def->virtType, false, &features) < 0)
+ return -1;
+
+ if (features &&
+ virCPUDefFilterFeatures(def->cpu, qemuProcessDropUnknownCPUFeatures,
+ features) < 0)
+ return -1;
+ }
+
return 0;
}
-object secret,id=masterKey0,format=raw,\
file=/tmp/lib/domain--1-test/master-key.aes \
-machine pc,accel=kvm,usb=off,dump-guest-core=off \
--cpu Icelake-Server,pconfig=off \
+-cpu Icelake-Server \
-m 214 \
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \