]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
cpu: wire up support for maximum CPU mode
authorDaniel P. Berrangé <berrange@redhat.com>
Fri, 5 Feb 2021 16:19:33 +0000 (16:19 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Wed, 10 Feb 2021 11:44:48 +0000 (11:44 +0000)
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>
src/cpu/cpu.c
src/cpu/cpu_ppc64.c
src/cpu/cpu_x86.c

index 6ff88d6a9f95b28b62aa329b84c8c67783fc8895..dfedf5bbf0b4f8068a1b73ed3101443511394302 100644 (file)
@@ -884,7 +884,8 @@ virCPUTranslate(virArch arch,
         return -1;
 
     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;
 
     if (virCPUModelIsAllowed(cpu->model, models))
index d71d147207958a2ebbaa9718c814066d846fb5c8..3e34b14f79fd60543017f8ce890cd0cf67353d85 100644 (file)
@@ -474,8 +474,14 @@ ppc64Compute(virCPUDefPtr host,
             G_GNUC_FALLTHROUGH;
 
         case VIR_CPU_MODE_HOST_PASSTHROUGH:
-            /* host-model and host-passthrough:
-             * the guest CPU is the same as the host */
+        case VIR_CPU_MODE_MAXIMUM:
+            /* 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);
             break;
 
index 2422e258ecee225224a6f3dc830ddbd0db0c7e06..fe423f38f92727fccf9512975d27bb95351e3bfd 100644 (file)
@@ -3050,7 +3050,8 @@ virCPUx86UpdateLive(virCPUDefPtr cpu,
                     virCPUDataPtr dataEnabled,
                     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;
     g_autoptr(virCPUx86Model) model = NULL;
     g_autoptr(virCPUx86Model) modelDisabled = NULL;