Home » Linux Kernel » Core Kernel » Solved: WARNING: irq-gic-v3.c gic_irq_domain_translate kernel messages

Solved: WARNING: irq-gic-v3.c gic_irq_domain_translate kernel messages

If your are working to port the kernel versions or port the kernels to different platforms, during the porting, you may see the warnings as below in dmesg “WARNING: CPU: 4 PID: 1 at drivers/irqchip/irq-gic-v3.c:1060 gic_irq_domain_translate+0x184/0x18c” ,

[    1.109674] WARNING: CPU: 4 PID: 1 at drivers/irqchip/irq-gic-v3.c:1060 gic_irq_domain_translate+0x184/0x18c
[    1.114499] Modules linked in:
[    1.124296] CPU: 4 PID: 1 Comm: swapper/0 Not tainted 4.19.157+ #1
[    1.127164] Hardware name: 
[    1.133335] pstate: 60400005 (nZCv daif +PAN -UAO)
[    1.141572] pc : gic_irq_domain_translate+0x184/0x18c
[    1.146172] lr : gic_irq_domain_translate+0x184/0x18c
[    1.151291] sp : ffffff800805b5c0
[    1.156321] x29: ffffff800805b5c0 x28: ffffffadbd6ca0a8
[    1.159626] x27: 0000000000000000 x26: ffffffadbd583e70
[    1.165007] x25: 0000000000000001 x24: ffffffd8b5037580
[    1.170303] x23: 00000000006080c0 x22: ffffffd8b8c02500
[    1.175599] x21: ffffff800805b600 x20: ffffff800805b6a8
[    1.180893] x19: ffffff800805b5fc x18: ffffffd8b9638008
[    1.186188] x17: 00000000000000fd x16: 0000000000000001
[    1.191483] x15: ffffffadbcc06bec x14: 0000000000003034
[    1.196778] x13: 00000000000003fd x12: ffffffadbdb25f80
[    1.202073] x11: 6fb7a0caf0784500 x10: 0000000000000000
[    1.207370] x9 : 6fb7a0caf0784500 x8 : 6fb7a0caf0784500
[    1.212663] x7 : 5d20657265682074 x6 : ffffffadbdde962c
[    1.217959] x5 : 0000000000000000 x4 : 0000000000000000
[    1.223254] x3 : ffffff800805b258 x2 : ffffffadbba95324
[    1.228550] x1 : ffffffadbbb41e80 x0 : 0000000000000024
[    1.233845] Call trace:
[    1.239134] gic_irq_domain_translate+0x184/0x18c
[    1.241310] gic_irq_domain_alloc+0x50/0x20c
[    1.246174] irq_domain_alloc_irqs_hierarchy+0x18/0x50
[    1.250513] irq_domain_alloc_irqs_parent+0x14/0x24
[    1.260232] irq_domain_alloc_irqs_hierarchy+0x18/0x50
[    1.264749] __irq_domain_alloc_irqs+0xfc/0x25c
[    1.269782] irq_create_fwspec_mapping+0x1ec/0x308
[    1.274210] irq_create_of_mapping+0x5c/0x80
[    1.279072] of_irq_get+0x90/0xc0
[    1.283494] of_irq_to_resource+0x34/0x17c
[    1.286707] of_irq_to_resource_table+0x38/0x70
[    1.290703] of_device_alloc+0x128/0x1e8
[    1.295130] of_platform_device_create_pdata+0x6c/0x10c
[    1.299299] of_platform_bus_create+0x234/0x484
[    1.304244] of_platform_bus_create+0x298/0x484
[    1.308758] of_platform_populate+0x90/0x11c
[    1.313276] of_platform_default_populate_init+0xac/0xc8
[    1.317790] do_one_initcall+0x118/0x290
[    1.323084] kernel_init_freeable+0x308/0x3c0
[    1.326990] kernel_init+0x10/0xf8
[    1.331238] ret_from_fork+0x10/0x18
[    1.334541] ---[ end trace 1d3823a2eedce308 ]---

Solution :

These warnings are occurred due to porting DTC files / nodes as it from old version to new.. In recent DTC files the “interrupts” definitions has been changed to use the macro

               interrupts = <0 114 0>;

Change this code as,

               interrupts = <0 114 IRQ_TYPE_LEVEL_HIGH>;

Once, we change like this, and recompile, flash the kernel.. the above warnings will go away 🙂 Happy Trying..

If we want to debug which exactly DTC node, we want to make changes.. this can be identified either from the warnings which will tell us, which driver this warnings originates from.. and from there we can go to “compatible” in DTC and then fix the interrupts..

To debug and identify which DTC node is causing this warnings we can modify below kernel code as,

$ vim drivers/of/irq.c
/**
 * of_irq_to_resource - Decode a node's IRQ and return it as a resource
 * @dev: pointer to device tree node
 * @index: zero-based index of the irq
 * @r: pointer to resource structure to return result into.
 */
int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
{
        int irq = of_irq_get(dev, index);
        u32 trigger_type;
        struct of_phandle_args oirq;

        if (irq < 0)
                return irq;

        /* Only dereference the resource if both the
         * resource and the irq are valid. */
        if (r && irq) {
                const char *name = NULL;

                memset(r, 0, sizeof(*r));
                /*
                 * Get optional "interrupt-names" property to add a name
                 * to the resource.
                 */
                of_property_read_string_index(dev, "interrupt-names", index,
                                              &name);

                trigger_type = irqd_get_trigger_type(irq_get_irq_data(irq));

                of_irq_parse_one(dev, index, &oirq);

                if (!trigger_type &&
                        of_device_is_compatible(oirq.np, "arm,gic-v3")) {
                        pr_err("IRQ TYPE should not be NONE for %s\n",
                                                        dev->full_name);
                }
                        pr_err("DEBUG_WARNING: of_device_is_compatible: %d\n", of_device_is_compatible(oirq.np, "arm,gic-v3"));
                        pr_err("DEBUG_WARNING: trigger_type %d, irq=%d\n", trigger_type, irq);
                        pr_err("DEBUG_WARNING: name %s : of_node_full_name: %s\n", name, of_node_full_name(dev));

                r->start = r->end = irq;
                r->flags = IORESOURCE_IRQ | trigger_type;
                r->name = name ? name : of_node_full_name(dev);
        }

        return irq;
}
EXPORT_SYMBOL_GPL(of_irq_to_resource);

here, we added below line of code,

                        pr_err("DEBUG_WARNING: of_device_is_compatible: %d\n", of_device_is_compatible(oirq.np, "arm,gic-v3"));
                        pr_err("DEBUG_WARNING: trigger_type %d, irq=%d\n", trigger_type, irq);
                        pr_err("DEBUG_WARNING: name %s : of_node_full_name: %s\n", name, of_node_full_name(dev));

and then recompile kernel and check in dmesg, we will get the clue about the node which was causing this warning..


Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

Leave a Comment