Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a84258e authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6: (37 commits)
  PCI: merge almost all of pci_32.h and pci_64.h together
  PCI: X86: Introduce and enable PCI domain support
  PCI: Add 'nodomains' boot option, and pci_domains_supported global
  PCI: modify PCI bridge control ISA flag for clarity
  PCI: use _CRS for PCI resource allocation
  PCI: avoid P2P prefetch window for expansion ROMs
  PCI: skip ISA ioresource alignment on some systems
  PCI: remove transparent bridge sizing
  pci: write file size to inode on proc bus file write
  pci: use size stored in proc_dir_entry for proc bus files
  pci: implement "pci=noaer"
  PCI: fix IDE legacy mode resources
  MSI: Use correct data offset for 32-bit MSI in read_msi_msg()
  PCI: Fix incorrect argument order to list_add_tail() in PCI dynamic ID code
  PCI: i386: Compaq EVO N800c needs PCI bus renumbering
  PCI: Remove no longer correct documentation regarding MSI vector assignment
  PCI: re-enable onboard sound on "MSI K8T Neo2-FIR"
  PCI: quirk_vt82c586_acpi: Omit reading PCI revision ID
  PCI: quirk amd_8131_mmrbc: Omit reading pci revision ID
  cpqphp: Use PCI_CLASS_REVISION instead of PCI_REVISION_ID for read
  ...
parents efefc6eb f3e6f164
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -68,6 +68,9 @@ size and dma_handle must all be the same as those passed into the
consistent allocate.  cpu_addr must be the virtual address returned by
the consistent allocate.

Note that unlike their sibling allocation calls, these routines
may only be called with IRQs enabled.


Part Ib - Using small dma-coherent buffers
------------------------------------------
+4 −65
Original line number Diff line number Diff line
@@ -241,68 +241,7 @@ address space of the MSI-X table/MSI-X PBA. Otherwise, the PCI subsystem
will fail enabling MSI-X on its hardware device when it calls the function
pci_enable_msix().

5.3.2 Handling MSI-X allocation

Determining the number of MSI-X vectors allocated to a function is
dependent on the number of MSI capable devices and MSI-X capable
devices populated in the system. The policy of allocating MSI-X
vectors to a function is defined as the following:

#of MSI-X vectors allocated to a function = (x - y)/z where

x = 	The number of available PCI vector resources by the time
	the device driver calls pci_enable_msix(). The PCI vector
	resources is the sum of the number of unassigned vectors
	(new) and the number of released vectors when any MSI/MSI-X
	device driver switches its hardware device back to a legacy
	mode or is hot-removed.	The number of unassigned vectors
	may exclude some vectors reserved, as defined in parameter
	NR_HP_RESERVED_VECTORS, for the case where the system is
	capable of supporting hot-add/hot-remove operations. Users
	may change the value defined in NR_HR_RESERVED_VECTORS to
	meet their specific needs.

y =	The number of MSI capable devices populated in the system.
	This policy ensures that each MSI capable device has its
	vector reserved to avoid the case where some MSI-X capable
	drivers may attempt to claim all available vector resources.

z =	The number of MSI-X capable devices populated in the system.
	This policy ensures that maximum (x - y) is distributed
	evenly among MSI-X capable devices.

Note that the PCI subsystem scans y and z during a bus enumeration.
When the PCI subsystem completes configuring MSI/MSI-X capability
structure of a device as requested by its device driver, y/z is
decremented accordingly.

5.3.3 Handling MSI-X shortages

For the case where fewer MSI-X vectors are allocated to a function
than requested, the function pci_enable_msix() will return the
maximum number of MSI-X vectors available to the caller. A device
driver may re-send its request with fewer or equal vectors indicated
in the return. For example, if a device driver requests 5 vectors, but
the number of available vectors is 3 vectors, a value of 3 will be
returned as a result of pci_enable_msix() call. A function could be
designed for its driver to use only 3 MSI-X table entries as
different combinations as ABC--, A-B-C, A--CB, etc. Note that this
patch does not support multiple entries with the same vector. Such
attempt by a device driver to use 5 MSI-X table entries with 3 vectors
as ABBCC, AABCC, BCCBA, etc will result as a failure by the function
pci_enable_msix(). Below are the reasons why supporting multiple
entries with the same vector is an undesirable solution.

	- The PCI subsystem cannot determine the entry that
	  generated the message to mask/unmask MSI while handling
	  software driver ISR. Attempting to walk through all MSI-X
	  table entries (2048 max) to mask/unmask any match vector
	  is an undesirable solution.

	- Walking through all MSI-X table entries (2048 max) to handle
	  SMP affinity of any match vector is an undesirable solution.

