[PATCH V3 00/17] i3c: Fixes, cleanups and HDR-DDR support

Adrian Hunter posted 17 patches 4 days, 5 hours ago
drivers/i3c/device.c                               |  15 ++-
drivers/i3c/internals.h                            |   2 +
drivers/i3c/master.c                               |  88 +++++++++++--
drivers/i3c/master/mipi-i3c-hci/cmd.h              |   4 +-
drivers/i3c/master/mipi-i3c-hci/cmd_v1.c           |  28 ++++-
drivers/i3c/master/mipi-i3c-hci/cmd_v2.c           |   4 +-
drivers/i3c/master/mipi-i3c-hci/core.c             | 106 +++++++++++++---
drivers/i3c/master/mipi-i3c-hci/dat.h              |   2 +
drivers/i3c/master/mipi-i3c-hci/dat_v1.c           |  13 +-
drivers/i3c/master/mipi-i3c-hci/dma.c              | 136 +++++++++++++++------
drivers/i3c/master/mipi-i3c-hci/hci.h              |   9 +-
drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c |   5 +-
include/linux/i3c/device.h                         |   4 +
include/linux/i3c/master.h                         |   3 +
include/linux/platform_data/mipi-i3c-hci.h         |   4 +
15 files changed, 335 insertions(+), 88 deletions(-)
[PATCH V3 00/17] i3c: Fixes, cleanups and HDR-DDR support
Posted by Adrian Hunter 4 days, 5 hours ago
Hi

This series brings a collection of fixes, specification-conformance
cleanups and feature additions to the I3C core and MIPI I3C HCI driver.

The first three patches are independent fixes tagged for stable. The
remaining patches address a mixture of correctness issues in the core
and HCI driver, improve conformance with the I3C and HCI
specifications, add support for configurable device NACK retries, and
finally add HDR-DDR support.

The series is organised as follows:

  Stable fixes (patches 1-3)
  --------------------------

  - Fix an out-of-bounds read in the core DMA bounce-buffer helper.

  - Fix a destination buffer overrun in the HCI DMA path for reads whose
    length is not a multiple of four bytes. The issue is independent of
    IOMMU usage, although the existing workaround was only applied when
    an IOMMU was present.

  - Close a probe-time race in the HCI PCI driver where the LTR sysfs
    attribute becomes visible before drvdata has been initialized.

  Core fixes (patches 4-5)
  ------------------------

  - Fix ACPI target enumeration on multi-instance controllers by
    extracting the bus-controller instance number and PID from the
    correct _ADR fields.

  - Remove a stale GETSTATUS response-length check that became obsolete
    when actual_len-based validation was introduced.

  HCI IBI and suspend fixes (patches 6-11)
  ----------------------------------------

  - Restore controller state when enabling IBIs fails, so that a failed
    ENEC does not leave controller-side setup in place.

  - Send DISEC before disabling IBIs in hardware so that an IBI racing
    with teardown is not silently dropped.

  - Avoid accessing controller hardware from ->free_ibi(), where runtime
    PM does not guarantee the device is resumed.

  - Drain all pending IBIs whenever INTR_IBI_READY is received instead
    of processing only the first queued entry.

  - Reorganize the DMA suspend/resume callbacks in preparation for the
    following change.

  - Rework DMA suspend handling to stop Ring Bundles according to the
    HCI specification, synchronize with the interrupt handler, and flush
    any pending IBI before disabling the rings.

  HCI specification cleanups (patches 12-14)
  -------------------------------------------

  - Correct the Response Descriptor DATA_LENGTH field definition.

  - Remove an invalid maximum-transfer-size capability derived from
    reserved HC_CAPABILITIES bits.

  - Remove HDR-BT and Fm/Fm+ definitions that are not defined by any
    released version of the HCI specification.

  Feature additions (patches 15-17)
  ---------------------------------

  - Implement the .set_dev_nack_retry() master operation using DAT
    support provided by HCI v1 controllers.

  - Restrict advertised and permitted HDR modes to the intersection of:
      * controller capabilities,
      * bus-configuration constraints, and
      * target capabilities.

  - Add HDR-DDR private-transfer support to the HCI driver, including
    descriptor generation and capability advertisement when supported by
    both the controller and the active command-descriptor format.


