From patchwork Fri Jul 14 16:13:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Le_Goater?= X-Patchwork-Id: 788617 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 ozlabs.org (Postfix) with ESMTPS id 3x8HpC3fdXz9s7C for ; Sat, 15 Jul 2017 02:14:59 +1000 (AEST) Received: from localhost ([::1]:38874 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dW3F3-0006hO-FO for incoming@patchwork.ozlabs.org; Fri, 14 Jul 2017 12:14:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dW3Eh-0006fs-Jh for qemu-devel@nongnu.org; Fri, 14 Jul 2017 12:14:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dW3Ed-0004Ah-NY for qemu-devel@nongnu.org; Fri, 14 Jul 2017 12:14:35 -0400 Received: from 11.mo4.mail-out.ovh.net ([46.105.34.195]:34869) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dW3Ed-00048O-Hn for qemu-devel@nongnu.org; Fri, 14 Jul 2017 12:14:31 -0400 Received: from player694.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo4.mail-out.ovh.net (Postfix) with ESMTP id 29E4E85B4F for ; Fri, 14 Jul 2017 18:14:22 +0200 (CEST) Received: from zorba.kaod.org.com (LFbn-1-10652-153.w90-89.abo.wanadoo.fr [90.89.238.153]) (Authenticated sender: clg@kaod.org) by player694.ha.ovh.net (Postfix) with ESMTPSA id F1EBE2C006D; Fri, 14 Jul 2017 18:14:16 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Fri, 14 Jul 2017 18:13:58 +0200 Message-Id: <1500048838-16802-1-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.5 MIME-Version: 1.0 X-Ovh-Tracer-Id: 17140137235654413286 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelkedrfeefgdellecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.34.195 Subject: [Qemu-devel] [PATCH] target/ppc: fix CPU hotplug when radix is enabled (TCG) 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-ppc@nongnu.org, qemu-devel@nongnu.org, Suraj Jitindar Singh , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" But when a guest initializes radix mode, it issues a H_REGISTER_PROC_TBL to update the LPCR of all CPUs. Hot-plugged CPUs inherit from the same setting under KVM but not under TCG. So, Let's check for radix and update the default LPCR to keep new CPUs in sync. Signed-off-by: Cédric Le Goater Reviewed-by: Suraj Jitindar Singh --- target/ppc/translate_init.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c index 8b9807665dd5..8776e9b0f8fa 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.c @@ -9014,8 +9014,16 @@ void cpu_ppc_set_papr(PowerPCCPU *cpu, PPCVirtualHypervisor *vhyp) /* By default we choose legacy mode and switch to new hash or radix * when a register process table hcall is made. So disable process * tables and guest translation shootdown by default + * + * Hot-plugged CPUs inherit from the guest radix setting under + * KVM but not under TCG. Update the default LPCR to keep new + * CPUs in sync when radix is enabled. */ - lpcr->default_value &= ~(LPCR_UPRT | LPCR_GTSE); + if (ppc64_radix_guest(cpu)) { + lpcr->default_value |= LPCR_UPRT | LPCR_GTSE; + } else { + lpcr->default_value &= ~(LPCR_UPRT | LPCR_GTSE); + } lpcr->default_value |= LPCR_PDEE | LPCR_HDEE | LPCR_EEE | LPCR_DEE | LPCR_OEE; break;