diff options
| author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-05-14 10:29:55 -0800 |
|---|---|---|
| committer | Jonathan Corbet <corbet@lwn.net> | 2017-07-14 11:51:41 -0800 |
| commit | 1642a1e68a70230c4dd0fb1523e1e886e3f5972a (patch) | |
| tree | ba23c20aca8b2fe5a722fd93f3272095767ca7a2 /Documentation/IRQ-domain.txt | |
| parent | ae2f26aa4c31498f9bbcfd2f2798d07b4cb82728 (diff) | |
| download | linux-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.txt | 69 |
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 @@ | |||
| 1 | irq_domain interrupt number mapping library | 1 | =============================================== |
| 2 | The irq_domain interrupt number mapping library | ||
| 3 | =============================================== | ||
| 2 | 4 | ||
| 3 | The current design of the Linux kernel uses a single large number | 5 | The current design of the Linux kernel uses a single large number |
| 4 | space where each separate IRQ source is assigned a different number. | 6 | space where each separate IRQ source is assigned a different number. |
| @@ -36,7 +38,9 @@ irq_domain also implements translation from an abstract irq_fwspec | |||
| 36 | structure to hwirq numbers (Device Tree and ACPI GSI so far), and can | 38 | structure to hwirq numbers (Device Tree and ACPI GSI so far), and can |
| 37 | be easily extended to support other IRQ topology data sources. | 39 | be easily extended to support other IRQ topology data sources. |
| 38 | 40 | ||
| 39 | === irq_domain usage === | 41 | irq_domain usage |
| 42 | ================ | ||
| 43 | |||
| 40 | An interrupt controller driver creates and registers an irq_domain by | 44 | An interrupt controller driver creates and registers an irq_domain by |
| 41 | calling one of the irq_domain_add_*() functions (each mapping method | 45 | calling one of the irq_domain_add_*() functions (each mapping method |
| 42 | has a different allocator function, more on that later). The function | 46 | has 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 | |||
| 62 | needs to know the associated hwirq number (such as in the irq_chip | 66 | needs to know the associated hwirq number (such as in the irq_chip |
| 63 | callbacks) then it can be directly obtained from irq_data->hwirq. | 67 | callbacks) then it can be directly obtained from irq_data->hwirq. |
| 64 | 68 | ||
| 65 | === Types of irq_domain mappings === | 69 | Types of irq_domain mappings |
| 70 | ============================ | ||
| 71 | |||
| 66 | There are several mechanisms available for reverse mapping from hwirq | 72 | There are several mechanisms available for reverse mapping from hwirq |
| 67 | to Linux irq, and each mechanism uses a different allocation function. | 73 | to Linux irq, and each mechanism uses a different allocation function. |
| 68 | Which reverse map type should be used depends on the use case. Each | 74 | Which reverse map type should be used depends on the use case. Each |
| 69 | of the reverse map types are described below: | 75 | of the reverse map types are described below: |
| 70 | 76 | ||
| 71 | ==== Linear ==== | 77 | Linear |
| 72 | irq_domain_add_linear() | 78 | ------ |
| 73 | irq_domain_create_linear() | 79 | |
| 80 | :: | ||
| 81 | |||
| 82 | irq_domain_add_linear() | ||
| 83 | irq_domain_create_linear() | ||
| 74 | 84 | ||
| 75 | The linear reverse map maintains a fixed size table indexed by the | 85 | The linear reverse map maintains a fixed size table indexed by the |
| 76 | hwirq number. When a hwirq is mapped, an irq_desc is allocated for | 86 | hwirq 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 | ||
| 90 | The majority of drivers should use the linear map. | 100 | The majority of drivers should use the linear map. |
| 91 | 101 | ||
| 92 | ==== Tree ==== | 102 | Tree |
| 93 | irq_domain_add_tree() | 103 | ---- |
| 94 | irq_domain_create_tree() | 104 | |
| 105 | :: | ||
| 106 | |||
| 107 | irq_domain_add_tree() | ||
| 108 | irq_domain_create_tree() | ||
| 95 | 109 | ||
| 96 | The irq_domain maintains a radix tree map from hwirq numbers to Linux | 110 | The irq_domain maintains a radix tree map from hwirq numbers to Linux |
| 97 | IRQs. When an hwirq is mapped, an irq_desc is allocated and the | 111 | IRQs. 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 | ||
| 110 | Very few drivers should need this mapping. | 124 | Very few drivers should need this mapping. |
| 111 | 125 | ||
| 112 | ==== No Map ===- | 126 | No Map |
| 113 | irq_domain_add_nomap() | 127 | ------ |
| 128 | |||
| 129 | :: | ||
| 130 | |||
| 131 | irq_domain_add_nomap() | ||
| 114 | 132 | ||
| 115 | The No Map mapping is to be used when the hwirq number is | 133 | The No Map mapping is to be used when the hwirq number is |
| 116 | programmable in the hardware. In this case it is best to program the | 134 | programmable in the hardware. In this case it is best to program the |
| @@ -121,10 +139,14 @@ Linux IRQ number into the hardware. | |||
| 121 | 139 | ||
| 122 | Most drivers cannot use this mapping. | 140 | Most drivers cannot use this mapping. |
| 123 | 141 | ||
| 124 | ==== Legacy ==== | 142 | Legacy |
| 125 | irq_domain_add_simple() | 143 | ------ |
| 126 | irq_domain_add_legacy() | 144 | |
| 127 | irq_domain_add_legacy_isa() | 145 | :: |
| 146 | |||
| 147 | irq_domain_add_simple() | ||
| 148 | irq_domain_add_legacy() | ||
| 149 | irq_domain_add_legacy_isa() | ||
| 128 | 150 | ||
| 129 | The Legacy mapping is a special case for drivers that already have a | 151 | The Legacy mapping is a special case for drivers that already have a |
| 130 | range of irq_descs allocated for the hwirqs. It is used when the | 152 | range 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() | |||
| 163 | before any irq_find_mapping() since the latter will actually work | 185 | before any irq_find_mapping() since the latter will actually work |
| 164 | for the static IRQ assignment case. | 186 | for the static IRQ assignment case. |
| 165 | 187 | ||
| 166 | ==== Hierarchy IRQ domain ==== | 188 | Hierarchy IRQ domain |
| 189 | -------------------- | ||
| 190 | |||
| 167 | On some architectures, there may be multiple interrupt controllers | 191 | On some architectures, there may be multiple interrupt controllers |
| 168 | involved in delivering an interrupt from the device to the target CPU. | 192 | involved in delivering an interrupt from the device to the target CPU. |
| 169 | Let's look at a typical interrupt delivering path on x86 platforms: | 193 | Let's look at a typical interrupt delivering path on x86 platforms:: |
| 170 | 194 | ||
| 171 | Device --> IOAPIC -> Interrupt remapping Controller -> Local APIC -> CPU | 195 | Device --> IOAPIC -> Interrupt remapping Controller -> Local APIC -> CPU |
| 172 | 196 | ||
| 173 | There are three interrupt controllers involved: | 197 | There are three interrupt controllers involved: |
| 198 | |||
| 174 | 1) IOAPIC controller | 199 | 1) IOAPIC controller |
| 175 | 2) Interrupt remapping controller | 200 | 2) Interrupt remapping controller |
| 176 | 3) Local APIC controller | 201 | 3) Local APIC controller |
| @@ -180,7 +205,8 @@ hardware architecture, an irq_domain data structure is built for each | |||
| 180 | interrupt controller and those irq_domains are organized into hierarchy. | 205 | interrupt controller and those irq_domains are organized into hierarchy. |
| 181 | When building irq_domain hierarchy, the irq_domain near to the device is | 206 | When building irq_domain hierarchy, the irq_domain near to the device is |
| 182 | child and the irq_domain near to CPU is parent. So a hierarchy structure | 207 | child and the irq_domain near to CPU is parent. So a hierarchy structure |
| 183 | as below will be built for the example above. | 208 | as 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 | ||
| 192 | There are four major interfaces to use hierarchy irq_domain: | 218 | There are four major interfaces to use hierarchy irq_domain: |
| 219 | |||
| 193 | 1) irq_domain_alloc_irqs(): allocate IRQ descriptors and interrupt | 220 | 1) 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. |
| 195 | 2) irq_domain_free_irqs(): free IRQ descriptors and interrupt controller | 222 | 2) irq_domain_free_irqs(): free IRQ descriptors and interrupt controller |
| @@ -199,7 +226,8 @@ There are four major interfaces to use hierarchy irq_domain: | |||
| 199 | 4) irq_domain_deactivate_irq(): deactivate interrupt controller hardware | 226 | 4) irq_domain_deactivate_irq(): deactivate interrupt controller hardware |
| 200 | to stop delivering the interrupt. | 227 | to stop delivering the interrupt. |
| 201 | 228 | ||
| 202 | Following changes are needed to support hierarchy irq_domain. | 229 | Following changes are needed to support hierarchy irq_domain: |
| 230 | |||
| 203 | 1) a new field 'parent' is added to struct irq_domain; it's used to | 231 | 1) 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. |
| 205 | 2) a new field 'parent_data' is added to struct irq_data; it's used to | 233 | 2) a new field 'parent_data' is added to struct irq_data; it's used to |
| @@ -223,6 +251,7 @@ software architecture. | |||
| 223 | 251 | ||
| 224 | For an interrupt controller driver to support hierarchy irq_domain, it | 252 | For an interrupt controller driver to support hierarchy irq_domain, it |
| 225 | needs to: | 253 | needs to: |
| 254 | |||
| 226 | 1) Implement irq_domain_ops.alloc and irq_domain_ops.free | 255 | 1) Implement irq_domain_ops.alloc and irq_domain_ops.free |
| 227 | 2) Optionally implement irq_domain_ops.activate and | 256 | 2) Optionally implement irq_domain_ops.activate and |
| 228 | irq_domain_ops.deactivate. | 257 | irq_domain_ops.deactivate. |
