From nobody Mon Feb 9 15:18:57 2026 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=1562174628; cv=none; d=zoho.com; s=zohoarc; b=dOVdA2ZBzDSAhJQqCyr0kN0fUyxXhJugpb/usN4LcsphghbJPz1jXl2I6wBX2XKnkSzIlB6cnOP4V06hSVIh6SyBrHzM9Ja07HEy1m03QYkUTu1J+GkcQuzdkuVuAOkyJ04OfM+ugOfx9FwWgX2IAISinL8ZsEiRvficu4dJhLw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562174628; 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=/H+MBkbnJf5xU1FY+RdfKlo0nN5uZqqENhLnaAMVSok=; b=Fi1HSI6CxC5McvA2dwN33LZFR91u8so9QCaU2fjbjrVm3TvZwMIjUdz+wgBfDPs6Mdmj1Pbubjzs9p4GrY44XoXmNHDbbM0zP3cMs4hSLSOCWRotbMMJ3SGBIBnjb5bbORmOKSz0PCtyYXaiXLcK0UeH17rdvhqOa7cULzgeBN0= 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1562174628442663.024460154598; Wed, 3 Jul 2019 10:23:48 -0700 (PDT) Received: from localhost ([::1]:37938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hiiyo-00030V-Bg for importer@patchew.org; Wed, 03 Jul 2019 13:23:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47524) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hiixr-00026w-7C for qemu-devel@nongnu.org; Wed, 03 Jul 2019 13:22:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hiixq-00034U-1w for qemu-devel@nongnu.org; Wed, 03 Jul 2019 13:22:39 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:45796) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hiixp-0002zQ-O6 for qemu-devel@nongnu.org; Wed, 03 Jul 2019 13:22:38 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x63HMOne093699 for ; Wed, 3 Jul 2019 13:22:28 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tgyg4auta-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 03 Jul 2019 13:22:26 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 3 Jul 2019 18:22:24 +0100 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, 3 Jul 2019 18:22:22 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x63HML5845875388 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 3 Jul 2019 17:22:21 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 54D8B52052; Wed, 3 Jul 2019 17:22:21 +0000 (GMT) Received: from bahia.lan (unknown [9.145.70.88]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 266AD5204E; Wed, 3 Jul 2019 17:22:21 +0000 (GMT) From: Greg Kurz To: David Gibson , =?utf-8?q?C=C3=A9dric?= Le Goater Date: Wed, 03 Jul 2019 19:22:20 +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: 19070317-0028-0000-0000-000003800E01 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19070317-0029-0000-0000-000024404DE2 Message-Id: <156217454083.559957.7359208229523652842.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-03_04:, , 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=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907030211 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH for-4.1] xics/kvm: Always set the MASKED bit if interrupt is masked 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: qemu-ppc@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" The ics_set_kvm_state_one() function is called either to restore the state of an interrupt source during migration or to set the interrupt source to a default state during reset. Since always, ie. 2013, the code only sets the MASKED bit if the 'current priority' and the 'saved priority' are different. This is likely true when restoring an interrupt that had been previously masked with the ibm,int-off RTAS call. However this is always false in the case of reset since both 'current priority' and 'saved priority' are equal to 0xff, and the MASKED bit is never set. The legacy KVM XICS device gets away with that because it ends updating its internal structure the same way, whether the MASKED bit is set or the priority is 0xff. The XICS-on-XIVE device for POWER9 is different. It sticks to the KVM documentation [1] and _really_ relies on the MASKED bit to correctly set. If not, it will configure the interrupt source in the XIVE HW, even though the guest hasn't configured the interrupt yet. This disturbs the complex logic implemented in XICS-on-XIVE and may result in the loss of subsequent queued events. Always set the MASKED bit if interrupt is masked as expected by the KVM XICS-on-XIVE device. This has no impact on the legacy KVM XICS. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree= /Documentation/virtual/kvm/devices/xics.txt Signed-off-by: Greg Kurz --- hw/intc/xics_kvm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 51433b19b076..2df1f3e92c7e 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -257,6 +257,9 @@ int ics_set_kvm_state_one(ICSState *ics, int srcno, Err= or **errp) << KVM_XICS_PRIORITY_SHIFT; if (irq->priority !=3D irq->saved_priority) { assert(irq->priority =3D=3D 0xff); + } + + if (irq->priority =3D=3D 0xff) { state |=3D KVM_XICS_MASKED; } =20