All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ravindra <ravindra@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: kiran.k@intel.com, linux-kernel@vger.kernel.org,
	luiz.dentz@gmail.com, marcel@holtmann.org,
	stable@vger.kernel.org, chethan.tumkur.narayan@intel.com,
	Ravindra <ravindra@intel.com>
Subject: [PATCH v2] Bluetooth: btintel_pcie: Use blocking reset for FLR
Date: Thu, 15 Oct 2026 13:34:30 +0530	[thread overview]
Message-ID: <20261015080430.3336201-1-ravindra@intel.com> (raw)

Several paths request an FLR asynchronously, including S3/S4 resume,
resume recovery, HCI reset, and hardware-error recovery. A queued reset
may run before the PM callback releases the PCI device lock, causing
pci_try_reset_function() to return -EAGAIN without attempting the FLR.

Use pci_reset_function() so reset work waits for the device lock and
performs the FLR once the PM callback releases it. If the reset fails,
clear the recovery in-progress flag so a later reset request can try
again.

Fixes: 9c36951474d8 ("Bluetooth: btintel_pcie: Refactor FLR to use device_reprobe()")
Signed-off-by: Ravindra <ravindra@intel.com>
---
 drivers/bluetooth/btintel_pcie.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index 3a555aa50c87..92b91f058fce 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -3745,13 +3745,10 @@ static int btintel_pcie_perform_flr(struct btintel_pcie_data *data)
 	struct pci_dev *pdev = data->pdev;
 	int err;
 
-	/* pci_try_reset_function() avoids the device_lock ABBA against
-	 * btintel_pcie_remove(): .remove() runs with device_lock held and
-	 * then waits for this work via disable_work_sync(); the blocking
-	 * pci_reset_function() would deadlock by trying to re-acquire
-	 * device_lock here.
+	/* Reset work runs asynchronously, so it can wait for the device lock
+	 * held by a PM callback to be released.
 	 */
-	err = pci_try_reset_function(pdev);
+	err = pci_reset_function(pdev);
 	if (err) {
 		BT_ERR("Failed resetting the pcie device (%d)", err);
 		return err;
@@ -3817,6 +3814,7 @@ static void btintel_pcie_reset_work(struct work_struct *wk)
 		enable_work(&data->hwexp_work);
 		enable_work(&data->fwtrigger_work);
 		enable_work(&data->mbox_work);
+		clear_bit(BTINTEL_PCIE_RECOVERY_IN_PROGRESS, &data->flags);
 	}
 
 out:
@@ -3841,10 +3839,9 @@ static void btintel_pcie_reset_work(struct work_struct *wk)
  *     in-flight one (whose recovery will reinitialize the device
  *     regardless of the dropped trigger's variant).
  *
- * The bit is cleared only by .remove() / re-probe via fresh devm
- * allocation, which is the intended one-shot semantics: a reset
- * tears down and re-probes 'data', so there is no "in-flight"
- * reset to follow up after device_reprobe() succeeds.
+ * A successful reset clears the bit through .remove() / re-probe via
+ * fresh devm allocation. A failed FLR clears it in reset_work so a
+ * later request can retry; there is no in-flight reset after failure.
  */
 static void btintel_pcie_request_reset(struct btintel_pcie_data *data,
 				       enum btintel_pcie_reset_type type)
-- 
2.43.0


             reply	other threads:[~2026-10-15  8:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15  8:04 Ravindra [this message]
2026-10-15 12:41 ` [v2] Bluetooth: btintel_pcie: Use blocking reset for FLR bluez.test.bot

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=20261015080430.3336201-1-ravindra@intel.com \
    --to=ravindra@intel.com \
    --cc=chethan.tumkur.narayan@intel.com \
    --cc=kiran.k@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=stable@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 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.