summaryrefslogtreecommitdiffstatshomepage
path: root/Documentation/IRQ-domain.txt
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2017-05-14 10:29:55 -0800
committerJonathan Corbet <corbet@lwn.net>2017-07-14 11:51:41 -0800
commit1642a1e68a70230c4dd0fb1523e1e886e3f5972a (patch)
treeba23c20aca8b2fe5a722fd93f3272095767ca7a2 /Documentation/IRQ-domain.txt
parentae2f26aa4c31498f9bbcfd2f2798d07b4cb82728 (diff)
downloadlinux-stable-1642a1e68a70230c4dd0fb1523e1e886e3f5972a.tar.gz
linux-stable-1642a1e68a70230c4dd0fb1523e1e886e3f5972a.tar.bz2
linux-stable-1642a1e68a70230c4dd0fb1523e1e886e3f5972a.tar.xz
linux-stable-1642a1e68a70230c4dd0fb1523e1e886e3f5972a.zip
IRQ-domain.txt: standardize document format
Each text file under Documentation follows a different format. Some doesn't even have titles! Change its representation to follow the adopted standard, using ReST markups for it to be parseable by Sphinx: - use proper markups for titles; - mark literal blocks as such; - add blank lines where needed. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'Documentation/IRQ-domain.txt')
-rw-r--r--Documentation/IRQ-domain.txt69
1 files changed, 49 insertions, 20 deletions
diff --git a/Documentation/IRQ-domain.txt b/Documentation/IRQ-domain.txt
index 1f246eb25ca5..4a1cd7645d85 100644
--- a/Documentation/IRQ-domain.txt
+++ b/Documentation/IRQ-domain.txt
@@ -1,4 +1,6 @@
1irq_domain interrupt number mapping library 1===============================================
2The irq_domain interrupt number mapping library
3===============================================
2 4
3The current design of the Linux kernel uses a single large number 5The current design of the Linux kernel uses a single large number
4space where each separate IRQ source is assigned a different number. 6space where each separate IRQ source is assigned a different number.
@@ -36,7 +38,9 @@ irq_domain also implements translation from an abstract irq_fwspec
36structure to hwirq numbers (Device Tree and ACPI GSI so far), and can 38structure to hwirq numbers (Device Tree and ACPI GSI so far), and can
37be easily extended to support other IRQ topology data sources. 39be easily extended to support other IRQ topology data sources.
38 40
39=== irq_domain usage === 41irq_domain usage
42================
43
40An interrupt controller driver creates and registers an irq_domain by 44An interrupt controller driver creates and registers an irq_domain by
41calling one of the irq_domain_add_*() functions (each mapping method 45calling one of the irq_domain_add_*() functions (each mapping method
42has a different allocator function, more on that later). The function 46has a different allocator function, more on that later). The function
@@ -62,15 +66,21 @@ If the driver has the Linux IRQ number or the irq_data pointer, and
62needs to know the associated hwirq number (such as in the irq_chip 66needs to know the associated hwirq number (such as in the irq_chip
63callbacks) then it can be directly obtained from irq_data->hwirq. 67callbacks) then it can be directly obtained from irq_data->hwirq.
64 68
65=== Types of irq_domain mappings === 69Types of irq_domain mappings
70============================
71
66There are several mechanisms available for reverse mapping from hwirq 72There are several mechanisms available for reverse mapping from hwirq
67to Linux irq, and each mechanism uses a different allocation function. 73to Linux irq, and each mechanism uses a different allocation function.
68Which reverse map type should be used depends on the use case. Each 74Which reverse map type should be used depends on the use case. Each
69of the reverse map types are described below: 75of the reverse map types are described below:
70 76
71==== Linear ==== 77Linear
72irq_domain_add_linear() 78------
73irq_domain_create_linear() 79
80::
81
82 irq_domain_add_linear()
83 irq_domain_create_linear()
74 84
75The linear reverse map maintains a fixed size table indexed by the 85The linear reverse map maintains a fixed size table indexed by the
76hwirq number. When a hwirq is mapped, an irq_desc is allocated for 86hwirq number. When a hwirq is mapped, an irq_desc is allocated for
@@ -89,9 +99,13 @@ accepts a more general abstraction 'struct fwnode_handle'.
89 99
90The majority of drivers should use the linear map. 100The majority of drivers should use the linear map.
91 101
92==== Tree ==== 102Tree
93irq_domain_add_tree() 103----
94irq_domain_create_tree() 104
105::
106
107 irq_domain_add_tree()
108 irq_domain_create_tree()
95 109
96The irq_domain maintains a radix tree map from hwirq numbers to Linux 110The irq_domain maintains a radix tree map from hwirq numbers to Linux
97IRQs. When an hwirq is mapped, an irq_desc is allocated and the 111IRQs. When an hwirq is mapped, an irq_desc is allocated and the
@@ -109,8 +123,12 @@ accepts a more general abstraction 'struct fwnode_handle'.
109 123
110Very few drivers should need this mapping. 124Very few drivers should need this mapping.
111 125
112==== No Map ===- 126No Map
113irq_domain_add_nomap() 127------
128
129::
130
131 irq_domain_add_nomap()
114 132
115The No Map mapping is to be used when the hwirq number is 133The No Map mapping is to be used when the hwirq number is
116programmable in the hardware. In this case it is best to program the 134programmable in the hardware. In this case it is best to program the
@@ -121,10 +139,14 @@ Linux IRQ number into the hardware.
121 139
122Most drivers cannot use this mapping. 140Most drivers cannot use this mapping.
123 141
124==== Legacy ==== 142Legacy
125irq_domain_add_simple() 143------
126irq_domain_add_legacy() 144
127irq_domain_add_legacy_isa() 145::
146
147 irq_domain_add_simple()
148 irq_domain_add_legacy()
149 irq_domain_add_legacy_isa()
128 150
129The Legacy mapping is a special case for drivers that already have a 151The Legacy mapping is a special case for drivers that already have a
130range of irq_descs allocated for the hwirqs. It is used when the 152range of irq_descs allocated for the hwirqs. It is used when the
@@ -163,14 +185,17 @@ that the driver using the simple domain call irq_create_mapping()
163before any irq_find_mapping() since the latter will actually work 185before any irq_find_mapping() since the latter will actually work
164for the static IRQ assignment case. 186for the static IRQ assignment case.
165 187
166==== Hierarchy IRQ domain ==== 188Hierarchy IRQ domain
189--------------------
190
167On some architectures, there may be multiple interrupt controllers 191On some architectures, there may be multiple interrupt controllers
168involved in delivering an interrupt from the device to the target CPU. 192involved in delivering an interrupt from the device to the target CPU.
169Let's look at a typical interrupt delivering path on x86 platforms: 193Let's look at a typical interrupt delivering path on x86 platforms::
170 194
171Device --> IOAPIC -> Interrupt remapping Controller -> Local APIC -> CPU 195 Device --> IOAPIC -> Interrupt remapping Controller -> Local APIC -> CPU
172 196
173There are three interrupt controllers involved: 197There are three interrupt controllers involved:
198
1741) IOAPIC controller 1991) IOAPIC controller
1752) Interrupt remapping controller 2002) Interrupt remapping controller
1763) Local APIC controller 2013) Local APIC controller
@@ -180,7 +205,8 @@ hardware architecture, an irq_domain data structure is built for each
180interrupt controller and those irq_domains are organized into hierarchy. 205interrupt controller and those irq_domains are organized into hierarchy.
181When building irq_domain hierarchy, the irq_domain near to the device is 206When building irq_domain hierarchy, the irq_domain near to the device is
182child and the irq_domain near to CPU is parent. So a hierarchy structure 207child and the irq_domain near to CPU is parent. So a hierarchy structure
183as below will be built for the example above. 208as below will be built for the example above::
209
184 CPU Vector irq_domain (root irq_domain to manage CPU vectors) 210 CPU Vector irq_domain (root irq_domain to manage CPU vectors)
185 ^ 211 ^
186 | 212 |
@@ -190,6 +216,7 @@ as below will be built for the example above.
190 IOAPIC irq_domain (manage IOAPIC delivery entries/pins) 216 IOAPIC irq_domain (manage IOAPIC delivery entries/pins)
191 217
192There are four major interfaces to use hierarchy irq_domain: 218There are four major interfaces to use hierarchy irq_domain:
219
1931) irq_domain_alloc_irqs(): allocate IRQ descriptors and interrupt 2201) irq_domain_alloc_irqs(): allocate IRQ descriptors and interrupt
194 controller related resources to deliver these interrupts. 221 controller related resources to deliver these interrupts.
1952) irq_domain_free_irqs(): free IRQ descriptors and interrupt controller 2222) irq_domain_free_irqs(): free IRQ descriptors and interrupt controller
@@ -199,7 +226,8 @@ There are four major interfaces to use hierarchy irq_domain:
1994) irq_domain_deactivate_irq(): deactivate interrupt controller hardware 2264) irq_domain_deactivate_irq(): deactivate interrupt controller hardware
200 to stop delivering the interrupt. 227 to stop delivering the interrupt.
201 228
202Following changes are needed to support hierarchy irq_domain. 229Following changes are needed to support hierarchy irq_domain:
230
2031) a new field 'parent' is added to struct irq_domain; it's used to 2311) a new field 'parent' is added to struct irq_domain; it's used to
204 maintain irq_domain hierarchy information. 232 maintain irq_domain hierarchy information.
2052) a new field 'parent_data' is added to struct irq_data; it's used to 2332) a new field 'parent_data' is added to struct irq_data; it's used to
@@ -223,6 +251,7 @@ software architecture.
223 251
224For an interrupt controller driver to support hierarchy irq_domain, it 252For an interrupt controller driver to support hierarchy irq_domain, it
225needs to: 253needs to:
254
2261) Implement irq_domain_ops.alloc and irq_domain_ops.free 2551) Implement irq_domain_ops.alloc and irq_domain_ops.free
2272) Optionally implement irq_domain_ops.activate and 2562) Optionally implement irq_domain_ops.activate and
228 irq_domain_ops.deactivate. 257 irq_domain_ops.deactivate.