[PATCH v3 07/19] iommu/riscv: Add IRQ domain for interrupt remapping
Thomas Gleixner
tglx at kernel.org
Fri Aug 7 13:36:43 PDT 2026
On Fri, Aug 07 2026 at 22:32, Thomas Gleixner wrote:
> On Fri, Aug 07 2026 at 20:17, Andrew Jones wrote:
>> +static int riscv_iommu_ir_irq_domain_alloc_irqs(struct irq_domain *irqdomain,
>> + unsigned int irq_base, unsigned int nr_irqs,
>> + void *arg)
>> +{
>> + struct irq_data *data;
>> + int i, ret;
>> +
>> + ret = irq_domain_alloc_irqs_parent(irqdomain, irq_base, nr_irqs, arg);
>> + if (ret)
>> + return ret;
>> +
>> + for (i = 0; i < nr_irqs; i++) {
>
> for (unsigned int i = 0; .....
>
> nr_irqs is unsigned after all
>
> The struct irq_data declaration want's to be inside the loop as that's
> the scope where it is used.
>
>> + data = irq_domain_get_irq_data(irqdomain, irq_base + i);
>
>
>> + data->chip = &riscv_iommu_ir_irq_chip;
>> + }
>> +
>> + return 0;
>> +}
>> +
>> +static const struct irq_domain_ops riscv_iommu_ir_irq_domain_ops = {
>> + .alloc = riscv_iommu_ir_irq_domain_alloc_irqs,
>> + .free = irq_domain_free_irqs_parent,
>
> https://docs.kernel.org/process/maintainer-tip.html#struct-declarations-and-initializers
>
>> +};
>> +
>> +static const struct msi_parent_ops riscv_iommu_ir_msi_parent_ops = {
>> + .prefix = "IR-",
>> + .supported_flags = MSI_GENERIC_FLAGS_MASK |
>> + MSI_FLAG_PCI_MSIX,
>> + .required_flags = MSI_FLAG_USE_DEF_DOM_OPS |
>> + MSI_FLAG_USE_DEF_CHIP_OPS |
>> + MSI_FLAG_PCI_MSI_MASK_PARENT,
>> + .chip_flags = MSI_CHIP_FLAG_SET_ACK,
>> + .init_dev_msi_info = msi_parent_init_dev_msi_info,
>> +};
>> +
>> +struct irq_domain *riscv_iommu_ir_irq_domain_create(struct device *dev,
>> + struct riscv_iommu_info *info)
>
> You have 100 characters, please use them.
Oops. Just noticed, that this is IOMMU territory. So whatever the IOMMU
maintainers prefer :)
More information about the linux-riscv
mailing list