[PATCH v3 2/4] i3c: mipi-i3c-hci: Use core helpers for DMA mapping and bounce buffering
Jarkko Nikula
jarkko.nikula at linux.intel.com
Wed Aug 20 22:51:37 PDT 2025
On 8/20/25 7:11 PM, Frank Li wrote:
> On Wed, Aug 20, 2025 at 02:34:45PM +0300, Jarkko Nikula wrote:
>>
>> For now, require bounce buffer only when the buffer is in the
>> vmalloc() area to avoid unnecessary copying with CCC commands and
>> DMA-safe I2C transfers.
>
> I see below you pass 'false' to i3c_master_dma_map_single(). where
> check buffer in the vmaloc() area?
>
Yes it's intended in this patch. Driver doesn't especially require a
bounce here (in the next patch yes) but if buffer is in vmalloc area the
i3c_master_dma_map_single() does allocate it internally.
>>
>> Signed-off-by: Jarkko Nikula <jarkko.nikula at linux.intel.com>
>> ---
>> drivers/i3c/master/mipi-i3c-hci/core.c | 34 --------------------------
>> drivers/i3c/master/mipi-i3c-hci/dma.c | 27 +++++++++-----------
>> drivers/i3c/master/mipi-i3c-hci/hci.h | 3 +--
>> 3 files changed, 12 insertions(+), 52 deletions(-)
>>
> [...]
>> @@ -391,21 +390,17 @@ static int hci_dma_queue_xfer(struct i3c_hci *hci,
>>
>> /* 2nd and 3rd words of Data Buffer Descriptor Structure */
>> if (xfer->data) {
>> - buf = xfer->bounce_buf ? xfer->bounce_buf : xfer->data;
>> - xfer->data_dma =
>> - dma_map_single(&hci->master.dev,
>> - buf,
>> - xfer->data_len,
>> - xfer->rnw ?
>> - DMA_FROM_DEVICE :
>> - DMA_TO_DEVICE);
>> - if (dma_mapping_error(&hci->master.dev,
>> - xfer->data_dma)) {
>> + xfer->dma = i3c_master_dma_map_single(&hci->master.dev,
>> + xfer->data,
>> + xfer->data_len,
>> + false,
>> +
>
> you pass false here.
>
More information about the linux-i3c
mailing list