* a single qom-list-get QMP command
* @cpuQOMPath: QOM path of a CPU to probe
* @translate: callback for translating CPU feature names from QEMU to libvirt
- * @opaque: data for @translate callback
+ * @filter: callback for filtering ignored features, a pointer to @arch is
+ * passed as opaque pointer to the callback
* @enabled: returns the CPU data for all enabled features
* @disabled: returns the CPU data for features which we asked for
* (either explicitly or via a named CPU model) but QEMU disabled them
bool qomListGet,
const char *cpuQOMPath,
qemuMonitorCPUFeatureTranslationCallback translate,
+ virCPUDefFeatureFilter filter,
virCPUData **enabled,
virCPUData **disabled)
{
*disabled = NULL;
return qemuMonitorJSONGetGuestCPU(mon, arch, qomListGet, cpuQOMPath,
- translate, enabled, disabled);
+ translate, filter, enabled, disabled);
}
static int
qemuMonitorJSONCPUDataAddFeatures(virCPUData *data,
GStrv props,
- qemuMonitorCPUFeatureTranslationCallback translate)
+ qemuMonitorCPUFeatureTranslationCallback translate,
+ virCPUDefFeatureFilter filter)
{
char **p;
if (translate)
name = translate(data->arch, name);
+ if (filter && !filter(name, VIR_CPU_FEATURE_REQUIRE, &data->arch))
+ continue;
+
if (virCPUDataAddFeature(data, name) < 0)
return -1;
}
* a single qom-list-get QMP command
* @cpuQOMPath: QOM path of a CPU to probe
* @translate: callback for translating CPU feature names from QEMU to libvirt
- * @opaque: data for @translate callback
+ * @filter: callback for filtering ignored features, a pointer to @arch is
+ * passed as opaque pointer to the callback
* @enabled: returns the CPU data for all enabled features
* @disabled: returns the CPU data for features which we asked for
* (either explicitly or via a named CPU model) but QEMU disabled them
bool qomListGet,
const char *cpuQOMPath,
qemuMonitorCPUFeatureTranslationCallback translate,
+ virCPUDefFeatureFilter filter,
virCPUData **enabled,
virCPUData **disabled)
{
&propsEnabled, &propsDisabled) < 0)
return -1;
- if (qemuMonitorJSONCPUDataAddFeatures(cpuEnabled, propsEnabled, translate) < 0 ||
- qemuMonitorJSONCPUDataAddFeatures(cpuDisabled, propsDisabled, translate) < 0)
+ if (qemuMonitorJSONCPUDataAddFeatures(cpuEnabled, propsEnabled,
+ translate, filter) < 0 ||
+ qemuMonitorJSONCPUDataAddFeatures(cpuDisabled, propsDisabled,
+ translate, filter) < 0)
return -1;
*enabled = g_steal_pointer(&cpuEnabled);
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QOM_LIST_GET),
cpuQOMPath,
virQEMUCapsCPUFeatureFromQEMU,
+ virQEMUCapsCPUFilterFeatures,
&dataEnabled, &dataDisabled);
qemuDomainObjExitMonitor(vm);