Add VIR_CPU_MODE_HOST_RECOMMENDED for host-recommended CPU models and satisfy all switch cases. For the most part, host-recommended will follow similar paths as host-model, aside from touching any architecture specifics. Signed-off-by: Collin Walling <walling@xxxxxxxxxxxxx> Reviewed-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx> --- src/conf/cpu_conf.c | 1 + src/conf/cpu_conf.h | 1 + src/cpu/cpu.c | 1 + src/cpu/cpu_ppc64.c | 2 ++ src/qemu/qemu_capabilities.c | 4 ++++ src/qemu/qemu_command.c | 1 + src/qemu/qemu_domain.c | 2 ++ src/qemu/qemu_validate.c | 1 + 8 files changed, 13 insertions(+) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 7abe489733..c0116808d8 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -43,6 +43,7 @@ VIR_ENUM_IMPL(virCPUMode, "host-model", "host-passthrough", "maximum", + "host-recommended", ); VIR_ENUM_IMPL(virCPUMatch, diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h index 3e4c53675c..f73d852e69 100644 --- a/src/conf/cpu_conf.h +++ b/src/conf/cpu_conf.h @@ -44,6 +44,7 @@ typedef enum { VIR_CPU_MODE_HOST_MODEL, VIR_CPU_MODE_HOST_PASSTHROUGH, VIR_CPU_MODE_MAXIMUM, + VIR_CPU_MODE_HOST_RECOMMENDED, VIR_CPU_MODE_LAST } virCPUMode; diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index bb5737e938..805aff1bf5 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -587,6 +587,7 @@ virCPUUpdate(virArch arch, return 0; case VIR_CPU_MODE_HOST_MODEL: + case VIR_CPU_MODE_HOST_RECOMMENDED: relative = true; break; diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index e13cdbdf6b..dc42e869e7 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -483,6 +483,8 @@ ppc64Compute(virCPUDef *host, * look up guest CPU information */ guest_model = ppc64ModelFromCPU(cpu, map); break; + case VIR_CPU_MODE_HOST_RECOMMENDED: + break; } } else { /* Other host CPU information */ diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 59403808ee..d7096a08c2 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2340,6 +2340,10 @@ virQEMUCapsIsCPUModeSupported(virQEMUCaps *qemuCaps, case VIR_CPU_MODE_MAXIMUM: return virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_MAX); + case VIR_CPU_MODE_HOST_RECOMMENDED: + return !!virQEMUCapsGetHostModel(qemuCaps, type, + VIR_QEMU_CAPS_HOST_CPU_RECOMMENDED); + case VIR_CPU_MODE_LAST: break; } diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a912ed064f..a45e2fbb95 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6293,6 +6293,7 @@ qemuBuildCpuModelArgStr(virQEMUDriver *driver, virBufferAdd(buf, cpu->model, -1); break; + case VIR_CPU_MODE_HOST_RECOMMENDED: case VIR_CPU_MODE_LAST: break; } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c7d64e1b5c..f7493431ac 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4753,6 +4753,7 @@ qemuDomainDefCPUPostParse(virDomainDef *def, break; case VIR_CPU_MODE_HOST_MODEL: + case VIR_CPU_MODE_HOST_RECOMMENDED: def->cpu->check = VIR_CPU_CHECK_PARTIAL; break; @@ -6995,6 +6996,7 @@ qemuDomainObjCheckCPUTaint(virQEMUDriver *driver, } break; case VIR_CPU_MODE_HOST_MODEL: + case VIR_CPU_MODE_HOST_RECOMMENDED: case VIR_CPU_MODE_LAST: default: break; diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 1346bbfb44..387c2f1fa8 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -372,6 +372,7 @@ qemuValidateDomainDefCpu(virQEMUDriver *driver, } break; + case VIR_CPU_MODE_HOST_RECOMMENDED: case VIR_CPU_MODE_CUSTOM: case VIR_CPU_MODE_LAST: break; -- 2.41.0