diff options
author | Jarkko Nikula <jarkko.nikula@linux.intel.com> | 2023-11-09 15:37:08 +0200 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2023-11-16 23:36:44 +0100 |
commit | 4afd72876942f2ab1e97e79082464a46ab40a485 (patch) | |
tree | aeafb7d610e68ce135d868375bdcc625d4e841fd /drivers/i3c/master.c | |
parent | f83f86e506e6b776ba5dd70f919f7e2856f9e061 (diff) | |
download | lwn-4afd72876942f2ab1e97e79082464a46ab40a485.tar.gz lwn-4afd72876942f2ab1e97e79082464a46ab40a485.zip |
i3c: mipi-i3c-hci: Add DMA bounce buffer for private transfers
Implement a local bounce buffer for private I3C SDR and I2C transfers
when using DMA and the buffer attached to the transfer is not DMA safe.
Otherwise the DMA transfer will fail and with following warning:
[ 11.411059] i3c mipi-i3c-hci.0: rejecting DMA map of vmalloc memory
[ 11.417313] WARNING: CPU: 3 PID: 357 at include/linux/dma-mapping.h:332 hci_dma_queue_xfer+0x2e2/0x300 [mipi_i3c_hci]
Strictly speaking private I3C SDR transfers are expected to pass a
DMA-able buffer. However I fear this requirement may easily be slipped
or go unnoticed when I3C interface support is added into a existing
device driver that use regmap API to read/write stack variables.
For example this is the case with the commit 2660b0080bb2 ("iio: imu:
st_lsm6dsx: add i3c basic support for LSM6DSO and LSM6DSR").
Buffer of an I2C message is not required to be DMA safe and the I2C core
provides i2c_(get|put)_dma_safe_msg_buf() helpers for the host
controllers that do DMA and that is also recommendation for the
i2c_xfers() callback from the I3C core.
However due to above I3C private transfers reason I decided to implement
a bounce buffer for them and reuse the same code for the I2C transfers
too. Since this driver is currently the only I3C host controller driver
that can do DMA the implementation is done here and not in I3C core.
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Link: https://lore.kernel.org/r/20231109133708.653950-5-jarkko.nikula@linux.intel.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/i3c/master.c')
0 files changed, 0 insertions, 0 deletions