mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: alexandre.belloni@bootlin.com, Frank.Li@nxp.com,
	billy_tsai@aspeedtech.com, linux-i3c@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2 08/17] i3c: mipi-i3c-hci: Fix runtime PM violation in i3c_hci_free_ibi()
Date: Thu, 17 Sep 2026 17:32:03 -0400	[thread overview]
Message-ID: <aqxcU6bT5ALm-1-8@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260917191356.133242-9-adrian.hunter@intel.com>

On Thu, Sep 17, 2026 at 10:13:47PM +0300, Adrian Hunter wrote:
> i3c_hci_free_ibi() calls __i3c_hci_disable_ibi(), but the latter
> requires runtime PM to be resumed.  The ->free_ibi() callback does not
> guarantee that condition.
>
> The cases where ->free_ibi() may be called without a preceding
> ->disable_ibi() do not require re-enabling runtime PM handling:
>
> - runtime resume failed in i3c_dev_free_ibi_locked(), so it skips the
>   IBI disable but still proceeds to call ->free_ibi()
> - the device has been re-enumerated under a new dynamic address in
>   __i3c_master_add_i3c_dev_locked(), which tears down the old device
>   descriptor and deliberately clears olddev->ibi->enabled (to avoid
>   sending a DISEC to the stale old address) before calling
>   i3c_dev_free_ibi_locked().  As a result ->free_ibi() is reached with
>   neither a hardware IBI disable nor runtime PM resumed.
>
> In both cases the important requirement is to prevent further IBI
> processing for the device.  That can be done without accessing hardware
> by removing the device from the ibi_devs[] table.
>
> Replace the call to __i3c_hci_disable_ibi() with clearing the
> corresponding ibi_devs[] entry under the controller lock.
>
> Fixes: 650716f23eac4 ("i3c: mipi-i3c-hci: Fix race in i3c_hci_addr_to_dev()")
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>
>
> Changes in V2:
>
> 	None
>
>
>  drivers/i3c/master/mipi-i3c-hci/core.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
> index f6a34ce7a295..b9b20797d045 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/core.c
> +++ b/drivers/i3c/master/mipi-i3c-hci/core.c
> @@ -675,11 +675,13 @@ static void __i3c_hci_disable_ibi(struct i3c_hci *hci, struct i3c_dev_desc *dev)
>
>  static void i3c_hci_free_ibi(struct i3c_dev_desc *dev)
>  {
> +	struct i3c_hci_dev_data *dev_data = i3c_dev_get_master_data(dev);
>  	struct i3c_master_controller *m = i3c_dev_get_master(dev);
>  	struct i3c_hci *hci = to_i3c_hci(m);
>
> -	/* Must ensure the IBI has been disabled */
> -	__i3c_hci_disable_ibi(hci, dev);
> +	/* Must ensure IBIs for this device will no longer be processed */
> +	scoped_guard(spinlock_irqsave, &hci->lock)
> +		hci->ibi_devs[dev_data->dat_idx] = NULL;
>  	hci->io->free_ibi(hci, dev);
>  }
>
> --
> 2.53.0
>

  reply	other threads:[~2026-09-17 21:32 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 19:13 [PATCH V2 00/17] i3c: Fixes, cleanups and HDR-DDR support Adrian Hunter
2026-09-17 19:13 ` [PATCH V2 01/17] i3c: master: Fix out-of-bounds read in DMA bounce buffer setup Adrian Hunter
2026-09-17 19:13 ` [PATCH V2 02/17] i3c: mipi-i3c-hci: Bounce short reads irrespective of the IOMMU Adrian Hunter
2026-09-17 21:21   ` Frank Li
2026-09-17 19:13 ` [PATCH V2 03/17] i3c: mipi-i3c-hci-pci: Set drvdata before creating LTR sysfs attribute Adrian Hunter
2026-09-17 19:13 ` [PATCH V2 04/17] i3c: master: Match ACPI targets to the correct bus controller instance Adrian Hunter
2026-09-17 19:13 ` [PATCH V2 05/17] i3c: master: Remove stale GETSTATUS length check Adrian Hunter
2026-09-17 19:13 ` [PATCH V2 06/17] i3c: mipi-i3c-hci: Restore controller state if i3c_hci_enable_ibi() returns an error Adrian Hunter
2026-09-17 21:23   ` Frank Li
2026-09-17 19:13 ` [PATCH V2 07/17] i3c: mipi-i3c-hci: Send DISEC before disabling IBIs in hardware Adrian Hunter
2026-09-17 19:13 ` [PATCH V2 08/17] i3c: mipi-i3c-hci: Fix runtime PM violation in i3c_hci_free_ibi() Adrian Hunter
2026-09-17 21:32   ` Frank Li [this message]
2026-09-17 19:13 ` [PATCH V2 09/17] i3c: mipi-i3c-hci: Process multiple IBIs per interrupt Adrian Hunter
2026-09-17 21:37   ` Frank Li
2026-09-17 19:13 ` [PATCH V2 10/17] i3c: mipi-i3c-hci: Move DMA suspend/resume callbacks Adrian Hunter
2026-09-17 19:13 ` [PATCH V2 11/17] i3c: mipi-i3c-hci: Stop rings gracefully when suspending Adrian Hunter
2026-09-17 21:40   ` Frank Li
2026-09-17 19:13 ` [PATCH V2 12/17] i3c: mipi-i3c-hci: Correct RESP_DATA_LENGTH to bits 15:0 Adrian Hunter
2026-09-17 21:42   ` Frank Li
2026-09-17 19:13 ` [PATCH V2 13/17] i3c: mipi-i3c-hci: Remove invalid transfer size limit Adrian Hunter
2026-09-17 19:13 ` [PATCH V2 14/17] i3c: mipi-i3c-hci: Remove invalid HDR-BT and Fm/Fm+ definitions Adrian Hunter
2026-09-17 19:13 ` [PATCH V2 15/17] i3c: mipi-i3c-hci: Support configurable device NACK retries Adrian Hunter
2026-09-18 13:44   ` Frank Li
2026-09-17 19:13 ` [PATCH V2 16/17] i3c: Restrict HDR modes to those supported by the bus and target Adrian Hunter
2026-09-17 19:13 ` [PATCH V2 17/17] i3c: mipi-i3c-hci: Add HDR-DDR support Adrian Hunter

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=aqxcU6bT5ALm-1-8@lizhi-Precision-Tower-5810 \
    --to=frank.li@oss.nxp.com \
    --cc=Frank.Li@nxp.com \
    --cc=adrian.hunter@intel.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=billy_tsai@aspeedtech.com \
    --cc=linux-i3c@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®