qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] pci: add standard bridge device


From: Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH] pci: add standard bridge device
Date: Wed, 7 Sep 2011 14:52:23 +0300
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Sep 07, 2011 at 12:39:09PM +0800, Wen Congyang wrote:
> At 09/06/2011 03:45 PM, Avi Kivity Write:
> > On 09/06/2011 06:06 AM, Wen Congyang wrote:
> >> >  Use the uio driver -
> >> >  http://docs.blackfin.uclinux.org/kernel/generated/uio-howto/.  You
> >> just
> >> >  mmap() the BAR from userspace and play with it.
> >>
> >> When I try to bind ivshmem to uio_pci_generic, I get the following
> >> messages:
> >> uio_pci_generic 0000:01:01.0: No IRQ assigned to device: no support
> >> for interrupts?
> >>
> > 
> > No idea what this means.
> 
> PCI 3.0 6.2.4
> For x86 based PCs, the values in this register correspond to IRQ numbers 
> (0-15) of the standard dual
> 8259 configuration. The value 255 is defined as meaning "unknown" or "no 
> connection" to the interrupt
> controller. Values between 15 and 254 are reserved.
> 
> The register is interrupt line.
> 
> I read the config of this device, the interrupt line is 0. It means that it 
> uses the IRQ0.
> 
> The following is the uio_pci_generic's code:
> static int __devinit probe(struct pci_dev *pdev,
>                          const struct pci_device_id *id)
> {
>       struct uio_pci_generic_dev *gdev;
>       int err;
> 
>       err = pci_enable_device(pdev);
>       if (err) {
>               dev_err(&pdev->dev, "%s: pci_enable_device failed: %d\n",
>                       __func__, err);
>               return err;
>       }
> 
>       if (!pdev->irq) {
>               dev_warn(&pdev->dev, "No IRQ assigned to device: "
>                        "no support for interrupts?\n");
>               pci_disable_device(pdev);
>               return -ENODEV;
>       }
> ...
> }
> 
> This function will be called when we write 'domain:bus:slot.function' to 
> /sys/bus/pci/drivers/uio_pci_generic/bind.
> pdev->irq is 0, it means the device uses IRQ0. But we refuse it. I do not why.
> 
> To Michael S. Tsirkin
> This code is writen by you. Do you know why you check whether pdev->irq is 0?
> 
> Thanks
> Wen Congyang
> 
> > 

Well I see this in linux:

/*
 * Read interrupt line and base address registers.
 * The architecture-dependent code can tweak these, of course.
 */
static void pci_read_irq(struct pci_dev *dev)
{
        unsigned char irq;

        pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &irq);
        dev->pin = irq;
        if (irq)
                pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq);
        dev->irq = irq;
}

Thus a device without an interrupt pin will get irq set to 0,
and this seems the right way to detect such devices.
I don't think PCI devices really use IRQ0 in practice,
its probably used for PC things. More likely the system is
misconfigured.  Try lspci -vv to see what went wrong.

-- 
MST



reply via email to

[Prev in Thread] Current Thread [Next in Thread]