From patchwork Sat Nov 27 01:24:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 12642079 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B15A3C433F5 for ; Sat, 27 Nov 2021 01:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350282AbhK0Bg5 (ORCPT ); Fri, 26 Nov 2021 20:36:57 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:40718 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348743AbhK0Bez (ORCPT ); Fri, 26 Nov 2021 20:34:55 -0500 Message-ID: <20211126233124.618283684@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1637976270; 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=cXwN7LAx6ag9HOMQtjLd6VTeK3zX6xCMXFRxvs6U6Qg=; b=14q4wOfG/0/SZhjwir+cQHJgN4Eo+aHBwW3N78dcnYHDysV9Oh1NWZqgJ4JuWR/baa9D2Z NGYz0nAYpGfPsHFUlg5IrQQTw+vEwwj30OLhvIpllXtuE9HgIXHfbE7EEDVm3GOiGHYHbG QKUA3MpESWpx/pP4hwDMPtsbETljzTerGL18EUZQZo3hOmbv8495iEjfmpSrxIhYVTmU9q Y+ipEcdCu43SMNRGBKk3j3+5hGIz1q5c7m+vCiYI5CvegGVw6Zpl6rZNHHG7P6my+qeA/L PXiEE2W/Cgvup0+A3VLyLKTee/d5AKafHg/Uir8yQD0wfIFbtg/4DTAu6ZhMxw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1637976270; 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=cXwN7LAx6ag9HOMQtjLd6VTeK3zX6xCMXFRxvs6U6Qg=; b=KO4VdGK/spEZe2s55ufjJGfc/FG3K9/3AjsE6hAK9UTesq2K2rALdyStZ/xDIu23Rs4Tjf UmIDWC9TXBsCnuCA== From: Thomas Gleixner To: LKML Cc: Bjorn Helgaas , Marc Zygnier , Alex Williamson , Kevin Tian , Jason Gunthorpe , Megha Dey , Ashok Raj , Michael Ellerman , Andrew Cooper , Juergen Gross , linux-pci@vger.kernel.org, xen-devel@lists.xenproject.org Subject: [patch 00/10] genirq/msi, PCI/MSI: Support for dynamic MSI-X vector expansion - Part 4 MIME-Version: 1.0 Date: Sat, 27 Nov 2021 02:24:30 +0100 (CET) Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org This is finally the point where dynamically expanding MSI-X vectors after enabling MSI-X is implemented. The first three parts of this work can be found here: https://lore.kernel.org/r/20211126222700.862407977@linutronix.de https://lore.kernel.org/r/20211126224100.303046749@linutronix.de https://lore.kernel.org/r/20211126230957.239391799@linutronix.de This last and smallest part of the overall series contains the following changes: 1) Prepare the core MSI irq domain code to handle range based allocation and free 2) Prepare the PCI/MSI code to handle range based allocation and free 3) Implement a new interface which allows to expand the MSI-X vector space after initialization 4) Enable support for the X86 PCI/MSI irq domains This is unfortunate, but some PCI/MSI irq domain implementations, e.g. powerpc and the x86/XEN irqdomain wrappers are not really ready to support this out of the box. I looked at the 30 places which implement PCI/MSI irq domains and many of them look like they could support it out of the box, but as we have two which definitely don't, making this opt-in is the only safe option. I've tested this by hacking up the XHCI driver and it works like a charm. There is certainly some more room for consolidating the PCI/MSI-X usage in drivers, i.e. getting rid of pci_enable_msix*(), but this would have made this overall series even larger and is an orthogonal issue. This fourth series is based on: git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git msi-v1-part-3 and also available from git: git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git msi-v1-part-4 Thanks, tglx --- arch/powerpc/platforms/pseries/msi.c | 6 +- arch/x86/kernel/apic/msi.c | 4 - arch/x86/pci/xen.c | 10 +-- drivers/base/platform-msi.c | 3 - drivers/pci/msi/irqdomain.c | 39 ++++++++++---- drivers/pci/msi/msi.c | 97 +++++++++++++++++++++++++++-------- drivers/pci/msi/msi.h | 4 - include/linux/msi.h | 46 +++++++++++----- include/linux/pci.h | 13 ++++ kernel/irq/msi.c | 75 +++++++++++++++------------ 10 files changed, 208 insertions(+), 89 deletions(-)