mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
cpu_conf: Pass policy to CPU feature filtering callbacks
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
2f7d81497b
commit
668797dc5c
@ -147,7 +147,7 @@ virCPUDefCopyModelFilter(virCPUDefPtr dst,
|
|||||||
dst->nfeatures = 0;
|
dst->nfeatures = 0;
|
||||||
|
|
||||||
for (i = 0; i < src->nfeatures; i++) {
|
for (i = 0; i < src->nfeatures; i++) {
|
||||||
if (filter && !filter(src->features[i].name, opaque))
|
if (filter && !filter(src->features[i].name, src->features[i].policy, opaque))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
n = dst->nfeatures++;
|
n = dst->nfeatures++;
|
||||||
@ -937,7 +937,7 @@ virCPUDefFilterFeatures(virCPUDefPtr cpu,
|
|||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
|
|
||||||
while (i < cpu->nfeatures) {
|
while (i < cpu->nfeatures) {
|
||||||
if (filter(cpu->features[i].name, opaque)) {
|
if (filter(cpu->features[i].name, cpu->features[i].policy, opaque)) {
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -972,7 +972,7 @@ virCPUDefCheckFeatures(virCPUDefPtr cpu,
|
|||||||
*features = NULL;
|
*features = NULL;
|
||||||
|
|
||||||
for (i = 0; i < cpu->nfeatures; i++) {
|
for (i = 0; i < cpu->nfeatures; i++) {
|
||||||
if (filter(cpu->features[i].name, opaque)) {
|
if (filter(cpu->features[i].name, cpu->features[i].policy, opaque)) {
|
||||||
if (virStringListAdd(&list, cpu->features[i].name) < 0)
|
if (virStringListAdd(&list, cpu->features[i].name) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
n++;
|
n++;
|
||||||
|
@ -161,6 +161,7 @@ virCPUDefCopyModel(virCPUDefPtr dst,
|
|||||||
* Returns true if feature @name should copied, false otherwise.
|
* Returns true if feature @name should copied, false otherwise.
|
||||||
*/
|
*/
|
||||||
typedef bool (*virCPUDefFeatureFilter)(const char *name,
|
typedef bool (*virCPUDefFeatureFilter)(const char *name,
|
||||||
|
virCPUFeaturePolicy policy,
|
||||||
void *opaque);
|
void *opaque);
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -3233,6 +3233,15 @@ virCPUx86ExpandFeatures(virCPUDefPtr cpu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
x86FeatureFilterMigratable(const char *name,
|
||||||
|
virCPUFeaturePolicy policy G_GNUC_UNUSED,
|
||||||
|
void *cpu_map)
|
||||||
|
{
|
||||||
|
return x86FeatureIsMigratable(name, cpu_map);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static virCPUDefPtr
|
static virCPUDefPtr
|
||||||
virCPUx86CopyMigratable(virCPUDefPtr cpu)
|
virCPUx86CopyMigratable(virCPUDefPtr cpu)
|
||||||
{
|
{
|
||||||
@ -3246,7 +3255,7 @@ virCPUx86CopyMigratable(virCPUDefPtr cpu)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (virCPUDefCopyModelFilter(copy, cpu, false,
|
if (virCPUDefCopyModelFilter(copy, cpu, false,
|
||||||
x86FeatureIsMigratable, map) < 0)
|
x86FeatureFilterMigratable, map) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
return copy;
|
return copy;
|
||||||
@ -3381,6 +3390,7 @@ virCPUx86FeatureIsMSR(const char *name)
|
|||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
virCPUx86FeatureFilterSelectMSR(const char *name,
|
virCPUx86FeatureFilterSelectMSR(const char *name,
|
||||||
|
virCPUFeaturePolicy policy G_GNUC_UNUSED,
|
||||||
void *opaque G_GNUC_UNUSED)
|
void *opaque G_GNUC_UNUSED)
|
||||||
{
|
{
|
||||||
return virCPUx86FeatureIsMSR(name);
|
return virCPUx86FeatureIsMSR(name);
|
||||||
@ -3397,6 +3407,7 @@ virCPUx86FeatureFilterSelectMSR(const char *name,
|
|||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
virCPUx86FeatureFilterDropMSR(const char *name,
|
virCPUx86FeatureFilterDropMSR(const char *name,
|
||||||
|
virCPUFeaturePolicy policy G_GNUC_UNUSED,
|
||||||
void *opaque G_GNUC_UNUSED)
|
void *opaque G_GNUC_UNUSED)
|
||||||
{
|
{
|
||||||
return !virCPUx86FeatureIsMSR(name);
|
return !virCPUx86FeatureIsMSR(name);
|
||||||
|
@ -42,7 +42,9 @@ int virCPUx86DataSetVendor(virCPUDataPtr cpuData,
|
|||||||
const char *vendor);
|
const char *vendor);
|
||||||
|
|
||||||
bool virCPUx86FeatureFilterSelectMSR(const char *name,
|
bool virCPUx86FeatureFilterSelectMSR(const char *name,
|
||||||
|
virCPUFeaturePolicy policy,
|
||||||
void *opaque);
|
void *opaque);
|
||||||
|
|
||||||
bool virCPUx86FeatureFilterDropMSR(const char *name,
|
bool virCPUx86FeatureFilterDropMSR(const char *name,
|
||||||
|
virCPUFeaturePolicy policy,
|
||||||
void *opaque);
|
void *opaque);
|
||||||
|
@ -2908,6 +2908,7 @@ virQEMUCapsProbeQMPSEVCapabilities(virQEMUCapsPtr qemuCaps,
|
|||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
virQEMUCapsCPUFilterFeatures(const char *name,
|
virQEMUCapsCPUFilterFeatures(const char *name,
|
||||||
|
virCPUFeaturePolicy policy G_GNUC_UNUSED,
|
||||||
void *opaque)
|
void *opaque)
|
||||||
{
|
{
|
||||||
virArch *arch = opaque;
|
virArch *arch = opaque;
|
||||||
|
@ -667,6 +667,7 @@ bool virQEMUCapsGuestIsNative(virArch host,
|
|||||||
virArch guest);
|
virArch guest);
|
||||||
|
|
||||||
bool virQEMUCapsCPUFilterFeatures(const char *name,
|
bool virQEMUCapsCPUFilterFeatures(const char *name,
|
||||||
|
virCPUFeaturePolicy policy,
|
||||||
void *opaque);
|
void *opaque);
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
Loading…
Reference in New Issue
Block a user