From patchwork Fri Jul 1 22:42:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 9210557 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 E546D60752 for ; Fri, 1 Jul 2016 22:42:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7826286CA for ; Fri, 1 Jul 2016 22:42:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC40E286CD; Fri, 1 Jul 2016 22:42:58 +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 4EFF7286CA for ; Fri, 1 Jul 2016 22:42:58 +0000 (UTC) Received: from localhost ([::1]:36030 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJ79F-0002eV-Bo for patchwork-qemu-devel@patchwork.kernel.org; Fri, 01 Jul 2016 18:42:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44180) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJ78c-0002Xg-MB for qemu-devel@nongnu.org; Fri, 01 Jul 2016 18:42:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bJ78X-0003WZ-J4 for qemu-devel@nongnu.org; Fri, 01 Jul 2016 18:42:17 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:27949) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJ78X-0003WG-9T for qemu-devel@nongnu.org; Fri, 01 Jul 2016 18:42:13 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u61Mcjjv008165 for ; Fri, 1 Jul 2016 18:42:12 -0400 Received: from e19.ny.us.ibm.com (e19.ny.us.ibm.com [129.33.205.209]) by mx0a-001b2d01.pphosted.com with ESMTP id 23wag1adjp-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 01 Jul 2016 18:42:12 -0400 Received: from localhost by e19.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 1 Jul 2016 18:42:11 -0400 Received: from d01dlp02.pok.ibm.com (9.56.250.167) by e19.ny.us.ibm.com (146.89.104.206) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 1 Jul 2016 18:42:08 -0400 X-IBM-Helo: d01dlp02.pok.ibm.com X-IBM-MailFrom: groug@kaod.org Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 5A0D46E803C; Fri, 1 Jul 2016 18:41:49 -0400 (EDT) Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u61Mg5R548889972; Fri, 1 Jul 2016 22:42:07 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9A108AE03B; Fri, 1 Jul 2016 18:42:07 -0400 (EDT) Received: from bahia.lan (unknown [9.164.136.204]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP id C7BDAAE05F; Fri, 1 Jul 2016 18:42:05 -0400 (EDT) From: Greg Kurz To: David Gibson Date: Sat, 02 Jul 2016 00:42:04 +0200 In-Reply-To: <146741287399.948.15988269239450224065.stgit@bahia.lan> References: <146741287399.948.15988269239450224065.stgit@bahia.lan> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16070122-0056-0000-0000-000000AE25A5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16070122-0057-0000-0000-000004C81F1D Message-Id: <146741292480.948.3408923676233078960.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-07-01_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1607010225 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v2 6/7] spapr: use ppc_set_vcpu_dt_id() in CPU hotplug code 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: qemu-devel@nongnu.org, Alexander Graf , qemu-ppc@nongnu.org, Cedric Le Goater , Bharata B Rao , Scott Wood , Igor Mammedov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Starting with version 2.7, pseries machine now support hotplug of cpu cores. The implementation requires to open code cpu creation and thus does not call ppc_cpu_init(). This patch does all the plumbing to allow pseries machine types with version >= 2.7 to generate cpu DT ids out of the indexes of the cores and threads in their respective arrays. Suggested-by: Igor Mammedov Signed-off-by: Greg Kurz --- hw/ppc/ppc.c | 2 +- hw/ppc/spapr_cpu_core.c | 11 +++++++++-- include/hw/ppc/ppc.h | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index dbc8ac7b3a9b..12de255fb211 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -1352,7 +1352,7 @@ PowerPCCPU *ppc_get_vcpu_by_dt_id(int cpu_dt_id) return NULL; } -static void ppc_set_vcpu_dt_id(PowerPCCPU *cpu, int cpu_index, Error **errp) +void ppc_set_vcpu_dt_id(PowerPCCPU *cpu, int cpu_index, Error **errp) { ; } diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index 70b6b0b5ee17..475c8063f086 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -259,13 +259,20 @@ out: error_propagate(errp, local_err); } -static void spapr_cpu_core_realize_child(Object *child, Error **errp) +static void spapr_cpu_core_realize_child(Object *child, int cpu_index, + Error **errp) { Error *local_err = NULL; sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine()); CPUState *cs = CPU(child); PowerPCCPU *cpu = POWERPC_CPU(cs); + ppc_set_vcpu_dt_id(cpu, cpu_index, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + object_property_set_bool(child, true, "realized", &local_err); if (local_err) { error_propagate(errp, local_err); @@ -306,7 +313,7 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error **errp) for (j = 0; j < cc->nr_threads; j++) { obj = sc->threads + j * size; - spapr_cpu_core_realize_child(obj, &local_err); + spapr_cpu_core_realize_child(obj, cc->core_id + j, &local_err); if (local_err) { goto err; } diff --git a/include/hw/ppc/ppc.h b/include/hw/ppc/ppc.h index 647451c9b6ac..a9067f45b3f4 100644 --- a/include/hw/ppc/ppc.h +++ b/include/hw/ppc/ppc.h @@ -107,4 +107,5 @@ enum { void ppc_booke_timers_init(PowerPCCPU *cpu, uint32_t freq, uint32_t flags); PowerPCCPU *ppc_cpu_init(const char *cpu_model, int cpu_index); +void ppc_set_vcpu_dt_id(PowerPCCPU *cpu, int cpu_index, Error **errp); #endif