Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH v2 1/2] Bluetooth: btintel_pcie: Set only MAC_INIT in btintel_pcie_mac_init()
@ 2026-11-03 14:37 Kiran K
  2026-11-03 14:37 ` [PATCH v2 2/2] Bluetooth: btintel_pcie: Fold MAC_INIT into btintel_pcie_get_mac_access() Kiran K
  2026-11-03 17:13 ` [v2,1/2] Bluetooth: btintel_pcie: Set only MAC_INIT in btintel_pcie_mac_init() bluez.test.bot
  0 siblings, 2 replies; 3+ messages in thread
From: Kiran K @ 2026-11-03 14:37 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: chethan.tumkur.narayan, chandrashekar.devegowda, Kiran K,
	Paul Menzel

btintel_pcie_mac_init() is called prior to reading device memory via
target access. To acquire MAC access, only the MAC_INIT and
MAC_ACCESS_REQ bits in the function control register need to be
programmed.

Currently, btintel_pcie_mac_init() also modifies FUNC_ENA, FUNC_INIT,
BUS_MASTER_DISCON, and SW_RESET, which are not relevant to MAC access
(though doing so had no observed side effects). Leave those bits
untouched and only set MAC_INIT if it is not already set.

Fixes: b9465e6670a2 ("Bluetooth: btintel_pcie: Read hardware exception data")
Assisted-by: Copilot:Gemini 4 Argon
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Kiran K <kiran.k@intel.com>
---
 drivers/bluetooth/btintel_pcie.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index 7d84c8106cf1..eee49bffe148 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -993,14 +993,11 @@ static void btintel_pcie_mac_init(struct btintel_pcie_data *data)
 {
 	u32 reg;
 
-	/* Set MAC_INIT bit to start primary bootloader */
 	reg = btintel_pcie_rd_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG);
-	reg &= ~(BTINTEL_PCIE_CSR_FUNC_CTRL_FUNC_INIT |
-			BTINTEL_PCIE_CSR_FUNC_CTRL_BUS_MASTER_DISCON |
-			BTINTEL_PCIE_CSR_FUNC_CTRL_SW_RESET);
-	reg |= (BTINTEL_PCIE_CSR_FUNC_CTRL_FUNC_ENA |
-			BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_INIT);
-	btintel_pcie_wr_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG, reg);
+	if (!(reg & BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_INIT)) {
+		reg |= BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_INIT;
+		btintel_pcie_wr_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG, reg);
+	}
 }
 
 static int btintel_pcie_get_mac_access(struct btintel_pcie_data *data)
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2 2/2] Bluetooth: btintel_pcie: Fold MAC_INIT into btintel_pcie_get_mac_access()
  2026-11-03 14:37 [PATCH v2 1/2] Bluetooth: btintel_pcie: Set only MAC_INIT in btintel_pcie_mac_init() Kiran K
@ 2026-11-03 14:37 ` Kiran K
  2026-11-03 17:13 ` [v2,1/2] Bluetooth: btintel_pcie: Set only MAC_INIT in btintel_pcie_mac_init() bluez.test.bot
  1 sibling, 0 replies; 3+ messages in thread
From: Kiran K @ 2026-11-03 14:37 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: chethan.tumkur.narayan, chandrashekar.devegowda, Kiran K,
	Paul Menzel

Currently, every caller reading device memory has to call
btintel_pcie_mac_init() right before btintel_pcie_read_device_mem().
Since btintel_pcie_read_device_mem() acquires MAC access via
btintel_pcie_get_mac_access(), fold the MAC_INIT handling into
btintel_pcie_get_mac_access() and drop btintel_pcie_mac_init() along
with its three call sites.

Set MAC_INIT and MAC_ACCESS_REQ with a single register write when either
bit is not already set.

Assisted-by: Copilot:Gemini 4 Argon
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Kiran K <kiran.k@intel.com>
---
 drivers/bluetooth/btintel_pcie.c | 28 ++++++----------------------
 1 file changed, 6 insertions(+), 22 deletions(-)

diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index eee49bffe148..025c4c64d020 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -989,28 +989,18 @@ static int btintel_pcie_reset_bt(struct btintel_pcie_data *data)
 	return reg == 0 ? 0 : -ENODEV;
 }
 
-static void btintel_pcie_mac_init(struct btintel_pcie_data *data)
-{
-	u32 reg;
-
-	reg = btintel_pcie_rd_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG);
-	if (!(reg & BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_INIT)) {
-		reg |= BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_INIT;
-		btintel_pcie_wr_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG, reg);
-	}
-}
-
 static int btintel_pcie_get_mac_access(struct btintel_pcie_data *data)
 {
-	u32 reg;
+	u32 reg, val;
 	int retry = 15;
+	const u32 req = BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_INIT |
+			BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_ACCESS_REQ;
 
 	reg = btintel_pcie_rd_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG);
 
