[libvirt PATCH 3/5] cpu: wire up support for maximum CPU mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 src/cpu/cpu.c       |  3 ++-
 src/cpu/cpu_ppc64.c | 10 ++++++++--
 src/cpu/cpu_x86.c   |  3 ++-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index 6ff88d6a9f..dfedf5bbf0 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -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))
diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
index d71d147207..3e34b14f79 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -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;
 
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 2422e258ec..fe423f38f9 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -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;
-- 
2.29.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux