summaryrefslogtreecommitdiff
path: root/drivers/char/tpm/tpm_ibmvtpm.c
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.ibm.com>2020-03-12 18:53:32 +0300
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2020-03-15 21:13:33 +0300
commit18b3670d79ae9948a5839f0956a47e4eb4130a63 (patch)
tree22fa47b4b100427f22ec14a2074493d2015a912a /drivers/char/tpm/tpm_ibmvtpm.c
parentd8d74ea3c00214aee1e1826ca18e77944812b9b4 (diff)
downloadlinux-18b3670d79ae9948a5839f0956a47e4eb4130a63.tar.xz
tpm: ibmvtpm: Add support for TPM2
Support TPM2 in the IBM vTPM driver. The hypervisor tells us what version of TPM is connected through the vio_device_id. In case a TPM2 device is found, we set the TPM_CHIP_FLAG_TPM2 flag and get the command codes attributes table. The driver does not need the timeouts and durations, though. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Acked-by: Nayna Jain <nayna@linux.ibm.com> Tested-by: Nayna Jain <nayna@linux.ibm.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Diffstat (limited to 'drivers/char/tpm/tpm_ibmvtpm.c')
-rw-r--r--drivers/char/tpm/tpm_ibmvtpm.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c
index cfe40e7b1ba4..1a49db9e108e 100644
--- a/drivers/char/tpm/tpm_ibmvtpm.c
+++ b/drivers/char/tpm/tpm_ibmvtpm.c
@@ -29,6 +29,7 @@ static const char tpm_ibmvtpm_driver_name[] = "tpm_ibmvtpm";
static const struct vio_device_id tpm_ibmvtpm_device_table[] = {
{ "IBM,vtpm", "IBM,vtpm"},
+ { "IBM,vtpm", "IBM,vtpm20"},
{ "", "" }
};
MODULE_DEVICE_TABLE(vio, tpm_ibmvtpm_device_table);
@@ -672,6 +673,13 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev,
if (rc)
goto init_irq_cleanup;
+ if (!strcmp(id->compat, "IBM,vtpm20")) {
+ chip->flags |= TPM_CHIP_FLAG_TPM2;
+ rc = tpm2_get_cc_attrs_tbl(chip);
+ if (rc)
+ goto init_irq_cleanup;
+ }
+
if (!wait_event_timeout(ibmvtpm->crq_queue.wq,
ibmvtpm->rtce_buf != NULL,
HZ)) {