diff options
Diffstat (limited to 'Documentation/MSI-HOWTO.txt')
-rw-r--r-- | Documentation/MSI-HOWTO.txt | 69 |
1 files changed, 4 insertions, 65 deletions
diff --git a/Documentation/MSI-HOWTO.txt b/Documentation/MSI-HOWTO.txt index 0d8240774fca..a51f693c1541 100644 --- a/Documentation/MSI-HOWTO.txt +++ b/Documentation/MSI-HOWTO.txt | |||
@@ -241,68 +241,7 @@ address space of the MSI-X table/MSI-X PBA. Otherwise, the PCI subsystem | |||
241 | will fail enabling MSI-X on its hardware device when it calls the function | 241 | will fail enabling MSI-X on its hardware device when it calls the function |
242 | pci_enable_msix(). | 242 | pci_enable_msix(). |
243 | 243 | ||
244 | 5.3.2 Handling MSI-X allocation | 244 | 5.3.2 API pci_enable_msix |
245 | |||
246 | Determining the number of MSI-X vectors allocated to a function is | ||
247 | dependent on the number of MSI capable devices and MSI-X capable | ||
248 | devices populated in the system. The policy of allocating MSI-X | ||
249 | vectors to a function is defined as the following: | ||
250 | |||
251 | #of MSI-X vectors allocated to a function = (x - y)/z where | ||
252 | |||
253 | x = The number of available PCI vector resources by the time | ||
254 | the device driver calls pci_enable_msix(). The PCI vector | ||
255 | resources is the sum of the number of unassigned vectors | ||
256 | (new) and the number of released vectors when any MSI/MSI-X | ||
257 | device driver switches its hardware device back to a legacy | ||
258 | mode or is hot-removed. The number of unassigned vectors | ||
259 | may exclude some vectors reserved, as defined in parameter | ||
260 | NR_HP_RESERVED_VECTORS, for the case where the system is | ||
261 | capable of supporting hot-add/hot-remove operations. Users | ||
262 | may change the value defined in NR_HR_RESERVED_VECTORS to | ||
263 | meet their specific needs. | ||
264 | |||
265 | y = The number of MSI capable devices populated in the system. | ||
266 | This policy ensures that each MSI capable device has its | ||
267 | vector reserved to avoid the case where some MSI-X capable | ||
268 | drivers may attempt to claim all available vector resources. | ||
269 | |||
270 | z = The number of MSI-X capable devices populated in the system. | ||
271 | This policy ensures that maximum (x - y) is distributed | ||
272 | evenly among MSI-X capable devices. | ||
273 | |||
274 | Note that the PCI subsystem scans y and z during a bus enumeration. | ||
275 | When the PCI subsystem completes configuring MSI/MSI-X capability | ||
276 | structure of a device as requested by its device driver, y/z is | ||
277 | decremented accordingly. | ||
278 | |||
279 | 5.3.3 Handling MSI-X shortages | ||
280 | |||
281 | For the case where fewer MSI-X vectors are allocated to a function | ||
282 | than requested, the function pci_enable_msix() will return the | ||
283 | maximum number of MSI-X vectors available to the caller. A device | ||
284 | driver may re-send its request with fewer or equal vectors indicated | ||
285 | in the return. For example, if a device driver requests 5 vectors, but | ||
286 | the number of available vectors is 3 vectors, a value of 3 will be | ||
287 | returned as a result of pci_enable_msix() call. A function could be | ||
288 | designed for its driver to use only 3 MSI-X table entries as | ||
289 | different combinations as ABC--, A-B-C, A--CB, etc. Note that this | ||
290 | patch does not support multiple entries with the same vector. Such | ||
291 | attempt by a device driver to use 5 MSI-X table entries with 3 vectors | ||
292 | as ABBCC, AABCC, BCCBA, etc will result as a failure by the function | ||
293 | pci_enable_msix(). Below are the reasons why supporting multiple | ||
294 | entries with the same vector is an undesirable solution. | ||
295 | |||
296 | - The PCI subsystem cannot determine the entry that | ||
297 | generated the message to mask/unmask MSI while handling | ||
298 | software driver ISR. Attempting to walk through all MSI-X | ||
299 | table entries (2048 max) to mask/unmask any match vector | ||
300 | is an undesirable solution. | ||
301 | |||
302 | - Walking through all MSI-X table entries (2048 max) to handle | ||
303 | SMP affinity of any match vector is an undesirable solution. | ||
304 | |||
305 | 5.3.4 API pci_enable_msix | ||
306 | 245 | ||
307 | int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec) | 246 | int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec) |
308 | 247 | ||
@@ -339,7 +278,7 @@ a failure. This failure may be a result of duplicate entries | |||
339 | specified in second argument, or a result of no available vector, | 278 | specified in second argument, or a result of no available vector, |
340 | or a result of failing to initialize MSI-X table entries. | 279 | or a result of failing to initialize MSI-X table entries. |
341 | 280 | ||
342 | 5.3.5 API pci_disable_msix | 281 | 5.3.3 API pci_disable_msix |
343 | 282 | ||
344 | void pci_disable_msix(struct pci_dev *dev) | 283 | void pci_disable_msix(struct pci_dev *dev) |
345 | 284 | ||
@@ -349,7 +288,7 @@ always call free_irq() on all MSI-X vectors it has done request_irq() | |||
349 | on before calling this API. Failure to do so results in a BUG_ON() and | 288 | on before calling this API. Failure to do so results in a BUG_ON() and |
350 | a device will be left with MSI-X enabled and leaks its vectors. | 289 | a device will be left with MSI-X enabled and leaks its vectors. |
351 | 290 | ||
352 | 5.3.6 MSI-X mode vs. legacy mode diagram | 291 | 5.3.4 MSI-X mode vs. legacy mode diagram |
353 | 292 | ||
354 | The below diagram shows the events which switch the interrupt | 293 | The below diagram shows the events which switch the interrupt |
355 | mode on the MSI-X capable device function between MSI-X mode and | 294 | 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. | |||
407 | MSI/MSI-X support requires support from both system hardware and | 346 | MSI/MSI-X support requires support from both system hardware and |
408 | individual hardware device functions. | 347 | individual hardware device functions. |
409 | 348 | ||
410 | 5.5.1 System hardware support | 349 | 5.5.1 Required x86 hardware support |
411 | 350 | ||
412 | Since the target of MSI address is the local APIC CPU, enabling | 351 | Since the target of MSI address is the local APIC CPU, enabling |
413 | MSI/MSI-X support in the Linux kernel is dependent on whether existing | 352 | MSI/MSI-X support in the Linux kernel is dependent on whether existing |