From patchwork Thu Nov 9 10:14:27 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: 836349 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 3yXkXV6XpCz9t5c for ; Fri, 10 Nov 2017 00:29:14 +1100 (AEDT) Received: from localhost ([::1]:36899 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCmtN-000804-07 for incoming@patchwork.ozlabs.org; Thu, 09 Nov 2017 08:29:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCmsr-0007vk-DA for qemu-devel@nongnu.org; Thu, 09 Nov 2017 08:28:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCmsm-0004xg-W1 for qemu-devel@nongnu.org; Thu, 09 Nov 2017 08:28:41 -0500 Received: from 1.mo68.mail-out.ovh.net ([46.105.41.146]:60158) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eCmsm-0004wr-PB for qemu-devel@nongnu.org; Thu, 09 Nov 2017 08:28:36 -0500 Received: from player750.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo68.mail-out.ovh.net (Postfix) with ESMTP id DD83598EBB for ; Thu, 9 Nov 2017 14:28:32 +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 C26201805A1; Thu, 9 Nov 2017 11:14:48 +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:27 +0100 Message-Id: <20171109101439.390-1-clg@kaod.org> X-Mailer: git-send-email 2.13.6 MIME-Version: 1.0 X-Ovh-Tracer-Id: 3071736423654394707 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.41.146 Subject: [Qemu-devel] [PATCH for-2.12 v2 00/12] spapr: introduce an IRQ allocator at the machine level 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" Hello, 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 proposal adding 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); bool (*irq_is_lsi)(XICSFabric *xi, int irq); In these prototypes, the 'irq' parameter refers to a number in the global IRQ number space. On the sPAPR platform, these operations are simply backed by a bitmap and to handle migration compatibility, we introduce a machine class flag 'has_irq_bitmap', which is set to false for older machines. To completely remove the use of the ICSState object (required to introduce XIVE), we also need to change how the nature of an interrupt, MSI or LSI, is stored. Today, this is done using the flag attribute of the ICSIRQState array. We change that by splitting the IRQ number space of the machine in two: first the LSIs and then the MSIs. This has the benefit to keep the LSI IRQ numbers in a well known range which is useful for PHB hotplug. The git repo for this pachset can be found here along with the latest XIVE model: https://github.com/legoater/qemu/commits/xive Thanks, C. Tests : - make check on each patch - migration : qemu-2.12 (pseries-2.12) <-> qemu-2.12 (pseries-2.12) qemu-2.12 (pseries-2.10) <-> qemu-2.12 (pseries-2.10) qemu-2.10 (pseries-2.10) <-> qemu-2.12 (pseries-2.10) Changes since v1 : - reorganised patchset to introduce the XICSFabric operations before the major changes: bitmap and IRQ number space split - introduced a reference bitmap to save some state in migration Cédric Le Goater (12): spapr: add pseries 2.12 machine type ppc/xics: remove useless if condition spapr: introduce new XICSFabric operations for an IRQ allocator spapr: move current IRQ allocation under the machine spapr: introduce an IRQ allocator using a bitmap spapr: store a reference IRQ bitmap spapr: introduce an 'irq_base' number spapr: remove the use of ics_valid_irq() spapr: introduce a XICSFabric is_lsi() operation spapr: split the IRQ number space for LSI interrupts sparp: merge ics_set_irq_type() in irq_alloc_block() operation spapr: use sPAPRMachineState in spapr_ics_ prototypes hw/intc/trace-events | 2 - hw/intc/xics.c | 37 ++++++----- hw/intc/xics_kvm.c | 4 +- hw/intc/xics_spapr.c | 76 ++++----------------- hw/ppc/pnv.c | 34 ++++++++++ hw/ppc/pnv_psi.c | 4 -- hw/ppc/spapr.c | 174 ++++++++++++++++++++++++++++++++++++++++++++++++- hw/ppc/spapr_events.c | 4 +- hw/ppc/spapr_pci.c | 8 +-- hw/ppc/spapr_vio.c | 2 +- hw/ppc/trace-events | 2 + include/hw/ppc/spapr.h | 6 ++ include/hw/ppc/xics.h | 20 ++++-- 13 files changed, 267 insertions(+), 106 deletions(-)