linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* two small PCI documentation fixups
@ 2017-02-15  7:58 Christoph Hellwig
  2017-02-15  7:58 ` [PATCH 1/2] PCI: update pci.txt to talk about pci_alloc_irq_vectors Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christoph Hellwig @ 2017-02-15  7:58 UTC (permalink / raw)
  To: Bjorn Helgaas, Jonathan Corbet; +Cc: linux-pci, linux-doc

Avoid mentioning deprecated APIs and make the text a little
easier to understand.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] PCI: update pci.txt to talk about pci_alloc_irq_vectors
  2017-02-15  7:58 two small PCI documentation fixups Christoph Hellwig
@ 2017-02-15  7:58 ` Christoph Hellwig
  2017-02-15  7:58 ` [PATCH 2/2] PCI: update MSI/MSI-X bits in PCIEBUS-HOWTO Christoph Hellwig
  2017-02-15 16:37 ` two small PCI documentation fixups Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2017-02-15  7:58 UTC (permalink / raw)
  To: Bjorn Helgaas, Jonathan Corbet; +Cc: linux-pci, linux-doc

instead of the deprecated pci_enable_msi* APIs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 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.
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] PCI: update MSI/MSI-X bits in PCIEBUS-HOWTO
  2017-02-15  7:58 two small PCI documentation fixups Christoph Hellwig
  2017-02-15  7:58 ` [PATCH 1/2] PCI: update pci.txt to talk about pci_alloc_irq_vectors Christoph Hellwig
@ 2017-02-15  7:58 ` Christoph Hellwig
  2017-02-15 16:37 ` two small PCI documentation fixups Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2017-02-15  7:58 UTC (permalink / raw)
  To: Bjorn Helgaas, Jonathan Corbet; +Cc: linux-pci, linux-doc

Stop talking about low-level details that mention deprecated APIs and
concentrate on what service drivers should do and why.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 Documentation/PCI/PCIEBUS-HOWTO.txt | 33 +++++++--------------------------
 1 file changed, 7 insertions(+), 26 deletions(-)

diff --git a/Documentation/PCI/PCIEBUS-HOWTO.txt b/Documentation/PCI/PCIEBUS-HOWTO.txt
index 6bd5f372adec..15f0bb3b5045 100644
--- a/Documentation/PCI/PCIEBUS-HOWTO.txt
+++ b/Documentation/PCI/PCIEBUS-HOWTO.txt
@@ -161,21 +161,13 @@ Since all service drivers of a PCI-PCI Bridge Port device are
 allowed to run simultaneously, below lists a few of possible resource
 conflicts with proposed solutions.
 
-6.1 MSI Vector Resource
-
-The MSI capability structure enables a device software driver to call
-pci_enable_msi to request MSI based interrupts. Once MSI interrupts
-are enabled on a device, it stays in this mode until a device driver
-calls pci_disable_msi to disable MSI interrupts and revert back to
-INTx emulation mode. Since service drivers of the same PCI-PCI Bridge
-port share the same physical device, if an individual service driver
-calls pci_enable_msi/pci_disable_msi it may result unpredictable
-behavior. For example, two service drivers run simultaneously on the
-same physical Root Port. Both service drivers call pci_enable_msi to
-request MSI based interrupts. A service driver may not know whether
-any other service drivers have run on this Root Port. If either one
-of them calls pci_disable_msi, it puts the other service driver
-in a wrong interrupt mode.
+6.1 MSI and MSI-X Vector Resource
+
+Once MSI or MSI-X interrupts are enabled on a device, it stays in this
+mode until they are disabled again.  Since service drivers of the same
+PCI-PCI Bridge port share the same physical device, if an individual
+service driver enables or disables MSI/MSI-X mode it may result
+unpredictable behavior.
 
 To avoid this situation all service drivers are not permitted to
 switch interrupt mode on its device. The PCI Express Port Bus driver
@@ -187,17 +179,6 @@ driver. Service drivers should use (struct pcie_device*)dev->irq to
 call request_irq/free_irq. In addition, the interrupt mode is stored
 in the field interrupt_mode of struct pcie_device.
 
-6.2 MSI-X Vector Resources
-
-Similar to the MSI a device driver for an MSI-X capable device can
-call pci_enable_msix to request MSI-X interrupts. All service drivers
-are not permitted to switch interrupt mode on its device. The PCI
-Express Port Bus driver is responsible for determining the interrupt
-mode and this should be transparent to service drivers. Any attempt
-by service driver to call pci_enable_msix/pci_disable_msix may
-result unpredictable behavior. Service drivers should use
-(struct pcie_device*)dev->irq and call request_irq/free_irq.
-
 6.3 PCI Memory/IO Mapped Regions
 
 Service drivers for PCI Express Power Management (PME), Advanced
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: two small PCI documentation fixups
  2017-02-15  7:58 two small PCI documentation fixups Christoph Hellwig
  2017-02-15  7:58 ` [PATCH 1/2] PCI: update pci.txt to talk about pci_alloc_irq_vectors Christoph Hellwig
  2017-02-15  7:58 ` [PATCH 2/2] PCI: update MSI/MSI-X bits in PCIEBUS-HOWTO Christoph Hellwig
@ 2017-02-15 16:37 ` Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2017-02-15 16:37 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Bjorn Helgaas, Jonathan Corbet, linux-pci, linux-doc

On Wed, Feb 15, 2017 at 08:58:21AM +0100, Christoph Hellwig wrote:
> Avoid mentioning deprecated APIs and make the text a little
> easier to understand.

Applied to pci/msi for v4.11, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-02-15 16:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-15  7:58 two small PCI documentation fixups Christoph Hellwig
2017-02-15  7:58 ` [PATCH 1/2] PCI: update pci.txt to talk about pci_alloc_irq_vectors Christoph Hellwig
2017-02-15  7:58 ` [PATCH 2/2] PCI: update MSI/MSI-X bits in PCIEBUS-HOWTO Christoph Hellwig
2017-02-15 16:37 ` two small PCI documentation fixups Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).