From nobody Tue Feb 10 20:28:50 2026 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 1524143214938773.6078162068571; Thu, 19 Apr 2018 06:06:54 -0700 (PDT) Received: from localhost ([::1]:45262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f99H3-0000ek-K6 for importer@patchew.org; Thu, 19 Apr 2018 09:06:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57673) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f98wK-0000au-V8 for qemu-devel@nongnu.org; Thu, 19 Apr 2018 08:45:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f98wG-0000Na-SP for qemu-devel@nongnu.org; Thu, 19 Apr 2018 08:45:29 -0400 Received: from 1.mo179.mail-out.ovh.net ([178.33.111.220]:43822) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f98wG-0000MB-Dm for qemu-devel@nongnu.org; Thu, 19 Apr 2018 08:45:24 -0400 Received: from player792.ha.ovh.net (unknown [10.109.120.21]) by mo179.mail-out.ovh.net (Postfix) with ESMTP id AD278B949D for ; Thu, 19 Apr 2018 14:45:22 +0200 (CEST) Received: from zorba.kaod.org.com (LFbn-REN-1-664-241.w81-53.abo.wanadoo.fr [81.53.234.241]) (Authenticated sender: clg@kaod.org) by player792.ha.ovh.net (Postfix) with ESMTPSA id 1AF68A008F; Thu, 19 Apr 2018 14:45:17 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org Date: Thu, 19 Apr 2018 14:43:13 +0200 Message-Id: <20180419124331.3915-18-clg@kaod.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180419124331.3915-1-clg@kaod.org> References: <20180419124331.3915-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 10331820496290351955 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtgedrjeehgdehjecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.33.111.220 Subject: [Qemu-devel] [PATCH v3 17/35] spapr: add XIVE support to spapr_qirq() 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=20Le=20Goater?= , David Gibson 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" The XIVE object has its own set of qirqs which is to be used when the XIVE exploitation interrupt mode is activated. Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/spapr_xive.c | 13 +++++++++++++ hw/ppc/spapr.c | 4 ++++ include/hw/ppc/spapr_xive.h | 1 + include/hw/ppc/xive.h | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c index 7aba6e571a93..98e067bfc90c 100644 --- a/hw/intc/spapr_xive.c +++ b/hw/intc/spapr_xive.c @@ -263,3 +263,16 @@ void spapr_xive_mmio_unmap(sPAPRXive *xive) sysbus_mmio_unmap(SYS_BUS_DEVICE(xive), 0); sysbus_mmio_unmap(SYS_BUS_DEVICE(xive), 1); } + +qemu_irq spapr_xive_qirq(sPAPRXive *xive, int lisn) +{ + XiveIVE *ive =3D spapr_xive_get_ive(XIVE_FABRIC(xive), lisn); + XiveSource *xsrc =3D &xive->source; + + if (!ive || !(ive->w & IVE_VALID)) { + qemu_log_mask(LOG_GUEST_ERROR, "XIVE: invalid LISN %d\n", lisn); + return NULL; + } + + return xive_source_qirq(xsrc, lisn - xsrc->offset); +} diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index a9770f8f0a6e..4fcc942ccfa3 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3941,6 +3941,10 @@ qemu_irq spapr_qirq(sPAPRMachineState *spapr, int ir= q) { ICSState *ics =3D spapr->ics; =20 + if (spapr_ovec_test(spapr->ov5_cas, OV5_XIVE_EXPLOIT)) { + return spapr_xive_qirq(spapr->xive, irq); + } + if (ics_valid_irq(ics, irq)) { return ics->qirqs[irq - ics->offset]; } diff --git a/include/hw/ppc/spapr_xive.h b/include/hw/ppc/spapr_xive.h index 0373b1c995bc..df87e68b3d05 100644 --- a/include/hw/ppc/spapr_xive.h +++ b/include/hw/ppc/spapr_xive.h @@ -37,6 +37,7 @@ bool spapr_xive_irq_disable(sPAPRXive *xive, uint32_t lis= n); void spapr_xive_pic_print_info(sPAPRXive *xive, Monitor *mon); void spapr_xive_mmio_map(sPAPRXive *xive); void spapr_xive_mmio_unmap(sPAPRXive *xive); +qemu_irq spapr_xive_qirq(sPAPRXive *xive, int lisn); =20 /* * sPAPR encoding of EQ indexes diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h index 6cc02638c677..328b093eb9c3 100644 --- a/include/hw/ppc/xive.h +++ b/include/hw/ppc/xive.h @@ -155,6 +155,12 @@ static inline void xive_source_irq_set(XiveSource *xsr= c, uint32_t srcno, xsrc->status[srcno] |=3D lsi ? XIVE_STATUS_LSI : 0; } =20 +static inline qemu_irq xive_source_qirq(XiveSource *xsrc, uint32_t srcno) +{ + assert(srcno < xsrc->nr_irqs); + return xsrc->qirqs[srcno]; +} + /* * XIVE Interrupt Presenter */ --=20 2.13.6