gplv2/tpmdd/patches/UPSTREAM-0002-tpm-reduce-tp...

60 lines
2.0 KiB
Diff
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 19b460f3fe98b0513bf5a52f63e19bc120bd8093 Mon Sep 17 00:00:00 2001
From: Nayna Jain <nayna@linux.vnet.ibm.com>
Date: Fri, 10 Nov 2017 16:33:06 -0500
Subject: [PATCH] =?UTF-8?q?tpm:=20reduce=C2=A0tpm=C2=A0polling=C2=A0delay?=
=?UTF-8?q?=C2=A0in=C2=A0tpm=5Ftis=5Fcore?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The existing wait_for_tpm_stat() polls for the chip status after
5msec sleep. As per TCG ddwg input, it is expected that tpm might
return status in few usec. So, reducing the delay in polling to
1msec.
Similarly, get_burstcount() function sleeps for 5msec before
retrying for next query to burstcount in a loop. If it takes
lesser time for TPM to return, this 5msec delay is longer than
necessary.
After this change, performance on a TPM 1.2 with an 8 byte
burstcount for 1000 extends improved from ~14sec to ~9sec.
Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
tpm-interface.c | 2 +-
tpm_tis_core.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tpm-interface.c b/tpm-interface.c
index 66d671b..9971422 100644
--- a/tpm-interface.c
+++ b/tpm-interface.c
@@ -1050,7 +1050,7 @@ again:
}
} else {
do {
- tpm_msleep(TPM_TIMEOUT);
+ tpm_msleep(1);
status = chip->ops->status(chip);
if ((status & mask) == mask)
return 0;
diff --git a/tpm_tis_core.c b/tpm_tis_core.c
index 63bc6c3..d87255f 100644
--- a/tpm_tis_core.c
+++ b/tpm_tis_core.c
@@ -164,7 +164,7 @@ static int get_burstcount(struct tpm_chip *chip)
burstcnt = (value >> 8) & 0xFFFF;
if (burstcnt)
return burstcnt;
- tpm_msleep(TPM_TIMEOUT);
+ tpm_msleep(1);
} while (time_before(jiffies, stop));
return -EBUSY;
}
--
1.8.3.1