-	if (!(reg & BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_ACCESS_REQ)) {
-		reg |= BTINTEL_PCIE_CSR_FUNC_CTRL_MAC_ACCESS_REQ;
-		btintel_pcie_wr_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG, reg);
-	}
+	val = reg | req;
+	if (val != reg)
+		btintel_pcie_wr_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG, val);
 
 	do {
 		reg = btintel_pcie_rd_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG);
@@ -1948,8 +1938,6 @@ static int btintel_parse_mbox_tlv(struct btintel_pcie_data *data)
 	if (!buffer)
 		return -ENOMEM;
 
-	btintel_pcie_mac_init(data);
-
 	err = btintel_pcie_read_device_mem(data, buffer, tbl_addr,
 					   buffer_len);
 	if (err)
@@ -2640,8 +2628,6 @@ static void btintel_pcie_read_hwexp(struct btintel_pcie_data *data)
 	if (!buf)
 		goto exit_on_error;
 
-	btintel_pcie_mac_init(data);
-
 	err = btintel_pcie_read_device_mem(data, buf, addr, len);
 	if (err)
 		goto exit_on_error;
@@ -2729,8 +2715,6 @@ static int btintel_pcie_dump_fwtrigger_event(struct btintel_pcie_data *data)
 	if (!buf)
 		return -ENOMEM;
 
-	btintel_pcie_mac_init(data);
-
 	err = btintel_pcie_read_device_mem(data, buf, data->debug_evt_addr,
 					   len);
 	if (err)
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [v2,1/2] Bluetooth: btintel_pcie: Set only MAC_INIT in btintel_pcie_mac_init()
  2026-11-03 14:37 [PATCH v2 1/2] Bluetooth: btintel_pcie: Set only MAC_INIT in btintel_pcie_mac_init() Kiran K
  2026-11-03 14:37 ` [PATCH v2 2/2] Bluetooth: btintel_pcie: Fold MAC_INIT into btintel_pcie_get_mac_access() Kiran K
@ 2026-11-03 17:13 ` bluez.test.bot
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-11-03 17:13 UTC (permalink / raw)
  To: linux-bluetooth, kiran.k

[-- Attachment #1: Type: text/plain, Size: 2907 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1200445/

---Test result---

Test Summary:
CheckPatch                    FAIL      1.55 seconds
VerifyFixes                   PASS      0.13 seconds
VerifySignedoff               PASS      0.63 seconds
GitLint                       FAIL      0.70 seconds
SubjectPrefix                 PASS      0.29 seconds
BuildKernel                   PASS      31.54 seconds
CheckAllWarning               PASS      35.53 seconds
CheckSparse                   PASS      38.19 seconds
BuildKernel32                 PASS      31.29 seconds
CheckKernelLLVM               PASS      35.78 seconds
TestRunnerSetup               PASS      764.06 seconds
IncrementalBuild              PASS      33.75 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[v2,1/2] Bluetooth: btintel_pcie: Set only MAC_INIT in btintel_pcie_mac_init()
WARNING: Non-standard signature: Assisted-by:
#109: 
Assisted-by: Copilot:Gemini 4 Argon

ERROR: Unrecognized email address: 'Copilot:Gemini 4 Argon'
#109: 
Assisted-by: Copilot:Gemini 4 Argon

total: 1 errors, 1 warnings, 18 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/home/runner/work/bluetooth-next/bluetooth-next/src/patch/14940452.patch has style problems, please review.

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.


[v2,2/2] Bluetooth: btintel_pcie: Fold MAC_INIT into btintel_pcie_get_mac_access()
WARNING: Non-standard signature: Assisted-by:
#111: 
Assisted-by: Copilot:Gemini 4 Argon

ERROR: Unrecognized email address: 'Copilot:Gemini 4 Argon'
#111: 
Assisted-by: Copilot:Gemini 4 Argon

total: 1 errors, 1 warnings, 58 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/home/runner/work/bluetooth-next/bluetooth-next/src/patch/14940453.patch has style problems, please review.

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.


##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[v2,2/2] Bluetooth: btintel_pcie: Fold MAC_INIT into btintel_pcie_get_mac_access()

1: T1 Title exceeds max length (82>80): "[v2,2/2] Bluetooth: btintel_pcie: Fold MAC_INIT into btintel_pcie_get_mac_access()"


https://github.com/bluez/bluetooth-next/pull/1054

---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-03 17:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-03 14:37 [PATCH v2 1/2] Bluetooth: btintel_pcie: Set only MAC_INIT in btintel_pcie_mac_init() Kiran K
2026-11-03 14:37 ` [PATCH v2 2/2] Bluetooth: btintel_pcie: Fold MAC_INIT into btintel_pcie_get_mac_access() Kiran K
2026-11-03 17:13 ` [v2,1/2] Bluetooth: btintel_pcie: Set only MAC_INIT in btintel_pcie_mac_init() bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox