qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Disabling IRQ error


From: Max Filippov
Subject: Re: [Qemu-devel] Disabling IRQ error
Date: Wed, 11 Sep 2013 13:29:11 +0400

On Wed, Sep 11, 2013 at 12:12 PM, Xie Xianshan <address@hidden> wrote:
>   I want to add a new device "fpga" for e500, and trigger an interrupt IRQ3
> while the register BB_INTR_REG which belongs to device "fpga" is wrote by
> the device driver of "fpga".
>   For e500, IRQ3 is an external interrupt irq.
>   According the debug log, the disabling error is encoutered during writing
> BB_INTR_REG register.
>   - write BB_INTR_REG register
>       - qemu_irq_raise() is called.
>       - after serval minutes,
>         the error message about disabling irq is displayed.
>   - continue the next execution without error(with poll?)

So your device raises IRQ, but it doesn't lower it. Real devices
usually don't do that, they either generate a short pulse on the
IRQ line (in case of edge-triggered IRQ) or raise IRQ line on
some event and then lower it on a command from its driver
(level-triggered IRQ).

You can do the following to make your device behave that way:
- make your fpga device capable of lowering its IRQ, e.g. by adding
  another register:

> static void fpga_write(FPGAState *s, unsigned int offset, uint32_t value,
> unsigned size) {
>     switch(offset) {
>     case BB_INTR_REG:
>         qemu_irq_raise(s->irq);
>         break;
       case BB_INTC_REG:
           qemu_irq_lower(s->irq);
           break;
>     }
> }

- provide an interrupt service routine in the linux driver for your fpga
  device that would check whether the interrupt was caused by its
  device, and if so lower the device's IRQ.

Thanks.
-- Max



reply via email to

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