summaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm_ibmvtpm.c
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.vnet.ibm.com>2013-01-22 13:52:35 -0600
committerKent Yoder <key@linux.vnet.ibm.com>2013-02-05 09:38:24 -0600
commit1f866057291fc00f14e4962473bd7724ffa8f578 (patch)
treeea780b029f24530a32913fa983a60f1a01a4d0d4 /drivers/char/tpm/tpm_ibmvtpm.c
parent3e3a5e906998b090ad929010a5f5082ac0dbbdfb (diff)
downloadblackbird-op-linux-1f866057291fc00f14e4962473bd7724ffa8f578.tar.gz
blackbird-op-linux-1f866057291fc00f14e4962473bd7724ffa8f578.zip
tpm: Fix cancellation of TPM commands (polling mode)
On one of my machines the cancellation of TPM commands does not work. The reason is that by writing into sysfs 'cancel' the tpm_tis_ready call causes the status flag TPM_STS_VALID to be set in the statusregister. However, the TIS driver seems to wait for TPM_STS_COMMAND_READY. Once a 2nd time sysfs 'cancel' is written to, the TPM_STS_COMMAND_READY flag also gets set, resulting in TPM_STS_VALID|TPM_STS_COMMAND_READY to be read from the status register. This patch now converts req_canceled into a function to enable more complex comparisons against possible cancellation status codes. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
Diffstat (limited to 'drivers/char/tpm/tpm_ibmvtpm.c')
-rw-r--r--drivers/char/tpm/tpm_ibmvtpm.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c
index 6cd99bc1c5d4..56b07c35a13e 100644
--- a/drivers/char/tpm/tpm_ibmvtpm.c
+++ b/drivers/char/tpm/tpm_ibmvtpm.c
@@ -398,6 +398,11 @@ static int tpm_ibmvtpm_resume(struct device *dev)
return rc;
}
+static bool tpm_ibmvtpm_req_canceled(struct tpm_chip *chip, u8 status)
+{
+ return (status == 0);
+}
+
static const struct file_operations ibmvtpm_ops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
@@ -441,7 +446,7 @@ static const struct tpm_vendor_specific tpm_ibmvtpm = {
.status = tpm_ibmvtpm_status,
.req_complete_mask = 0,
.req_complete_val = 0,
- .req_canceled = 0,
+ .req_canceled = tpm_ibmvtpm_req_canceled,
.attr_group = &ibmvtpm_attr_grp,
.miscdev = { .fops = &ibmvtpm_ops, },
};
OpenPOWER on IntegriCloud