https://bugzilla.kernel.org/show_bug.cgi?id=68291

--- Comment #20 from Jin Yao <[email protected]> ---
I think I got the root cause. Let's see 2 execution flows (based on 3.13
kernel):

Flow 1: GPIO
    acpi_gpiochip_request_interrupts() -> byt_gpio_to_irq() ->
irq_create_mapping() -> 
        irq_alloc_desc_from()    /* IRQ16 is allocated */
        irq_domain_associate() ->
            domain->ops->map() /* Execute the callback byt_gpio_irq_map() */

            static int byt_gpio_irq_map(struct irq_domain *d, unsigned int
virq,
                            irq_hw_number_t hw)
            {
                struct byt_gpio *vg = d->host_data;
                ......            
                irq_set_chip_data(virq, vg);    
                ......    
            }

            int irq_set_chip_data(unsigned int irq, void *data)
            {
                struct irq_desc *desc = irq_get_desc_lock(irq, &flags, 0);
                ......
                desc->irq_data.chip_data = data;
                ......
            }

    Now the chip_data in irq_desc of IRQ16 is pointing to "byt_gpio".

Flow 2: i915
    acpi_pci_irq_enable()    /* From ACPI, we know the gsi=16 */
        -> acpi_register_gsi() -> mp_register_gsi() ->
io_apic_set_pci_routing() ->
        io_apic_setup_irq_pin_once() -> io_apic_setup_irq_pin()

        /* irq = 16 here */
        io_apic_setup_irq_pin(unsigned int irq, int node, struct
io_apic_irq_attr *attr)
        {
        /* A */    struct irq_cfg *cfg = alloc_irq_and_cfg_at(irq, node);
            int ret;

            if (!cfg)
                return -EINVAL;
            ret = __add_pin_to_irq_node(cfg, node, attr->ioapic,
attr->ioapic_pin);
            if (!ret)
                setup_ioapic_irq(irq, cfg, attr);
            return ret;
        }

    The problem is at line A, actually the returned cfg is the chip_data in
irq_desc of IRQ16, it's pointing to "byt_gpio" in flow 1.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
acpi-bugzilla mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/acpi-bugzilla

Reply via email to