]> git.proxmox.com Git - mirror_qemu.git/commitdiff
spapr: Limit threads per core according to current compatibility mode
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Fri, 23 May 2014 02:26:56 +0000 (12:26 +1000)
committerAlexander Graf <agraf@suse.de>
Mon, 16 Jun 2014 11:24:38 +0000 (13:24 +0200)
This puts a limit to the number of threads per core based on the current
compatibility mode. Although PowerISA specs do not specify the maximum
threads per core number, the linux guest still expects that
PowerISA2.05-compatible CPU supports only 2 threads per core as this
is what POWER6 (2.05 compliant CPU) implements, the same is for
POWER7 (2.06, 4 threads) and POWER8 (2.07, 8 threads).

This calls spapr_fixup_cpu_smt_dt() with the maximum allowed number of
threads which affects ibm,ppc-interrupt-server#s and
ibm,ppc-interrupt-gserver#s properties.

The number of CPU nodesremains unchanged.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
hw/ppc/spapr.c
target-ppc/cpu.h
target-ppc/translate_init.c

index f5baa33fc95cba43c62d5f0b6677d609083e891e..15adeed8e2320e321b6aaefa34504738a07b57ef 100644 (file)
@@ -293,7 +293,7 @@ static int spapr_fixup_cpu_dt(void *fdt, sPAPREnvironment *spapr)
         }
 
         ret = spapr_fixup_cpu_smt_dt(fdt, offset, cpu,
-                                     smp_threads);
+                                     ppc_get_compat_smt_threads(cpu));
         if (ret < 0) {
             return ret;
         }
index 0d2253b53c8bbb0500f54cf6582779fb9f0e1bef..406a406ebb6e0902883e9dcfdf4b33339db0c821 100644 (file)
@@ -1122,6 +1122,7 @@ void ppc_store_sdr1 (CPUPPCState *env, target_ulong value);
 void ppc_store_msr (CPUPPCState *env, target_ulong value);
 
 void ppc_cpu_list (FILE *f, fprintf_function cpu_fprintf);
+int ppc_get_compat_smt_threads(PowerPCCPU *cpu);
 int ppc_set_compat(PowerPCCPU *cpu, uint32_t cpu_version);
 
 /* Time-base and decrementer management */
index faac74a33c75661b978225542f8d67063ac128c3..56d3b973687b8ce47696706c5b95ac56a6f33657 100644 (file)
@@ -8921,6 +8921,33 @@ static void ppc_cpu_unrealizefn(DeviceState *dev, Error **errp)
     }
 }
 
+int ppc_get_compat_smt_threads(PowerPCCPU *cpu)
+{
+    int ret = smp_threads;
+    PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
+
+    switch (cpu->cpu_version) {
+    case CPU_POWERPC_LOGICAL_2_05:
+        ret = 2;
+        break;
+    case CPU_POWERPC_LOGICAL_2_06:
+        ret = 4;
+        break;
+    case CPU_POWERPC_LOGICAL_2_07:
+        ret = 8;
+        break;
+    default:
+        if (pcc->pcr_mask & PCR_COMPAT_2_06) {
+            ret = 4;
+        } else if (pcc->pcr_mask & PCR_COMPAT_2_05) {
+            ret = 2;
+        }
+        break;
+    }
+
+    return MIN(ret, smp_threads);
+}
+
 int ppc_set_compat(PowerPCCPU *cpu, uint32_t cpu_version)
 {
     int ret = 0;