Skip to contentSkip to conversation

Fixed tpm_tis bug when some devices report invalid timeout

PATCH New Emil Condrea 2 participants 4 messages Oct 29, 2014 – Oct 30, 2014

lore
Share & tools
lore
#2 lore raw

Re: [PATCH] Fixed tpm_tis bug when some devices report invalid timeout values.

In reply to Emil Condrea

On Wed, 2014-10-29 at 19:28 +0200, Emil Condrea wrote:

Thanks.

Please see http://wiki.xen.org/wiki/Submitting_Xen_Patches which describes some of the requirements for submitting a patch. In particular we need a Signed-off-by in order to accept a contribution, but also note the bit about CCing the relevant maintainer and the bit about what a good changelog entry might contain.

Thanks,
Ian.

Quoted 43 lines
---
 extras/mini-os/tpm_tis.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
extras/mini-os/tpm_tis.c +12 -0
index b067cb7..81d426a 100644
@@ -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;
#0 lore raw

PATCH 1/1 Fixed tpm_tis bug when some devices report invalid timeout

This patch contains fixes for TPM drivers that report invalid timeouts. After aplying this patch developers using Atmel chipsets that were facing problems starting vtmmgr-stubdom, should succeed.

#1 lore raw

PATCH 1/1 Fixed tpm_tis bug when some devices report invalid timeout values.

---
 extras/mini-os/tpm_tis.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
extras/mini-os/tpm_tis.c +12 -0
index b067cb7..81d426a 100644
@@ -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;
Signature · 1 line
1.9.1
#3 lore raw

Re: [PATCH] Fixed tpm_tis bug when some devices report invalid timeout values.

In reply to Ian Campbell

Sure.
I sent the patch using git send-email and it seems that it was not well configured to include the description and Signed-off. I will send it again.

Quoted 55 lines · Ian Campbell

On Wed, 2014-10-29 at 19:28 +0200, Emil Condrea wrote:

Thanks.

Please see http://wiki.xen.org/wiki/Submitting_Xen_Patches which describes some of the requirements for submitting a patch. In particular we need a Signed-off-by in order to accept a contribution, but also note the bit about CCing the relevant maintainer and the bit about what a good changelog entry might contain.

Thanks,
Ian.

extras/mini-os/tpm_tis.c line 36

Quoted 13 lines
---
 extras/mini-os/tpm_tis.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
extras/mini-os/tpm_tis.c +1 -0
index b067cb7..81d426a 100644
@@ -33,6 +33,11 @@
 #ifndef min
      #define min( a, b ) ( ((a) < (b)) ? (a) : (b) )
 #endif
+#define ADJUST_TIMEOUTS_TO_STANDARD(initial,standard,timeout_no)
             \

extras/mini-os/tpm_tis.c line 37

Quoted 1 line
extras/mini-os/tpm_tis.c +1 -0
+     if((initial) < (standard)){
             \

extras/mini-os/tpm_tis.c line 38

Quoted 1 line
extras/mini-os/tpm_tis.c +1 -0
+             (initial) = (standard);
             \

extras/mini-os/tpm_tis.c line 39

Quoted 1 line
extras/mini-os/tpm_tis.c +1 -0
+             printk("Timeout %c was adjusted to standard

value.\n",timeout_no); \

extras/mini-os/tpm_tis.c int tpm_get_timeouts(struct tpm_chip *chip) · line 1005

Quoted 9 lines
extras/mini-os/tpm_tis.c +2 -0
+     }
 
 #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');

extras/mini-os/tpm_tis.c int tpm_get_timeouts(struct tpm_chip *chip) · line 1011

Quoted 5 lines
extras/mini-os/tpm_tis.c +2 -0
+
    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');

extras/mini-os/tpm_tis.c int tpm_get_timeouts(struct tpm_chip *chip) · line 1016

Quoted 5 lines
extras/mini-os/tpm_tis.c +2 -0
+
    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');

Quoted 12 lines

extras/mini-os/tpm_tis.c int tpm_get_timeouts(struct tpm_chip *chip)

Quoted 5 lines
extras/mini-os/tpm_tis.c +2 -0
+
    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');

Quoted 3 lines
extras/mini-os/tpm_tis.c +0 -0
 duration:
    tpm_cmd.header.in = tpm_getcap_header;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel