public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Nikula <jarkko.nikula@linux.intel.com>
To: Billy Tsai <billy_tsai@aspeedtech.com>,
	alexandre.belloni@bootlin.com, pgaj@cadence.com,
	miquel.raynal@bootlin.com, conor.culhane@silvaco.com,
	aniketmaurya@google.com, Shyam-sundar.S-k@amd.com,
	wsa+renesas@sang-engineering.com, xiaopei01@kylinos.cn,
	Guruvendra.Punugupati@amd.com, linux-i3c@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 2/2] i3c: mipi-i3c-hci: Use DMA-safe buffer for I2C transfers
Date: Wed, 22 Jan 2025 10:28:01 +0200	[thread overview]
Message-ID: <82ce69fe-42fc-4199-bf78-4a147c26048a@linux.intel.com> (raw)
In-Reply-To: <20250121110756.214714-2-billy_tsai@aspeedtech.com>

On 1/21/25 1:07 PM, Billy Tsai wrote:
> The i2c_get_dma_safe_msg_buf function is used to ensure safe handling of
> I2C messages in HCI DMA mode.
> 
> Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
> ---
>   drivers/i3c/master/mipi-i3c-hci/core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
> index a408feac3e9e..3567cd566339 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/core.c
> +++ b/drivers/i3c/master/mipi-i3c-hci/core.c
> @@ -382,7 +382,7 @@ static int i3c_hci_i2c_xfers(struct i2c_dev_desc *dev,
>   		return -ENOMEM;
>   
>   	for (i = 0; i < nxfers; i++) {
> -		xfer[i].data = i2c_xfers[i].buf;
> +		xfer[i].data = i2c_get_dma_safe_msg_buf(&i2c_xfers[i], 1);
>   		xfer[i].data_len = i2c_xfers[i].len;
>   		xfer[i].rnw = i2c_xfers[i].flags & I2C_M_RD;
>   		hci->cmd->prep_i2c_xfer(hci, dev, &xfer[i]);

This allow to remove calls to i3c_hci_alloc_safe_xfer_buf() and 
i3c_hci_free_safe_xfer_buf() in i3c_hci_i2c_xfers().

I was pondering the i2c_get_dma_safe_msg_buf() when making commit 
4afd72876942 ("i3c: mipi-i3c-hci: Add DMA bounce buffer for private 
transfers") but decided to reuse the same (own) helper for both 
i3c_hci_priv_xfers() and i3c_hci_i2c_xfers().

In that sense I'd modify the commit log a bit that instead of ensuring 
safe handling patch switches from custom helper to 
i2c_get_dma_safe_msg_buf() and i2c_put_dma_safe_msg_buf() (please note 
the comment from Wolfram).

  parent reply	other threads:[~2025-01-22  8:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-21 11:07 [PATCH v1 1/2] i3c: Remove the const qualifier from i2c_msg pointer in i2c_xfers API Billy Tsai
2025-01-21 11:07 ` [PATCH v1 2/2] i3c: mipi-i3c-hci: Use DMA-safe buffer for I2C transfers Billy Tsai
2025-01-21 22:19   ` Wolfram Sang
2025-01-23 10:23     ` Billy Tsai
2025-01-22  7:11   ` Mukesh Kumar Savaliya
2025-01-22  8:28   ` Jarkko Nikula [this message]
2025-01-21 22:18 ` [PATCH v1 1/2] i3c: Remove the const qualifier from i2c_msg pointer in i2c_xfers API Wolfram Sang
2025-01-22  7:11 ` Mukesh Kumar Savaliya
2025-01-22  7:21   ` Wolfram Sang
2025-01-22  8:42 ` Thomas Weißschuh
2025-02-04 15:15 ` Mukesh Kumar Savaliya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=82ce69fe-42fc-4199-bf78-4a147c26048a@linux.intel.com \
    --to=jarkko.nikula@linux.intel.com \
    --cc=Guruvendra.Punugupati@amd.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=aniketmaurya@google.com \
    --cc=billy_tsai@aspeedtech.com \
    --cc=conor.culhane@silvaco.com \
    --cc=linux-i3c@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=pgaj@cadence.com \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=xiaopei01@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox