From nobody Wed May 8 23:24:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1559841012; cv=none; d=zoho.com; s=zohoarc; b=hyFmLjy9QUEGk9q8qEfxqvi5vBByP4KtTLf93FicLXESQcHO4HwIVX4AfMGFE03aXRkGHCfiTfcG3xEfHCbQXoGiD/836E18SwuqjnW5d6iRUAt+GptMsET7D82XX+MWer9cxD6K6SS2xMkYXegmiDC7sgk6PSp9rMKcE4M/T+g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559841012; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=LjtMn3RynV6bxdAuMP8DJ2MYd0aw+kwe84v8IEVTTLQ=; b=Dc3rKC5gUITW9qsOcQfr1aenD3j04lvCT2nm5bAsrV3hOy0Ytrz59Ijvm92XvIqGSUxaAIqQHCnboXanIicxlAOUrxS31yuQXrwkWaRBjjfJ27ysF03hhyvEpqExPKvVx+gmJmGr9o4MMY40IfKe80j8EOozo0ofvjDSpTH2cyA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.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 1559841012263364.1215924536881; Thu, 6 Jun 2019 10:10:12 -0700 (PDT) Received: from localhost ([127.0.0.1]:35441 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYvtt-00078m-Hv for importer@patchew.org; Thu, 06 Jun 2019 13:10:05 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36153) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYvsz-0006m0-DS for qemu-devel@nongnu.org; Thu, 06 Jun 2019 13:09:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hYvsx-00018F-Ga for qemu-devel@nongnu.org; Thu, 06 Jun 2019 13:09:09 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:50068 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 1hYvsx-00014G-6w for qemu-devel@nongnu.org; Thu, 06 Jun 2019 13:09:07 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x56H2RkE034707 for ; Thu, 6 Jun 2019 13:09:05 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0b-001b2d01.pphosted.com with ESMTP id 2sy6q40r1t-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 06 Jun 2019 13:09:05 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 6 Jun 2019 18:09:03 +0100 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 6 Jun 2019 18:09:00 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x56H8xrl30146860 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 6 Jun 2019 17:08:59 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 74DFA52052; Thu, 6 Jun 2019 17:08:59 +0000 (GMT) Received: from bahia.lan (unknown [9.145.50.113]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 3F43E52051; Thu, 6 Jun 2019 17:08:59 +0000 (GMT) From: Greg Kurz To: David Gibson Date: Thu, 06 Jun 2019 19:08:59 +0200 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: 19060617-0016-0000-0000-0000028692A5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19060617-0017-0000-0000-000032E3AFD4 Message-Id: <155984093894.2803172.8618224129384655510.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-06_12:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=810 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906060115 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH] spapr: Don't use the "dual" interrupt controller mode with an old hypervisor 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-devel@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9dric?= Le Goater , Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" If KVM is too old to support XIVE native exploitation mode, we might end up using the emulated XIVE after CAS. This is sub-optimal if KVM in-kernel XICS is available, which is the case most of the time. Also, an old KVM may not allow to destroy and re-create the KVM XICS, which is precisely what "dual" does during machine reset. This causes QEMU to try to switch to emulated XICS and to crash because RTAS call de-registration isn't handled correctly. We could possibly fix that, but again we would still end up with an emulated XICS or XIVE. "dual" is definitely not a good choice with older KVMs. Internally force XICS when we detect this. Signed-off-by: Greg Kurz Reviewed-by: C=C3=A9dric Le Goater --- hw/ppc/spapr_irq.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index 3156daf09381..d788bd662a7a 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -18,6 +18,7 @@ #include "hw/ppc/xics_spapr.h" #include "cpu-models.h" #include "sysemu/kvm.h" +#include "kvm_ppc.h" =20 #include "trace.h" =20 @@ -668,6 +669,15 @@ static void spapr_irq_check(SpaprMachineState *spapr, = Error **errp) return; } } + + /* + * KVM may be too old to support XIVE, in which case we'd rather try + * to use the in-kernel XICS instead of the emulated XIVE. + */ + if (kvm_enabled() && !kvmppc_has_cap_xive() && + spapr->irq =3D=3D &spapr_irq_dual) { + spapr->irq =3D &spapr_irq_xics; + } } =20 /*