aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRandy Dunlap <rdunlap@xenotime.net>2005-11-07 04:01:03 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:53:55 -0500
commit2500e7abc8f606d87b2590f205dac080640b6b04 (patch)
treebb01a1f147360ef22b9a67e9ba8d552e40441a66
parent62a07e6e9e93eda88a6eeb5009fc46d44ca60281 (diff)
[PATCH] Doc/MSI-HOWTO: cleanups
Clean up typos, kernel function interfaces, acronyms, add whitespace, improve readability. Signed-off-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--Documentation/MSI-HOWTO.txt174
1 files changed, 91 insertions, 83 deletions
diff --git a/Documentation/MSI-HOWTO.txt b/Documentation/MSI-HOWTO.txt
index 63edc5f847c4..3ec6c720b016 100644
--- a/Documentation/MSI-HOWTO.txt
+++ b/Documentation/MSI-HOWTO.txt
@@ -10,14 +10,22 @@
10This guide describes the basics of Message Signaled Interrupts (MSI), 10This guide describes the basics of Message Signaled Interrupts (MSI),
11the advantages of using MSI over traditional interrupt mechanisms, 11the advantages of using MSI over traditional interrupt mechanisms,
12and how to enable your driver to use MSI or MSI-X. Also included is 12and how to enable your driver to use MSI or MSI-X. Also included is
13a Frequently Asked Questions. 13a Frequently Asked Questions (FAQ) section.
14
151.1 Terminology
16
17PCI devices can be single-function or multi-function. In either case,
18when this text talks about enabling or disabling MSI on a "device
19function," it is referring to one specific PCI device and function and
20not to all functions on a PCI device (unless the PCI device has only
21one function).
14 22
152. Copyright 2003 Intel Corporation 232. Copyright 2003 Intel Corporation
16 24
173. What is MSI/MSI-X? 253. What is MSI/MSI-X?
18 26
19Message Signaled Interrupt (MSI), as described in the PCI Local Bus 27Message Signaled Interrupt (MSI), as described in the PCI Local Bus
20Specification Revision 2.3 or latest, is an optional feature, and a 28Specification Revision 2.3 or later, is an optional feature, and a
21required feature for PCI Express devices. MSI enables a device function 29required feature for PCI Express devices. MSI enables a device function
22to request service by sending an Inbound Memory Write on its PCI bus to 30to request service by sending an Inbound Memory Write on its PCI bus to
23the FSB as a Message Signal Interrupt transaction. Because MSI is 31the FSB as a Message Signal Interrupt transaction. Because MSI is
@@ -27,7 +35,7 @@ supported.
27 35
28A PCI device that supports MSI must also support pin IRQ assertion 36A PCI device that supports MSI must also support pin IRQ assertion
29interrupt mechanism to provide backward compatibility for systems that 37interrupt mechanism to provide backward compatibility for systems that
30do not support MSI. In Systems, which support MSI, the bus driver is 38do not support MSI. In systems which support MSI, the bus driver is
31responsible for initializing the message address and message data of 39responsible for initializing the message address and message data of
32the device function's MSI/MSI-X capability structure during device 40the device function's MSI/MSI-X capability structure during device
33initial configuration. 41initial configuration.
@@ -61,17 +69,17 @@ over the MSI capability structure as described below.
61 69
62 - MSI and MSI-X both support per-vector masking. Per-vector 70 - MSI and MSI-X both support per-vector masking. Per-vector
63 masking is an optional extension of MSI but a required 71 masking is an optional extension of MSI but a required
64 feature for MSI-X. Per-vector masking provides the kernel 72 feature for MSI-X. Per-vector masking provides the kernel the
65 the ability to mask/unmask MSI when servicing its software 73 ability to mask/unmask a single MSI while running its
66 interrupt service routing handler. If per-vector masking is 74 interrupt service routine. If per-vector masking is
67 not supported, then the device driver should provide the 75 not supported, then the device driver should provide the
68 hardware/software synchronization to ensure that the device 76 hardware/software synchronization to ensure that the device
69 generates MSI when the driver wants it to do so. 77 generates MSI when the driver wants it to do so.
70 78
714. Why use MSI? 794. Why use MSI?
72 80
73As a benefit the simplification of board design, MSI allows board 81As a benefit to the simplification of board design, MSI allows board
74designers to remove out of band interrupt routing. MSI is another 82designers to remove out-of-band interrupt routing. MSI is another
75step towards a legacy-free environment. 83step towards a legacy-free environment.
76 84
77Due to increasing pressure on chipset and processor packages to 85Due to increasing pressure on chipset and processor packages to
@@ -87,7 +95,7 @@ support. As a result, the PCI Express technology requires MSI
87support for better interrupt performance. 95support for better interrupt performance.
88 96
89Using MSI enables the device functions to support two or more 97Using MSI enables the device functions to support two or more
90vectors, which can be configured to target different CPU's to 98vectors, which can be configured to target different CPUs to
91increase scalability. 99increase scalability.
92 100
935. Configuring a driver to use MSI/MSI-X 1015. Configuring a driver to use MSI/MSI-X
@@ -119,13 +127,13 @@ pci_enable_msi() explicitly.
119 127
120int pci_enable_msi(struct pci_dev *dev) 128int pci_enable_msi(struct pci_dev *dev)
121 129
122With this new API, any existing device driver, which like to have 130With this new API, a device driver that wants to have MSI
123MSI enabled on its device function, must call this API to enable MSI 131enabled on its device function must call this API to enable MSI.
124A successful call will initialize the MSI capability structure 132A successful call will initialize the MSI capability structure
125with ONE vector, regardless of whether a device function is 133with ONE vector, regardless of whether a device function is
126capable of supporting multiple messages. This vector replaces the 134capable of supporting multiple messages. This vector replaces the
127pre-assigned dev->irq with a new MSI vector. To avoid the conflict 135pre-assigned dev->irq with a new MSI vector. To avoid a conflict
128of new assigned vector with existing pre-assigned vector requires 136of the new assigned vector with existing pre-assigned vector requires
129a device driver to call this API before calling request_irq(). 137a device driver to call this API before calling request_irq().
130 138
1315.2.2 API pci_disable_msi 1395.2.2 API pci_disable_msi
@@ -137,14 +145,14 @@ when a device driver is unloading. This API restores dev->irq with
137the pre-assigned IOAPIC vector and switches a device's interrupt 145the pre-assigned IOAPIC vector and switches a device's interrupt
138mode to PCI pin-irq assertion/INTx emulation mode. 146mode to PCI pin-irq assertion/INTx emulation mode.
139 147
140Note that a device driver should always call free_irq() on MSI vector 148Note that a device driver should always call free_irq() on the MSI vector
141it has done request_irq() on before calling this API. Failure to do 149that it has done request_irq() on before calling this API. Failure to do
142so results a BUG_ON() and a device will be left with MSI enabled and 150so results in a BUG_ON() and a device will be left with MSI enabled and
143leaks its vector. 151leaks its vector.
144 152
1455.2.3 MSI mode vs. legacy mode diagram 1535.2.3 MSI mode vs. legacy mode diagram
146 154
147The below diagram shows the events, which switches the interrupt 155The below diagram shows the events which switch the interrupt
148mode on the MSI-capable device function between MSI mode and 156mode on the MSI-capable device function between MSI mode and
149PIN-IRQ assertion mode. 157PIN-IRQ assertion mode.
150 158
@@ -155,9 +163,9 @@ PIN-IRQ assertion mode.
155 ------------ pci_disable_msi ------------------------ 163 ------------ pci_disable_msi ------------------------
156 164
157 165
158Figure 1.0 MSI Mode vs. Legacy Mode 166Figure 1. MSI Mode vs. Legacy Mode
159 167
160In Figure 1.0, a device operates by default in legacy mode. Legacy 168In Figure 1, a device operates by default in legacy mode. Legacy
161in this context means PCI pin-irq assertion or PCI-Express INTx 169in this context means PCI pin-irq assertion or PCI-Express INTx
162emulation. A successful MSI request (using pci_enable_msi()) switches 170emulation. A successful MSI request (using pci_enable_msi()) switches
163a device's interrupt mode to MSI mode. A pre-assigned IOAPIC vector 171a device's interrupt mode to MSI mode. A pre-assigned IOAPIC vector
@@ -166,11 +174,11 @@ assigned MSI vector will replace dev->irq.
166 174
167To return back to its default mode, a device driver should always call 175To return back to its default mode, a device driver should always call
168pci_disable_msi() to undo the effect of pci_enable_msi(). Note that a 176pci_disable_msi() to undo the effect of pci_enable_msi(). Note that a
169device driver should always call free_irq() on MSI vector it has done 177device driver should always call free_irq() on the MSI vector it has
170request_irq() on before calling pci_disable_msi(). Failure to do so 178done request_irq() on before calling pci_disable_msi(). Failure to do
171results a BUG_ON() and a device will be left with MSI enabled and 179so results in a BUG_ON() and a device will be left with MSI enabled and
172leaks its vector. Otherwise, the PCI subsystem restores a device's 180leaks its vector. Otherwise, the PCI subsystem restores a device's
173dev->irq with a pre-assigned IOAPIC vector and marks released 181dev->irq with a pre-assigned IOAPIC vector and marks the released
174MSI vector as unused. 182MSI vector as unused.
175 183
176Once being marked as unused, there is no guarantee that the PCI 184Once being marked as unused, there is no guarantee that the PCI
@@ -178,8 +186,8 @@ subsystem will reserve this MSI vector for a device. Depending on
178the availability of current PCI vector resources and the number of 186the availability of current PCI vector resources and the number of
179MSI/MSI-X requests from other drivers, this MSI may be re-assigned. 187MSI/MSI-X requests from other drivers, this MSI may be re-assigned.
180 188
181For the case where the PCI subsystem re-assigned this MSI vector 189For the case where the PCI subsystem re-assigns this MSI vector to
182another driver, a request to switching back to MSI mode may result 190another driver, a request to switch back to MSI mode may result
183in being assigned a different MSI vector or a failure if no more 191in being assigned a different MSI vector or a failure if no more
184vectors are available. 192vectors are available.
185 193
@@ -208,12 +216,12 @@ Unlike the function pci_enable_msi(), the function pci_enable_msix()
208does not replace the pre-assigned IOAPIC dev->irq with a new MSI 216does not replace the pre-assigned IOAPIC dev->irq with a new MSI
209vector because the PCI subsystem writes the 1:1 vector-to-entry mapping 217vector because the PCI subsystem writes the 1:1 vector-to-entry mapping
210into the field vector of each element contained in a second argument. 218into the field vector of each element contained in a second argument.
211Note that the pre-assigned IO-APIC dev->irq is valid only if the device 219Note that the pre-assigned IOAPIC dev->irq is valid only if the device
212operates in PIN-IRQ assertion mode. In MSI-X mode, any attempt of 220operates in PIN-IRQ assertion mode. In MSI-X mode, any attempt at
213using dev->irq by the device driver to request for interrupt service 221using dev->irq by the device driver to request for interrupt service
214may result unpredictabe behavior. 222may result unpredictabe behavior.
215 223
216For each MSI-X vector granted, a device driver is responsible to call 224For each MSI-X vector granted, a device driver is responsible for calling
217other functions like request_irq(), enable_irq(), etc. to enable 225other functions like request_irq(), enable_irq(), etc. to enable
218this vector with its corresponding interrupt service handler. It is 226this vector with its corresponding interrupt service handler. It is
219a device driver's choice to assign all vectors with the same 227a device driver's choice to assign all vectors with the same
@@ -224,13 +232,13 @@ service handler.
224 232
225The PCI 3.0 specification has implementation notes that MMIO address 233The PCI 3.0 specification has implementation notes that MMIO address
226space for a device's MSI-X structure should be isolated so that the 234space for a device's MSI-X structure should be isolated so that the
227software system can set different page for controlling accesses to 235software system can set different pages for controlling accesses to the
228the MSI-X structure. The implementation of MSI patch requires the PCI 236MSI-X structure. The implementation of MSI support requires the PCI
229subsystem, not a device driver, to maintain full control of the MSI-X 237subsystem, not a device driver, to maintain full control of the MSI-X
230table/MSI-X PBA and MMIO address space of the MSI-X table/MSI-X PBA. 238table/MSI-X PBA (Pending Bit Array) and MMIO address space of the MSI-X
231A device driver is prohibited from requesting the MMIO address space 239table/MSI-X PBA. A device driver is prohibited from requesting the MMIO
232of the MSI-X table/MSI-X PBA. Otherwise, the PCI subsystem will fail 240address space of the MSI-X table/MSI-X PBA. Otherwise, the PCI subsystem
233enabling MSI-X on its hardware device when it calls the function 241will fail enabling MSI-X on its hardware device when it calls the function
234pci_enable_msix(). 242pci_enable_msix().
235 243
2365.3.2 Handling MSI-X allocation 2445.3.2 Handling MSI-X allocation
@@ -274,9 +282,9 @@ For the case where fewer MSI-X vectors are allocated to a function
274than requested, the function pci_enable_msix() will return the 282than requested, the function pci_enable_msix() will return the
275maximum number of MSI-X vectors available to the caller. A device 283maximum number of MSI-X vectors available to the caller. A device
276driver may re-send its request with fewer or equal vectors indicated 284driver may re-send its request with fewer or equal vectors indicated
277in a return. For example, if a device driver requests 5 vectors, but 285in the return. For example, if a device driver requests 5 vectors, but
278the number of available vectors is 3 vectors, a value of 3 will be a 286the number of available vectors is 3 vectors, a value of 3 will be
279return as a result of pci_enable_msix() call. A function could be 287returned as a result of pci_enable_msix() call. A function could be
280designed for its driver to use only 3 MSI-X table entries as 288designed for its driver to use only 3 MSI-X table entries as
281different combinations as ABC--, A-B-C, A--CB, etc. Note that this 289different combinations as ABC--, A-B-C, A--CB, etc. Note that this
282patch does not support multiple entries with the same vector. Such 290patch does not support multiple entries with the same vector. Such
@@ -285,49 +293,46 @@ as ABBCC, AABCC, BCCBA, etc will result as a failure by the function
285pci_enable_msix(). Below are the reasons why supporting multiple 293pci_enable_msix(). Below are the reasons why supporting multiple
286entries with the same vector is an undesirable solution. 294entries with the same vector is an undesirable solution.
287 295
288 - The PCI subsystem can not determine which entry, which 296 - The PCI subsystem cannot determine the entry that
289 generated the message, to mask/unmask MSI while handling 297 generated the message to mask/unmask MSI while handling
290 software driver ISR. Attempting to walk through all MSI-X 298 software driver ISR. Attempting to walk through all MSI-X
291 table entries (2048 max) to mask/unmask any match vector 299 table entries (2048 max) to mask/unmask any match vector
292 is an undesirable solution. 300 is an undesirable solution.
293 301
294 - Walk through all MSI-X table entries (2048 max) to handle 302 - Walking through all MSI-X table entries (2048 max) to handle
295 SMP affinity of any match vector is an undesirable solution. 303 SMP affinity of any match vector is an undesirable solution.
296 304
2975.3.4 API pci_enable_msix 3055.3.4 API pci_enable_msix
298 306
299int pci_enable_msix(struct pci_dev *dev, u32 *entries, int nvec) 307int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec)
300 308
301This API enables a device driver to request the PCI subsystem 309This API enables a device driver to request the PCI subsystem
302for enabling MSI-X messages on its hardware device. Depending on 310to enable MSI-X messages on its hardware device. Depending on
303the availability of PCI vectors resources, the PCI subsystem enables 311the availability of PCI vectors resources, the PCI subsystem enables
304either all or nothing. 312either all or none of the requested vectors.
305 313
306Argument dev points to the device (pci_dev) structure. 314Argument 'dev' points to the device (pci_dev) structure.
307 315
308Argument entries is a pointer of unsigned integer type. The number of 316Argument 'entries' is a pointer to an array of msix_entry structs.
309elements is indicated in argument nvec. The content of each element 317The number of entries is indicated in argument 'nvec'.
310will be mapped to the following struct defined in /driver/pci/msi.h. 318struct msix_entry is defined in /driver/pci/msi.h:
311 319
312struct msix_entry { 320struct msix_entry {
313 u16 vector; /* kernel uses to write alloc vector */ 321 u16 vector; /* kernel uses to write alloc vector */
314 u16 entry; /* driver uses to specify entry */ 322 u16 entry; /* driver uses to specify entry */
315}; 323};
316 324
317A device driver is responsible for initializing the field entry of 325A device driver is responsible for initializing the field 'entry' of
318each element with unique entry supported by MSI-X table. Otherwise, 326each element with a unique entry supported by MSI-X table. Otherwise,
319-EINVAL will be returned as a result. A successful return of zero 327-EINVAL will be returned as a result. A successful return of zero
320indicates the PCI subsystem completes initializing each of requested 328indicates the PCI subsystem completed initializing each of the requested
321entries of the MSI-X table with message address and message data. 329entries of the MSI-X table with message address and message data.
322Last but not least, the PCI subsystem will write the 1:1 330Last but not least, the PCI subsystem will write the 1:1
323vector-to-entry mapping into the field vector of each element. A 331vector-to-entry mapping into the field 'vector' of each element. A
324device driver is responsible of keeping track of allocated MSI-X 332device driver is responsible for keeping track of allocated MSI-X
325vectors in its internal data structure. 333vectors in its internal data structure.
326 334
327Argument nvec is an integer indicating the number of messages 335A return of zero indicates that the number of MSI-X vectors was
328requested.
329
330A return of zero indicates that the number of MSI-X vectors is
331successfully allocated. A return of greater than zero indicates 336successfully allocated. A return of greater than zero indicates
332MSI-X vector shortage. Or a return of less than zero indicates 337MSI-X vector shortage. Or a return of less than zero indicates
333a failure. This failure may be a result of duplicate entries 338a failure. This failure may be a result of duplicate entries
@@ -341,12 +346,12 @@ void pci_disable_msix(struct pci_dev *dev)
341This API should always be used to undo the effect of pci_enable_msix() 346This API should always be used to undo the effect of pci_enable_msix()
342when a device driver is unloading. Note that a device driver should 347when a device driver is unloading. Note that a device driver should
343always call free_irq() on all MSI-X vectors it has done request_irq() 348always call free_irq() on all MSI-X vectors it has done request_irq()
344on before calling this API. Failure to do so results a BUG_ON() and 349on before calling this API. Failure to do so results in a BUG_ON() and
345a device will be left with MSI-X enabled and leaks its vectors. 350a device will be left with MSI-X enabled and leaks its vectors.
346 351
3475.3.6 MSI-X mode vs. legacy mode diagram 3525.3.6 MSI-X mode vs. legacy mode diagram
348 353
349The below diagram shows the events, which switches the interrupt 354The below diagram shows the events which switch the interrupt
350mode on the MSI-X capable device function between MSI-X mode and 355mode on the MSI-X capable device function between MSI-X mode and
351PIN-IRQ assertion mode (legacy). 356PIN-IRQ assertion mode (legacy).
352 357
@@ -356,22 +361,22 @@ PIN-IRQ assertion mode (legacy).
356 | | ===============> | | 361 | | ===============> | |
357 ------------ pci_disable_msix ------------------------ 362 ------------ pci_disable_msix ------------------------
358 363
359Figure 2.0 MSI-X Mode vs. Legacy Mode 364Figure 2. MSI-X Mode vs. Legacy Mode
360 365
361In Figure 2.0, a device operates by default in legacy mode. A 366In Figure 2, a device operates by default in legacy mode. A
362successful MSI-X request (using pci_enable_msix()) switches a 367successful MSI-X request (using pci_enable_msix()) switches a
363device's interrupt mode to MSI-X mode. A pre-assigned IOAPIC vector 368device's interrupt mode to MSI-X mode. A pre-assigned IOAPIC vector
364stored in dev->irq will be saved by the PCI subsystem; however, 369stored in dev->irq will be saved by the PCI subsystem; however,
365unlike MSI mode, the PCI subsystem will not replace dev->irq with 370unlike MSI mode, the PCI subsystem will not replace dev->irq with
366assigned MSI-X vector because the PCI subsystem already writes the 1:1 371assigned MSI-X vector because the PCI subsystem already writes the 1:1
367vector-to-entry mapping into the field vector of each element 372vector-to-entry mapping into the field 'vector' of each element
368specified in second argument. 373specified in second argument.
369 374
370To return back to its default mode, a device driver should always call 375To return back to its default mode, a device driver should always call
371pci_disable_msix() to undo the effect of pci_enable_msix(). Note that 376pci_disable_msix() to undo the effect of pci_enable_msix(). Note that
372a device driver should always call free_irq() on all MSI-X vectors it 377a device driver should always call free_irq() on all MSI-X vectors it
373has done request_irq() on before calling pci_disable_msix(). Failure 378has done request_irq() on before calling pci_disable_msix(). Failure
374to do so results a BUG_ON() and a device will be left with MSI-X 379to do so results in a BUG_ON() and a device will be left with MSI-X
375enabled and leaks its vectors. Otherwise, the PCI subsystem switches a 380enabled and leaks its vectors. Otherwise, the PCI subsystem switches a
376device function's interrupt mode from MSI-X mode to legacy mode and 381device function's interrupt mode from MSI-X mode to legacy mode and
377marks all allocated MSI-X vectors as unused. 382marks all allocated MSI-X vectors as unused.
@@ -383,53 +388,56 @@ MSI/MSI-X requests from other drivers, these MSI-X vectors may be
383re-assigned. 388re-assigned.
384 389
385For the case where the PCI subsystem re-assigned these MSI-X vectors 390For the case where the PCI subsystem re-assigned these MSI-X vectors
386to other driver, a request to switching back to MSI-X mode may result 391to other drivers, a request to switch back to MSI-X mode may result
387being assigned with another set of MSI-X vectors or a failure if no 392being assigned with another set of MSI-X vectors or a failure if no
388more vectors are available. 393more vectors are available.
389 394
3905.4 Handling function implementng both MSI and MSI-X capabilities 3955.4 Handling function implementing both MSI and MSI-X capabilities
391 396
392For the case where a function implements both MSI and MSI-X 397For the case where a function implements both MSI and MSI-X
393capabilities, the PCI subsystem enables a device to run either in MSI 398capabilities, the PCI subsystem enables a device to run either in MSI
394mode or MSI-X mode but not both. A device driver determines whether it 399mode or MSI-X mode but not both. A device driver determines whether it
395wants MSI or MSI-X enabled on its hardware device. Once a device 400wants MSI or MSI-X enabled on its hardware device. Once a device
396driver requests for MSI, for example, it is prohibited to request for 401driver requests for MSI, for example, it is prohibited from requesting
397MSI-X; in other words, a device driver is not permitted to ping-pong 402MSI-X; in other words, a device driver is not permitted to ping-pong
398between MSI mod MSI-X mode during a run-time. 403between MSI mod MSI-X mode during a run-time.
399 404
4005.5 Hardware requirements for MSI/MSI-X support 4055.5 Hardware requirements for MSI/MSI-X support
406
401MSI/MSI-X support requires support from both system hardware and 407MSI/MSI-X support requires support from both system hardware and
402individual hardware device functions. 408individual hardware device functions.
403 409
4045.5.1 System hardware support 4105.5.1 System hardware support
411
405Since the target of MSI address is the local APIC CPU, enabling 412Since the target of MSI address is the local APIC CPU, enabling
406MSI/MSI-X support in Linux kernel is dependent on whether existing 413MSI/MSI-X support in the Linux kernel is dependent on whether existing
407system hardware supports local APIC. Users should verify their 414system hardware supports local APIC. Users should verify that their
408system whether it runs when CONFIG_X86_LOCAL_APIC=y. 415system supports local APIC operation by testing that it runs when
416CONFIG_X86_LOCAL_APIC=y.
409 417
410In SMP environment, CONFIG_X86_LOCAL_APIC is automatically set; 418In SMP environment, CONFIG_X86_LOCAL_APIC is automatically set;
411however, in UP environment, users must manually set 419however, in UP environment, users must manually set
412CONFIG_X86_LOCAL_APIC. Once CONFIG_X86_LOCAL_APIC=y, setting 420CONFIG_X86_LOCAL_APIC. Once CONFIG_X86_LOCAL_APIC=y, setting
413CONFIG_PCI_MSI enables the VECTOR based scheme and 421CONFIG_PCI_MSI enables the VECTOR based scheme and the option for
414the option for MSI-capable device drivers to selectively enable 422MSI-capable device drivers to selectively enable MSI/MSI-X.
415MSI/MSI-X.
416 423
417Note that CONFIG_X86_IO_APIC setting is irrelevant because MSI/MSI-X 424Note that CONFIG_X86_IO_APIC setting is irrelevant because MSI/MSI-X
418vector is allocated new during runtime and MSI/MSI-X support does not 425vector is allocated new during runtime and MSI/MSI-X support does not
419depend on BIOS support. This key independency enables MSI/MSI-X 426depend on BIOS support. This key independency enables MSI/MSI-X
420support on future IOxAPIC free platform. 427support on future IOxAPIC free platforms.
421 428
4225.5.2 Device hardware support 4295.5.2 Device hardware support
430
423The hardware device function supports MSI by indicating the 431The hardware device function supports MSI by indicating the
424MSI/MSI-X capability structure on its PCI capability list. By 432MSI/MSI-X capability structure on its PCI capability list. By
425default, this capability structure will not be initialized by 433default, this capability structure will not be initialized by
426the kernel to enable MSI during the system boot. In other words, 434the kernel to enable MSI during the system boot. In other words,
427the device function is running on its default pin assertion mode. 435the device function is running on its default pin assertion mode.
428Note that in many cases the hardware supporting MSI have bugs, 436Note that in many cases the hardware supporting MSI have bugs,
429which may result in system hang. The software driver of specific 437which may result in system hangs. The software driver of specific
430MSI-capable hardware is responsible for whether calling 438MSI-capable hardware is responsible for deciding whether to call
431pci_enable_msi or not. A return of zero indicates the kernel 439pci_enable_msi or not. A return of zero indicates the kernel
432successfully initializes the MSI/MSI-X capability structure of the 440successfully initialized the MSI/MSI-X capability structure of the
433device function. The device function is now running on MSI/MSI-X mode. 441device function. The device function is now running on MSI/MSI-X mode.
434 442
4355.6 How to tell whether MSI/MSI-X is enabled on device function 4435.6 How to tell whether MSI/MSI-X is enabled on device function
@@ -439,10 +447,10 @@ pci_enable_msi()/pci_enable_msix() indicates to a device driver that
439its device function is initialized successfully and ready to run in 447its device function is initialized successfully and ready to run in
440MSI/MSI-X mode. 448MSI/MSI-X mode.
441 449
442At the user level, users can use command 'cat /proc/interrupts' 450At the user level, users can use the command 'cat /proc/interrupts'
443to display the vector allocated for a device and its interrupt 451to display the vectors allocated for devices and their interrupt
444MSI/MSI-X mode ("PCI MSI"/"PCI MSIX"). Below shows below MSI mode is 452MSI/MSI-X modes ("PCI-MSI"/"PCI-MSI-X"). Below shows MSI mode is
445enabled on a SCSI Adaptec 39320D Ultra320. 453enabled on a SCSI Adaptec 39320D Ultra320 controller.
446 454
447 CPU0 CPU1 455 CPU0 CPU1
448 0: 324639 0 IO-APIC-edge timer 456 0: 324639 0 IO-APIC-edge timer
@@ -453,8 +461,8 @@ enabled on a SCSI Adaptec 39320D Ultra320.
453 15: 1 0 IO-APIC-edge ide1 461 15: 1 0 IO-APIC-edge ide1
454169: 0 0 IO-APIC-level uhci-hcd 462169: 0 0 IO-APIC-level uhci-hcd
455185: 0 0 IO-APIC-level uhci-hcd 463185: 0 0 IO-APIC-level uhci-hcd
456193: 138 10 PCI MSI aic79xx 464193: 138 10 PCI-MSI aic79xx
457201: 30 0 PCI MSI aic79xx 465201: 30 0 PCI-MSI aic79xx
458225: 30 0 IO-APIC-level aic7xxx 466225: 30 0 IO-APIC-level aic7xxx
459233: 30 0 IO-APIC-level aic7xxx 467233: 30 0 IO-APIC-level aic7xxx
460NMI: 0 0 468NMI: 0 0
@@ -490,8 +498,8 @@ target address set as 0xfeexxxxx, as conformed to PCI
490specification 2.3 or latest, then it should work. 498specification 2.3 or latest, then it should work.
491 499
492Q4. From the driver point of view, if the MSI is lost because 500Q4. From the driver point of view, if the MSI is lost because
493of the errors occur during inbound memory write, then it may 501of errors occurring during inbound memory write, then it may
494wait for ever. Is there a mechanism for it to recover? 502wait forever. Is there a mechanism for it to recover?
495 503
496A4. Since the target of the transaction is an inbound memory 504A4. Since the target of the transaction is an inbound memory
497write, all transaction termination conditions (Retry, 505write, all transaction termination conditions (Retry,