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

[Xen-changelog] [xen master] vTPM: Fix Atmel timeout bug.



commit f804eee318eeeb2fa5202f155c360ede02010d20
Author:     Emil Condrea <emilcondrea@xxxxxxxxx>
AuthorDate: Thu Oct 30 15:05:30 2014 +0200
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Fri Nov 14 10:13:23 2014 +0000

    vTPM: Fix Atmel timeout bug.
    
    Some versions of Atmel TPMs provide invalid values for 
TPM_CAP_PROP_TIS_TIMEOUT query.
    Because timeouts are invalid, every other command after tpm_get_timeouts 
will fail.
    It is a known issue and it was fixed recently in linux kernel tpm_tis.c on 
2014-07-29.
    This patch does not allow timeouts to be less than standard values.
    I tested it on a Dell Latitude E5520 and after making the changes I was 
able to start vtpmmgr-stubdom.
    
    Signed-off-by: Emil Condrea <emilcondrea@xxxxxxxxx>
    Acked-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
---
 extras/mini-os/tpm_tis.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/extras/mini-os/tpm_tis.c b/extras/mini-os/tpm_tis.c
index b067cb7..d78c465 100644
--- a/extras/mini-os/tpm_tis.c
+++ b/extras/mini-os/tpm_tis.c
@@ -33,6 +33,11 @@
 #ifndef min
        #define min( a, b ) ( ((a) < (b)) ? (a) : (b) )
 #endif
+#define ADJUST_TIMEOUTS_TO_STANDARD(initial,standard,timeout_no)               
        \
+       if((initial) < (standard)){                                             
        \
+               (initial) = (standard);                                         
        \
+               printk("Timeout %c was adjusted to standard 
value.\n",timeout_no);      \
+       }
 
 #define TPM_HEADER_SIZE 10
 
@@ -997,15 +1002,22 @@ int tpm_get_timeouts(struct tpm_chip *chip)
    }
    if (timeout)
       chip->timeout_a = MICROSECS(timeout * scale); /*Convert to msec */
+   
ADJUST_TIMEOUTS_TO_STANDARD(chip->timeout_a,MILLISECS(TIS_SHORT_TIMEOUT),'a');
+
    timeout = be32_to_cpu(timeout_cap->b);
    if (timeout)
       chip->timeout_b = MICROSECS(timeout * scale); /*Convert to msec */
+   
ADJUST_TIMEOUTS_TO_STANDARD(chip->timeout_b,MILLISECS(TIS_LONG_TIMEOUT),'b');
+
    timeout = be32_to_cpu(timeout_cap->c);
    if (timeout)
       chip->timeout_c = MICROSECS(timeout * scale); /*Convert to msec */
+   
ADJUST_TIMEOUTS_TO_STANDARD(chip->timeout_c,MILLISECS(TIS_SHORT_TIMEOUT),'c');
+
    timeout = be32_to_cpu(timeout_cap->d);
    if (timeout)
       chip->timeout_d = MICROSECS(timeout * scale); /*Convert to msec */
+   
ADJUST_TIMEOUTS_TO_STANDARD(chip->timeout_d,MILLISECS(TIS_SHORT_TIMEOUT),'d');
 
 duration:
    tpm_cmd.header.in = tpm_getcap_header;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.