[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20200225205305.3948001-2-stefanb@linux.vnet.ibm.com>
Date: Tue, 25 Feb 2020 15:53:02 -0500
From: Stefan Berger <stefanb@...ux.vnet.ibm.com>
To: jarkko.sakkinen@...ux.intel.com, linux-integrity@...r.kernel.org
Cc: aik@...abs.ru, david@...son.dropbear.id.au,
linux-kernel@...r.kernel.org, nayna@...ux.vnet.ibm.com,
gcwilson@...ux.ibm.com, jgg@...pe.ca,
Stefan Berger <stefanb@...ux.ibm.com>
Subject: [PATCH v3 1/4] tpm: of: Handle IBM,vtpm20 case when getting log parameters
From: Stefan Berger <stefanb@...ux.ibm.com>
A vTPM 2.0 is identified by 'IBM,vtpm20' in the 'compatible' node in
the device tree. Handle it in the same way as 'IBM,vtpm'.
The vTPM 2.0's log is written in little endian format so that for this
aspect we can rely on existing code.
Signed-off-by: Stefan Berger <stefanb@...ux.ibm.com>
Acked-by: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
---
drivers/char/tpm/eventlog/of.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/char/tpm/eventlog/of.c b/drivers/char/tpm/eventlog/of.c
index af347c190819..a31a625ad44e 100644
--- a/drivers/char/tpm/eventlog/of.c
+++ b/drivers/char/tpm/eventlog/of.c
@@ -17,6 +17,12 @@
#include "../tpm.h"
#include "common.h"
+static const char * const compatibles[] = {
+ "IBM,vtpm",
+ "IBM,vtpm20",
+ NULL
+};
+
int tpm_read_log_of(struct tpm_chip *chip)
{
struct device_node *np;
@@ -51,7 +57,7 @@ int tpm_read_log_of(struct tpm_chip *chip)
* endian format. For this reason, vtpm doesn't need conversion
* but physical tpm needs the conversion.
*/
- if (of_property_match_string(np, "compatible", "IBM,vtpm") < 0) {
+ if (!of_device_compatible_match(np, compatibles)) {
size = be32_to_cpup((__force __be32 *)sizep);
base = be64_to_cpup((__force __be64 *)basep);
} else {
--
2.23.0
Powered by blists - more mailing lists