From nobody Thu May 2 20:59:10 2024 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; 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 1500005240593303.640679034212; Thu, 13 Jul 2017 21:07:20 -0700 (PDT) Received: from localhost ([::1]:35273 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVrss-000303-Uh for importer@patchew.org; Fri, 14 Jul 2017 00:07:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50262) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVrrv-0002dN-Gn for qemu-devel@nongnu.org; Fri, 14 Jul 2017 00:06:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVrrs-0005t3-Ry for qemu-devel@nongnu.org; Fri, 14 Jul 2017 00:06:19 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:34917) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVrrs-0005sm-IT for qemu-devel@nongnu.org; Fri, 14 Jul 2017 00:06:16 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6E43pF4014950 for ; Fri, 14 Jul 2017 00:06:15 -0400 Received: from e23smtp06.au.ibm.com (e23smtp06.au.ibm.com [202.81.31.148]) by mx0a-001b2d01.pphosted.com with ESMTP id 2bpmjam2dy-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 14 Jul 2017 00:06:14 -0400 Received: from localhost by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 14 Jul 2017 14:06:12 +1000 Received: from d23relay10.au.ibm.com (202.81.31.229) by e23smtp06.au.ibm.com (202.81.31.212) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 14 Jul 2017 14:06:09 +1000 Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay10.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6E44roL22609996; Fri, 14 Jul 2017 14:04:53 +1000 Received: from d23av04.au.ibm.com (localhost [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v6E44pNi014796; Fri, 14 Jul 2017 14:04:52 +1000 Received: from abhimanyu.ibmmodules.com ([9.85.68.189]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v6E44l0b014771; Fri, 14 Jul 2017 14:04:48 +1000 From: Nikunj A Dadhania To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Date: Fri, 14 Jul 2017 09:34:37 +0530 X-Mailer: git-send-email 2.9.3 MIME-Version: 1.0 X-TM-AS-MML: disable x-cbid: 17071404-0040-0000-0000-00000348F739 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17071404-0041-0000-0000-00000CC49051 Message-Id: <20170714040437.22034-1-nikunj@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-13_13:, , 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-1706020000 definitions=main-1707140066 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by mx0a-001b2d01.pphosted.com id v6E43pF4014950 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v2] spapr: ignore decr interrupts when MSR_EE is disabled 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: bharata@linux.vnet.ibm.com, qemu-devel@nongnu.org, Nikunj A Dadhania , clg@kaod.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Rebooting a SMP TCG guest is broken for both single/multi threaded TCG. When reset happens, all the CPUs are in halted state. First CPU is brought = out of reset and secondary CPUs would be initialized by the guest kernel using a rtas call start-cpu. However, in case of TCG, decrementer interrupts keep on coming and waking t= he secondary CPUs up. These secondary CPUs would see the decrementer interrupt pending, which mak= es cpu::has_work() to bring them out of wait loop and start executing tcg_exec_cpu(). The problem with this is all the CPUs wake up and start booting SLOF image, causing the following exception(4 CPUs TCG VM): [ 81.440850] reboot: Restarting system SLOF S SLOF SLOFLOF[0[0m **************************************************************= ******** QEMU Starting Build Date =3D Mar 3 2017 13:29:19 FW Version =3D git-66d250ef0fd06bb8 [0m ********************************************************************** QEMU Starting Build Date =3D Mar 3 2017 13:29:19 FW Version =3D git-66d250ef0fd06bb8 [0m *************************************m**********[?25l *****************= ***************************************************** QEMU Starting Build Date =3D Mar 3 2017 13:29:19 FW Version =3D git-66d250ef0fd06bb8 *********************** QEMU Starting Build Date =3D Mar 3 2017 13:29:19 FW Version =3D git-66d250ef0fd06bb8 ERROR: Flatten device tree not available! exception 300 SRR0 =3D 00000000000060e4 SRR1 =3D 800000008000000000000000 SPRG2 =3D 0000000000400000 SPRG3 =3D 0000000000004bd8 ERROR: Flatten device tree not available! exception 300 SRR0 =3D 00000000000060e4 SRR1 =3D 800000008000000000000000 SPRG2 =3D 0000000000400000 SPRG3 =3D 0000000000004bd8 Reported-by: Bharata B Rao Tested-by: C=C3=A9dric Le Goater Signed-off-by: Nikunj A Dadhania --- target/ppc/translate_init.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c index 783bf98..8b98076 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.c @@ -8536,7 +8536,8 @@ static bool cpu_has_work_POWER7(CPUState *cs) } if ((env->pending_interrupts & (1u << PPC_INTERRUPT_DECR)) && (env->spr[SPR_LPCR] & LPCR_P7_PECE1)) { - return true; + /* Return true only when MSR_EE is enabled */ + return msr_ee; } if ((env->pending_interrupts & (1u << PPC_INTERRUPT_MCK)) && (env->spr[SPR_LPCR] & LPCR_P7_PECE2)) { @@ -8693,7 +8694,8 @@ static bool cpu_has_work_POWER8(CPUState *cs) } if ((env->pending_interrupts & (1u << PPC_INTERRUPT_DECR)) && (env->spr[SPR_LPCR] & LPCR_P8_PECE3)) { - return true; + /* Return true only when MSR_EE is enabled */ + return msr_ee; } if ((env->pending_interrupts & (1u << PPC_INTERRUPT_MCK)) && (env->spr[SPR_LPCR] & LPCR_P8_PECE4)) { @@ -8876,7 +8878,8 @@ static bool cpu_has_work_POWER9(CPUState *cs) /* Decrementer Exception */ if ((env->pending_interrupts & (1u << PPC_INTERRUPT_DECR)) && (env->spr[SPR_LPCR] & LPCR_DEE)) { - return true; + /* Return true only when MSR_EE is enabled */ + return msr_ee; } /* Machine Check or Hypervisor Maintenance Exception */ if ((env->pending_interrupts & (1u << PPC_INTERRUPT_MCK | --=20 2.9.3