From nobody Mon Feb 9 22:20:01 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 1510234486001189.49583928977688; Thu, 9 Nov 2017 05:34:46 -0800 (PST) Received: from localhost ([::1]:36926 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCmyj-0003oc-58 for importer@patchew.org; Thu, 09 Nov 2017 08:34:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40794) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCmu7-0000Kw-3h for qemu-devel@nongnu.org; Thu, 09 Nov 2017 08:30:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCmu3-0005QS-3B for qemu-devel@nongnu.org; Thu, 09 Nov 2017 08:29:59 -0500 Received: from 5.mo68.mail-out.ovh.net ([46.105.62.179]:51828) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eCmu2-0005QC-TR for qemu-devel@nongnu.org; Thu, 09 Nov 2017 08:29:55 -0500 Received: from player750.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo68.mail-out.ovh.net (Postfix) with ESMTP id B194E9B877 for ; Thu, 9 Nov 2017 14:29:53 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-2231-173.w90-76.abo.wanadoo.fr [90.76.52.173]) (Authenticated sender: clg@kaod.org) by player750.ha.ovh.net (Postfix) with ESMTPSA id 50E64181B40; Thu, 9 Nov 2017 11:15:34 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, David Gibson , Greg Kurz , Benjamin Herrenschmidt Date: Thu, 9 Nov 2017 11:14:34 +0100 Message-Id: <20171109101439.390-8-clg@kaod.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171109101439.390-1-clg@kaod.org> References: <20171109101439.390-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 3083839847709707091 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedttddriedugdegiecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd 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: 46.105.62.179 Subject: [Qemu-devel] [PATCH for-2.12 v2 07/12] spapr: introduce an 'irq_base' number 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?= 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" 'irq_base' is a base IRQ number which lets us allocate only the subset of the IRQ numbers used on the sPAPR platform. It is sync with the ICSState 'offset' attribute and this is slightly redundant. We could also choose to waste some extra bytes (512) and allocate the whole number space. To be discussed. But more important, it removes a dependency on the ICSState object of the sPAPR machine which is required for XIVE. Signed-off-by: C=C3=A9dric Le Goater --- hw/ppc/spapr.c | 11 +++++------ include/hw/ppc/spapr.h | 1 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index d4d0a36cc5bf..6c3fc12ed8e1 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2383,6 +2383,7 @@ static void ppc_spapr_init(MachineState *machine) /* Initialize the IRQ allocator */ spapr->nr_irqs =3D XICS_IRQS_SPAPR; spapr->irq_map =3D bitmap_new(spapr->nr_irqs); + spapr->irq_base =3D XICS_IRQ_BASE; =20 /* Set up Interrupt Controller before we create the VCPUs */ xics_system_init(machine, spapr->nr_irqs, &error_fatal); @@ -3586,8 +3587,7 @@ static ICPState *spapr_icp_get(XICSFabric *xi, int vc= pu_id) static bool spapr_irq_test(XICSFabric *xi, int irq) { sPAPRMachineState *spapr =3D SPAPR_MACHINE(xi); - ICSState *ics =3D spapr->ics; - int srcno =3D irq - ics->offset; + int srcno =3D irq - spapr->irq_base; =20 return test_bit(srcno, spapr->irq_map); } @@ -3595,7 +3595,6 @@ static bool spapr_irq_test(XICSFabric *xi, int irq) static int spapr_irq_alloc_block(XICSFabric *xi, int count, int align) { sPAPRMachineState *spapr =3D SPAPR_MACHINE(xi); - ICSState *ics =3D spapr->ics; int start =3D 0; int srcno; =20 @@ -3614,21 +3613,21 @@ static int spapr_irq_alloc_block(XICSFabric *xi, in= t count, int align) } =20 bitmap_set(spapr->irq_map, srcno, count); - return srcno + ics->offset; + return srcno + spapr->irq_base; } =20 static void spapr_irq_free_block(XICSFabric *xi, int irq, int num) { sPAPRMachineState *spapr =3D SPAPR_MACHINE(xi); ICSState *ics =3D spapr->ics; - int srcno =3D irq - ics->offset; + int srcno =3D irq - spapr->irq_base; int i; =20 if (ics_valid_irq(ics, irq)) { trace_spapr_irq_free(0, irq, num); for (i =3D srcno; i < srcno + num; ++i) { if (!test_bit(i, spapr->irq_map)) { - trace_spapr_irq_free_warn(0, i + ics->offset); + trace_spapr_irq_free_warn(0, i + spapr->irq_base); } } bitmap_clear(spapr->irq_map, srcno, num); diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 090eda962ccb..8d227fe6f56c 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -83,6 +83,7 @@ struct sPAPRMachineState { int32_t nr_irqs; unsigned long *irq_map; unsigned long *irq_map_ref; + uint32_t irq_base; ICSState *ics; sPAPRRTCState rtc; =20 --=20 2.13.6