]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - kernel/irq/irqdomain.c
Merge branches 'iommu/fixes', 'arm/exynos', 'arm/renesas', 'arm/smmu', 'arm/mediatek...
[mirror_ubuntu-bionic-kernel.git] / kernel / irq / irqdomain.c
index b59e6768c5e94ad831e78b539437cfd99576e780..31805f237396bdfb6f4d72a906c0dcb957b6ceaf 100644 (file)
@@ -277,6 +277,31 @@ struct irq_domain *irq_find_matching_fwspec(struct irq_fwspec *fwspec,
 }
 EXPORT_SYMBOL_GPL(irq_find_matching_fwspec);
 
+/**
+ * irq_domain_check_msi_remap - Check whether all MSI irq domains implement
+ * IRQ remapping
+ *
+ * Return: false if any MSI irq domain does not support IRQ remapping,
+ * true otherwise (including if there is no MSI irq domain)
+ */
+bool irq_domain_check_msi_remap(void)
+{
+       struct irq_domain *h;
+       bool ret = true;
+
+       mutex_lock(&irq_domain_mutex);
+       list_for_each_entry(h, &irq_domain_list, link) {
+               if (irq_domain_is_msi(h) &&
+                   !irq_domain_hierarchical_is_msi_remap(h)) {
+                       ret = false;
+                       break;
+               }
+       }
+       mutex_unlock(&irq_domain_mutex);
+       return ret;
+}
+EXPORT_SYMBOL_GPL(irq_domain_check_msi_remap);
+
 /**
  * irq_set_default_host() - Set a "default" irq domain
  * @domain: default domain pointer
@@ -1408,6 +1433,20 @@ static void irq_domain_check_hierarchy(struct irq_domain *domain)
        if (domain->ops->alloc)
                domain->flags |= IRQ_DOMAIN_FLAG_HIERARCHY;
 }
+
+/**
+ * irq_domain_hierarchical_is_msi_remap - Check if the domain or any
+ * parent has MSI remapping support
+ * @domain: domain pointer
+ */
+bool irq_domain_hierarchical_is_msi_remap(struct irq_domain *domain)
+{
+       for (; domain; domain = domain->parent) {
+               if (irq_domain_is_msi_remap(domain))
+                       return true;
+       }
+       return false;
+}
 #else  /* CONFIG_IRQ_DOMAIN_HIERARCHY */
 /**
  * irq_domain_get_irq_data - Get irq_data associated with @virq and @domain