diff mbox

[RFC,11/16] target-ppc: don't use smp_threads

Message ID 1465580427-13596-12-git-send-email-drjones@redhat.com
State New
Headers show

Commit Message

Andrew Jones June 10, 2016, 5:40 p.m. UTC
Use CPUState nr_threads instead.

Signed-off-by: Andrew Jones <drjones@redhat.com>

---
 target-ppc/translate_init.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

-- 
2.4.11
diff mbox

Patch

diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index a1db5009c4a83..f442b2fc934d1 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -24,7 +24,6 @@ 
 #include <sysemu/kvm.h>
 #include "kvm_ppc.h"
 #include "sysemu/arch_init.h"
-#include "sysemu/cpus.h"
 #include "cpu-models.h"
 #include "mmu-hash32.h"
 #include "mmu-hash64.h"
@@ -9228,15 +9227,15 @@  static void ppc_cpu_realizefn(DeviceState *dev, Error **errp)
 #endif
 
 #if !defined(CONFIG_USER_ONLY)
-    if (smp_threads > max_smt) {
+    if (cs->nr_threads > max_smt) {
         error_setg(errp, "Cannot support more than %d threads on PPC with %s",
                    max_smt, kvm_enabled() ? "KVM" : "TCG");
         return;
     }
-    if (!is_power_of_2(smp_threads)) {
+    if (!is_power_of_2(cs->nr_threads)) {
         error_setg(errp, "Cannot support %d threads on PPC with %s, "
                    "threads count must be a power of 2.",
-                   smp_threads, kvm_enabled() ? "KVM" : "TCG");
+                   cs->nr_threads, kvm_enabled() ? "KVM" : "TCG");
         return;
     }
 #endif
@@ -9248,14 +9247,14 @@  static void ppc_cpu_realizefn(DeviceState *dev, Error **errp)
     }
 
 #if !defined(CONFIG_USER_ONLY)
-    cpu->cpu_dt_id = (cs->cpu_index / smp_threads) * max_smt
-        + (cs->cpu_index % smp_threads);
+    cpu->cpu_dt_id = (cs->cpu_index / cs->nr_threads) * max_smt
+        + (cs->cpu_index % cs->nr_threads);
 
     if (kvm_enabled() && !kvm_vcpu_id_is_valid(cpu->cpu_dt_id)) {
         error_setg(errp, "Can't create CPU with id %d in KVM", cpu->cpu_dt_id);
         error_append_hint(errp, "Adjust the number of cpus to %d "
                           "or try to raise the number of threads per core\n",
-                          cpu->cpu_dt_id * smp_threads / max_smt);
+                          cpu->cpu_dt_id * cs->nr_threads / max_smt);
         return;
     }
 #endif
@@ -9496,7 +9495,7 @@  static void ppc_cpu_unrealizefn(DeviceState *dev, Error **errp)
 
 int ppc_get_compat_smt_threads(PowerPCCPU *cpu)
 {
-    int ret = MIN(smp_threads, kvmppc_smt_threads());
+    int ret = MIN(CPU(cpu)->nr_threads, kvmppc_smt_threads());
 
     switch (cpu->cpu_version) {
     case CPU_POWERPC_LOGICAL_2_05: