From patchwork Thu Nov 9 10:14:30 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: 836351 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 3yXkYf3kz1z9t5Q for ; Fri, 10 Nov 2017 00:30:13 +1100 (AEDT) Received: from localhost ([::1]:36902 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCmuJ-0008I8-4t for incoming@patchwork.ozlabs.org; Thu, 09 Nov 2017 08:30:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCmtX-0008Gf-7k for qemu-devel@nongnu.org; Thu, 09 Nov 2017 08:29:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCmtT-0005B2-8K for qemu-devel@nongnu.org; Thu, 09 Nov 2017 08:29:23 -0500 Received: from 8.mo68.mail-out.ovh.net ([46.105.74.219]:34714) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eCmtT-0005Ao-1o for qemu-devel@nongnu.org; Thu, 09 Nov 2017 08:29:19 -0500 Received: from player750.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo68.mail-out.ovh.net (Postfix) with ESMTP id EA0709B8F0 for ; Thu, 9 Nov 2017 14:29:17 +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 92455181AFD; Thu, 9 Nov 2017 11:15:09 +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: Thu, 9 Nov 2017 11:14:30 +0100 Message-Id: <20171109101439.390-4-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: 3076802973432253267 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedttddriedugdegiecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.74.219 Subject: [Qemu-devel] [PATCH for-2.12 v2 03/12] 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 --- 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