From patchwork Mon Dec 6 22:51:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 12660305 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B4BA0C433EF for ; Mon, 6 Dec 2021 22:51:18 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.240124.416525 (Exim 4.92) (envelope-from ) id 1muMp8-0008Ne-8x; Mon, 06 Dec 2021 22:51:06 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 240124.416525; Mon, 06 Dec 2021 22:51:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muMp8-0008NX-60; Mon, 06 Dec 2021 22:51:06 +0000 Received: by outflank-mailman (input) for mailman id 240124; Mon, 06 Dec 2021 22:51:05 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muMp6-0008NM-Vp for xen-devel@lists.xenproject.org; Mon, 06 Dec 2021 22:51:04 +0000 Received: from galois.linutronix.de (galois.linutronix.de [193.142.43.55]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id fd976516-56e6-11ec-a5e1-b9374ead2679; Mon, 06 Dec 2021 23:51:04 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: fd976516-56e6-11ec-a5e1-b9374ead2679 Message-ID: <20211206210600.123171746@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1638831063; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zuaVjYRhYaXSnxhOlTO3/+R1NRokr9z15QjTY7nAlqg=; b=g/R4QSH9IT1htMarbLNdxFDavRX6bJv4OUQ/T0gt4OQTqWZXzTnEFGfVNGY6u3WarVEX0M fO4dKL3Nm1idJ1EHNtMX9r3gv7Aa9o3YXnLoyDUhkVhTcL9wyzfCwA4mRP43jrVG1lBrvk ufNL0788SoAA7ns5LdioDLX/09NweJXy7JmQK0sepafvaSdQB0dkUuy9APy8Z+ZZpZRmtZ UyO27tAZTKgZE/UHN5p4OPkUXcwgOWtBGytrfD/kqC5Kq+IksH7RiH5qUuZ9fR60c7jrom Il+EusOQlF4egTWzDwPjnoc5PCnLeWjJc6hprAFpEnNdSv7BoTX/aaA5Ro+wcA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1638831063; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zuaVjYRhYaXSnxhOlTO3/+R1NRokr9z15QjTY7nAlqg=; b=EiJLBZ0I2k31uIESwAuf3JVleODzfA1PUF4FPIFRUFMUdHiPUHwv8yQK8cFPw5MnxUJoi2 tEyzCBesXZg681CA== From: Thomas Gleixner To: LKML Cc: Bjorn Helgaas , Marc Zygnier , Alex Williamson , Kevin Tian , Jason Gunthorpe , Megha Dey , Ashok Raj , linux-pci@vger.kernel.org, Cedric Le Goater , xen-devel@lists.xenproject.org, Juergen Gross , Greg Kroah-Hartman , Niklas Schnelle , linux-s390@vger.kernel.org, Heiko Carstens , Christian Borntraeger , Logan Gunthorpe , Jon Mason , Dave Jiang , Allen Hubbe , linux-ntb@googlegroups.com Subject: [patch V2 00/31] genirq/msi, PCI/MSI: Spring cleaning - Part 3 MIME-Version: 1.0 Date: Mon, 6 Dec 2021 23:51:02 +0100 (CET) This is the third part of [PCI]MSI refactoring which aims to provide the ability of expanding MSI-X vectors after enabling MSI-X. The first two parts of this work can be found here: https://lore.kernel.org/r/20211206210147.872865823@linutronix.de https://lore.kernel.org/r/20211206210307.625116253@linutronix.de This third part has the following important changes: 1) Add locking to protect the MSI descriptor storage Right now the MSI descriptor storage (linked list) is not protected by anything under the assumption that the list is installed before use and destroyed after use. As this is about to change there has to be protection 2) A new set of iterators which allow filtering on the state of the descriptors namely whether a descriptor is associated to a Linux interrupt or not. This cleans up a lot of use cases which have to do this filtering manually. 3) A new set of MSI descriptor allocation functions which make the usage sites simpler and confine the storage handling to the core code. Trivial MSI descriptors (non PCI) are now allocated by the core code automatically when the underlying irq domain requests that. 4) Rework of sysfs handling to prepare for dynamic extension of MSI-X The current mechanism which creates the directory and the attributes for all MSI descriptors in one go is obviously not suitable for dynamic extension. The rework splits the directory creation out and lets the MSI interrupt allocation create the per descriptor attributes. 5) Conversion of the MSI descriptor storage to xarray The linked list based storage is suboptimal even without dynamic expansion as it requires full list walks to get to a specific descriptor. With dynamic expansion this gets even more convoluted. Xarray is way more suitable and simplifies the final goal of dynamic expansion of the MSI-X space. This third series is based on: git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git msi-v2-part-2 and also available from git: git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git msi-v2-part-3 V1 of this series can be found here: https://lore.kernel.org/r/20211126224100.303046749@linutronix.de Changes versus V1: - Remove the allocation counter patch as it is not required - Fix the powerpc fallout - Cedric - Fix the CONFIG typo - Niklas - Picked up Reviewed/Tested/Acked-by tags as appropriate As a consequence of the discussion vs. the general direction of these patches, part 4 is not going to be updated in it's current form. The assumption that MSI[X] and IMS are mutually exclusive and that IMS is basically an extension for finer grained splitup of the PCI device does not hold. There is a plan to refactor the code further in order to provide the desired functionality of MSI[X]/IMS which will also gain the dynamic extension of MSI-X vectors: https://lore.kernel.org/r/87o85v3znb.ffs@tglx Thanks, tglx Reviewed-by: Jason Gunthorpe --- .clang-format | 1 arch/powerpc/platforms/4xx/hsta_msi.c | 7 arch/powerpc/platforms/cell/axon_msi.c | 7 arch/powerpc/platforms/pasemi/msi.c | 9 arch/powerpc/sysdev/fsl_msi.c | 8 arch/powerpc/sysdev/mpic_u3msi.c | 9 arch/s390/pci/pci_irq.c | 6 arch/x86/pci/xen.c | 14 drivers/base/core.c | 3 drivers/base/platform-msi.c | 110 ----- drivers/bus/fsl-mc/fsl-mc-msi.c | 61 -- drivers/ntb/msi.c | 19 drivers/pci/controller/pci-hyperv.c | 15 drivers/pci/msi/irqdomain.c | 11 drivers/pci/msi/legacy.c | 20 drivers/pci/msi/msi.c | 258 ++++++------ drivers/pci/xen-pcifront.c | 2 drivers/soc/ti/ti_sci_inta_msi.c | 77 +-- include/linux/device.h | 4 include/linux/msi.h | 107 +++-- include/linux/soc/ti/ti_sci_inta_msi.h | 1 kernel/irq/msi.c | 700 ++++++++++++++++++++++----------- 22 files changed, 794 insertions(+), 655 deletions(-)