Skip to contentSkip to conversation

When doing PT for a device, fails to bind the interrupt, if the specified irq is *not* PT_MACHINE_IRQ_AUTO

DISCUSSION Tom Rotenberg 1 participant 1 message Aug 17, 2009

lore
Share & tools
lore
#0 lore raw

Hi,

When i'm doing PT for a device, if i specify the 'PT_MACHINE_IRQ_AUTO' as the irq for the device, it works fine. However, if i try and specify an irq number (even if i specify the same irq , which will later be selected by the auto-irq method) - it fails to bind the interrupt.

I looked at the code a little bit, and it looks like, if the irq isn't PT_MACHINE_IRQ_AUTO, then the call to 'xc_physdev_map_pirq()' won't be executed. Here is the code:

    if ( PT_MACHINE_IRQ_AUTO == machine_irq )
    {
        int pirq = pci_dev->irq;

        machine_irq = pci_dev->irq;
        rc = xc_physdev_map_pirq(xc_handle, domid, machine_irq, &pirq);

        if ( rc )
        {
            PT_LOG("Error: Mapping irq failed, rc = %d\n", rc);

            /* Disable PCI intx assertion (turn on bit10 of devctl) */
            pci_write_word(pci_dev, PCI_COMMAND,
                *(uint16_t *)(&assigned_device->dev.config[PCI_COMMAND])
                | PCI_COMMAND_DISABLE_INTx);
            machine_irq = 0;
            assigned_device->machine_irq = 0;
        }
        else
        {
            machine_irq = pirq;
            assigned_device->machine_irq = pirq;
            mapped_machine_irq[machine_irq]++;
        }
    }

This looks like a bug, no?

Tom