aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/IRQ-domain.txt
diff options
context:
space:
mode:
authorJiang Liu <jiang.liu@linux.intel.com>2014-11-06 09:20:14 -0500
committerThomas Gleixner <tglx@linutronix.de>2014-11-23 07:01:45 -0500
commitf8264e34965aaf43203912ed8f7b543c00c8d70f (patch)
tree1b037da27ec42cd9a2120f0f6dfb645731fb89ec /Documentation/IRQ-domain.txt
parentd31eb342409b24e3d2e1989c775f3361e93acc08 (diff)
irqdomain: Introduce new interfaces to support hierarchy irqdomains
We plan to use hierarchy irqdomain to suppport CPU vector assignment, interrupt remapping controller, IO-APIC controller, MSI interrupt and hypertransport interrupt etc on x86 platforms. So extend irqdomain interfaces to support hierarchy irqdomain. There are already many clients of current irqdomain interfaces. To minimize the changes, we choose to introduce new version 2 interfaces to support hierarchy instead of extending existing irqdomain interfaces. According to Thomas's suggestion, the most important design decision is to build hierarchy struct irq_data to support hierarchy irqdomain, so hierarchy irqdomain related data could be saved in struct irq_data. With support of hierarchy irq_data, we could also support stacked irq_chips. This is most useful in case of set_affinity(). The new hierarchy irqdomain introduces following interfaces: 1) irq_domain_alloc_irqs()/irq_domain_free_irqs(): allocate/release IRQ and related resources. 2) __irq_domain_alloc_irqs(): a special version to support legacy IRQs. 3) irq_domain_activate_irq()/irq_domain_deactivate_irq(): program interrupt controllers to activate/deactivate interrupt. There are also several help functions to ease irqdomain implemenations: 1) irq_domain_get_irq_data(): get irq_data associated with a specific irqdomain. 2) irq_domain_set_hwirq_and_chip(): save irqdomain specific data into irq_data. 3) irq_domain_alloc_irqs_parent()/irq_domain_free_irqs_parent(): invoke parent irqdomain's alloc/free callbacks. We also changed irq_startup()/irq_shutdown() to invoke irq_domain_activate_irq()/irq_domain_deactivate_irq() to program interrupt controller when start/stop interrupts. [ tglx: Folded parts of the later patch series in ] Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Grant Likely <grant.likely@linaro.org> Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: Yingjoe Chen <yingjoe.chen@mediatek.com> Cc: Yijing Wang <wangyijing@huawei.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'Documentation/IRQ-domain.txt')
-rw-r--r--Documentation/IRQ-domain.txt71
1 files changed, 71 insertions, 0 deletions
diff --git a/Documentation/IRQ-domain.txt b/Documentation/IRQ-domain.txt
index 8a8b82c9ca53..39cfa72732ff 100644
--- a/Documentation/IRQ-domain.txt
+++ b/Documentation/IRQ-domain.txt
@@ -151,3 +151,74 @@ used and no descriptor gets allocated it is very important to make sure
151that the driver using the simple domain call irq_create_mapping() 151that the driver using the simple domain call irq_create_mapping()
152before any irq_find_mapping() since the latter will actually work 152before any irq_find_mapping() since the latter will actually work
153for the static IRQ assignment case. 153for the static IRQ assignment case.
154
155==== Hierarchy IRQ domain ====
156On some architectures, there may be multiple interrupt controllers
157involved in delivering an interrupt from the device to the target CPU.
158Let's look at a typical interrupt delivering path on x86 platforms:
159
160Device --> IOAPIC -> Interrupt remapping Controller -> Local APIC -> CPU
161
162There are three interrupt controllers involved:
1631) IOAPIC controller
1642) Interrupt remapping controller
1653) Local APIC controller
166
167To support such a hardware topology and make software architecture match
168hardware architecture, an irq_domain data structure is built for each
169interrupt controller and those irq_domains are organized into hierarchy.
170When building irq_domain hierarchy, the irq_domain near to the device is
171child and the irq_domain near to CPU is parent. So a hierarchy structure
172as below will be built for the example above.
173 CPU Vector irq_domain (root irq_domain to manage CPU vectors)
174 ^
175 |
176 Interrupt Remapping irq_domain (manage irq_remapping entries)
177 ^
178 |
179 IOAPIC irq_domain (manage IOAPIC delivery entries/pins)
180
181There are four major interfaces to use hierarchy irq_domain:
1821) irq_domain_alloc_irqs(): allocate IRQ descriptors and interrupt
183 controller related resources to deliver these interrupts.
1842) irq_domain_free_irqs(): free IRQ descriptors and interrupt controller
185 related resources associated with these interrupts.
1863) irq_domain_activate_irq(): activate interrupt controller hardware to
187 deliver the interrupt.
1883) irq_domain_deactivate_irq(): deactivate interrupt controller hardware
189 to stop delivering the interrupt.
190
191Following changes are needed to support hierarchy irq_domain.
1921) a new field 'parent' is added to struct irq_domain; it's used to
193 maintain irq_domain hierarchy information.
1942) a new field 'parent_data' is added to struct irq_data; it's used to
195 build hierarchy irq_data to match hierarchy irq_domains. The irq_data
196 is used to store irq_domain pointer and hardware irq number.
1973) new callbacks are added to struct irq_domain_ops to support hierarchy
198 irq_domain operations.
199
200With support of hierarchy irq_domain and hierarchy irq_data ready, an
201irq_domain structure is built for each interrupt controller, and an
202irq_data structure is allocated for each irq_domain associated with an
203IRQ. Now we could go one step further to support stacked(hierarchy)
204irq_chip. That is, an irq_chip is associated with each irq_data along
205the hierarchy. A child irq_chip may implement a required action by
206itself or by cooperating with its parent irq_chip.
207
208With stacked irq_chip, interrupt controller driver only needs to deal
209with the hardware managed by itself and may ask for services from its
210parent irq_chip when needed. So we could achieve a much cleaner
211software architecture.
212
213For an interrupt controller driver to support hierarchy irq_domain, it
214needs to:
2151) Implement irq_domain_ops.alloc and irq_domain_ops.free
2162) Optionally implement irq_domain_ops.activate and
217 irq_domain_ops.deactivate.
2183) Optionally implement an irq_chip to manage the interrupt controller
219 hardware.
2204) No need to implement irq_domain_ops.map and irq_domain_ops.unmap,
221 they are unused with hierarchy irq_domain.
222
223Hierarchy irq_domain may also be used to support other architectures,
224such as ARM, ARM64 etc.