From patchwork Mon Oct 9 15:49:29 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: 823313 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y9lBv3kszz9t3B for ; Tue, 10 Oct 2017 02:53:11 +1100 (AEDT) Received: from localhost ([::1]:58487 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1aMf-0006K1-Hh for incoming@patchwork.ozlabs.org; Mon, 09 Oct 2017 11:53:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1aJf-0004JO-O4 for qemu-devel@nongnu.org; Mon, 09 Oct 2017 11:50:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1aJc-0003GQ-KA for qemu-devel@nongnu.org; Mon, 09 Oct 2017 11:50:03 -0400 Received: from 9.mo4.mail-out.ovh.net ([46.105.40.176]:33814) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e1aJc-0003Dz-Di for qemu-devel@nongnu.org; Mon, 09 Oct 2017 11:50:00 -0400 Received: from player746.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo4.mail-out.ovh.net (Postfix) with ESMTP id 0DD22D9648 for ; Mon, 9 Oct 2017 17:49:59 +0200 (CEST) Received: from zorba.kaod.org.com (LFbn-1-2231-173.w90-76.abo.wanadoo.fr [90.76.52.173]) (Authenticated sender: clg@kaod.org) by player746.ha.ovh.net (Postfix) with ESMTPSA id D03975000AC; Mon, 9 Oct 2017 17:49:52 +0200 (CEST) From: =?utf-8?q?C=C3=A9dric_Le_Goater?= To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, David Gibson , Nikunj A Dadhania , Benjamin Herrenschmidt Date: Mon, 9 Oct 2017 17:49:29 +0200 Message-Id: <20171009154930.29095-4-clg@kaod.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171009154930.29095-1-clg@kaod.org> References: <20171009154930.29095-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 11143594331323796307 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelledrleelgdejkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.40.176 Subject: [Qemu-devel] [PATCH v2 3/4] spapr/rtas: fix reboot of a SMP TCG guest 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: =?utf-8?q?C=C3=A9dric_Le_Goater?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Just like for hot unplugged CPUs, when a guest is rebooted, the secondary CPUs can be awaken by the decrementer and start entering SLOF at the same time the boot CPU is. To be safe, let's disable the decrementer interrupt in the LPCR for the secondaries. Based on previous work from Nikunj A Dadhania Signed-off-by: Cédric Le Goater Reviewed-by: Nikunj A Dadhania --- hw/ppc/spapr_cpu_core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index 37beb56e8b18..112868dc39d5 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -20,6 +20,7 @@ #include "sysemu/numa.h" #include "sysemu/hw_accel.h" #include "qemu/error-report.h" +#include "target/ppc/cpu-models.h" void spapr_cpu_parse_features(sPAPRMachineState *spapr) { @@ -86,6 +87,17 @@ static void spapr_cpu_reset(void *opaque) cs->halted = 1; env->spr[SPR_HIOR] = 0; + + /* Don't let the decremeter wake up CPUs other than the boot + * CPUs. this can cause issues when rebooting the guest */ + if (cs != first_cpu) { + if (ppc_cpu_pvr_match(cpu, CPU_POWERPC_LOGICAL_3_00)) { + env->spr[SPR_LPCR] &= ~LPCR_DEE; + } else { + /* P7 and P8 both have same bit for DECR */ + env->spr[SPR_LPCR] &= ~LPCR_P8_PECE3; + } + } } static void spapr_cpu_destroy(PowerPCCPU *cpu)