Lines Matching +full:mbi +full:- +full:ranges

1 // SPDX-License-Identifier: GPL-2.0
9 #include <linux/dma-iommu.h>
19 #include <linux/irqchip/arm-gic-v3.h>
33 .name = "MBI",
50 * Using ACPI? There is no MBI support in the spec, you in mbi_irq_gic_domain_alloc()
53 if (!is_of_node(domain->parent->fwnode)) in mbi_irq_gic_domain_alloc()
54 return -EINVAL; in mbi_irq_gic_domain_alloc()
61 fwspec.fwnode = domain->parent->fwnode; in mbi_irq_gic_domain_alloc()
64 fwspec.param[1] = hwirq - 32; in mbi_irq_gic_domain_alloc()
71 d = irq_domain_get_irq_data(domain->parent, virq); in mbi_irq_gic_domain_alloc()
72 return d->chip->irq_set_type(d, IRQ_TYPE_EDGE_RISING); in mbi_irq_gic_domain_alloc()
75 static void mbi_free_msi(struct mbi_range *mbi, unsigned int hwirq, in mbi_free_msi() argument
79 bitmap_release_region(mbi->bm, hwirq - mbi->spi_start, in mbi_free_msi()
88 struct mbi_range *mbi = NULL; in mbi_irq_domain_alloc() local
97 mbi = &mbi_ranges[i]; in mbi_irq_domain_alloc()
103 if (!mbi) in mbi_irq_domain_alloc()
104 return -ENOSPC; in mbi_irq_domain_alloc()
106 hwirq = mbi->spi_start + offset; in mbi_irq_domain_alloc()
108 err = iommu_dma_prepare_msi(info->desc, in mbi_irq_domain_alloc()
119 &mbi_irq_chip, mbi); in mbi_irq_domain_alloc()
126 mbi_free_msi(mbi, hwirq, nr_irqs); in mbi_irq_domain_alloc()
134 struct mbi_range *mbi = irq_data_get_irq_chip_data(d); in mbi_irq_domain_free() local
136 mbi_free_msi(mbi, d->hwirq, nr_irqs); in mbi_irq_domain_free()
149 msg[0].data = data->parent_data->hwirq; in mbi_compose_msi_msg()
155 /* PCI-specific irqchip */
186 *pci_domain = pci_msi_create_irq_domain(nexus_domain->parent->fwnode, in mbi_allocate_pci_domain()
190 return -ENOMEM; in mbi_allocate_pci_domain()
209 msg[1].data = data->parent_data->hwirq; in mbi_compose_mbi_msg()
214 /* Platform-MSI specific irqchip */
237 nexus_domain = irq_domain_create_tree(parent->fwnode, in mbi_allocate_domains()
240 return -ENOMEM; in mbi_allocate_domains()
243 nexus_domain->parent = parent; in mbi_allocate_domains()
247 plat_domain = platform_msi_create_irq_domain(parent->fwnode, in mbi_allocate_domains()
257 return -ENOMEM; in mbi_allocate_domains()
271 if (!of_property_read_bool(np, "msi-controller")) in mbi_init()
274 n = of_property_count_elems_of_size(np, "mbi-ranges", sizeof(u32)); in mbi_init()
276 return -EINVAL; in mbi_init()
281 return -ENOMEM; in mbi_init()
284 ret = of_property_read_u32_index(np, "mbi-ranges", n * 2, in mbi_init()
288 ret = of_property_read_u32_index(np, "mbi-ranges", n * 2 + 1, in mbi_init()
296 ret = -ENOMEM; in mbi_init()
299 pr_info("MBI range [%d:%d]\n", mbi_ranges[n].spi_start, in mbi_init()
300 mbi_ranges[n].spi_start + mbi_ranges[n].nr_spis - 1); in mbi_init()
303 reg = of_get_property(np, "mbi-alias", NULL); in mbi_init()
307 ret = -ENXIO; in mbi_init()
314 ret = -ENXIO; in mbi_init()
321 pr_info("Using MBI frame %pa\n", &mbi_phys_base); in mbi_init()