From nobody Sun May 19 22:19:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1575488963; cv=none; d=zohomail.com; s=zohoarc; b=laUUIxEmm97haCURgJAzHPpqXYUXpdlKuFMoDccmTk7n+4fMZazSDkXl4CaSQ2saWS3jS2oXjz8Xsiz/gI3cYEZt47D/TNjOD3gTzBuboBnGm9p63BRycHDrQoUuUDxbQoscbSIu4F66LLakgLdSM6vTTstZkmPDto4Qu0wa1xc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575488963; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LD6V1w6sCdSnRwpDOYv0tU8ah+8lFHkfUJWtPMRQock=; b=QVKFTOfxu1tFgPluFxKpwF+P15/ZZcDGVO9I591CM8S7EGg1XmdMId5XtZ5hjfjNRhFlk1tnkVZqhSEfCe9zlHOQ+T24FOZuGzNvX+hGQBhGF6tzCg/5sb8X3sCszALMKmjVTSyU6+XFl6lNSA8gL9l8cFpoPWqaHnvjdP2E6Uo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1575488963328403.29107064128425; Wed, 4 Dec 2019 11:49:23 -0800 (PST) Received: from localhost ([::1]:46462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icaeI-0002dy-02 for importer@patchew.org; Wed, 04 Dec 2019 14:49:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58465) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icaZ7-0000eP-DJ for qemu-devel@nongnu.org; Wed, 04 Dec 2019 14:44:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icaZ5-0008MT-Ro for qemu-devel@nongnu.org; Wed, 04 Dec 2019 14:44:01 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:42454) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icaZ3-0007oC-S8 for qemu-devel@nongnu.org; Wed, 04 Dec 2019 14:43:59 -0500 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xB4JceBW053319 for ; Wed, 4 Dec 2019 14:43:44 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2wpdmk7v74-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 04 Dec 2019 14:43:43 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Dec 2019 19:43:41 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 4 Dec 2019 19:43:39 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xB4Jhc6i40829158 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 4 Dec 2019 19:43:38 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EF8C052059; Wed, 4 Dec 2019 19:43:37 +0000 (GMT) Received: from bahia.lan (unknown [9.145.42.200]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id B296852054; Wed, 4 Dec 2019 19:43:37 +0000 (GMT) Subject: [for-5.0 PATCH 1/4] ppc: Deassert the external interrupt pin in KVM on reset From: Greg Kurz To: David Gibson Date: Wed, 04 Dec 2019 20:43:37 +0100 In-Reply-To: <157548861171.3650476.14824062174573272058.stgit@bahia.lan> References: <157548861171.3650476.14824062174573272058.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19120419-4275-0000-0000-0000038B4FD4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19120419-4276-0000-0000-0000389EF301 Message-Id: <157548861740.3650476.16879693165328764758.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-12-04_03:2019-12-04,2019-12-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 clxscore=1034 bulkscore=0 mlxscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 malwarescore=0 suspectscore=0 phishscore=0 mlxlogscore=909 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1912040158 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , qemu-ppc@nongnu.org, Satheesh Rajendran , =?utf-8?q?C=C3=A9dric?= Le Goater , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" When a CPU is reset, QEMU makes sure no interrupt is pending by clearing CPUPPCstate::pending_interrupts in ppc_cpu_reset(). In the case of a complete machine emulation, eg. a sPAPR machine, an external interrupt request could still be pending in KVM though, eg. an IPI. It will be eventually presented to the guest, which is supposed to acknowledge it at the interrupt controller. If the interrupt controller is emulated in QEMU, either XICS or XIVE, ppc_set_irq() won't deassert the external interrupt pin in KVM since it isn't pending anymore for QEMU. When the vCPU re-enters the guest, the interrupt request is still pending and the vCPU will try again to acknowledge it. This causes an infinite loop and eventually hangs the guest. The code has been broken since the beginning. The issue wasn't hit before because accel=3Dkvm,kernel-irqchip=3Doff is an awkward setup that never got used until recently with the LC92x IBM systems (aka, Boston). Add a ppc_irq_reset() function to do the necessary cleanup, ie. deassert the IRQ pins of the CPU in QEMU and most importantly the external interrupt pin for this vCPU in KVM. Reported-by: Satheesh Rajendran Signed-off-by: Greg Kurz --- hw/ppc/ppc.c | 8 ++++++++ include/hw/ppc/ppc.h | 2 ++ target/ppc/translate_init.inc.c | 1 + 3 files changed, 11 insertions(+) diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index 8dd982fc1e40..fab73f1b1fc9 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -1515,3 +1515,11 @@ PowerPCCPU *ppc_get_vcpu_by_pir(int pir) =20 return NULL; } + +void ppc_irq_reset(PowerPCCPU *cpu) +{ + CPUPPCState *env =3D &cpu->env; + + env->irq_input_state =3D 0; + kvmppc_set_interrupt(cpu, PPC_INTERRUPT_EXT, 0); +} diff --git a/include/hw/ppc/ppc.h b/include/hw/ppc/ppc.h index 585be6ab98c5..89e1dd065af7 100644 --- a/include/hw/ppc/ppc.h +++ b/include/hw/ppc/ppc.h @@ -77,6 +77,7 @@ static inline void ppc970_irq_init(PowerPCCPU *cpu) {} static inline void ppcPOWER7_irq_init(PowerPCCPU *cpu) {} static inline void ppcPOWER9_irq_init(PowerPCCPU *cpu) {} static inline void ppce500_irq_init(PowerPCCPU *cpu) {} +static inline void ppc_irq_reset(PowerPCCPU *cpu) {} #else void ppc40x_irq_init(PowerPCCPU *cpu); void ppce500_irq_init(PowerPCCPU *cpu); @@ -84,6 +85,7 @@ void ppc6xx_irq_init(PowerPCCPU *cpu); void ppc970_irq_init(PowerPCCPU *cpu); void ppcPOWER7_irq_init(PowerPCCPU *cpu); void ppcPOWER9_irq_init(PowerPCCPU *cpu); +void ppc_irq_reset(PowerPCCPU *cpu); #endif =20 /* PPC machines for OpenBIOS */ diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.in= c.c index ba726dec4d00..64a838095c7a 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -10461,6 +10461,7 @@ static void ppc_cpu_reset(CPUState *s) env->pending_interrupts =3D 0; s->exception_index =3D POWERPC_EXCP_NONE; env->error_code =3D 0; + ppc_irq_reset(cpu); =20 /* tininess for underflow is detected before rounding */ set_float_detect_tininess(float_tininess_before_rounding, From nobody Sun May 19 22:19:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1575489100; cv=none; d=zohomail.com; s=zohoarc; b=mSnH9DYJ8ky54+/zKGS562Xgfgg9WE4tEnLVGYiURYf8nemivrV6EWqc3aX1ZHIKWd+kK1pswaX3yp6+CrPexMvSJOei/c975Sq2KuC85mqxTltP4ppPFDE7J3THSP2MG+xLnQ3QUnrRcnyHvpDLqtq4IUGb6CRC9FexeQFjHaU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575489100; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xcuOsRfdE2SOjCvDhajMa8NdohStvCrmJ4FFaD7KJZY=; b=AGx4VLPLc8JVgfiHnDIR/rswQKgG21Dw9xS7wenk0gBvoWKpIDLN3EJWUCqdN0DytUJDi9ZP/pWfzmcJhlwLDO/gC0OOJA5jK2hTU9oX2Y9sHX5neHvva1Hku/38XBqv7zD8Wm6fnc3l0jI8VgAjtUVTLvY/3mIThQjxNQhzDDw= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1575489100471945.1617905504705; Wed, 4 Dec 2019 11:51:40 -0800 (PST) Received: from localhost ([::1]:46472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icagU-0003w7-7Y for importer@patchew.org; Wed, 04 Dec 2019 14:51:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58461) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icaZ7-0000eL-AZ for qemu-devel@nongnu.org; Wed, 04 Dec 2019 14:44:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icaZ6-0008Nt-7W for qemu-devel@nongnu.org; Wed, 04 Dec 2019 14:44:01 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:65484 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icaZ6-00080D-1n for qemu-devel@nongnu.org; Wed, 04 Dec 2019 14:44:00 -0500 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xB4JcgNW191949 for ; Wed, 4 Dec 2019 14:43:49 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2wnsd5mura-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 04 Dec 2019 14:43:49 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Dec 2019 19:43:47 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 4 Dec 2019 19:43:44 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xB4Jhh9548627884 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 4 Dec 2019 19:43:43 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 95E224C052; Wed, 4 Dec 2019 19:43:43 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5569F4C040; Wed, 4 Dec 2019 19:43:43 +0000 (GMT) Received: from bahia.lan (unknown [9.145.42.200]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 4 Dec 2019 19:43:43 +0000 (GMT) Subject: [for-5.0 PATCH 2/4] xics: Don't deassert outputs From: Greg Kurz To: David Gibson Date: Wed, 04 Dec 2019 20:43:43 +0100 In-Reply-To: <157548861171.3650476.14824062174573272058.stgit@bahia.lan> References: <157548861171.3650476.14824062174573272058.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19120419-4275-0000-0000-0000038B4FD5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19120419-4276-0000-0000-0000389EF302 Message-Id: <157548862298.3650476.1228720391270249433.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-12-04_03:2019-12-04,2019-12-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 spamscore=0 priorityscore=1501 mlxscore=0 malwarescore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=903 impostorscore=0 suspectscore=0 clxscore=1034 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1912040158 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , qemu-ppc@nongnu.org, Satheesh Rajendran , =?utf-8?q?C=C3=A9dric?= Le Goater , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" The correct way to do this is to deassert the input pins on the CPU side. This is the case since a previous change. Signed-off-by: Greg Kurz --- hw/intc/xics.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 0b259a09c545..1952009e6d22 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -289,9 +289,6 @@ void icp_reset(ICPState *icp) icp->pending_priority =3D 0xff; icp->mfrr =3D 0xff; =20 - /* Make all outputs are deasserted */ - qemu_set_irq(icp->output, 0); - if (kvm_irqchip_in_kernel()) { Error *local_err =3D NULL; =20 From nobody Sun May 19 22:19:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1575489387; cv=none; d=zohomail.com; s=zohoarc; b=bWGuAreWd7SX38UHKo+WdOy4mjID3RtrxQWCHO8e2Urt3Wi0KXOwChNBWKJMnx2HMj7tpGl64nDfVdcr1LLqzPnhcs6sczXwayp/mnnWWcFWkHvBBDWMDVaW2pUsTM+H/iUsYr43GHu0OYhn/LvGEhgF3NkzWwOlLThyWtVXhZY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575489387; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eU1a/woMhVQCZb17QcvrsoXLE2UXm0GC/WshsZhcFiY=; b=MaA1pR1kmDp61DItA2xdTs6nKg50WC6OlNkmNDXIsjoXHhpUi9G07gPvL7IoLOFEbOO0abXVJYTuqToBMCqPqRJHm1BSvaFe2RDCwYglMdIbX9sV31Pua0VTzZovVdfEW9TsND1K+g7vHbSQGc1EOmzIcfwr3LVllZzSZBl8YZY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1575489387895152.27650268384627; Wed, 4 Dec 2019 11:56:27 -0800 (PST) Received: from localhost ([::1]:46532 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ical6-0007QJ-I4 for importer@patchew.org; Wed, 04 Dec 2019 14:56:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58486) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icaZ7-0000el-Pb for qemu-devel@nongnu.org; Wed, 04 Dec 2019 14:44:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icaZ6-0008OH-BR for qemu-devel@nongnu.org; Wed, 04 Dec 2019 14:44:01 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:60844) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icaZ6-0008AE-35 for qemu-devel@nongnu.org; Wed, 04 Dec 2019 14:44:00 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xB4JcnSL083091 for ; Wed, 4 Dec 2019 14:43:54 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2wpd128trh-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 04 Dec 2019 14:43:54 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Dec 2019 19:43:52 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 4 Dec 2019 19:43:50 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xB4Jhnsb8847526 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 4 Dec 2019 19:43:49 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 399DBA4053; Wed, 4 Dec 2019 19:43:49 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EF8C2A4051; Wed, 4 Dec 2019 19:43:48 +0000 (GMT) Received: from bahia.lan (unknown [9.145.42.200]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 4 Dec 2019 19:43:48 +0000 (GMT) Subject: [for-5.0 PATCH 3/4] ppc: Don't use CPUPPCState::irq_input_state with modern Book3s CPU models From: Greg Kurz To: David Gibson Date: Wed, 04 Dec 2019 20:43:48 +0100 In-Reply-To: <157548861171.3650476.14824062174573272058.stgit@bahia.lan> References: <157548861171.3650476.14824062174573272058.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19120419-0008-0000-0000-0000033D2DD1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19120419-0009-0000-0000-00004A5C4ECE Message-Id: <157548862861.3650476.16622818876928044450.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-12-04_03:2019-12-04,2019-12-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1034 bulkscore=0 phishscore=0 adultscore=0 priorityscore=1501 mlxlogscore=999 impostorscore=0 spamscore=0 suspectscore=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1912040158 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , qemu-ppc@nongnu.org, Satheesh Rajendran , =?utf-8?q?C=C3=A9dric?= Le Goater , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" The power7_set_irq() and power9_set_irq() functions set this but it is never used actually. Modern Book3s compatible CPUs are only supported by the pnv and spapr machines. They have an interrupt controller, XICS for POWER7/8 and XIVE for POWER9, whose models don't require to track IRQ input states at the CPU level. Drop these lines to avoid confusion. Signed-off-by: Greg Kurz --- hw/ppc/ppc.c | 16 ++-------------- target/ppc/cpu.h | 4 +++- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index fab73f1b1fc9..45834f98d176 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -275,10 +275,9 @@ void ppc970_irq_init(PowerPCCPU *cpu) static void power7_set_irq(void *opaque, int pin, int level) { PowerPCCPU *cpu =3D opaque; - CPUPPCState *env =3D &cpu->env; =20 LOG_IRQ("%s: env %p pin %d level %d\n", __func__, - env, pin, level); + &cpu->env, pin, level); =20 switch (pin) { case POWER7_INPUT_INT: @@ -292,11 +291,6 @@ static void power7_set_irq(void *opaque, int pin, int = level) LOG_IRQ("%s: unknown IRQ pin %d\n", __func__, pin); return; } - if (level) { - env->irq_input_state |=3D 1 << pin; - } else { - env->irq_input_state &=3D ~(1 << pin); - } } =20 void ppcPOWER7_irq_init(PowerPCCPU *cpu) @@ -311,10 +305,9 @@ void ppcPOWER7_irq_init(PowerPCCPU *cpu) static void power9_set_irq(void *opaque, int pin, int level) { PowerPCCPU *cpu =3D opaque; - CPUPPCState *env =3D &cpu->env; =20 LOG_IRQ("%s: env %p pin %d level %d\n", __func__, - env, pin, level); + &cpu->env, pin, level); =20 switch (pin) { case POWER9_INPUT_INT: @@ -334,11 +327,6 @@ static void power9_set_irq(void *opaque, int pin, int = level) LOG_IRQ("%s: unknown IRQ pin %d\n", __func__, pin); return; } - if (level) { - env->irq_input_state |=3D 1 << pin; - } else { - env->irq_input_state &=3D ~(1 << pin); - } } =20 void ppcPOWER9_irq_init(PowerPCCPU *cpu) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index e3e82327b723..f9528fc29d98 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1090,7 +1090,9 @@ struct CPUPPCState { #if !defined(CONFIG_USER_ONLY) /* * This is the IRQ controller, which is implementation dependent - * and only relevant when emulating a complete machine. + * and only relevant when emulating a complete machine. Note that + * this isn't used by recent Book3s compatible CPUs (POWER7 and + * newer). */ uint32_t irq_input_state; void **irq_inputs; From nobody Sun May 19 22:19:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1575489283; cv=none; d=zohomail.com; s=zohoarc; b=RowNG4w8yk9C4JlorCg8/Ka6LRyXaFzNsdayfwoWrfqSZKa076Hdl81KX1vqv9JVmhvvIR7veRem/FmJwbD/wPSY96TgRFtgRpsWpUvQPwzh9eI8bzndxHdvxgUzOWAMqNRq+h+C8N8bAsnnyNVOvxnjPn6zryqGU1ylFHyyfhE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575489283; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iZWAPxnRdgxkS1jb1XSGcDD0m/4Hwcq3uREWmQIwilA=; b=aN18+QQNPKi53eP411doPANRnWSaH2eUnGRDU+NkAI/dg6C8LQKWKDdt3CDKSIseQVpKD7Dk9xo73UtvjctrcbnLFwS+QUj5cgEn/D0ckZg+Upy3uZYO6vf7ukjqTaJno9+Zz7nb5HxkeNoExDJFT6NOe1cbYoUWZEZrsrltQ/I= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1575489283103167.95375888353203; Wed, 4 Dec 2019 11:54:43 -0800 (PST) Received: from localhost ([::1]:46506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icajR-0006C5-Lz for importer@patchew.org; Wed, 04 Dec 2019 14:54:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58475) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icaZ7-0000eb-Jp for qemu-devel@nongnu.org; Wed, 04 Dec 2019 14:44:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icaZ6-0008OO-Bz for qemu-devel@nongnu.org; Wed, 04 Dec 2019 14:44:01 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:46186 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icaZ6-0008Mr-6A for qemu-devel@nongnu.org; Wed, 04 Dec 2019 14:44:00 -0500 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xB4JcgXp192063 for ; Wed, 4 Dec 2019 14:43:59 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 2wnsd5muvk-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 04 Dec 2019 14:43:59 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Dec 2019 19:43:57 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 4 Dec 2019 19:43:55 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xB4Jhsp465011854 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 4 Dec 2019 19:43:54 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D446D42047; Wed, 4 Dec 2019 19:43:54 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9291A42041; Wed, 4 Dec 2019 19:43:54 +0000 (GMT) Received: from bahia.lan (unknown [9.145.42.200]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 4 Dec 2019 19:43:54 +0000 (GMT) Subject: [for-5.0 PATCH 4/4] ppc: Ignore the CPU_INTERRUPT_EXITTB interrupt with KVM From: Greg Kurz To: David Gibson Date: Wed, 04 Dec 2019 20:43:54 +0100 In-Reply-To: <157548861171.3650476.14824062174573272058.stgit@bahia.lan> References: <157548861171.3650476.14824062174573272058.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19120419-0028-0000-0000-000003C4E9C2 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19120419-0029-0000-0000-000024880994 Message-Id: <157548863423.3650476.16424649423510075159.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-12-04_03:2019-12-04,2019-12-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 spamscore=0 priorityscore=1501 mlxscore=0 malwarescore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=549 impostorscore=0 suspectscore=0 clxscore=1034 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1912040158 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , qemu-ppc@nongnu.org, Satheesh Rajendran , =?utf-8?q?C=C3=A9dric?= Le Goater , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" This only makes sense with an emulated CPU. Don't set the bit in CPUState::interrupt_request when using KVM to avoid confusions. Signed-off-by: Greg Kurz --- target/ppc/helper_regs.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/ppc/helper_regs.h b/target/ppc/helper_regs.h index 85dfe7687fbb..d78c2af63eac 100644 --- a/target/ppc/helper_regs.h +++ b/target/ppc/helper_regs.h @@ -22,6 +22,7 @@ =20 #include "qemu/main-loop.h" #include "exec/exec-all.h" +#include "sysemu/kvm.h" =20 /* Swap temporary saved registers with GPRs */ static inline void hreg_swap_gpr_tgpr(CPUPPCState *env) @@ -102,6 +103,10 @@ static inline void hreg_compute_hflags(CPUPPCState *en= v) =20 static inline void cpu_interrupt_exittb(CPUState *cs) { + if (!kvm_enabled()) { + return; + } + if (!qemu_mutex_iothread_locked()) { qemu_mutex_lock_iothread(); cpu_interrupt(cs, CPU_INTERRUPT_EXITTB);