From patchwork Wed Feb 15 07:58:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 9573471 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B1171601D8 for ; Wed, 15 Feb 2017 07:58:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DF8728443 for ; Wed, 15 Feb 2017 07:58:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92BBB28448; Wed, 15 Feb 2017 07:58:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30AA428443 for ; Wed, 15 Feb 2017 07:58:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750816AbdBOH6b (ORCPT ); Wed, 15 Feb 2017 02:58:31 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:48872 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750760AbdBOH6a (ORCPT ); Wed, 15 Feb 2017 02:58:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=k9WtJRxh8fIC3ta02nZy/bktIqX0nyMpWS1mScHfEAs=; b=rodTqEzzZRdcasGwpMQO0NwHP pJDfKW4oMGx+oNdRE9l9LBTVlc6+szGxhNFT2uewtkpdyja9xkzB9cHNP9lO0K224KiOpG85Y5qGi II4oeVZmSFn9GfQyO9MKZEeXSkGNNWCkcOK4Merp0bQ90edlcgSTl8QP9dErHo5jfgVfUJUyhOTSp R5T/Sej+HAahEYbDrVooDqr/TMwvzq0odyRfKHUYzqBvqbbYiS94Y14uG0pcOsjNw/NUlQJM7YEiG DKtxfsfVGk5hwaNMxDWp5dFsuLHz3c5QAouoaHqjwMdxkFFsHTukA4DJ6Dp+7BSY2fbhGK3mK2Fjw sIpy9f04g==; Received: from [91.114.64.3] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1cduTt-0003rj-Hy; Wed, 15 Feb 2017 07:58:30 +0000 From: Christoph Hellwig To: Bjorn Helgaas , Jonathan Corbet Cc: linux-pci@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH 1/2] PCI: update pci.txt to talk about pci_alloc_irq_vectors Date: Wed, 15 Feb 2017 08:58:22 +0100 Message-Id: <20170215075823.3024-2-hch@lst.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170215075823.3024-1-hch@lst.de> References: <20170215075823.3024-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP instead of the deprecated pci_enable_msi* APIs. Signed-off-by: Christoph Hellwig --- Documentation/PCI/pci.txt | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Documentation/PCI/pci.txt b/Documentation/PCI/pci.txt index 77f49dc5be23..98875f8cb7ba 100644 --- a/Documentation/PCI/pci.txt +++ b/Documentation/PCI/pci.txt @@ -382,18 +382,18 @@ The fundamental difference between MSI and MSI-X is how multiple "vectors" get allocated. MSI requires contiguous blocks of vectors while MSI-X can allocate several individual ones. -MSI capability can be enabled by calling pci_enable_msi() or -pci_enable_msix() before calling request_irq(). This causes -the PCI support to program CPU vector data into the PCI device -capability registers. - -If your PCI device supports both, try to enable MSI-X first. -Only one can be enabled at a time. Many architectures, chip-sets, -or BIOSes do NOT support MSI or MSI-X and the call to pci_enable_msi/msix -will fail. This is important to note since many drivers have -two (or more) interrupt handlers: one for MSI/MSI-X and another for IRQs. -They choose which handler to register with request_irq() based on the -return value from pci_enable_msi/msix(). +MSI capability can be enabled by calling pci_alloc_irq_vectors with the +PCI_IRQ_MSI and/or PCI_IRQ_MSIX flags before calling request_irq(). This +causes the PCI support to program CPU vector data into the PCI device +capability registers. Many architectures, chip-sets, or BIOSes do NOT +support MSI or MSI-X and a call to pci_alloc_irq_vectors with just +the PCI_IRQ_MSI and PCI_IRQ_MSIX flags will fail, so try to always +specify PCI_IRQ_LEGACY as well. + +Drivers that have different interrupt handlers for MSI/MSI-X and +legacy INTx should chose the right one based on the msi_enabled +and msix_enabled flags in the pci_dev structure after calling +pci_alloc_irq_vectors. There are (at least) two really good reasons for using MSI: 1) MSI is an exclusive interrupt vector by definition.