tpm_tis_spi: Use DMA-safe memory for SPI transfers
authorAlexander Steffen <Alexander.Steffen@infineon.com>
Mon, 11 Sep 2017 10:26:52 +0000 (12:26 +0200)
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Wed, 18 Oct 2017 15:28:46 +0000 (18:28 +0300)
commit6b3a13173f23e798e1ba213dd4a2c065a3b8d751
treecdccb6bb1c247a7a54497e1e1e52a2c01521cdc2
parentf5357413dbaadd82361903f3c389cb1d5763a85e
tpm_tis_spi: Use DMA-safe memory for SPI transfers

The buffers used as tx_buf/rx_buf in a SPI transfer need to be DMA-safe.
This cannot be guaranteed for the buffers passed to tpm_tis_spi_read_bytes
and tpm_tis_spi_write_bytes. Therefore, we need to use our own DMA-safe
buffer and copy the data to/from it.

The buffer needs to be allocated separately, to ensure that it is
cacheline-aligned and not shared with other data, so that DMA can work
correctly.

Fixes: 0edbfea537d1 ("tpm/tpm_tis_spi: Add support for spi phy")
Cc: stable@vger.kernel.org
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Alexander Steffen <Alexander.Steffen@infineon.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
drivers/char/tpm/tpm_tis_spi.c