• S
    tpm_tis: Fix the probing for interrupts · a7b66822
    Stefan Berger 提交于
    This patch fixes several aspects of the probing for interrupts.
    
    This patch reads the TPM's timeouts before probing for the interrupts. The
    tpm_get_timeouts() function is invoked in polling mode and gets the proper
    timeouts from the TPM so that we don't need to fall back to 2 minutes timeouts
    for short duration commands while the interrupt probing is happening.
    
    This patch introduces a variable probed_irq into the vendor structure that gets
    the irq number if an interrupt is received while the the tpm_gen_interrupt()
    function is run in polling mode during interrupt probing. Previously some
    parts of tpm_gen_interrupt() were run in polling mode, then the irq variable
    was set in the interrupt handler when an interrupt was received and execution
    of tpm_gen_interrupt() ended up switching over to interrupt mode.
    tpm_gen_interrupt() execution ended up on an event queue where it eventually
    timed out since the probing handler doesn't wake any queues.
    
    Before calling into free_irq() clear all interrupt flags that may have
    been set by the TPM. The reason is that free_irq() will call into the probing
    interrupt handler and may otherwise fool us into thinking that a real interrupt
    happened (because we see the flags as being set) while the TPM's interrupt line
    is not even connected to anything on the motherboard. This solves a problem
    on one machine I did testing on (Thinkpad T60).
    
    If a TPM claims to use a specifc interrupt, the probing is done as well
    to verify that the interrupt is actually working. If a TPM indicates
    that it does not use a specific interrupt (returns '0'), probe all interrupts
    from 3 to 15.
    Signed-off-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
    Signed-off-by: NRajiv Andrade <srajiv@linux.vnet.ibm.com>
    a7b66822
tpm_tis.c 21.3 KB