5.3.4 API pci_enable_msix
5.3.2 API pci_enable_msix

int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec)

@@ -339,7 +278,7 @@ a failure. This failure may be a result of duplicate entries
specified in second argument, or a result of no available vector,
or a result of failing to initialize MSI-X table entries.

5.3.5 API pci_disable_msix
5.3.3 API pci_disable_msix

void pci_disable_msix(struct pci_dev *dev)

@@ -349,7 +288,7 @@ always call free_irq() on all MSI-X vectors it has done request_irq()
on before calling this API. Failure to do so results in a BUG_ON() and
a device will be left with MSI-X enabled and leaks its vectors.

5.3.6 MSI-X mode vs. legacy mode diagram
5.3.4 MSI-X mode vs. legacy mode diagram

The below diagram shows the events which switch the interrupt
mode on the MSI-X capable device function between MSI-X mode and
@@ -407,7 +346,7 @@ between MSI mod MSI-X mode during a run-time.
MSI/MSI-X support requires support from both system hardware and
individual hardware device functions.

5.5.1 System hardware support
5.5.1 Required x86 hardware support

Since the target of MSI address is the local APIC CPU, enabling
MSI/MSI-X support in the Linux kernel is dependent on whether existing
+8 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ parameter is applicable:
	PARIDE	The ParIDE (parallel port IDE) subsystem is enabled.
	PARISC	The PA-RISC architecture is enabled.
	PCI	PCI bus support is enabled.
	PCIE	PCI Express support is enabled.
	PCMCIA	The PCMCIA subsystem is enabled.
	PNP	Plug & Play support is enabled.
	PPC	PowerPC architecture is enabled.
@@ -1277,6 +1278,11 @@ and is between 256 and 4096 characters. It is defined in the file
				Mechanism 1.
		conf2		[X86-32] Force use of PCI Configuration
				Mechanism 2.
		noaer		[PCIE] If the PCIEAER kernel config parameter is
				enabled, this kernel boot option can be used to
				disable the use of PCIE advanced error reporting.
		nodomains	[PCI] Disable support for multiple PCI
				root domains (aka PCI segments, in ACPI-speak).
		nommconf	[X86-32,X86_64] Disable use of MMCONFIG for PCI
				Configuration
		nomsi		[MSI] If the PCI_MSI kernel config parameter is
@@ -1321,6 +1327,8 @@ and is between 256 and 4096 characters. It is defined in the file
				IRQ routing is enabled.
		noacpi		[X86-32] Do not use ACPI for IRQ routing
				or for PCI scanning.
		use_crs		[X86-32] Use _CRS for PCI resource
				allocation.
		routeirq	Do IRQ routing for all PCI devices.
				This is normally done in pci_enable_device(),
				so this option is a temporary workaround
+5 −0
Original line number Diff line number Diff line
@@ -1137,6 +1137,11 @@ config PCI_MMCONFIG
	depends on PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY)
	default y

config PCI_DOMAINS
	bool
	depends on PCI
	default y

source "drivers/pci/pcie/Kconfig"

source "drivers/pci/Kconfig"
+2 −1
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ void dma_free_coherent(struct device *dev, size_t size,
	struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
	int order = get_order(size);

	WARN_ON(irqs_disabled());	/* for portability */
	if (mem && vaddr >= mem->virt_base && vaddr < (mem->virt_base + (mem->size << PAGE_SHIFT))) {
		int page = (vaddr - mem->virt_base) >> PAGE_SHIFT;

Loading