Re: [PATCH v10 1/8] tpm: Make read{16, 32}() and write32() in tpm_tis_phy_ops optional

From: Jarkko Sakkinen
Date: Tue Jun 16 2020 - 20:37:43 EST


On Thu, Jun 04, 2020 at 04:47:06PM +0300, amirmizi6@xxxxxxxxx wrote:
> From: Amir Mizinski <amirmizi6@xxxxxxxxx>
>
> Only tpm_tis can use memory-mapped I/O, which is truly mapped into
> the kernel's memory space. Therefore, using ioread16/ioread32/iowrite32
> turns into a straightforward pointer dereference.
> Every other driver requires more complicated operations to read more than
> one byte at a time and will just fall back to read_bytes/write_bytes.
> Therefore, move this common code out of tpm_tis_spi and into tpm_tis_core
> so that it is used automatically when low-level drivers do not implement
> the specialized methods.
>
> Co-developed-by: Alexander Steffen <Alexander.Steffen@xxxxxxxxxxxx>
> Signed-off-by: Alexander Steffen <Alexander.Steffen@xxxxxxxxxxxx>
> Signed-off-by: Amir Mizinski <amirmizi6@xxxxxxxxx>

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@xxxxxxxxxxxxxxx>
Tested-by: Jarkko Sakkinen <jarkko.sakkinen@xxxxxxxxxxxxxxx>

I tested this with my T480 ThinkPad, which has Infineon SLB 9670 TPM
chip according to TPM_PT_VENDOR_STRING_* [*]

[*] tpm2_getcap properties-fixed from tpm2-tools package to fetch this
information.

/Jarkko