Changes in V3:

    i3c: mipi-i3c-hci: Support configurable device NACK retries
	Moved the retry count range check and the loop over allocated
	DAT entries from the DAT layer into i3c_hci_set_dev_nack_retry(),
	and removed the set_all_nack_retry() DAT operation.
	Moved the DAT_0_DEV_NACK_RETRY_CNT definition to dat.h so that it
	is visible to the caller.
	Amended the commit message accordingly.

    Added Frank Li's Reviewed-by tags.

Changes in V2:

    i3c: mipi-i3c-hci: Bounce short reads irrespective of the IOMMU
	Added the slub_debug report to the commit message.

    i3c: mipi-i3c-hci: Restore controller state if i3c_hci_enable_ibi() returns an error
	Reworded the subject, which was previously "i3c: mipi-i3c-hci:
	Fix i3c_hci_enable_ibi() error path", to say what the patch does
	rather than that it fixes something.

    i3c: mipi-i3c-hci: Stop rings gracefully when suspending
	Added comments explaining the choice of the RING_STOP_TIMEOUT_US
	and RING_STOP_SLEEP_US values.

    i3c: mipi-i3c-hci: Correct RESP_DATA_LENGTH to bits 15:0
	Reworded the subject, which was previously "i3c: mipi-i3c-hci:
	Fix Response Descriptor DATA_LENGTH mask", to name the macro and
	the corrected bit range.

    Added Frank Li's Reviewed-by tags.


Adrian Hunter (17):
      i3c: master: Fix out-of-bounds read in DMA bounce buffer setup
      i3c: mipi-i3c-hci: Bounce short reads irrespective of the IOMMU
      i3c: mipi-i3c-hci-pci: Set drvdata before creating LTR sysfs attribute
      i3c: master: Match ACPI targets to the correct bus controller instance
      i3c: master: Remove stale GETSTATUS length check
      i3c: mipi-i3c-hci: Restore controller state if i3c_hci_enable_ibi() returns an error
      i3c: mipi-i3c-hci: Send DISEC before disabling IBIs in hardware
      i3c: mipi-i3c-hci: Fix runtime PM violation in i3c_hci_free_ibi()
      i3c: mipi-i3c-hci: Process multiple IBIs per interrupt
      i3c: mipi-i3c-hci: Move DMA suspend/resume callbacks
      i3c: mipi-i3c-hci: Stop rings gracefully when suspending
      i3c: mipi-i3c-hci: Correct RESP_DATA_LENGTH to bits 15:0
      i3c: mipi-i3c-hci: Remove invalid transfer size limit
      i3c: mipi-i3c-hci: Remove invalid HDR-BT and Fm/Fm+ definitions
      i3c: mipi-i3c-hci: Support configurable device NACK retries
      i3c: Restrict HDR modes to those supported by the bus and target
      i3c: mipi-i3c-hci: Add HDR-DDR support

 drivers/i3c/device.c                               |  15 ++-
 drivers/i3c/internals.h                            |   2 +
 drivers/i3c/master.c                               |  88 +++++++++++--
 drivers/i3c/master/mipi-i3c-hci/cmd.h              |   4 +-
 drivers/i3c/master/mipi-i3c-hci/cmd_v1.c           |  28 ++++-
 drivers/i3c/master/mipi-i3c-hci/cmd_v2.c           |   4 +-
 drivers/i3c/master/mipi-i3c-hci/core.c             | 106 +++++++++++++---
 drivers/i3c/master/mipi-i3c-hci/dat.h              |   2 +
 drivers/i3c/master/mipi-i3c-hci/dat_v1.c           |  13 +-
 drivers/i3c/master/mipi-i3c-hci/dma.c              | 136 +++++++++++++++------
 drivers/i3c/master/mipi-i3c-hci/hci.h              |   9 +-
 drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c |   5 +-
 include/linux/i3c/device.h                         |   4 +
 include/linux/i3c/master.h                         |   3 +
 include/linux/platform_data/mipi-i3c-hci.h         |   4 +
 15 files changed, 335 insertions(+), 88 deletions(-)


