From patchwork Fri Nov 10 15:20:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Le_Goater?= X-Patchwork-Id: 836784 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yYP0R4X9fz9sCZ for ; Sat, 11 Nov 2017 02:22:15 +1100 (AEDT) Received: from localhost ([::1]:42215 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eDB8H-00084Z-KY for incoming@patchwork.ozlabs.org; Fri, 10 Nov 2017 10:22:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eDB7X-00081D-6W for qemu-devel@nongnu.org; Fri, 10 Nov 2017 10:21:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eDB7T-0006ag-3c for qemu-devel@nongnu.org; Fri, 10 Nov 2017 10:21:27 -0500 Received: from 1.mo68.mail-out.ovh.net ([46.105.41.146]:59875) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eDB7S-0006ZQ-TI for qemu-devel@nongnu.org; Fri, 10 Nov 2017 10:21:23 -0500 Received: from player737.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo68.mail-out.ovh.net (Postfix) with ESMTP id D59459C350 for ; Fri, 10 Nov 2017 16:21:21 +0100 (CET) Received: from zorba.kaod.org.com (deibp9eh1--blueice1n7.emea.ibm.com [195.212.29.161]) (Authenticated sender: clg@kaod.org) by player737.ha.ovh.net (Postfix) with ESMTPSA id 819C8E009C; Fri, 10 Nov 2017 16:21:14 +0100 (CET) From: =?utf-8?q?C=C3=A9dric_Le_Goater?= To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, David Gibson , Greg Kurz , Benjamin Herrenschmidt Date: Fri, 10 Nov 2017 15:20:13 +0000 Message-Id: <20171110152017.24324-8-clg@kaod.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171110152017.24324-1-clg@kaod.org> References: <20171110152017.24324-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 14119066309961157459 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedttddrieefgdejgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.41.146 Subject: [Qemu-devel] [PATCH for-2.12 v3 07/11] 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_Le_Goater?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" '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édric Le Goater --- hw/ppc/spapr.c | 7 ++++--- include/hw/ppc/spapr.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index bf0e5b4f815b..1cbbd7715a85 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2362,6 +2362,7 @@ static void ppc_spapr_init(MachineState *machine) /* Initialize the IRQ allocator */ spapr->nr_irqs = XICS_IRQS_SPAPR; spapr->irq_map = bitmap_new(spapr->nr_irqs); + spapr->irq_base = XICS_IRQ_BASE; /* Set up Interrupt Controller before we create the VCPUs */ xics_system_init(machine, spapr->nr_irqs, &error_fatal); @@ -3630,7 +3631,7 @@ static void spapr_irq_free_block_2_11(XICSFabric *xi, int irq, int num) static bool spapr_irq_test(XICSFabric *xi, int irq) { sPAPRMachineState *spapr = SPAPR_MACHINE(xi); - int srcno = irq - spapr->ics->offset; + int srcno = irq - spapr->irq_base; return test_bit(srcno, spapr->irq_map); } @@ -3656,13 +3657,13 @@ static int spapr_irq_alloc_block(XICSFabric *xi, int count, int align) } bitmap_set(spapr->irq_map, srcno, count); - return srcno + spapr->ics->offset; + return srcno + spapr->irq_base; } static void spapr_irq_free_block(XICSFabric *xi, int irq, int num) { sPAPRMachineState *spapr = SPAPR_MACHINE(xi); - int srcno = irq - spapr->ics->offset; + int srcno = irq - 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 023436c32b2a..200667dcff9d 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -82,6 +82,7 @@ struct sPAPRMachineState { int32_t nr_irqs; unsigned long *irq_map; unsigned long *irq_map_ref; + uint32_t irq_base; ICSState *ics; sPAPRRTCState rtc;