All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: <sashiko-reviews@lists.linux.dev>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
	<Frank.Li@kernel.org>, <linux-i3c@lists.infradead.org>
Subject: Re: [PATCH 17/17] i3c: mipi-i3c-hci: Add HDR-DDR support
Date: Mon, 14 Sep 2026 15:54:31 +0300	[thread overview]
Message-ID: <53ea27d2-1043-4b7f-b2a8-baabf6dfbfb8@intel.com> (raw)
In-Reply-To: <20260914115449.8A8971F000FF@smtp.kernel.org>

On 14/09/2026 14:54, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] The HDR Command Code's RNW bit (bit 7) is incorrectly masked out when constructing the transfer descriptor, causing HDR read commands to be sent as write commands on the bus.
> --
> 
> commit f1f61dea5df0e3000b1b519aa78a3886fbb61942
> Author: Adrian Hunter <adrian.hunter@intel.com>
> Subject: i3c: mipi-i3c-hci: Add HDR-DDR support
> 
> This patch adds support for HDR-DDR private transfers in the MIPI I3C HCI
> driver. It encodes HDR-DDR Command Descriptors, advertises HDR-DDR capability
> when supported by the controller, and enforces HDR-DDR transfer constraints.
> 
>> diff --git a/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c b/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c
>> index 9910df53c013d..78ad2ec2bd936 100644
>> --- a/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c
>> +++ b/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c
>> @@ -215,14 +215,30 @@ static int hci_cmd_v1_prep_ccc(struct i3c_hci *hci,
>>  
>>  static void hci_cmd_v1_prep_i3c_xfer(struct i3c_hci *hci,
>>  				     struct i3c_dev_desc *dev,
>> -				     struct hci_xfer *xfer)
>> +				     struct hci_xfer *xfer,
>> +				     enum i3c_xfer_mode xfer_mode)
>>  {
>>  	struct i3c_hci_dev_data *dev_data = i3c_dev_get_master_data(dev);
>>  	unsigned int dat_idx = dev_data->dat_idx;
>> -	enum hci_cmd_mode mode = get_i3c_mode(hci);
>> +	enum hci_cmd_mode mode;
>>  	u8 *data = xfer->data;
>>  	unsigned int data_len = xfer->data_len;
>>  	bool rnw = xfer->rnw;
>> +	u32 cp_cmd = 0;
>> +
>> +	if (xfer_mode == I3C_SDR) {
>> +		mode = get_i3c_mode(hci);
>> +	} else {
>> +		/*
>> +		 * HDR-DDR is the only advertised HDR Mode, so a non-SDR
>> +		 * transfer uses the HDR-DDR Command Code encoding: CP marks CMD
>> +		 * as valid, CMD carries bits[6:0], and RNW carries bit[7]. CP
>> +		 * and CMD occupy the same descriptor bits in both command
>> +		 * formats.
>> +		 */
>> +		mode = MODE_I3C_HDR_DDR;
>> +		cp_cmd = CMD_R0_CP | CMD_R0_CMD(xfer->hdr_cmd & I3C_HDR_CMD_CODE);
>                 ^^^^^^^^
> 
> [Severity: High]
> Does masking xfer->hdr_cmd with I3C_HDR_CMD_CODE unintentionally strip the RNW
> bit (bit 7) from the 8-bit HDR Command Code before it is placed into the
> descriptor?

No - it is intentional.

> 
> Since CMD_R0_CMD occupies an 8-bit field (bits 14:7) in the descriptor and
> xfer->hdr_cmd is masked with 0x7F, bit 14 of the descriptor will always be
> forced to 0.
> 
> If the hardware sends the 8-bit CMD field exactly as provided onto the bus
> rather than automatically merging in CMD_R0_RNW (bit 29), will this cause HDR
> read transfers to be transmitted as write commands? This could lead to bus
> protocol errors or timeouts, as the target device will expect to receive data
> instead of providing it.
> 
>>  	}
>>  
>>  	xfer->cmd_tid = hci_get_tid();
> 


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

  reply	other threads:[~2026-09-14 12:54 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 11:29 [PATCH 00/17] i3c: Fixes, cleanups and HDR-DDR support Adrian Hunter
2026-09-14 11:29 ` [PATCH 01/17] i3c: master: Fix out-of-bounds read in DMA bounce buffer setup Adrian Hunter
2026-09-14 16:09   ` Frank Li
2026-09-14 11:29 ` [PATCH 02/17] i3c: mipi-i3c-hci: Bounce short reads irrespective of the IOMMU Adrian Hunter
2026-09-14 16:16   ` Frank Li
2026-09-14 11:29 ` [PATCH 03/17] i3c: mipi-i3c-hci-pci: Set drvdata before creating LTR sysfs attribute Adrian Hunter
2026-09-14 11:45   ` sashiko-bot
2026-09-14 16:17   ` Frank Li
2026-09-14 11:29 ` [PATCH 04/17] i3c: master: Match ACPI targets to the correct bus controller instance Adrian Hunter
2026-09-14 11:50   ` sashiko-bot
2026-09-14 16:19   ` Frank Li
2026-09-14 11:29 ` [PATCH 05/17] i3c: master: Remove stale GETSTATUS length check Adrian Hunter
2026-09-14 16:23   ` Frank Li
2026-09-14 11:29 ` [PATCH 06/17] i3c: mipi-i3c-hci: Fix i3c_hci_enable_ibi() error path Adrian Hunter
2026-09-14 11:46   ` sashiko-bot
2026-09-14 16:27   ` Frank Li
2026-09-14 11:29 ` [PATCH 07/17] i3c: mipi-i3c-hci: Send DISEC before disabling IBIs in hardware Adrian Hunter
2026-09-14 16:29   ` Frank Li
2026-09-14 11:29 ` [PATCH 08/17] i3c: mipi-i3c-hci: Fix runtime PM violation in i3c_hci_free_ibi() Adrian Hunter
2026-09-14 11:58   ` sashiko-bot
2026-09-14 11:29 ` [PATCH 09/17] i3c: mipi-i3c-hci: Process multiple IBIs per interrupt Adrian Hunter
2026-09-14 16:45   ` Frank Li
2026-09-15  9:36     ` Adrian Hunter
2026-09-14 11:29 ` [PATCH 10/17] i3c: mipi-i3c-hci: Move DMA suspend/resume callbacks Adrian Hunter
2026-09-14 16:46   ` Frank Li
2026-09-14 11:29 ` [PATCH 11/17] i3c: mipi-i3c-hci: Stop rings gracefully when suspending Adrian Hunter
2026-09-14 16:51   ` Frank Li
2026-09-14 11:29 ` [PATCH 12/17] i3c: mipi-i3c-hci: Fix Response Descriptor DATA_LENGTH mask Adrian Hunter
2026-09-14 11:48   ` sashiko-bot
2026-09-14 16:55   ` Frank Li
2026-09-14 11:29 ` [PATCH 13/17] i3c: mipi-i3c-hci: Remove invalid transfer size limit Adrian Hunter
2026-09-14 11:49   ` sashiko-bot
2026-09-14 16:58   ` Frank Li
2026-09-14 11:30 ` [PATCH 14/17] i3c: mipi-i3c-hci: Remove invalid HDR-BT and Fm/Fm+ definitions Adrian Hunter
2026-09-14 17:00   ` Frank Li
2026-09-14 11:30 ` [PATCH 15/17] i3c: mipi-i3c-hci: Support configurable device NACK retries Adrian Hunter
2026-09-14 11:56   ` sashiko-bot
2026-09-14 18:21   ` Frank Li
2026-09-15  9:41     ` Adrian Hunter
2026-09-14 11:30 ` [PATCH 16/17] i3c: Restrict HDR modes to those supported by the bus and target Adrian Hunter
2026-09-14 18:26   ` Frank Li
2026-09-14 11:30 ` [PATCH 17/17] i3c: mipi-i3c-hci: Add HDR-DDR support Adrian Hunter
2026-09-14 11:54   ` sashiko-bot
2026-09-14 12:54     ` Adrian Hunter [this message]
2026-09-14 18:32   ` Frank Li

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=53ea27d2-1043-4b7f-b2a8-baabf6dfbfb8@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=Frank.Li@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-i3c@lists.infradead.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.