aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/irq/irqdomain.c
diff options
context:
space:
mode:
authorEric Auger <eric.auger@redhat.com>2017-01-19 15:57:59 -0500
committerWill Deacon <will.deacon@arm.com>2017-01-23 10:00:45 -0500
commitc7b41f0af38f53e46050b56a5b0e96710097b83c (patch)
tree11687bd608512ebc4e4dbfdf4056dddfaf6af902 /kernel/irq/irqdomain.c
parent88156f00904183d99e19269fbdb5cb56dc1522c3 (diff)
irqdomain: irq_domain_check_msi_remap
This new function checks whether all MSI irq domains implement IRQ remapping. This is useful to understand whether VFIO passthrough is safe with respect to interrupts. On ARM typically an MSI controller can sit downstream to the IOMMU without preventing VFIO passthrough. As such any assigned device can write into the MSI doorbell. In case the MSI controller implements IRQ remapping, assigned devices will not be able to trigger interrupts towards the host. On the contrary, the assignment must be emphasized as unsafe with respect to interrupts. Signed-off-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Marc Zyngier <marc.zyngier@arm.com> Reviewed-by: Tomasz Nowicki <tomasz.nowicki@caviumnetworks.com> Tested-by: Tomasz Nowicki <tomasz.nowicki@caviumnetworks.com> Tested-by: Bharat Bhushan <bharat.bhushan@nxp.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'kernel/irq/irqdomain.c')
-rw-r--r--kernel/irq/irqdomain.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 876e13172dc8..80c4f9312187 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -278,6 +278,31 @@ struct irq_domain *irq_find_matching_fwspec(struct irq_fwspec *fwspec,
278EXPORT_SYMBOL_GPL(irq_find_matching_fwspec); 278EXPORT_SYMBOL_GPL(irq_find_matching_fwspec);
279 279
280/** 280/**
281 * irq_domain_check_msi_remap - Check whether all MSI irq domains implement
282 * IRQ remapping
283 *
284 * Return: false if any MSI irq domain does not support IRQ remapping,
285 * true otherwise (including if there is no MSI irq domain)
286 */
287bool irq_domain_check_msi_remap(void)
288{
289 struct irq_domain *h;
290 bool ret = true;
291
292 mutex_lock(&irq_domain_mutex);
293 list_for_each_entry(h, &irq_domain_list, link) {
294 if (irq_domain_is_msi(h) &&
295 !irq_domain_hierarchical_is_msi_remap(h)) {
296 ret = false;
297 break;
298 }
299 }
300 mutex_unlock(&irq_domain_mutex);
301 return ret;
302}
303EXPORT_SYMBOL_GPL(irq_domain_check_msi_remap);
304
305/**
281 * irq_set_default_host() - Set a "default" irq domain 306 * irq_set_default_host() - Set a "default" irq domain
282 * @domain: default domain pointer 307 * @domain: default domain pointer
283 * 308 *