Regards
Adrian
Re: [PATCH V3 00/17] i3c: Fixes, cleanups and HDR-DDR support
Posted by Alexandre Belloni 2 days, 23 hours ago
On Sun, 20 Sep 2026 18:12:30 +0300, Adrian Hunter wrote:
> This series brings a collection of fixes, specification-conformance
> cleanups and feature additions to the I3C core and MIPI I3C HCI driver.
> 
> The first three patches are independent fixes tagged for stable. The
> remaining patches address a mixture of correctness issues in the core
> and HCI driver, improve conformance with the I3C and HCI
> specifications, add support for configurable device NACK retries, and
> finally add HDR-DDR support.
> 
> [...]

Applied, thanks!

[01/17] i3c: master: Fix out-of-bounds read in DMA bounce buffer setup
        https://git.kernel.org/i3c/c/35b028b25451
[02/17] i3c: mipi-i3c-hci: Bounce short reads irrespective of the IOMMU
        https://git.kernel.org/i3c/c/b1a25e8e143e
[03/17] i3c: mipi-i3c-hci-pci: Set drvdata before creating LTR sysfs attribute
        https://git.kernel.org/i3c/c/2bc2b1b89f65
[04/17] i3c: master: Match ACPI targets to the correct bus controller instance
        https://git.kernel.org/i3c/c/25648fb7cebb
[05/17] i3c: master: Remove stale GETSTATUS length check
        https://git.kernel.org/i3c/c/48d7187c98e8
[06/17] i3c: mipi-i3c-hci: Restore controller state if i3c_hci_enable_ibi() returns an error
        https://git.kernel.org/i3c/c/ad869331ac61
[07/17] i3c: mipi-i3c-hci: Send DISEC before disabling IBIs in hardware
        https://git.kernel.org/i3c/c/dcaabb080e0c
[08/17] i3c: mipi-i3c-hci: Fix runtime PM violation in i3c_hci_free_ibi()
        https://git.kernel.org/i3c/c/1570265b2257
[09/17] i3c: mipi-i3c-hci: Process multiple IBIs per interrupt
        https://git.kernel.org/i3c/c/5fbd0790af94
[10/17] i3c: mipi-i3c-hci: Move DMA suspend/resume callbacks
        https://git.kernel.org/i3c/c/ae307311a69e
[11/17] i3c: mipi-i3c-hci: Stop rings gracefully when suspending
        https://git.kernel.org/i3c/c/9796ccba1254
[12/17] i3c: mipi-i3c-hci: Correct RESP_DATA_LENGTH to bits 15:0
        https://git.kernel.org/i3c/c/de243c3dd2e5
[13/17] i3c: mipi-i3c-hci: Remove invalid transfer size limit
        https://git.kernel.org/i3c/c/f3bd76ecb075
[14/17] i3c: mipi-i3c-hci: Remove invalid HDR-BT and Fm/Fm+ definitions
        https://git.kernel.org/i3c/c/8fe4a1b93aa9
[15/17] i3c: mipi-i3c-hci: Support configurable device NACK retries
        https://git.kernel.org/i3c/c/b7e849313eba
[16/17] i3c: Restrict HDR modes to those supported by the bus and target
        https://git.kernel.org/i3c/c/b968be9e7193
[17/17] i3c: mipi-i3c-hci: Add HDR-DDR support
        https://git.kernel.org/i3c/c/9b347cbde81c

Best regards,

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com