cpu: wire up support for maximum CPU mode

The logic applied in the ppc64 case isn't quite correct, as the
interpretation of maximum mode depends on whether hardware virt
is used or not. This is information the CPU driver doesn't have.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2021-02-05 16:19:33 +00:00
parent 09cbd460fb
commit 7c1653f63a
3 changed files with 12 additions and 4 deletions

View File

@ -884,7 +884,8 @@ virCPUTranslate(virArch arch,
return -1; return -1;
if (cpu->mode == VIR_CPU_MODE_HOST_MODEL || if (cpu->mode == VIR_CPU_MODE_HOST_MODEL ||
cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH ||
cpu->mode == VIR_CPU_MODE_MAXIMUM)
return 0; return 0;
if (virCPUModelIsAllowed(cpu->model, models)) if (virCPUModelIsAllowed(cpu->model, models))

View File

@ -474,8 +474,14 @@ ppc64Compute(virCPUDefPtr host,
G_GNUC_FALLTHROUGH; G_GNUC_FALLTHROUGH;
case VIR_CPU_MODE_HOST_PASSTHROUGH: case VIR_CPU_MODE_HOST_PASSTHROUGH:
/* host-model and host-passthrough: case VIR_CPU_MODE_MAXIMUM:
* the guest CPU is the same as the host */ /* host-model, host-passthrough & maximum:
* the guest CPU is the same as the host.
*
* Note for maximum, with non hardware virt
* the guest CPU is actually arbitrarily defined by
* the emulator, so this isn't strictly correct.
*/
guest_model = ppc64ModelCopy(host_model); guest_model = ppc64ModelCopy(host_model);
break; break;

View File

@ -3050,7 +3050,8 @@ virCPUx86UpdateLive(virCPUDefPtr cpu,
virCPUDataPtr dataEnabled, virCPUDataPtr dataEnabled,
virCPUDataPtr dataDisabled) virCPUDataPtr dataDisabled)
{ {
bool hostPassthrough = cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH; bool hostPassthrough = (cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH ||
cpu->mode == VIR_CPU_MODE_MAXIMUM);
virCPUx86MapPtr map; virCPUx86MapPtr map;
g_autoptr(virCPUx86Model) model = NULL; g_autoptr(virCPUx86Model) model = NULL;
g_autoptr(virCPUx86Model) modelDisabled = NULL; g_autoptr(virCPUx86Model) modelDisabled = NULL;