qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] TSC2005 interrupt handling fix


From: andrzej zaborowski
Subject: Re: [Qemu-devel] [PATCH] TSC2005 interrupt handling fix
Date: Thu, 8 Jan 2009 08:27:55 +0100

2009/1/7 Riihimaki Juha (Nokia-D-MSW/Helsinki) <address@hidden>:
> Both issues are timing related; it is possible to get a timer tick callback
> in the TSC2005 while executing the guest ISR that is handling the interrupt
> raised by the TSC2005 earlier.
>
> For issue #1 specifically, when this happens with the current version, all
> DAV bits for the running conversion function are set by the timer tick
> callback even if some of the results had already been read out and the
> corresponding DAV bits cleared. Now, when the guest ISR is finished and it
> clears the IRQ, some DAV bits in the TSC2005 will remain set and this leads
> to the TSC2005 never to raise a new interrupt again (at least with function
> 1 in use).

The ISR doesn't clear the IRQ -- it can only clear the irq mask flag.
If the TSC2005 still keeps the IRQ pin high, then the cpu should
immediately jump to the ISR again.

We shouldn't be trying to change the tsc2005 emulation so that the
driver works, we should change it so that it behaves as described in
the specification from TI.  I think the real issue is that we start a
new conversion before the irq is deasserted, i.e. the following check
in tscXXXX_pin_update

    if (!s->enabled || s->busy)
        return;

should become

    if (!s->enabled || s->busy || s->dav)
        return;

or something similar.  It would be good to check on the real tsc2005
when exactly the DAC becomes busy (bit 14 of CFR0) in the different
modes.

>
> Issue #2 is similar but happens more rarely as it requires more precise
> conditions; if the guest ISR has just finished reading the conversion
> results, i.e. DAV bits are all clear, the SPI read function in TSC2005 will
> immediately clear the interrupt flag. It is then possible to get the timer
> tick callback between this moment and the moment when the guest ISR has
> actually cleared the IRQ. When this happens, the callback will try to raise
> a new interrupt but as the guest ISR will clear it shortly thereafter the
> actual IRQ will be cleared but the IRQ flag in the TSC2005 code will stay
> active causing the TSC2005 not to generate new interrupts anymore.
>
> A more elaborate solution than my proposed patch would of course be better.
> I tested my patch only with the "n810" machine emulation with an appropriate
> guest software image which seems to be the only configuration using the
> TSC2005. However I am aware that this combination is not utilizing every
> aspect of the TSC2005.

The initial patch you sent was breaking the logic described in the
specs so imho it would be a regression.  The specs says clearly when
the PINT/DAV must be raised and lowered and it's not only in the timer
callback.

Cheers




reply via email to

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