From nobody Tue Oct 28 12:16:36 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1515391475133202.27804457317563; Sun, 7 Jan 2018 22:04:35 -0800 (PST) Received: from localhost ([::1]:40802 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYQXv-00034I-ER for importer@patchew.org; Mon, 08 Jan 2018 01:04:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35389) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYQNx-0003Dt-5I for qemu-devel@nongnu.org; Mon, 08 Jan 2018 00:54:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eYQNv-0006XE-KY for qemu-devel@nongnu.org; Mon, 08 Jan 2018 00:54:13 -0500 Received: from ozlabs.org ([103.22.144.67]:46651) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eYQNv-0006U5-7S; Mon, 08 Jan 2018 00:54:11 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3zFPbb3TcBz9t2f; Mon, 8 Jan 2018 16:54:02 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1515390843; bh=rSEu9Isjibiepxtki5dpixFQzJp0YFq0GK/j8kwdfUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CA87X5LSDNR7eg/7PEbDU1OaCktJjbuUzZvuooBrWnQPYHzFlvCg5zc+eUmbAjLBX +mVGLDIjHAz46ItlNKwyzldwqScynrGmP0FMIUpwvoDn6y92H1d8QGUvVxO9/F+zd7 g4Rqr3i21bU+qzJSSXTVNaRV+RsyRcL/btDm+Vt4= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 8 Jan 2018 16:53:48 +1100 Message-Id: <20180108055348.20444-13-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180108055348.20444-1-david@gibson.dropbear.id.au> References: <20180108055348.20444-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 12/12] spapr: Correct compatibility mode setting for hotplugged CPUs 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: surajjs@au1.ibm.com, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currently the pseries machine sets the compatibility mode for the guest's cpus in two places: 1) at machine reset and 2) after CAS negotiation. This means that if we set or negotiate a compatiblity mode, then hotplug a cpu, the hotplugged cpu doesn't get the right mode set and will incorrectly have the full native features. To correct this, we set the compatibility mode on a cpu when it is brought online with the 'start-cpu' RTAS call. Given that we no longer need to set the compatibility mode on all CPUs at machine reset, so we change that to only set the mode for the boot cpu. Signed-off-by: David Gibson Reviewed-by: Alexey Kardashevskiy --- hw/ppc/spapr.c | 2 +- hw/ppc/spapr_rtas.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 6785a90c60..dfd352c473 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1504,7 +1504,7 @@ static void spapr_machine_reset(void) spapr_ovec_cleanup(spapr->ov5_cas); spapr->ov5_cas =3D spapr_ovec_new(); =20 - ppc_set_compat_all(spapr->max_compat_pvr, &error_fatal); + ppc_set_compat(first_ppc_cpu, spapr->max_compat_pvr, &error_fatal); } =20 fdt =3D spapr_build_fdt(spapr, rtas_addr, spapr->rtas_size); diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index 4bb939d3d1..2b89e1d448 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -163,6 +163,7 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMachi= neState *spapr, CPUState *cs =3D CPU(cpu); CPUPPCState *env =3D &cpu->env; PowerPCCPUClass *pcc =3D POWERPC_CPU_GET_CLASS(cpu); + Error *local_err =3D NULL; =20 if (!cs->halted) { rtas_st(rets, 0, RTAS_OUT_HW_ERROR); @@ -174,6 +175,14 @@ static void rtas_start_cpu(PowerPCCPU *cpu_, sPAPRMach= ineState *spapr, * new cpu enters */ kvm_cpu_synchronize_state(cs); =20 + /* Set compatibility mode to match existing cpus */ + ppc_set_compat(cpu, POWERPC_CPU(first_cpu)->compat_pvr, &local_err= ); + if (local_err) { + error_report_err(local_err); + rtas_st(rets, 0, RTAS_OUT_HW_ERROR); + return; + } + env->msr =3D (1ULL << MSR_SF) | (1ULL << MSR_ME); =20 /* Enable Power-saving mode Exit Cause exceptions for the new CPU = */ --=20 2.14.3