xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Emil Condrea <emilcondrea@gmail.com>, xen-devel@lists.xen.org
Cc: dgdegra@tycho.nsa.gov
Subject: Re: [PATCH] vTPM: Fix Atmel timeout bug.
Date: Thu, 30 Oct 2014 12:58:22 +0000	[thread overview]
Message-ID: <545235EE.4040000@citrix.com> (raw)
In-Reply-To: <1414674330-2779-1-git-send-email-emilcondrea@gmail.com>

On 30/10/14 13:05, Emil Condrea wrote:
> 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@gmail.com>
> ---
>  extras/mini-os/tpm_tis.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/extras/mini-os/tpm_tis.c b/extras/mini-os/tpm_tis.c
> index b067cb7..81d426a 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');

Surely each of these are just

chip->timeout_a = max(MICROSECS(timeout * scale),
MILLISECS(TIS_SHORT_TIMEOUT))

Also, are you certain that the units here are correct?  The micro vs
milli seconds looks odd.

~Andrew

  reply	other threads:[~2014-10-30 12:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-30 13:05 [PATCH] vTPM: Fix Atmel timeout bug Emil Condrea
2014-10-30 12:58 ` Andrew Cooper [this message]
2014-10-30 13:48   ` Emil Condrea
2014-11-04 10:15     ` Ian Campbell
2014-11-06 22:01       ` Daniel De Graaf
2014-11-07 10:45         ` Emil Condrea
2014-11-10 12:01         ` Ian Campbell
2014-11-10 14:35           ` Konrad Rzeszutek Wilk
2014-11-14 10:34             ` Ian Campbell
2014-11-10 22:10           ` Daniel De Graaf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=545235EE.4040000@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=emilcondrea@gmail.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).