From patchwork Fri Nov 10 15:20:09 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: 836786 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 3yYP380P2Nz9sRm for ; Sat, 11 Nov 2017 02:24:36 +1100 (AEDT) Received: from localhost ([::1]:42228 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eDBAX-0001lA-Up for incoming@patchwork.ozlabs.org; Fri, 10 Nov 2017 10:24:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eDB72-0007cp-S1 for qemu-devel@nongnu.org; Fri, 10 Nov 2017 10:20:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eDB6y-0005de-Pi for qemu-devel@nongnu.org; Fri, 10 Nov 2017 10:20:56 -0500 Received: from 4.mo68.mail-out.ovh.net ([46.105.59.63]:51355) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eDB6y-0005aq-Iu for qemu-devel@nongnu.org; Fri, 10 Nov 2017 10:20:52 -0500 Received: from player737.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo68.mail-out.ovh.net (Postfix) with ESMTP id 8F1C59C179 for ; Fri, 10 Nov 2017 16:20:51 +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 50966E00A1; Fri, 10 Nov 2017 16:20:44 +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:09 +0000 Message-Id: <20171110152017.24324-4-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: 14110622059604249427 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.59.63 Subject: [Qemu-devel] [PATCH for-2.12 v3 03/11] spapr: introduce new XICSFabric operations for an IRQ allocator 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" Currently, the ICSState 'ics' object of the sPAPR machine acts as the global interrupt source handler and also as the IRQ number allocator for the machine. Some IRQ numbers are allocated very early in the machine initialization sequence to populate the device tree, and this is a problem to introduce the new POWER XIVE interrupt model, as it needs to share the IRQ numbers with the older model. To prepare ground for XIVE, here is a set of new XICSFabric operations to let the machine handle directly the IRQ number allocation and to decorrelate the allocation from the interrupt source object : bool (*irq_test)(XICSFabric *xi, int irq); int (*irq_alloc_block)(XICSFabric *xi, int count, int align); void (*irq_free_block)(XICSFabric *xi, int irq, int num); In these prototypes, the 'irq' parameter refers to a number in the global IRQ number space. Indexes for arrays storing different state informations on the interrupts, like the ICSIRQState, are usually named 'srcno'. Signed-off-by: Cédric Le Goater Reviewed-by: Greg Kurz --- hw/ppc/spapr.c | 19 +++++++++++++++++++ include/hw/ppc/xics.h | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index a2dcbee07214..84d68f2fdbae 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3536,6 +3536,21 @@ static ICPState *spapr_icp_get(XICSFabric *xi, int vcpu_id) return cpu ? ICP(cpu->intc) : NULL; } +static bool spapr_irq_test(XICSFabric *xi, int irq) +{ + return false; +} + +static int spapr_irq_alloc_block(XICSFabric *xi, int count, int align) +{ + return -1; +} + +static void spapr_irq_free_block(XICSFabric *xi, int irq, int num) +{ + ; +} + static void spapr_pic_print_info(InterruptStatsProvider *obj, Monitor *mon) { @@ -3630,6 +3645,10 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) xic->ics_get = spapr_ics_get; xic->ics_resend = spapr_ics_resend; xic->icp_get = spapr_icp_get; + xic->irq_test = spapr_irq_test; + xic->irq_alloc_block = spapr_irq_alloc_block; + xic->irq_free_block = spapr_irq_free_block; + ispc->print_info = spapr_pic_print_info; /* Force NUMA node memory size to be a multiple of * SPAPR_MEMORY_BLOCK_SIZE (256M) since that's the granularity diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 28d248abad61..30e7f2e0a7dd 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -175,6 +175,10 @@ typedef struct XICSFabricClass { ICSState *(*ics_get)(XICSFabric *xi, int irq); void (*ics_resend)(XICSFabric *xi); ICPState *(*icp_get)(XICSFabric *xi, int server); + /* IRQ allocator helpers */ + bool (*irq_test)(XICSFabric *xi, int irq); + int (*irq_alloc_block)(XICSFabric *xi, int count, int align); + void (*irq_free_block)(XICSFabric *xi, int irq, int num); } XICSFabricClass; #define XICS_IRQS_SPAPR 1024