From patchwork Fri Jun 10 17:40:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 9170209 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E18006048C for ; Fri, 10 Jun 2016 18:05:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7FC228210 for ; Fri, 10 Jun 2016 18:05:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC6AE2832C; Fri, 10 Jun 2016 18:05:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6621B28210 for ; Fri, 10 Jun 2016 18:05:46 +0000 (UTC) Received: from localhost ([::1]:43757 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBQoT-0001Bf-0p for patchwork-qemu-devel@patchwork.kernel.org; Fri, 10 Jun 2016 14:05:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56025) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBQQk-0006k8-8M for qemu-devel@nongnu.org; Fri, 10 Jun 2016 13:41:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bBQQg-0000V7-6d for qemu-devel@nongnu.org; Fri, 10 Jun 2016 13:41:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42933) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBQQU-0000RK-Rs; Fri, 10 Jun 2016 13:40:59 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 62DCFC04D292; Fri, 10 Jun 2016 17:40:58 +0000 (UTC) Received: from hawk.localdomain.com (dhcp-1-122.brq.redhat.com [10.34.1.122]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5AHeVPb032552; Fri, 10 Jun 2016 13:40:56 -0400 From: Andrew Jones To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, qemu-arm@nongnu.org Date: Fri, 10 Jun 2016 19:40:21 +0200 Message-Id: <1465580427-13596-11-git-send-email-drjones@redhat.com> In-Reply-To: <1465580427-13596-1-git-send-email-drjones@redhat.com> References: <1465580427-13596-1-git-send-email-drjones@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 10 Jun 2016 17:40:58 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH RFC 10/16] hw/ppc/spapr: don't use smp_cores, smp_threads X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, ehabkost@redhat.com, agraf@suse.de, pbonzini@redhat.com, dgibson@redhat.com, imammedo@redhat.com, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Use CPUState nr_cores,nr_threads and MachineState cores,threads instead. Signed-off-by: Andrew Jones --- hw/ppc/spapr.c | 9 +++++---- hw/ppc/spapr_rtas.c | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 063664234106e..f78276bb4b164 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -35,7 +35,6 @@ #include "net/net.h" #include "sysemu/device_tree.h" #include "sysemu/block-backend.h" -#include "sysemu/cpus.h" #include "sysemu/kvm.h" #include "sysemu/device_tree.h" #include "kvm_ppc.h" @@ -603,7 +602,7 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset, uint32_t cpufreq = kvm_enabled() ? kvmppc_get_clockfreq() : 1000000000; uint32_t page_sizes_prop[64]; size_t page_sizes_prop_size; - uint32_t vcpus_per_socket = smp_threads * smp_cores; + uint32_t vcpus_per_socket = cs->nr_cores * cs->nr_threads; uint32_t pft_size_prop[] = {0, cpu_to_be32(spapr->htab_shift)}; /* Note: we keep CI large pages off for now because a 64K capable guest @@ -1774,7 +1773,7 @@ static void ppc_spapr_init(MachineState *machine) /* Set up Interrupt Controller before we create the VCPUs */ spapr->icp = xics_system_init(machine, DIV_ROUND_UP(max_cpus * kvmppc_smt_threads(), - smp_threads), + machine->threads), XICS_IRQS, &error_fatal); if (smc->dr_lmb_enabled) { @@ -2268,9 +2267,11 @@ static HotplugHandler *spapr_get_hotpug_handler(MachineState *machine, static unsigned spapr_cpu_index_to_socket_id(unsigned cpu_index) { + CPUState *cs = first_cpu; + /* Allocate to NUMA nodes on a "socket" basis (not that concept of * socket means much for the paravirtualized PAPR platform) */ - return cpu_index / smp_threads / smp_cores; + return cpu_index / cs->nr_cores / cs->nr_threads; } static void spapr_machine_class_init(ObjectClass *oc, void *data) diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index 43e2c684fda8d..3fdfbb01a20dd 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -742,7 +742,7 @@ int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr, lrdr_capacity[1] = cpu_to_be32(max_hotplug_addr & 0xffffffff); lrdr_capacity[2] = 0; lrdr_capacity[3] = cpu_to_be32(SPAPR_MEMORY_BLOCK_SIZE); - lrdr_capacity[4] = cpu_to_be32(max_cpus/smp_threads); + lrdr_capacity[4] = cpu_to_be32(max_cpus / machine->threads); ret = qemu_fdt_setprop(fdt, "/rtas", "ibm,lrdr-capacity", lrdr_capacity, sizeof(lrdr_capacity)); if (ret < 0) {