* [PATCH v1 1/3] Bluetooth: btintel_pcie: Add initial YoYo debug support
@ 2026-10-13 10:44 Ajay KV
2026-10-13 10:44 ` [PATCH v1 2/3] Bluetooth: btintel_pcie: Validate the YoYo DEBUG_INFO TLV Ajay KV
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ajay KV @ 2026-10-13 10:44 UTC (permalink / raw)
To: linux-bluetooth
Cc: chandrashekar.devegowda, kiran.k, linux-kernel, luiz.dentz,
marcel, stable, chethan.tumkur.narayan, lakshmipathi.k, Ajaykv
From: Ajaykv <ajay.k.v@intel.com>
Add an optional YoYo firmware configuration path to the Intel PCIe
Bluetooth driver. Read DBG_PATH and ENABLE_INI from
ibt_bt_dbg_cfg.ini, and load intel/ibt_debug_yoyo.bin only when YoYo
is enabled and host DRAM routing is selected.
Introduce a runtime context and bounded TLV-stream validation helper.
Initialize and clean up the context with PCI probe and removal, while
falling back to legacy debug behavior if optional YoYo data is missing
or invalid.
Runtime validation of the complete P1-P3 series produced:
[ 3.286504] Bluetooth: Core ver 2.22
[ 3.297359] Bluetooth: HCI device and connection manager initialized
[ 3.297373] Bluetooth: HCI socket layer initialized
[ 3.297376] Bluetooth: L2CAP socket layer initialized
[ 3.297384] Bluetooth: SCO socket layer initialized
[ 3.332848] Bluetooth: YoYo: configuration loaded and validated
[ 3.360857] Bluetooth: DBGC allocation 1: fragments=16 fragment_size=262144 total=4194304
[ 3.361298] Bluetooth: DBGC allocation 2: fragments=16 fragment_size=262144 total=4194304
[ 3.361712] Bluetooth: DBGC allocation 3: fragments=16 fragment_size=262144 total=4194304
[ 3.361715] Bluetooth: MDBGC fragments: DBGC1=16/262144 DBGC2=16/262144 DBGC3=16/262144
[ 3.397439] Bluetooth: hci0: Device revision is 0
[ 3.397442] Bluetooth: hci0: Secure boot is enabled
[ 3.397443] Bluetooth: hci0: OTP lock is disabled
[ 3.397444] Bluetooth: hci0: API lock is enabled
[ 3.397444] Bluetooth: hci0: Debug lock is disabled
Signed-off-by: Ajaykv <ajay.k.v@intel.com>
---
drivers/bluetooth/Makefile | 2 +-
drivers/bluetooth/btintel_pcie.c | 105 ++++++++++++++++++++++
drivers/bluetooth/btintel_pcie.h | 4 +
drivers/bluetooth/btintel_pcie_debug.c | 117 +++++++++++++++++++++++++
drivers/bluetooth/btintel_pcie_debug.h | 60 +++++++++++++
5 files changed, 287 insertions(+), 1 deletion(-)
create mode 100644 drivers/bluetooth/btintel_pcie_debug.c
create mode 100644 drivers/bluetooth/btintel_pcie_debug.h
diff --git a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile
index d5eb2568af2e..7d933755b291 100644
--- a/drivers/bluetooth/Makefile
+++ b/drivers/bluetooth/Makefile
@@ -14,7 +14,7 @@ obj-$(CONFIG_BT_HCIBTUSB) += btusb.o
obj-$(CONFIG_BT_HCIBTSDIO) += btsdio.o
obj-$(CONFIG_BT_INTEL) += btintel.o
-obj-$(CONFIG_BT_INTEL_PCIE) += btintel_pcie.o btintel.o
+obj-$(CONFIG_BT_INTEL_PCIE) += btintel_pcie.o btintel.o btintel_pcie_debug.o
obj-$(CONFIG_BT_ATH3K) += ath3k.o
obj-$(CONFIG_BT_MRVL) += btmrvl.o
obj-$(CONFIG_BT_MRVL_SDIO) += btmrvl_sdio.o
diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index 3a555aa50c87..a4aaca3daf20 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -203,6 +203,90 @@ static inline bool btintel_pcie_dbg_to_wifi(struct btintel_pcie_data *data)
return data->dbg_path_cache != BTINTEL_PCIE_DRAM;
}
+#define BTINTEL_PCIE_DBG_INI_FILE "ibt_bt_dbg_cfg.ini"
+
+/*
+ * Loads optional "DBG_PATH=<value>" and "ENABLE_INI=<value>" overrides from
+ * BTINTEL_PCIE_DBG_INI_FILE and applies them to dbg_path_cache and enable_ini.
+ *
+ * DBG_PATH accepts WiFi DBGC (0x06) or legacy host DRAM (0x01); ENABLE_INI
+ * accepts 1 (enabled) or 0 (disabled). Missing or invalid entries leave the
+ * values set by the caller unchanged.
+ */
+static void btintel_pcie_load_dbg_path_from_ini(struct btintel_pcie_data *data)
+{
+ const struct firmware *fw;
+ const char *ini_file = BTINTEL_PCIE_DBG_INI_FILE;
+ char *buf, *cursor, *line;
+ bool dbg_path_applied = false;
+ int err;
+
+ err = request_firmware_direct(&fw, ini_file, &data->pdev->dev);
+ if (err < 0) {
+ BT_ERR("%s not found (%d), using dbg_path=0x%02x", ini_file,
+ err, data->dbg_path_cache);
+ return;
+ }
+
+ buf = kmemdup_nul(fw->data, fw->size, GFP_KERNEL);
+ release_firmware(fw);
+ if (!buf)
+ return;
+
+ cursor = buf;
+ while ((line = strsep(&cursor, "\n"))) {
+ char *eq, *val;
+ unsigned int parsed;
+
+ line = strim(line);
+ if (!line[0] || line[0] == '#' || line[0] == ';')
+ continue;
+
+ eq = strchr(line, '=');
+ if (!eq)
+ continue;
+
+ *eq = '\0';
+ line = strim(line);
+ val = strim(eq + 1);
+
+ if (!strcasecmp(line, "DBG_PATH")) {
+ BT_DBG("Read DBG_PATH from %s: '%s'", ini_file, val);
+
+ if (!kstrtouint(val, 0, &parsed) &&
+ (parsed == BTINTEL_PCIE_DRAM ||
+ parsed == BTINTEL_PCIE_WIFI_DBGC)) {
+ data->dbg_path_cache = parsed;
+ dbg_path_applied = true;
+ BT_DBG("YoYo: DBG_PATH=0x%02x", data->dbg_path_cache);
+ } else {
+ BT_ERR("Invalid DBG_PATH='%s' in %s, using dbg_path=0x%02x",
+ val, ini_file, data->dbg_path_cache);
+ }
+ } else if (!strcasecmp(line, "ENABLE_INI")) {
+ BT_DBG("Read ENABLE_INI from %s: '%s'", ini_file, val);
+
+ if (!kstrtouint(val, 0, &parsed) && parsed <= 1) {
+ data->enable_ini = !!parsed;
+ BT_DBG("YoYo: ENABLE_INI=%u", data->enable_ini);
+ } else {
+ BT_ERR("Invalid ENABLE_INI='%s' in %s, using enable_ini=%u",
+ val, ini_file, data->enable_ini);
+ }
+ }
+ }
+
+ if (dbg_path_applied)
+ BT_DBG("Loaded dbg_path=0x%02x from %s", data->dbg_path_cache,
+ ini_file);
+ else
+ BT_ERR("No valid DBG_PATH in %s, dbg_path=0x%02x", ini_file,
+ data->dbg_path_cache);
+
+ BT_DBG("ENABLE_INI effective state: %u", data->enable_ini);
+ kfree(buf);
+}
+
/* Helper function to allocate and setup a debug buffer group
* @data: driver data structure
* @buf: pointer to data_buf array pointer
@@ -4101,6 +4185,22 @@ static int btintel_pcie_probe(struct pci_dev *pdev,
* initialized
*/
data->reset_type = BTINTEL_PCIE_IOSF_PRR_FLR;
+ data->enable_ini = false;
+ btintel_pcie_yoyo_init(&data->yoyo);
+ btintel_pcie_load_dbg_path_from_ini(data);
+
+ /* YoYo configuration is supported only with host DRAM debug routing. */
+ if (data->dbg_path_cache != BTINTEL_PCIE_DRAM)
+ data->enable_ini = false;
+
+ if (data->enable_ini) {
+ err = btintel_pcie_yoyo_load_and_parse(&data->yoyo, &pdev->dev);
+ if (err) {
+ BT_WARN("YoYo configuration is invalid (%d); keeping legacy defaults",
+ err);
+ btintel_pcie_yoyo_cleanup(&data->yoyo);
+ }
+ }
err = btintel_pcie_config_pcie(pdev, data);
if (err)
goto exit_error;
@@ -4128,11 +4228,14 @@ static int btintel_pcie_probe(struct pci_dev *pdev,
if (err)
goto exit_error;
+ data->yoyo.hdev = data->hdev;
bt_dev_dbg(data->hdev, "cnvi: 0x%8.8x cnvr: 0x%8.8x", data->cnvi,
data->cnvr);
return 0;
exit_error:
+ btintel_pcie_yoyo_cleanup(&data->yoyo);
+
/* reset device before exit */
btintel_pcie_reset_bt(data);
@@ -4173,6 +4276,8 @@ static void btintel_pcie_remove(struct pci_dev *pdev)
if (current_work() != &data->reset_work)
disable_work_sync(&data->reset_work);
+ btintel_pcie_yoyo_cleanup(&data->yoyo);
+
btintel_pcie_disable_interrupts(data);
btintel_pcie_synchronize_irqs(data);
diff --git a/drivers/bluetooth/btintel_pcie.h b/drivers/bluetooth/btintel_pcie.h
index 3030b4e8b750..e361ed483fd9 100644
--- a/drivers/bluetooth/btintel_pcie.h
+++ b/drivers/bluetooth/btintel_pcie.h
@@ -6,6 +6,8 @@
* Copyright (C) 2024 Intel Corporation
*/
+#include "btintel_pcie_debug.h"
+
/* Control and Status Register(BTINTEL_PCIE_CSR) */
#define BTINTEL_PCIE_CSR_BASE (0x000)
#define BTINTEL_PCIE_CSR_FUNC_CTRL_REG (BTINTEL_PCIE_CSR_BASE + 0x024)
@@ -737,6 +739,7 @@ struct btintel_pcie_data {
u32 boot_stage_cache;
u32 img_resp_cache;
u32 dbg_path_cache;
+ bool enable_ini;
u32 cnvi;
u32 cnvr;
@@ -778,6 +781,7 @@ struct btintel_pcie_data {
u32 debug_table_size;
struct btintel_pcie_dump_mem_info dump_info;
struct btintel_pcie_mbox mbox;
+ struct btintel_pcie_yoyo_ctx yoyo;
/* Wait queue for mbox_worker to wait for GP0 alive interrupt */
wait_queue_head_t mbox_parse_wait_q;
diff --git a/drivers/bluetooth/btintel_pcie_debug.c b/drivers/bluetooth/btintel_pcie_debug.c
new file mode 100644
index 000000000000..e8a32d791541
--- /dev/null
+++ b/drivers/bluetooth/btintel_pcie_debug.c
@@ -0,0 +1,117 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/* Intel Bluetooth PCIe YoYo debug configuration support. */
+
+#include <linux/errno.h>
+#include <linux/firmware.h>
+#include <linux/module.h>
+#include <linux/string.h>
+#include <linux/unaligned.h>
+#include <net/bluetooth/bluetooth.h>
+
+#include "btintel_pcie_debug.h"
+
+static int btintel_pcie_yoyo_parse_tlv_buffer(struct btintel_pcie_yoyo_ctx *ctx,
+ const u8 *buf, size_t buf_len)
+{
+ const u8 *ptr = buf;
+ size_t remaining = buf_len;
+ u32 count = 0;
+
+ if (!ctx || !buf)
+ return -EINVAL;
+
+ while (remaining >= sizeof(struct btintel_pcie_tlv_hdr)) {
+ u32 type = get_unaligned_le32(ptr);
+ u32 len = get_unaligned_le32(ptr + sizeof(__le32));
+
+ if (len > remaining - sizeof(struct btintel_pcie_tlv_hdr)) {
+ BT_ERR("YoYo: TLV %u truncated (len=%u remaining=%zu)",
+ count, len, remaining);
+ return -EBADMSG;
+ }
+
+ switch (type) {
+ case BTINTEL_PCIE_TLV_TYPE_DBG_INFO:
+ case BTINTEL_PCIE_TLV_TYPE_DBG_REGION:
+ case BTINTEL_PCIE_TLV_TYPE_DBG_TRIGGER:
+ case BTINTEL_PCIE_TLV_TYPE_DBG_HCMD:
+ case BTINTEL_PCIE_TLV_TYPE_DBG_CONFIG_SET:
+ case BTINTEL_PCIE_TLV_TYPE_DBG_BUF_ALLOC:
+ case BTINTEL_PCIE_TLV_TYPE_DBG_PRESET_OVERRIDE:
+ BT_DBG("YoYo: recognized TLV type 0x%x len=%u", type, len);
+ break;
+ default:
+ BT_DBG("YoYo: unknown TLV type 0x%x len=%u", type, len);
+ break;
+ }
+
+ ptr += sizeof(struct btintel_pcie_tlv_hdr) + len;
+ remaining -= sizeof(struct btintel_pcie_tlv_hdr) + len;
+ count++;
+ }
+
+ if (remaining || !count) {
+ BT_ERR("YoYo: invalid TLV stream (%zu trailing bytes, %u TLVs)",
+ remaining, count);
+ return -EBADMSG;
+ }
+ return 0;
+}
+
+int btintel_pcie_yoyo_init(struct btintel_pcie_yoyo_ctx *ctx)
+{
+ if (!ctx)
+ return -EINVAL;
+
+ memset(ctx, 0, sizeof(*ctx));
+ INIT_LIST_HEAD(&ctx->region_list);
+ INIT_LIST_HEAD(&ctx->trigger_list);
+ INIT_LIST_HEAD(&ctx->hcmd_list);
+ INIT_LIST_HEAD(&ctx->config_set_list);
+ return 0;
+}
+EXPORT_SYMBOL_GPL(btintel_pcie_yoyo_init);
+
+void btintel_pcie_yoyo_cleanup(struct btintel_pcie_yoyo_ctx *ctx)
+{
+ if (!ctx)
+ return;
+
+ ctx->enabled = false;
+}
+EXPORT_SYMBOL_GPL(btintel_pcie_yoyo_cleanup);
+
+int btintel_pcie_yoyo_load_and_parse(struct btintel_pcie_yoyo_ctx *ctx,
+ struct device *dev)
+{
+ const struct firmware *fw;
+ int err;
+
+ if (!ctx || !dev)
+ return -EINVAL;
+
+ err = request_firmware_direct(&fw, BTINTEL_PCIE_YOYO_FW_NAME, dev);
+ if (err) {
+ BT_ERR("YoYo: failed to load %s (%d)",
+ BTINTEL_PCIE_YOYO_FW_NAME, err);
+ return err;
+ }
+
+ if (fw->size < sizeof(struct btintel_pcie_tlv_hdr))
+ err = -EBADMSG;
+ else
+ err = btintel_pcie_yoyo_parse_tlv_buffer(ctx, fw->data, fw->size);
+
+ release_firmware(fw);
+ if (err) {
+ BT_ERR("YoYo: TLV parsing failed (%d)", err);
+ return err;
+ }
+ ctx->enabled = true;
+ BT_INFO("YoYo: configuration loaded and validated");
+ return 0;
+}
+EXPORT_SYMBOL_GPL(btintel_pcie_yoyo_load_and_parse);
+
+MODULE_DESCRIPTION("Intel Bluetooth PCIe YoYo debug configuration support");
+MODULE_LICENSE("GPL");
diff --git a/drivers/bluetooth/btintel_pcie_debug.h b/drivers/bluetooth/btintel_pcie_debug.h
new file mode 100644
index 000000000000..d2b7597848e6
--- /dev/null
+++ b/drivers/bluetooth/btintel_pcie_debug.h
@@ -0,0 +1,60 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/* Intel Bluetooth PCIe YoYo debug configuration support. */
+
+#ifndef __BTINTEL_PCIE_DEBUG_H__
+#define __BTINTEL_PCIE_DEBUG_H__
+
+#include <linux/device.h>
+#include <linux/list.h>
+#include <linux/types.h>
+
+#define BTINTEL_PCIE_YOYO_FW_NAME "intel/ibt_debug_yoyo.bin"
+
+#define BTINTEL_PCIE_TLV_TYPE_DBG_INFO 0x01000005
+#define BTINTEL_PCIE_TLV_TYPE_DBG_BUF_ALLOC 0x01000006
+#define BTINTEL_PCIE_TLV_TYPE_DBG_HCMD 0x01000007
+#define BTINTEL_PCIE_TLV_TYPE_DBG_REGION 0x01000008
+#define BTINTEL_PCIE_TLV_TYPE_DBG_TRIGGER 0x01000009
+#define BTINTEL_PCIE_TLV_TYPE_DBG_CONFIG_SET 0x0100000a
+#define BTINTEL_PCIE_TLV_TYPE_DBG_PRESET_OVERRIDE 0x0100000b
+
+#define BTINTEL_PCIE_CONFIG_NAME_LEN 64
+#define BTINTEL_PCIE_DOMAIN_BT 0
+#define BTINTEL_PCIE_CORE_TYPE_BT 1
+
+enum btintel_pcie_image_tlv_type {
+ BTINTEL_PCIE_IMAGE_TLV_TYPE_EXTERNAL = 0x1,
+ BTINTEL_PCIE_IMAGE_TLV_TYPE_INTERNAL = 0x2,
+ BTINTEL_PCIE_IMAGE_TLV_TYPE_UNKNOWN = 0xff,
+};
+
+struct btintel_pcie_tlv_hdr {
+ __le32 type;
+ __le32 length;
+} __packed;
+
+struct btintel_pcie_dbg_hdr {
+ __le32 tlv_data_version;
+ __le32 domain;
+} __packed;
+
+struct btintel_pcie_addr_value {
+ __le32 address;
+ __le32 value;
+} __packed;
+
+struct btintel_pcie_yoyo_ctx {
+ bool enabled;
+ struct list_head region_list;
+ struct list_head trigger_list;
+ struct list_head hcmd_list;
+ struct list_head config_set_list;
+ struct hci_dev *hdev;
+};
+
+int btintel_pcie_yoyo_init(struct btintel_pcie_yoyo_ctx *ctx);
+void btintel_pcie_yoyo_cleanup(struct btintel_pcie_yoyo_ctx *ctx);
+int btintel_pcie_yoyo_load_and_parse(struct btintel_pcie_yoyo_ctx *ctx,
+ struct device *dev);
+
+#endif /* __BTINTEL_PCIE_DEBUG_H__ */
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v1 2/3] Bluetooth: btintel_pcie: Validate the YoYo DEBUG_INFO TLV
2026-10-13 10:44 [PATCH v1 1/3] Bluetooth: btintel_pcie: Add initial YoYo debug support Ajay KV
@ 2026-10-13 10:44 ` Ajay KV
2026-10-13 10:44 ` [PATCH v1 3/3] Bluetooth: btintel_pcie: Configure YoYo DBGC buffer allocations Ajay KV
2026-10-13 11:54 ` [v1,1/3] Bluetooth: btintel_pcie: Add initial YoYo debug support bluez.test.bot
2 siblings, 0 replies; 4+ messages in thread
From: Ajay KV @ 2026-10-13 10:44 UTC (permalink / raw)
To: linux-bluetooth
Cc: chandrashekar.devegowda, kiran.k, linux-kernel, luiz.dentz,
marcel, stable, chethan.tumkur.narayan, lakshmipathi.k, Ajaykv
From: Ajaykv <ajay.k.v@intel.com>
Require a DEBUG_INFO TLV in the YoYo firmware configuration. Validate
its payload length, TLV version, Bluetooth domain, external image type,
and Bluetooth core type before accepting the configuration.
Reject missing or invalid metadata so the driver keeps legacy DBGC
defaults instead of enabling an incompatible configuration.
Signed-off-by: Ajaykv <ajay.k.v@intel.com>
---
drivers/bluetooth/btintel_pcie_debug.c | 63 ++++++++++++++++++++++++++
drivers/bluetooth/btintel_pcie_debug.h | 10 ++++
2 files changed, 73 insertions(+)
diff --git a/drivers/bluetooth/btintel_pcie_debug.c b/drivers/bluetooth/btintel_pcie_debug.c
index e8a32d791541..240724c3d12f 100644
--- a/drivers/bluetooth/btintel_pcie_debug.c
+++ b/drivers/bluetooth/btintel_pcie_debug.c
@@ -4,18 +4,64 @@
#include <linux/errno.h>
#include <linux/firmware.h>
#include <linux/module.h>
+#include <linux/stddef.h>
#include <linux/string.h>
#include <linux/unaligned.h>
#include <net/bluetooth/bluetooth.h>
#include "btintel_pcie_debug.h"
+static int btintel_pcie_yoyo_parse_dbg_info(struct btintel_pcie_yoyo_ctx *ctx,
+ const struct btintel_pcie_tlv_dbg_info *info,
+ u32 len)
+{
+ const u8 *data = (const u8 *)info;
+ u32 domain, image_type, core_type, version;
+
+ if (len != sizeof(*info) - sizeof(struct btintel_pcie_tlv_hdr))
+ return -EBADMSG;
+
+ image_type = get_unaligned_le32(data +
+ offsetof(struct btintel_pcie_tlv_dbg_info,
+ image_type));
+ core_type = get_unaligned_le32(data +
+ offsetof(struct btintel_pcie_tlv_dbg_info,
+ core_type));
+ domain = get_unaligned_le32(data +
+ offsetof(struct btintel_pcie_tlv_dbg_info,
+ dbg_hdr.domain));
+ version = get_unaligned_le32(data +
+ offsetof(struct btintel_pcie_tlv_dbg_info,
+ dbg_hdr.tlv_data_version));
+
+ if (domain != BTINTEL_PCIE_DOMAIN_BT ||
+ version != BTINTEL_PCIE_DBG_INFO_TLV_VERSION) {
+ BT_WARN("YoYo: unsupported domain/version (%u/%u), disabling",
+ domain, version);
+ return -EINVAL;
+ }
+ if (image_type != BTINTEL_PCIE_IMAGE_TLV_TYPE_EXTERNAL) {
+ BT_WARN("YoYo: unsupported image_type 0x%x, disabling", image_type);
+ return -EINVAL;
+ }
+ if (core_type != BTINTEL_PCIE_CORE_TYPE_BT) {
+ BT_WARN("YoYo: non-Bluetooth core_type %u, disabling", core_type);
+ return -EINVAL;
+ }
+
+ ctx->dbg_info_present = true;
+ BT_DBG("YoYo: config='%.64s' image=%u core=%u",
+ info->config_name, image_type, core_type);
+ return 0;
+}
+
static int btintel_pcie_yoyo_parse_tlv_buffer(struct btintel_pcie_yoyo_ctx *ctx,
const u8 *buf, size_t buf_len)
{
const u8 *ptr = buf;
size_t remaining = buf_len;
u32 count = 0;
+ int err;
if (!ctx || !buf)
return -EINVAL;
@@ -32,6 +78,14 @@ static int btintel_pcie_yoyo_parse_tlv_buffer(struct btintel_pcie_yoyo_ctx *ctx,
switch (type) {
case BTINTEL_PCIE_TLV_TYPE_DBG_INFO:
+ err = btintel_pcie_yoyo_parse_dbg_info(ctx,
+ (const void *)ptr,
+ len);
+ if (err) {
+ ctx->dbg_info_present = false;
+ return err;
+ }
+ break;
case BTINTEL_PCIE_TLV_TYPE_DBG_REGION:
case BTINTEL_PCIE_TLV_TYPE_DBG_TRIGGER:
case BTINTEL_PCIE_TLV_TYPE_DBG_HCMD:
@@ -55,6 +109,10 @@ static int btintel_pcie_yoyo_parse_tlv_buffer(struct btintel_pcie_yoyo_ctx *ctx,
remaining, count);
return -EBADMSG;
}
+ if (!ctx->dbg_info_present) {
+ BT_ERR("YoYo: mandatory DEBUG_INFO TLV missing");
+ return -EBADMSG;
+ }
return 0;
}
@@ -78,6 +136,7 @@ void btintel_pcie_yoyo_cleanup(struct btintel_pcie_yoyo_ctx *ctx)
return;
ctx->enabled = false;
+ ctx->dbg_info_present = false;
}
EXPORT_SYMBOL_GPL(btintel_pcie_yoyo_cleanup);
@@ -107,6 +166,10 @@ int btintel_pcie_yoyo_load_and_parse(struct btintel_pcie_yoyo_ctx *ctx,
BT_ERR("YoYo: TLV parsing failed (%d)", err);
return err;
}
+ if (!ctx->dbg_info_present) {
+ BT_ERR("YoYo: mandatory DEBUG_INFO TLV missing; using legacy defaults");
+ return -EBADMSG;
+ }
ctx->enabled = true;
BT_INFO("YoYo: configuration loaded and validated");
return 0;
diff --git a/drivers/bluetooth/btintel_pcie_debug.h b/drivers/bluetooth/btintel_pcie_debug.h
index d2b7597848e6..16951df2dcaa 100644
--- a/drivers/bluetooth/btintel_pcie_debug.h
+++ b/drivers/bluetooth/btintel_pcie_debug.h
@@ -18,6 +18,7 @@
#define BTINTEL_PCIE_TLV_TYPE_DBG_CONFIG_SET 0x0100000a
#define BTINTEL_PCIE_TLV_TYPE_DBG_PRESET_OVERRIDE 0x0100000b
+#define BTINTEL_PCIE_DBG_INFO_TLV_VERSION 2
#define BTINTEL_PCIE_CONFIG_NAME_LEN 64
#define BTINTEL_PCIE_DOMAIN_BT 0
#define BTINTEL_PCIE_CORE_TYPE_BT 1
@@ -43,8 +44,17 @@ struct btintel_pcie_addr_value {
__le32 value;
} __packed;
+struct btintel_pcie_tlv_dbg_info {
+ struct btintel_pcie_tlv_hdr hdr;
+ struct btintel_pcie_dbg_hdr dbg_hdr;
+ __le32 image_type;
+ __le32 core_type;
+ u8 config_name[BTINTEL_PCIE_CONFIG_NAME_LEN];
+} __packed;
+
struct btintel_pcie_yoyo_ctx {
bool enabled;
+ bool dbg_info_present;
struct list_head region_list;
struct list_head trigger_list;
struct list_head hcmd_list;
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v1 3/3] Bluetooth: btintel_pcie: Configure YoYo DBGC buffer allocations
2026-10-13 10:44 [PATCH v1 1/3] Bluetooth: btintel_pcie: Add initial YoYo debug support Ajay KV
2026-10-13 10:44 ` [PATCH v1 2/3] Bluetooth: btintel_pcie: Validate the YoYo DEBUG_INFO TLV Ajay KV
@ 2026-10-13 10:44 ` Ajay KV
2026-10-13 11:54 ` [v1,1/3] Bluetooth: btintel_pcie: Add initial YoYo debug support bluez.test.bot
2 siblings, 0 replies; 4+ messages in thread
From: Ajay KV @ 2026-10-13 10:44 UTC (permalink / raw)
To: linux-bluetooth
Cc: chandrashekar.devegowda, kiran.k, linux-kernel, luiz.dentz,
marcel, stable, chethan.tumkur.narayan, lakshmipathi.k, Ajaykv
From: Ajaykv <ajay.k.v@intel.com>
Parse DBGC buffer allocation TLVs for DBGC1 through DBGC3. Validate the
allocation ID, DRAM location, fragment count, requested size, and
minimum fragment size before storing each allocation.
Use configured fragment counts and sizes for DMA buffers, firmware
context descriptors, and coredump collection. On MDBGC devices, omit
unconfigured buffer IDs when YoYo is enabled; retain legacy allocations
when YoYo configuration is absent or invalid. Single-DBGC devices use
DBGC1.
Signed-off-by: Ajaykv <ajay.k.v@intel.com>
---
drivers/bluetooth/btintel_pcie.c | 175 ++++++++++++++++---------
drivers/bluetooth/btintel_pcie.h | 8 +-
drivers/bluetooth/btintel_pcie_debug.c | 93 ++++++++++++-
drivers/bluetooth/btintel_pcie_debug.h | 44 +++++++
4 files changed, 256 insertions(+), 64 deletions(-)
diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index a4aaca3daf20..b85e8229d5d7 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -302,7 +302,8 @@ static int btintel_pcie_alloc_dbgc_buf(struct btintel_pcie_data *data,
void **v_addr,
struct btintel_pcie_dbgc_ctxt_buf *frag,
u32 buf_index,
- u32 buf_count)
+ u32 buf_count,
+ u32 per_buf_size)
{
struct data_buf *b;
int i;
@@ -315,8 +316,7 @@ static int btintel_pcie_alloc_dbgc_buf(struct btintel_pcie_data *data,
}
*v_addr = dmam_alloc_coherent(&data->pdev->dev,
- buf_count *
- BTINTEL_PCIE_DBGC_BUFFER_SIZE,
+ buf_count * per_buf_size,
p_addr,
GFP_KERNEL | __GFP_NOWARN);
if (!*v_addr) {
@@ -326,16 +326,37 @@ static int btintel_pcie_alloc_dbgc_buf(struct btintel_pcie_data *data,
for (i = 0; i < buf_count; i++) {
b = &(*buf)[i];
- b->data_p_addr = *p_addr + i * BTINTEL_PCIE_DBGC_BUFFER_SIZE;
- b->data = *v_addr + i * BTINTEL_PCIE_DBGC_BUFFER_SIZE;
+ b->data_p_addr = *p_addr + i * per_buf_size;
+ b->data = *v_addr + i * per_buf_size;
frag[i].buf_addr_lsb = lower_32_bits(b->data_p_addr);
frag[i].buf_addr_msb = upper_32_bits(b->data_p_addr);
- frag[i].buf_size = BTINTEL_PCIE_DBGC_BUFFER_SIZE;
+ frag[i].buf_size = per_buf_size;
}
+ BT_INFO("DBGC allocation %u: fragments=%u fragment_size=%u total=%u",
+ buf_index + 1, buf_count, per_buf_size, buf_count * per_buf_size);
return 0;
}
+static bool btintel_pcie_get_mdbgc_cfg(struct btintel_pcie_data *data,
+ u32 alloc_id, u32 *count, u32 *size)
+{
+ const struct btintel_pcie_buf_alloc *alloc;
+
+ alloc = btintel_pcie_yoyo_get_buf_alloc(&data->yoyo, alloc_id);
+ if (alloc) {
+ *count = alloc->max_num_frags;
+ *size = alloc->req_buf_size / alloc->max_num_frags;
+ return true;
+ }
+ if (data->yoyo.enabled)
+ return false;
+
+ *count = BTINTEL_PCIE_DBGC_BUFFER_COUNT;
+ *size = BTINTEL_PCIE_DBGC_BUFFER_SIZE;
+ return true;
+}
+
/* This function initializes the memory for MDBGC buffers and formats the
* DBGC fragment which consists header info and DBGC buffer's LSB, MSB and
* size as the payload
@@ -345,10 +366,9 @@ static int btintel_pcie_setup_mdbgc(struct btintel_pcie_data *data)
struct btintel_pcie_mdbgc_ctxt db_frag;
u32 frag_size = sizeof(db_frag);
void *frag_v_addr;
+ u32 buf_count, buf_size;
int err;
- data->mdbgc.count = BTINTEL_PCIE_DBGC_BUFFER_COUNT;
-
/* Allocate fragment context structure */
frag_v_addr = dmam_alloc_coherent(&data->pdev->dev, frag_size,
&data->mdbgc.frag_p_addr,
@@ -367,46 +387,56 @@ static int btintel_pcie_setup_mdbgc(struct btintel_pcie_data *data)
db_frag.ver = BTINTEL_PCIE_MDBGC_FRAG_VERSION;
/* Allocate DBGC buffer 1 */
- db_frag.buf1_index = BTINTEL_PCIE_MDBGC_ALLOCATIONID_1;
- db_frag.buf1_count = data->mdbgc.count;
- err = btintel_pcie_alloc_dbgc_buf(data,
- &data->mdbgc.buf1,
- &data->mdbgc.buf1_p_addr,
- &data->mdbgc.buf1_v_addr,
- db_frag.buf1,
- 0,
- data->mdbgc.count);
- if (err)
- return err;
+ if (btintel_pcie_get_mdbgc_cfg(data, BTINTEL_PCIE_ALLOC_ID_DBGC1,
+ &buf_count, &buf_size)) {
+ db_frag.buf1_index = BTINTEL_PCIE_MDBGC_ALLOCATIONID_1;
+ db_frag.buf1_count = buf_count;
+ data->mdbgc.buf1_count = buf_count;
+ data->mdbgc.buf1_size = buf_size;
+ err = btintel_pcie_alloc_dbgc_buf(data, &data->mdbgc.buf1,
+ &data->mdbgc.buf1_p_addr,
+ &data->mdbgc.buf1_v_addr, db_frag.buf1,
+ 0, buf_count, buf_size);
+ if (err)
+ return err;
+ }
/* Allocate DBGC buffer 2 */
- db_frag.buf2_index = BTINTEL_PCIE_MDBGC_ALLOCATIONID_2;
- db_frag.buf2_count = data->mdbgc.count;
- err = btintel_pcie_alloc_dbgc_buf(data,
- &data->mdbgc.buf2,
- &data->mdbgc.buf2_p_addr,
- &data->mdbgc.buf2_v_addr,
- db_frag.buf2,
- 1,
- data->mdbgc.count);
- if (err)
- return err;
+ if (btintel_pcie_get_mdbgc_cfg(data, BTINTEL_PCIE_ALLOC_ID_DBGC2,
+ &buf_count, &buf_size)) {
+ db_frag.buf2_index = BTINTEL_PCIE_MDBGC_ALLOCATIONID_2;
+ db_frag.buf2_count = buf_count;
+ data->mdbgc.buf2_count = buf_count;
+ data->mdbgc.buf2_size = buf_size;
+ err = btintel_pcie_alloc_dbgc_buf(data, &data->mdbgc.buf2,
+ &data->mdbgc.buf2_p_addr,
+ &data->mdbgc.buf2_v_addr, db_frag.buf2,
+ 1, buf_count, buf_size);
+ if (err)
+ return err;
+ }
/* Allocate DBGC buffer 3 */
- db_frag.buf3_index = BTINTEL_PCIE_MDBGC_ALLOCATIONID_3;
- db_frag.buf3_count = data->mdbgc.count;
- err = btintel_pcie_alloc_dbgc_buf(data,
- &data->mdbgc.buf3,
- &data->mdbgc.buf3_p_addr,
- &data->mdbgc.buf3_v_addr,
- db_frag.buf3,
- 2,
- data->mdbgc.count);
- if (err)
- return err;
+ if (btintel_pcie_get_mdbgc_cfg(data, BTINTEL_PCIE_ALLOC_ID_DBGC3,
+ &buf_count, &buf_size)) {
+ db_frag.buf3_index = BTINTEL_PCIE_MDBGC_ALLOCATIONID_3;
+ db_frag.buf3_count = buf_count;
+ data->mdbgc.buf3_count = buf_count;
+ data->mdbgc.buf3_size = buf_size;
+ err = btintel_pcie_alloc_dbgc_buf(data, &data->mdbgc.buf3,
+ &data->mdbgc.buf3_p_addr,
+ &data->mdbgc.buf3_v_addr, db_frag.buf3,
+ 2, buf_count, buf_size);
+ if (err)
+ return err;
+ }
/* Copy fragment to DMA coherent memory */
memcpy(data->mdbgc.frag_v_addr, &db_frag, sizeof(db_frag));
+ BT_INFO("MDBGC fragments: DBGC1=%u/%u DBGC2=%u/%u DBGC3=%u/%u",
+ db_frag.buf1_count, data->mdbgc.buf1_size,
+ db_frag.buf2_count, data->mdbgc.buf2_size,
+ db_frag.buf3_count, data->mdbgc.buf3_size);
return 0;
}
@@ -418,9 +448,17 @@ static int btintel_pcie_setup_dbgc(struct btintel_pcie_data *data)
{
struct btintel_pcie_dbgc_ctxt db_frag;
u32 frag_size = sizeof(db_frag);
+ const struct btintel_pcie_buf_alloc *alloc;
+ u32 buf_count, buf_size;
int err;
- data->dbgc.count = BTINTEL_PCIE_DBGC_BUFFER_COUNT;
+ alloc = btintel_pcie_yoyo_get_buf_alloc(&data->yoyo,
+ BTINTEL_PCIE_ALLOC_ID_DBGC1);
+ buf_count = alloc ? alloc->max_num_frags : BTINTEL_PCIE_DBGC_BUFFER_COUNT;
+ buf_size = alloc ? alloc->req_buf_size / alloc->max_num_frags :
+ BTINTEL_PCIE_DBGC_BUFFER_SIZE;
+ data->dbgc.count = buf_count;
+ data->dbgc.buf_size = buf_size;
/* Allocate fragment context structure */
data->dbgc.frag_v_addr = dmam_alloc_coherent(&data->pdev->dev,
@@ -438,8 +476,9 @@ static int btintel_pcie_setup_dbgc(struct btintel_pcie_data *data)
memset(&db_frag, 0, sizeof(db_frag));
db_frag.magic_num = BTINTEL_PCIE_MAGIC_NUM;
db_frag.ver = BTINTEL_PCIE_DBGC_FRAG_VERSION;
- db_frag.total_size = BTINTEL_PCIE_DBGC_FRAG_PAYLOAD_SIZE;
- db_frag.num_buf = BTINTEL_PCIE_DBGC_FRAG_BUFFER_COUNT;
+ db_frag.total_size = sizeof(db_frag.num_buf) +
+ buf_count * sizeof(db_frag.bufs[0]);
+ db_frag.num_buf = buf_count;
/* Allocate DBGC buffers */
err = btintel_pcie_alloc_dbgc_buf(data,
@@ -448,7 +487,8 @@ static int btintel_pcie_setup_dbgc(struct btintel_pcie_data *data)
&data->dbgc.buf_v_addr,
db_frag.bufs,
0,
- data->dbgc.count);
+ buf_count,
+ buf_size);
if (err)
return err;
@@ -941,7 +981,8 @@ static u32 btintel_pcie_dump_list_total_size(struct list_head *list)
}
static int btintel_pcie_dump_dram(struct list_head *list,
- u8 count, struct data_buf *bufs,
+ u8 count, u32 buf_size,
+ struct data_buf *bufs,
u32 write_ptr, u32 wrap_ctr, u32 cur_frag,
u32 region_id, const char *name)
{
@@ -953,7 +994,7 @@ static int btintel_pcie_dump_dram(struct list_head *list,
int i;
mon_hdr_size = sizeof(*mon_dump);
- ranges_size = count * (sizeof(*range) + BTINTEL_PCIE_DBGC_BUFFER_SIZE);
+ ranges_size = count * (sizeof(*range) + buf_size);
payload_size = mon_hdr_size + ranges_size;
total_size = sizeof(*dump_data) + payload_size;
@@ -982,12 +1023,10 @@ static int btintel_pcie_dump_dram(struct list_head *list,
range = (void *)mon_dump->data;
for (i = 0; i < count; i++) {
- range->range_data_size =
- cpu_to_le32(BTINTEL_PCIE_DBGC_BUFFER_SIZE);
+ range->range_data_size = cpu_to_le32(buf_size);
range->dram_base_addr = cpu_to_le64(bufs[i].data_p_addr);
- memcpy(range->data, bufs[i].data,
- BTINTEL_PCIE_DBGC_BUFFER_SIZE);
- range = (void *)range->data + BTINTEL_PCIE_DBGC_BUFFER_SIZE;
+ memcpy(range->data, bufs[i].data, buf_size);
+ range = (void *)range->data + buf_size;
}
list_add_tail(&entry->list, list);
@@ -997,6 +1036,7 @@ static int btintel_pcie_dump_dram(struct list_head *list,
static int
btintel_pcie_dump_dram_monitor(struct btintel_pcie_data *data,
struct list_head *list, u8 count,
+ u32 buf_size,
struct data_buf *bufs, u32 status_reg,
u32 wrap_reg, u8 allocation_id, u32 region_id,
const char *name)
@@ -1004,6 +1044,9 @@ btintel_pcie_dump_dram_monitor(struct btintel_pcie_data *data,
u32 allocation_offset, write_ptr, wrap_ctr, wr_ptr_status;
u8 cur_frag;
+ if (!count)
+ return -ENOENT;
+
allocation_offset = allocation_id *
BTINTEL_PCIE_DBGC_ALLOCATION_OFFSET;
wr_ptr_status = btintel_pcie_rd_dev_mem(data, status_reg +
@@ -1025,8 +1068,8 @@ btintel_pcie_dump_dram_monitor(struct btintel_pcie_data *data,
"allocation=%u wr_ptr_status=0x%08x write_ptr=0x%06x cur_frag=%u wrap_ctr=0x%08x",
allocation_id, wr_ptr_status, write_ptr, cur_frag, wrap_ctr);
- return btintel_pcie_dump_dram(list, count, bufs, write_ptr, wrap_ctr,
- cur_frag, region_id, name);
+ return btintel_pcie_dump_dram(list, count, buf_size, bufs, write_ptr,
+ wrap_ctr, cur_frag, region_id, name);
}
static int btintel_pcie_dump_target_region(struct btintel_pcie_data *data,
@@ -1307,6 +1350,7 @@ static int btintel_pcie_read_debug_regions(struct btintel_pcie_data *data)
u8 hw_variant;
u32 file_len;
u8 count;
+ u32 buf_size;
int ret;
LIST_HEAD(dump_list);
@@ -1315,10 +1359,10 @@ static int btintel_pcie_read_debug_regions(struct btintel_pcie_data *data)
if (btintel_pcie_is_mdbgc_supported(data)) {
mdbgc = &data->mdbgc;
- count = mdbgc->count;
} else {
dbgc = &data->dbgc;
count = dbgc->count;
+ buf_size = dbgc->buf_size;
}
hw_variant = INTEL_HW_VARIANT(data->cnvi);
@@ -1338,7 +1382,9 @@ static int btintel_pcie_read_debug_regions(struct btintel_pcie_data *data)
}
if (btintel_pcie_is_mdbgc_supported(data)) {
- ret = btintel_pcie_dump_dram_monitor(data, &dump_list, count,
+ ret = btintel_pcie_dump_dram_monitor(data, &dump_list,
+ mdbgc->buf1_count,
+ mdbgc->buf1_size,
mdbgc->buf1, status_reg,
wrap_reg,
BTINTEL_PCIE_MDBGC_ALLOCATIONID_1,
@@ -1347,10 +1393,12 @@ static int btintel_pcie_read_debug_regions(struct btintel_pcie_data *data)
if (!ret)
regions_mask |=
BIT_ULL(BTINTEL_PCIE_INI_ID_DRAM_MONITOR1);
- else
+ else if (ret != -ENOENT)
bt_dev_warn(hdev, "Failed to dump DRAM buf1: %d", ret);
- ret = btintel_pcie_dump_dram_monitor(data, &dump_list, count,
+ ret = btintel_pcie_dump_dram_monitor(data, &dump_list,
+ mdbgc->buf2_count,
+ mdbgc->buf2_size,
mdbgc->buf2, status_reg,
wrap_reg,
BTINTEL_PCIE_MDBGC_ALLOCATIONID_2,
@@ -1359,10 +1407,12 @@ static int btintel_pcie_read_debug_regions(struct btintel_pcie_data *data)
if (!ret)
regions_mask |=
BIT_ULL(BTINTEL_PCIE_INI_ID_DRAM_MONITOR2);
- else
+ else if (ret != -ENOENT)
bt_dev_warn(hdev, "Failed to dump DRAM buf2: %d", ret);
- ret = btintel_pcie_dump_dram_monitor(data, &dump_list, count,
+ ret = btintel_pcie_dump_dram_monitor(data, &dump_list,
+ mdbgc->buf3_count,
+ mdbgc->buf3_size,
mdbgc->buf3, status_reg,
wrap_reg,
BTINTEL_PCIE_MDBGC_ALLOCATIONID_3,
@@ -1371,11 +1421,12 @@ static int btintel_pcie_read_debug_regions(struct btintel_pcie_data *data)
if (!ret)
regions_mask |=
BIT_ULL(BTINTEL_PCIE_INI_ID_DRAM_MONITOR3);
- else
+ else if (ret != -ENOENT)
bt_dev_warn(hdev, "Failed to dump DRAM buf3: %d", ret);
} else {
ret = btintel_pcie_dump_dram_monitor(data, &dump_list, count,
- dbgc->bufs, status_reg,
+ buf_size, dbgc->bufs,
+ status_reg,
wrap_reg,
BTINTEL_PCIE_MDBGC_ALLOCATIONID_1,
BTINTEL_PCIE_INI_ID_DRAM_MONITOR1,
diff --git a/drivers/bluetooth/btintel_pcie.h b/drivers/bluetooth/btintel_pcie.h
index e361ed483fd9..3827527c5b4d 100644
--- a/drivers/bluetooth/btintel_pcie.h
+++ b/drivers/bluetooth/btintel_pcie.h
@@ -468,6 +468,7 @@ struct rxq {
*/
struct btintel_pcie_dbgc {
u16 count;
+ u32 buf_size;
void *frag_v_addr;
dma_addr_t frag_p_addr;
@@ -479,7 +480,12 @@ struct btintel_pcie_dbgc {
};
struct btintel_pcie_mdbgc {
- u32 count;
+ u32 buf1_count;
+ u32 buf1_size;
+ u32 buf2_count;
+ u32 buf2_size;
+ u32 buf3_count;
+ u32 buf3_size;
void *frag_v_addr;
dma_addr_t frag_p_addr;
diff --git a/drivers/bluetooth/btintel_pcie_debug.c b/drivers/bluetooth/btintel_pcie_debug.c
index 240724c3d12f..806017b22209 100644
--- a/drivers/bluetooth/btintel_pcie_debug.c
+++ b/drivers/bluetooth/btintel_pcie_debug.c
@@ -55,6 +55,68 @@ static int btintel_pcie_yoyo_parse_dbg_info(struct btintel_pcie_yoyo_ctx *ctx,
return 0;
}
+static int btintel_pcie_yoyo_parse_buf_alloc(struct btintel_pcie_yoyo_ctx *ctx,
+ const struct btintel_pcie_tlv_buf_alloc *tlv,
+ u32 len)
+{
+ u32 alloc_id, buf_location, domain, idx, max_num_frags, min_buf_size;
+ u32 req_buf_size, version;
+
+ if (len != sizeof(*tlv) - sizeof(struct btintel_pcie_tlv_hdr)) {
+ BT_WARN("YoYo: unexpected buffer allocation TLV length %u", len);
+ return -EBADMSG;
+ }
+
+ domain = get_unaligned_le32(&tlv->dbg_hdr.domain);
+ version = get_unaligned_le32(&tlv->dbg_hdr.tlv_data_version);
+ if (domain != BTINTEL_PCIE_DOMAIN_BT ||
+ version != BTINTEL_PCIE_BUF_ALLOC_TLV_VERSION) {
+ BT_WARN("YoYo: unsupported buffer allocation domain/version (%u/%u)",
+ domain, version);
+ return -EINVAL;
+ }
+
+ alloc_id = get_unaligned_le32(&tlv->alloc_id);
+ if (alloc_id < BTINTEL_PCIE_ALLOC_ID_DBGC1 ||
+ alloc_id > BTINTEL_PCIE_ALLOC_ID_DBGC3) {
+ BT_WARN("YoYo: invalid buffer allocation ID %u", alloc_id);
+ return -EINVAL;
+ }
+
+ idx = alloc_id - BTINTEL_PCIE_ALLOC_ID_DBGC1;
+ buf_location = get_unaligned_le32(&tlv->buf_location);
+ max_num_frags = get_unaligned_le32(&tlv->max_num_frags);
+ min_buf_size = get_unaligned_le32(&tlv->min_buf_size);
+ req_buf_size = get_unaligned_le32(&tlv->req_buf_size);
+ if (buf_location != BTINTEL_PCIE_BUF_LOC_DRAM) {
+ BT_WARN("YoYo: allocation %u requests unsupported location %u",
+ alloc_id, buf_location);
+ return -EINVAL;
+ }
+
+ if (!max_num_frags || max_num_frags > BTINTEL_PCIE_MAX_BUF_FRAGS ||
+ min_buf_size < BTINTEL_PCIE_MIN_BUF_SIZE ||
+ min_buf_size > BTINTEL_PCIE_MAX_BUF_SIZE ||
+ req_buf_size > BTINTEL_PCIE_MAX_BUF_SIZE ||
+ req_buf_size % max_num_frags ||
+ req_buf_size / max_num_frags < min_buf_size) {
+ BT_WARN("YoYo: invalid allocation %u size=%u fragments=%u minimum=%u",
+ alloc_id, req_buf_size, max_num_frags, min_buf_size);
+ return -EINVAL;
+ }
+
+ ctx->buf_alloc[idx].alloc_id = alloc_id;
+ ctx->buf_alloc[idx].buf_location = buf_location;
+ ctx->buf_alloc[idx].req_buf_size = req_buf_size;
+ ctx->buf_alloc[idx].max_num_frags = max_num_frags;
+ ctx->buf_alloc[idx].min_buf_size = min_buf_size;
+ ctx->buf_alloc[idx].present = true;
+ ctx->num_buf_allocs = max(ctx->num_buf_allocs, idx + 1);
+ BT_DBG("YoYo: allocation %u location=%u size=%u fragments=%u minimum=%u",
+ alloc_id, buf_location, req_buf_size, max_num_frags, min_buf_size);
+ return 0;
+}
+
static int btintel_pcie_yoyo_parse_tlv_buffer(struct btintel_pcie_yoyo_ctx *ctx,
const u8 *buf, size_t buf_len)
{
@@ -86,11 +148,17 @@ static int btintel_pcie_yoyo_parse_tlv_buffer(struct btintel_pcie_yoyo_ctx *ctx,
return err;
}
break;
+ case BTINTEL_PCIE_TLV_TYPE_DBG_BUF_ALLOC:
+ err = btintel_pcie_yoyo_parse_buf_alloc(ctx,
+ (const void *)ptr,
+ len);
+ if (err)
+ return err;
+ break;
case BTINTEL_PCIE_TLV_TYPE_DBG_REGION:
case BTINTEL_PCIE_TLV_TYPE_DBG_TRIGGER:
case BTINTEL_PCIE_TLV_TYPE_DBG_HCMD:
case BTINTEL_PCIE_TLV_TYPE_DBG_CONFIG_SET:
- case BTINTEL_PCIE_TLV_TYPE_DBG_BUF_ALLOC:
case BTINTEL_PCIE_TLV_TYPE_DBG_PRESET_OVERRIDE:
BT_DBG("YoYo: recognized TLV type 0x%x len=%u", type, len);
break;
@@ -113,6 +181,10 @@ static int btintel_pcie_yoyo_parse_tlv_buffer(struct btintel_pcie_yoyo_ctx *ctx,
BT_ERR("YoYo: mandatory DEBUG_INFO TLV missing");
return -EBADMSG;
}
+ if (!ctx->num_buf_allocs) {
+ BT_ERR("YoYo: mandatory buffer allocation TLV missing");
+ return -EBADMSG;
+ }
return 0;
}
@@ -137,6 +209,8 @@ void btintel_pcie_yoyo_cleanup(struct btintel_pcie_yoyo_ctx *ctx)
ctx->enabled = false;
ctx->dbg_info_present = false;
+ ctx->num_buf_allocs = 0;
+ memset(ctx->buf_alloc, 0, sizeof(ctx->buf_alloc));
}
EXPORT_SYMBOL_GPL(btintel_pcie_yoyo_cleanup);
@@ -176,5 +250,22 @@ int btintel_pcie_yoyo_load_and_parse(struct btintel_pcie_yoyo_ctx *ctx,
}
EXPORT_SYMBOL_GPL(btintel_pcie_yoyo_load_and_parse);
+const struct btintel_pcie_buf_alloc *
+btintel_pcie_yoyo_get_buf_alloc(struct btintel_pcie_yoyo_ctx *ctx, u32 alloc_id)
+{
+ u32 idx;
+
+ if (!ctx || !ctx->enabled ||
+ alloc_id < BTINTEL_PCIE_ALLOC_ID_DBGC1 ||
+ alloc_id > BTINTEL_PCIE_ALLOC_ID_DBGC3)
+ return NULL;
+
+ idx = alloc_id - BTINTEL_PCIE_ALLOC_ID_DBGC1;
+ if (!ctx->buf_alloc[idx].present)
+ return NULL;
+ return &ctx->buf_alloc[idx];
+}
+EXPORT_SYMBOL_GPL(btintel_pcie_yoyo_get_buf_alloc);
+
MODULE_DESCRIPTION("Intel Bluetooth PCIe YoYo debug configuration support");
MODULE_LICENSE("GPL");
diff --git a/drivers/bluetooth/btintel_pcie_debug.h b/drivers/bluetooth/btintel_pcie_debug.h
index 16951df2dcaa..531a24c905b0 100644
--- a/drivers/bluetooth/btintel_pcie_debug.h
+++ b/drivers/bluetooth/btintel_pcie_debug.h
@@ -19,9 +19,14 @@
#define BTINTEL_PCIE_TLV_TYPE_DBG_PRESET_OVERRIDE 0x0100000b
#define BTINTEL_PCIE_DBG_INFO_TLV_VERSION 2
+#define BTINTEL_PCIE_BUF_ALLOC_TLV_VERSION 1
#define BTINTEL_PCIE_CONFIG_NAME_LEN 64
#define BTINTEL_PCIE_DOMAIN_BT 0
#define BTINTEL_PCIE_CORE_TYPE_BT 1
+#define BTINTEL_PCIE_MAX_BUF_ALLOC 3
+#define BTINTEL_PCIE_MAX_BUF_FRAGS 16
+#define BTINTEL_PCIE_MIN_BUF_SIZE (32 * 1024)
+#define BTINTEL_PCIE_MAX_BUF_SIZE (4 * 1024 * 1024)
enum btintel_pcie_image_tlv_type {
BTINTEL_PCIE_IMAGE_TLV_TYPE_EXTERNAL = 0x1,
@@ -29,6 +34,22 @@ enum btintel_pcie_image_tlv_type {
BTINTEL_PCIE_IMAGE_TLV_TYPE_UNKNOWN = 0xff,
};
+enum btintel_dbg_alloc_id {
+ BTINTEL_PCIE_ALLOC_ID_INVALID = 0,
+ BTINTEL_PCIE_ALLOC_ID_DBGC1 = 1,
+ BTINTEL_PCIE_ALLOC_ID_DBGC2 = 2,
+ BTINTEL_PCIE_ALLOC_ID_DBGC3 = 3,
+ BTINTEL_PCIE_ALLOC_ID_MAX,
+};
+
+enum btintel_dbg_buf_location {
+ BTINTEL_PCIE_BUF_LOC_INVALID = 0,
+ BTINTEL_PCIE_BUF_LOC_SRAM = 1,
+ BTINTEL_PCIE_BUF_LOC_DRAM = 2,
+ BTINTEL_PCIE_BUF_LOC_NPK = 3,
+ BTINTEL_PCIE_BUF_LOC_MAX,
+};
+
struct btintel_pcie_tlv_hdr {
__le32 type;
__le32 length;
@@ -52,9 +73,30 @@ struct btintel_pcie_tlv_dbg_info {
u8 config_name[BTINTEL_PCIE_CONFIG_NAME_LEN];
} __packed;
+struct btintel_pcie_tlv_buf_alloc {
+ struct btintel_pcie_tlv_hdr hdr;
+ struct btintel_pcie_dbg_hdr dbg_hdr;
+ __le32 alloc_id;
+ __le32 buf_location;
+ __le32 req_buf_size;
+ __le32 max_num_frags;
+ __le32 min_buf_size;
+} __packed;
+
+struct btintel_pcie_buf_alloc {
+ u32 alloc_id;
+ u32 buf_location;
+ u32 req_buf_size;
+ u32 max_num_frags;
+ u32 min_buf_size;
+ bool present;
+};
+
struct btintel_pcie_yoyo_ctx {
bool enabled;
bool dbg_info_present;
+ struct btintel_pcie_buf_alloc buf_alloc[BTINTEL_PCIE_MAX_BUF_ALLOC];
+ u32 num_buf_allocs;
struct list_head region_list;
struct list_head trigger_list;
struct list_head hcmd_list;
@@ -66,5 +108,7 @@ int btintel_pcie_yoyo_init(struct btintel_pcie_yoyo_ctx *ctx);
void btintel_pcie_yoyo_cleanup(struct btintel_pcie_yoyo_ctx *ctx);
int btintel_pcie_yoyo_load_and_parse(struct btintel_pcie_yoyo_ctx *ctx,
struct device *dev);
+const struct btintel_pcie_buf_alloc *
+btintel_pcie_yoyo_get_buf_alloc(struct btintel_pcie_yoyo_ctx *ctx, u32 alloc_id);
#endif /* __BTINTEL_PCIE_DEBUG_H__ */
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [v1,1/3] Bluetooth: btintel_pcie: Add initial YoYo debug support
2026-10-13 10:44 [PATCH v1 1/3] Bluetooth: btintel_pcie: Add initial YoYo debug support Ajay KV
2026-10-13 10:44 ` [PATCH v1 2/3] Bluetooth: btintel_pcie: Validate the YoYo DEBUG_INFO TLV Ajay KV
2026-10-13 10:44 ` [PATCH v1 3/3] Bluetooth: btintel_pcie: Configure YoYo DBGC buffer allocations Ajay KV
@ 2026-10-13 11:54 ` bluez.test.bot
2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2026-10-13 11:54 UTC (permalink / raw)
To: linux-bluetooth, ajay.k.v
[-- Attachment #1: Type: text/plain, Size: 2446 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/1184643/
---Test result---
Test Summary:
CheckPatch FAIL 4.58 seconds
VerifyFixes PASS 0.12 seconds
VerifySignedoff PASS 0.12 seconds
GitLint FAIL 0.97 seconds
SubjectPrefix PASS 0.35 seconds
BuildKernel PASS 35.68 seconds
CheckAllWarning PASS 33.04 seconds
CheckSparse PASS 35.76 seconds
BuildKernel32 PASS 30.16 seconds
CheckKernelLLVM PASS 36.47 seconds
TestRunnerSetup PASS 697.94 seconds
IncrementalBuild PASS 30.68 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[v1,1/3] Bluetooth: btintel_pcie: Add initial YoYo debug support
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#310:
new file mode 100644
total: 0 errors, 1 warnings, 341 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/14884820.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:
[v1,1/3] Bluetooth: btintel_pcie: Add initial YoYo debug support
22: B1 Line exceeds max length (92>80): "[ 3.360857] Bluetooth: DBGC allocation 1: fragments=16 fragment_size=262144 total=4194304"
23: B1 Line exceeds max length (92>80): "[ 3.361298] Bluetooth: DBGC allocation 2: fragments=16 fragment_size=262144 total=4194304"
24: B1 Line exceeds max length (92>80): "[ 3.361712] Bluetooth: DBGC allocation 3: fragments=16 fragment_size=262144 total=4194304"
25: B1 Line exceeds max length (90>80): "[ 3.361715] Bluetooth: MDBGC fragments: DBGC1=16/262144 DBGC2=16/262144 DBGC3=16/262144"
https://github.com/bluez/bluetooth-next/pull/916
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-13 11:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-13 10:44 [PATCH v1 1/3] Bluetooth: btintel_pcie: Add initial YoYo debug support Ajay KV
2026-10-13 10:44 ` [PATCH v1 2/3] Bluetooth: btintel_pcie: Validate the YoYo DEBUG_INFO TLV Ajay KV
2026-10-13 10:44 ` [PATCH v1 3/3] Bluetooth: btintel_pcie: Configure YoYo DBGC buffer allocations Ajay KV
2026-10-13 11:54 ` [v1,1/3] Bluetooth: btintel_pcie: Add initial YoYo debug support 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