[PATCH V2 6/6] gicv2m: acpi: Introducing GICv2m ACPI support
Suravee Suthikulanit
suravee.suthikulpanit at amd.com
Thu Oct 15 07:30:15 PDT 2015
Hi Tomasz,
On 10/15/2015 9:03 AM, Suravee Suthikulanit wrote:
>>> + if (!data)
>>> + return NULL;
>>> +
>>> + return data->fwnode;
>>> +}
>>> +
>>> +static int __init
>>> +acpi_parse_madt_msi(struct acpi_subtable_header *header,
>>> + const unsigned long end)
>>> +{
>>> + int ret;
>>> + struct resource res;
>>> + u32 spi_start = 0, nr_spis = 0;
>>> + struct acpi_madt_generic_msi_frame *m;
>>> + struct fwnode_handle *fwnode = NULL;
>>> +
>>> + m = (struct acpi_madt_generic_msi_frame *)header;
>>> + if (BAD_MADT_ENTRY(m, end))
>>> + return -EINVAL;
>>> +
>>> + res.start = m->base_address;
>>> + res.end = m->base_address + 0x1000;
>>> +
>>> + if (m->flags & ACPI_MADT_OVERRIDE_SPI_VALUES) {
>>> + spi_start = m->spi_base;
>>> + nr_spis = m->spi_count;
>>> +
>>> + pr_info("ACPI overriding V2M MSI_TYPER (base:%u, num:%u)\n",
>>> + spi_start, nr_spis);
>>> + }
>>> +
>>> + fwnode = irq_domain_alloc_fwnode((void *)m->base_address);
>>> + if (!fwnode) {
>>> + pr_err("Unable to allocate GICv2m domain token\n");
>>> + return -EINVAL;
>>> + }
>>> +
>>> + ret = gicv2m_init_one(fwnode, spi_start, nr_spis, &res);
>> I case of error, we should call here:
>> irq_domain_free_fwnode(fwnode);
>
> This should have already been handled when returning from the
> acpi_parse_madt_msi() in gicv2m_teardown() since we would need to
> iterate through all existing MSI frame to clean up.
Actually, you are correct since the fwnode allocated here might not get
assigned to the v2m_data.fwnode and added to the v2m_nodes list yet. So,
we would need to call irq_domain_alloc_fwnode() here in case of error.
Thanks,
Suravee
More information about the linux-arm-kernel
mailing list