diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index ab5e5257dbf4a2eecb10b5e1571f69700f9bd39c..b3bccd17680b9bcad1af85e3449a7a42d192b6f1 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2756,6 +2756,28 @@ virCPUx86DataSetVendor(virCPUDataPtr cpuData, } +int +virCPUx86DataAddFeature(virCPUDataPtr cpuData, + const char *name) +{ + virCPUx86FeaturePtr feature; + virCPUx86MapPtr map; + + if (!(map = virCPUx86GetMap())) + return -1; + + /* ignore unknown features */ + if (!(feature = x86FeatureFind(map, name)) && + !(feature = x86FeatureFindInternal(name))) + return 0; + + if (x86DataAdd(&cpuData->data.x86, &feature->data) < 0) + return -1; + + return 0; +} + + struct cpuArchDriver cpuDriverX86 = { .name = "x86", .arch = archs, diff --git a/src/cpu/cpu_x86.h b/src/cpu/cpu_x86.h index ab539491498011514a72ea63f201904cb69bdf59..91ec43fea982c1cc4fc6db76e9b9b473344052b3 100644 --- a/src/cpu/cpu_x86.h +++ b/src/cpu/cpu_x86.h @@ -39,4 +39,7 @@ int virCPUx86DataSetSignature(virCPUDataPtr cpuData, int virCPUx86DataSetVendor(virCPUDataPtr cpuData, const char *vendor); +int virCPUx86DataAddFeature(virCPUDataPtr cpuData, + const char *name); + #endif /* __VIR_CPU_X86_H__ */ diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 0dda65a2bce59614e15829a5ded67cac7775cde7..bce0487ab309d6b338057269dab8a5a4d7a225c6 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1003,6 +1003,7 @@ virCPUUpdate; # cpu/cpu_x86.h virCPUx86DataAddCPUID; +virCPUx86DataAddFeature; virCPUx86DataSetSignature; virCPUx86DataSetVendor;