void arch_init_htirq_domain(struct irq_domain *parent) { if (disable_apic) return; htirq_domain = irq_domain_add_tree(NULL, &htirq_domain_ops, NULL); if (!htirq_domain) pr_warn("failed to initialize irqdomain for HTIRQ.\n"); else htirq_domain->parent = parent; }
static struct irq_domain *uv_get_irq_domain(void) { static struct irq_domain *uv_domain; static DEFINE_MUTEX(uv_lock); mutex_lock(&uv_lock); if (uv_domain == NULL) { uv_domain = irq_domain_add_tree(NULL, &uv_domain_ops, NULL); if (uv_domain) uv_domain->parent = x86_vector_domain; } mutex_unlock(&uv_lock); return uv_domain; }
int __init qpnpint_of_init(struct device_node *node, struct device_node *parent) { struct q_chip_data *chip_d; chip_d = kzalloc(sizeof(struct q_chip_data), GFP_KERNEL); if (!chip_d) return -ENOMEM; chip_d->domain = irq_domain_add_tree(node, &qpnpint_irq_domain_ops, chip_d); if (!chip_d->domain) { pr_err("Unable to allocate irq_domain\n"); kfree(chip_d); return -ENOMEM; } INIT_RADIX_TREE(&chip_d->per_tree, GFP_ATOMIC); list_add(&chip_d->list, &qpnpint_chips); return 0; }
static void __init xics_init_host(void) { xics_host = irq_domain_add_tree(NULL, &xics_host_ops, NULL); BUG_ON(xics_host == NULL); irq_set_default_host(xics_host); }
static int __init gicv2m_init_one(struct device_node *node, struct irq_domain *parent) { int ret; struct v2m_data *v2m; struct irq_domain *inner_domain, *pci_domain, *plat_domain; v2m = kzalloc(sizeof(struct v2m_data), GFP_KERNEL); if (!v2m) { pr_err("Failed to allocate struct v2m_data.\n"); return -ENOMEM; } ret = of_address_to_resource(node, 0, &v2m->res); if (ret) { pr_err("Failed to allocate v2m resource.\n"); goto err_free_v2m; } v2m->base = ioremap(v2m->res.start, resource_size(&v2m->res)); if (!v2m->base) { pr_err("Failed to map GICv2m resource\n"); ret = -ENOMEM; goto err_free_v2m; } if (!of_property_read_u32(node, "arm,msi-base-spi", &v2m->spi_start) && !of_property_read_u32(node, "arm,msi-num-spis", &v2m->nr_spis)) { pr_info("Overriding V2M MSI_TYPER (base:%u, num:%u)\n", v2m->spi_start, v2m->nr_spis); } else { u32 typer = readl_relaxed(v2m->base + V2M_MSI_TYPER); v2m->spi_start = V2M_MSI_TYPER_BASE_SPI(typer); v2m->nr_spis = V2M_MSI_TYPER_NUM_SPI(typer); } if (!is_msi_spi_valid(v2m->spi_start, v2m->nr_spis)) { ret = -EINVAL; goto err_iounmap; } v2m->bm = kzalloc(sizeof(long) * BITS_TO_LONGS(v2m->nr_spis), GFP_KERNEL); if (!v2m->bm) { ret = -ENOMEM; goto err_iounmap; } inner_domain = irq_domain_add_tree(node, &gicv2m_domain_ops, v2m); if (!inner_domain) { pr_err("Failed to create GICv2m domain\n"); ret = -ENOMEM; goto err_free_bm; } inner_domain->bus_token = DOMAIN_BUS_NEXUS; inner_domain->parent = parent; pci_domain = pci_msi_create_irq_domain(node, &gicv2m_msi_domain_info, inner_domain); plat_domain = platform_msi_create_irq_domain(node, &gicv2m_pmsi_domain_info, inner_domain); if (!pci_domain || !plat_domain) { pr_err("Failed to create MSI domains\n"); ret = -ENOMEM; goto err_free_domains; } spin_lock_init(&v2m->msi_cnt_lock); pr_info("Node %s: range[%#lx:%#lx], SPI[%d:%d]\n", node->name, (unsigned long)v2m->res.start, (unsigned long)v2m->res.end, v2m->spi_start, (v2m->spi_start + v2m->nr_spis)); return 0; err_free_domains: if (plat_domain) irq_domain_remove(plat_domain); if (pci_domain) irq_domain_remove(pci_domain); if (inner_domain) irq_domain_remove(inner_domain); err_free_bm: kfree(v2m->bm); err_iounmap: iounmap(v2m->base); err_free_v2m: kfree(v2m); return ret; }