Bluetooth: btintel_pcie: Add yoyo support for config set TLV
Subsystems (2)
PATCH v3 1/3 Bluetooth: btintel_pcie: Add yoyo support for config set TLV
From: Ajaykv <[email protected]>
Add parsing of the YoYo CONFIG_SET TLV so that debug register configuration can be supplied through the external TLV file. Each CONFIG_SET TLV is validated, and its address/value pairs are stored in the config set list of the YoYo context.
At the configured timepoint, the stored pairs are written to the target memory region, with or without target access depending on the region type. Write failures are logged and do not stop normal Bluetooth bring-up.
Peripheral MAC and device memory pairs are written through the indirect target access registers: the address is written to PRPH_DEV_ADDR_REG (0x440), which is shared by reads and writes, and the value to PRPH_DEV_WR_REG (0x454), under MAC access. No readback is done, as reading some peripheral registers has side effects.
btintel_pcie_yoyo_cleanup() now frees the config set list, so in btintel_pcie_remove() it is moved after btintel_pcie_release_hdev(); the list must stay valid until the HCI device is gone. It also clears ctx->hdev, and btintel_pcie_yoyo_load_and_parse() now calls it itself when parsing fails or a mandatory TLV is missing, so a rejected file leaves no partial state.
btintel_pcie_yoyo_load_and_parse() also rejects a NULL device, and its parse failures are reported with BT_WARN instead of BT_ERR, since YoYo is optional and the driver falls back to the legacy DBGC defaults. The existing DEBUG_INFO and buffer allocation parser messages are reworded, and the PCI BDF is added to the YoYo status messages to identify the controller.
The mandatory TLV check for the buffer allocation TLV is moved from btintel_pcie_yoyo_parse_tlv_buffer() to btintel_pcie_yoyo_load_and_parse(), so that both mandatory TLVs are checked in one place.
Existing defines and enum entries in btintel_pcie_debug.h are realigned; these are whitespace-only changes.
--- drivers/bluetooth/btintel_pcie.c | 138 ++++++++++++++++++++++++- drivers/bluetooth/btintel_pcie.h | 1 + drivers/bluetooth/btintel_pcie_debug.c | 117 ++++++++++++++++++--- drivers/bluetooth/btintel_pcie_debug.h | 76 +++++++++++++- 4 files changed, 313 insertions(+), 19 deletions(-)
drivers/bluetooth/btintel_pcie.c +135 -3
@@ -927,6 +927,133 @@ static void btintel_pcie_release_mac_access(struct btintel_pcie_data *data) } } +static void +btintel_pcie_apply_yoyo_config_sets (struct btintel_pcie_data *data, +u32 time_point) +{ +struct btintel_pcie_yoyo_config_set *config_set; +resource_size_t bar0_len; +int ret; +u32 i; + +if (!data) +return ; + +/* Get the length of PCI BAR0 */ + bar0_len =pci_resource_len (data->pdev,0 ); + +if (!data->yoyo.enabled) +return ; + +list_for_each_entry (config_set, &data->yoyo.config_set_list, list) { +u32 pair_addr, addr, value; + +if (config_set->time_point != time_point) +continue ; + +switch (config_set->config_set_type) { +case BTINTEL_PCIE_CFGSET_CSR : +case BTINTEL_PCIE_CFGSET_PERIPH_MAC : +case BTINTEL_PCIE_CFGSET_DEVICE_MEM : +break ; +default : +BT_WARN ("YoYo: unknown/unsupported config_set type %u, skipping" , + config_set->config_set_type); +continue ; + } + +if (config_set->config_set_type ==BTINTEL_PCIE_CFGSET_PERIPH_MAC || + config_set->config_set_type ==BTINTEL_PCIE_CFGSET_DEVICE_MEM ) { + ret =btintel_pcie_get_mac_access (data); +if (ret) { +BT_WARN ("YoYo: MAC access failed for config set (%d), skipping" , + ret); +/* get_mac_access() asserts MAC_ACCESS_REQ before it +* polls, and leaves it set on timeout; drop it so the +* request bit is not leaked. +*/ +btintel_pcie_release_mac_access (data); +continue ; + } + } + +for (i =0 ; i < config_set->num_pairs; i++) { + pair_addr =get_unaligned_le32 (&config_set->pairs[i].address); + +/* Calculate the effective address by adding the address offset */ +if (check_add_overflow (pair_addr, config_set->addr_offset, &addr)) { +BT_WARN ("YoYo: config set address overflow (0x%08x + 0x%08x)" , + pair_addr, config_set->addr_offset); +continue ; + } + + value =get_unaligned_le32 (&config_set->pairs[i].value); + +switch (config_set->config_set_type) { +/* Direct Address Access (CSR) */ +case BTINTEL_PCIE_CFGSET_CSR : +/* Validate the effective address for CSR access (Direct Address) +* addr not aligned to 4 bytes or exceeds the BAR0 length +*/ +if ((addr & (sizeof (u32) -1 )) || + bar0_len <sizeof (u32) || + addr > bar0_len -sizeof (u32)) { +BT_WARN ("YoYo: bad CSR address 0x%08x for BAR0 length %llu" , + addr, (unsigned long long )bar0_len); +continue ; + } + +BT_DBG ("YoYo: CSR write [0x%08x] = 0x%08x" , addr, value); +btintel_pcie_wr_reg32 (data, addr, value); +break ; +/* Indirect Address Access (Peripheral MAC and Device Memory) */ +case BTINTEL_PCIE_CFGSET_PERIPH_MAC : +case BTINTEL_PCIE_CFGSET_DEVICE_MEM : +/* The config-set TLV comes from an untrusted external file; +* reject null or unaligned targets. +*/ +if (!addr || (addr & (sizeof (u32) -1 ))) { +BT_WARN ("YoYo: bad indirect address 0x%08x for type %u" , + addr, config_set->config_set_type); +continue ; + } + +btintel_pcie_wr_reg32 (data, +BTINTEL_PCIE_PRPH_DEV_ADDR_REG , + addr); +btintel_pcie_wr_reg32 (data, +BTINTEL_PCIE_PRPH_DEV_WR_REG , + value); +BT_DBG ("YoYo: indirect write type %u addr 0x%08x value 0x%08x" , + config_set->config_set_type, addr, value); +break ; +default : +BT_WARN ("YoYo: unknown config_set type %u" , + config_set->config_set_type); +break ; + } + } + +if (config_set->config_set_type ==BTINTEL_PCIE_CFGSET_PERIPH_MAC || + config_set->config_set_type ==BTINTEL_PCIE_CFGSET_DEVICE_MEM ) +btintel_pcie_release_mac_access (data); + } +} + +static void btintel_pcie_yoyo_handle_timepoint (struct btintel_pcie_data *data, +enum btintel_pcie_dbg_timepoint tp) +{ +if (!data || !data->yoyo.enabled) +return ; + +if (tp <=BTINTEL_PCIE_TP_INVALID || tp >=BTINTEL_PCIE_TP_MAX_NUM ) { +BT_WARN ("YoYo: invalid timepoint %u" , tp); +return ; + } + +btintel_pcie_apply_yoyo_config_sets (data, tp); +} +static struct scatterlist *btintel_pcie_alloc_sgtable (ssize_t size) {int nents;
@@ -1617,6 +1744,9 @@ static int btintel_pcie_enable_bt(struct btintel_pcie_data *data)BT_INFO ("%s: Mac Init: Wait on Alive Interrupt" ,btintel_pcie_dev_name (data)); +/* EARLY Timepoint Handler */ +btintel_pcie_yoyo_handle_timepoint (data,BTINTEL_PCIE_TP_EARLY ); +btintel_pcie_set_reg_bits (data,BTINTEL_PCIE_CSR_FUNC_CTRL_REG ,BTINTEL_PCIE_CSR_FUNC_CTRL_FUNC_INIT );
@@ -4751,7 +4881,8 @@ static int btintel_pcie_probe(struct pci_dev *pdev,if (data->enable_ini) { err =btintel_pcie_yoyo_load_and_parse (&data->yoyo, &pdev->dev);if (err) { -BT_WARN ("YoYo is not configured (%d)" , err); +BT_WARN ("YoYo (BDF - %s): yoyo is not configured (%d)" , +pci_name (pdev), err);btintel_pcie_yoyo_cleanup (&data->yoyo); } }
@@ -4834,8 +4965,6 @@ static void btintel_pcie_remove(struct pci_dev *pdev)btintel_pcie_synchronize_irqs (data);disable_delayed_work_sync (&data->hw_rfkill_work); -btintel_pcie_yoyo_cleanup (&data->yoyo); -btintel_pcie_disable_interrupts (data);btintel_pcie_synchronize_irqs (data);
@@ -4854,6 +4983,9 @@ static void btintel_pcie_remove(struct pci_dev *pdev)btintel_pcie_release_hdev (data); +/* Cleanup YoYo debug framework */ +btintel_pcie_yoyo_cleanup (&data->yoyo); +destroy_workqueue (data->dump_workqueue);destroy_workqueue (data->workqueue);
drivers/bluetooth/btintel_pcie.h +1 -0
@@ -27,6 +27,7 @@#define BTINTEL_PCIE_CSR_MBOX_4_REG (BTINTEL_PCIE_CSR_BASE + 0x17C)#define BTINTEL_PCIE_CSR_MBOX_STATUS_REG (BTINTEL_PCIE_CSR_BASE + 0x180)#define BTINTEL_PCIE_PRPH_DEV_ADDR_REG (BTINTEL_PCIE_CSR_BASE + 0x440) +#define BTINTEL_PCIE_PRPH_DEV_WR_REG (BTINTEL_PCIE_CSR_BASE + 0x454)#define BTINTEL_PCIE_PRPH_DEV_RD_REG (BTINTEL_PCIE_CSR_BASE + 0x458)#define BTINTEL_PCIE_CSR_HBUS_TARG_WRPTR (BTINTEL_PCIE_CSR_BASE + 0x460)
drivers/bluetooth/btintel_pcie_debug.c +105 -12
182 lines not on this page · raw message
drivers/bluetooth/btintel_pcie_debug.h +72 -4
115 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v3 2/3 Bluetooth: btintel_pcie: Add yoyo configuration for debug region
From: Ajaykv <[email protected]>
Add parsing of the YoYo DEBUG_REGION TLV. A region TLV defines a named, addressable debug region and registers it by region ID; it does not trigger a dump by itself. A later trigger TLV selects regions through a 64-bit region ID mask, and the dump for each selected region is dispatched based on its stored region type.
A region TLV shorter than its fixed layout means the YoYo file is corrupted, so parsing fails and YoYo is disabled. Otherwise, each region TLV is validated for domain, version, region ID and region type. Device memory, peripheral MAC and CSR regions must carry an address list, DRAM buffer regions a valid allocation ID, and device memory, internal buffer and special device memory regions a non-zero, dword-aligned size. An invalid entry is skipped with a warning. Other type-specific parameters are stored as received and checked when the region is dumped. Upper bounds on region size and address count are left to the dump path, which already caps reads at BTINTEL_PCIE_REGION_MAX_SIZE. Valid regions are stored in the region list of the YoYo context, replacing any existing entry with the same region ID, and are freed when the YoYo context is cleaned up.
--- drivers/bluetooth/btintel_pcie_debug.c | 146 +++++++++++++++++++++++++ drivers/bluetooth/btintel_pcie_debug.h | 135 +++++++++++++++++++++++ 2 files changed, 281 insertions(+)
drivers/bluetooth/btintel_pcie_debug.c +146 -0
@@ -504,6 +504,142 @@ static int btintel_pcie_yoyo_parse_config_set(struct btintel_pcie_yoyo_ctx *ctx,return 0 ; } +static int btintel_pcie_yoyo_parse_region (struct btintel_pcie_yoyo_ctx *ctx, +const struct btintel_pcie_tlv_region *tlv, +u32 len) +{ +struct btintel_pcie_yoyo_region *old_region, *region, *tmp; +u32 addr_count =0 , addr_offset =0 , domain, version; +u32 addr_bytes, alloc_id, size; +u16 region_id; + +if (len <sizeof (*tlv) -sizeof (struct btintel_pcie_tlv_hdr )) { +BT_WARN ("YoYo: region tlv is too short or Invalid" ); +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_REGION_TLV_VERSION ) { +BT_WARN ("YoYo: unsupported region domain/version (%u/%u), skipping" , + domain, version); +return 0 ; + } + + region_id =get_unaligned_le16 (&tlv->region_id); +if (region_id >BTINTEL_PCIE_REGION_ID_MAX ) { +BT_WARN ("YoYo: invalid region_id %u, skipping" , region_id); +return 0 ; + } + +if (tlv->region_type <=BTINTEL_PCIE_REGION_INVALID || + tlv->region_type >=BTINTEL_PCIE_REGION_TYPE_MAX ) { +BT_WARN ("YoYo: invalid region type %u, skipping" , tlv->region_type); +return 0 ; + } + +/* Any trailing bytes after the fixed region structure are an address +* list, regardless of region type, mirroring the reference parser. +*/ + addr_offset =sizeof (*tlv) -sizeof (struct btintel_pcie_tlv_hdr ); + addr_bytes = len - addr_offset; +if (addr_bytes %sizeof (__le32)) { +BT_WARN ("YoYo: invalid region addr_bytes length %u" , addr_bytes); +return 0 ; + } + + addr_count = addr_bytes /sizeof (__le32); + +/* Size is checked only where the parser reads it; other types are +* validated by their dump code, as in the reference driver. +*/ + size =sizeof (u32); +switch (tlv->region_type) { +case BTINTEL_PCIE_REGION_DEVICE_MEM : + size =get_unaligned_le32 (&tlv->conf_params.dev_addr.size_bytes); + fallthrough; +case BTINTEL_PCIE_REGION_PERIPH_MAC : +case BTINTEL_PCIE_REGION_CSR : +if (!addr_count) { +BT_WARN ("YoYo: region id=%u type=%u has no addresses, skipping" , + region_id, tlv->region_type); +return 0 ; + } +break ; +case BTINTEL_PCIE_REGION_DRAM_BUF : + alloc_id =get_unaligned_le32 (&tlv->conf_params.dram_alloc_id); +if (alloc_id <BTINTEL_PCIE_ALLOC_ID_DBGC1 || + alloc_id >BTINTEL_PCIE_ALLOC_ID_DBGC3 ) { +BT_WARN ("YoYo: region id=%u invalid dram alloc id %u, skipping" , + region_id, alloc_id); +return 0 ; + } +break ; +case BTINTEL_PCIE_REGION_INTERNAL_BUF : + size =get_unaligned_le32 (&tlv->conf_params.internal_buf.size_bytes); +break ; +case BTINTEL_PCIE_REGION_SPECIAL_DEV_MEM : + size =get_unaligned_le32 (&tlv->conf_params.special_dev_addr.size_bytes); +break ; +default : +break ; + } + +/* Upper bound is applied by the dump path (BTINTEL_PCIE_REGION_MAX_SIZE) */ +if (!size || size %sizeof (u32)) { +BT_WARN ("YoYo: region id=%u type=%u invalid size %u, skipping" , + region_id, tlv->region_type, size); +return 0 ; + } + + region =kzalloc (sizeof (*region),GFP_KERNEL ); +if (!region) +return -ENOMEM ; + + region->region_id = region_id; + region->dump_policy =get_unaligned_le16 (&tlv->region_dump_policy); + region->type = tlv->region_type; + region->sub_type = tlv->region_sub_type; + region->sub_type_ver = tlv->region_sub_type_ver; +/* Fixed 32-byte name from the TLV, not NUL-terminated */ +memcpy (region->name, tlv->region_name,BTINTEL_PCIE_REGION_NAME_LEN ); +memcpy (®ion->conf, &tlv->conf_params,sizeof (region->conf)); + +if (addr_count) { +u32 i; + +/* Root-supplied file; fail quietly instead of WARNing on huge lists */ + region->addrs =kmalloc_array (addr_count,sizeof (*region->addrs), +GFP_KERNEL | __GFP_NOWARN); +if (!region->addrs) { +kfree (region); +return -ENOMEM ; + } + +for (i =0 ; i < addr_count; i++) + region->addrs[i] =get_unaligned_le32 (&tlv->addrs[i]); + } + region->num_addrs = addr_count; + +/* Swap into list if duplicate region_id exists, otherwise append */ +list_for_each_entry_safe (old_region, tmp, &ctx->region_list, list) { +if (old_region->region_id == region_id) { +list_replace (&old_region->list, ®ion->list); +kfree (old_region->addrs); +kfree (old_region); + goto out; + } + } + +list_add_tail (®ion->list, &ctx->region_list); + +out: +BT_DBG ("YoYo: region id=%u type=%u name='%.32s'" , + region->region_id, region->type, region->name); +return 0 ; +} +/* * Parse the optional YoYo firmware TLV stream and validate each record. * This is the entry point for the runtime debug configuration payload.
@@ -548,6 +684,8 @@ static int btintel_pcie_yoyo_parse_tlv_buffer(struct btintel_pcie_yoyo_ctx *ctx, ret =btintel_pcie_yoyo_parse_config_set (ctx, (const void *)tlv, len);break ;case BTINTEL_PCIE_TLV_TYPE_DBG_REGION : + ret =btintel_pcie_yoyo_parse_region (ctx, (const void *)tlv, len); +break ;case BTINTEL_PCIE_TLV_TYPE_DBG_TRIGGER :case BTINTEL_PCIE_TLV_TYPE_DBG_HCMD :case BTINTEL_PCIE_TLV_TYPE_DBG_PRESET_OVERRIDE :
@@ -608,6 +746,7 @@ EXPORT_SYMBOL_GPL(btintel_pcie_yoyo_init);void btintel_pcie_yoyo_cleanup (struct btintel_pcie_yoyo_ctx *ctx) {struct btintel_pcie_yoyo_config_set *config_set, *config_tmp; +struct btintel_pcie_yoyo_region *region, *region_tmp;if (!ctx)return ;
@@ -624,6 +763,13 @@ void btintel_pcie_yoyo_cleanup(struct btintel_pcie_yoyo_ctx *ctx)kfree (config_set->pairs);kfree (config_set); } + +list_for_each_entry_safe (region, region_tmp, &ctx->region_list, list) { +list_del (®ion->list); +kfree (region->addrs); +kfree (region); + } + }EXPORT_SYMBOL_GPL (btintel_pcie_yoyo_cleanup);
drivers/bluetooth/btintel_pcie_debug.h +135 -0
165 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v3 3/3 Bluetooth: btintel_pcie: Add yoyo configuration for Hci cmd Tlvs
In reply to Ajay KVFrom: Ajaykv <[email protected]>
Add parsing of the YoYo HCI command TLV so that HCI commands can be sent to the controller through the external TLV file. Each TLV is validated for domain, version, timepoint and command length. Only the ALIVE timepoint is supported, and periodic commands are skipped with a warning. Valid commands are stored in the HCI command list of the YoYo context and are freed when the YoYo context is cleaned up.
A mutex in the YoYo context serializes HCI command dispatch against btintel_pcie_yoyo_cleanup(). It is held across each __hci_cmd_sync() call and across the cleanup on the probe error path and in btintel_pcie_remove(), so the command list is not freed while a command is being sent. The other YoYo lists are only used during setup and are freed after the HCI device is released.
The stored commands are sent in order at the ALIVE timepoint at the end of setup, once the operational firmware has booted and the alive interrupt and bootup event have been received. This matches the Windows driver: the commands are sent before the HCI init sequence resets the controller, and they are not sent again after that reset. As setup runs only once per HCI registration, the commands are also not repeated on later power-ons.
A command is skipped if its parameter length does not match the TLV payload. Sending stops if the device is halted, in recovery, in D3 or unregistering, or if a command fails because of a timeout, a lost device or an interrupted wait. Other command failures are logged as warnings and do not stop normal Bluetooth bring-up.
--- drivers/bluetooth/btintel_pcie.c | 92 ++++++++++++++++++++++++++ drivers/bluetooth/btintel_pcie_debug.c | 75 ++++++++++++++++++++- drivers/bluetooth/btintel_pcie_debug.h | 36 ++++++++++ 3 files changed, 202 insertions(+), 1 deletion(-)
drivers/bluetooth/btintel_pcie.c +92 -0
@@ -657,6 +657,8 @@ static inline void btintel_pcie_dump_debug_registers(struct hci_dev *hdev)hci_recv_diag (hdev, skb); } +static inline bool btintel_pcie_in_d3 (struct btintel_pcie_data *data); +static int btintel_pcie_send_sync (struct btintel_pcie_data *data,struct sk_buff *skb,u32 pkt_type,u16 opcode) {
@@ -927,6 +929,87 @@ static void btintel_pcie_release_mac_access(struct btintel_pcie_data *data) } } +/* btintel_pcie_yoyo_send_hcmds - Send all HCI commands configured for a timepoint */ +static void btintel_pcie_yoyo_send_hcmds (struct btintel_pcie_data *data, +enum btintel_pcie_dbg_timepoint tp) +{ +struct btintel_pcie_yoyo_hcmd *hcmd; +struct sk_buff *skb; +u8 plen; +u16 opcode; + +if (!data) +return ; + +/* Held across __hci_cmd_sync() so cleanup cannot free entries in use */ +mutex_lock (&data->yoyo.lock); +if (!data->yoyo.enabled || !data->hdev) { +mutex_unlock (&data->yoyo.lock); +return ; + } + +list_for_each_entry (hcmd, &data->yoyo.hcmd_list, list) { +long err; + +if (hcmd->time_point != tp) +continue ; + +/* Stop if device state changed or driver is shutting down */ +if (test_bit (BTINTEL_PCIE_CORE_HALTED , &data->flags) || +test_bit (BTINTEL_PCIE_RECOVERY_IN_PROGRESS , &data->flags) || +btintel_pcie_in_d3 (data) || +hci_dev_test_flag (data->hdev,HCI_UNREGISTER )) +break ; + +if (hcmd->cmd_len <3 ) { +bt_dev_warn (data->hdev,"YoYo: hci command too short (%u bytes)" , + hcmd->cmd_len); +continue ; + } + + opcode =get_unaligned_le16 (hcmd->cmd_data); + plen = hcmd->cmd_data[2 ]; + +if (plen != hcmd->cmd_len -3 ) { +bt_dev_warn (data->hdev, +"YoYo: hci command 0x%04x plen %u does not match tlv payload %u" , + opcode, plen, hcmd->cmd_len -3 ); +continue ; + } + +bt_dev_dbg (data->hdev,"YoYo: sending hci command, opcode=0x%04x len=%u at tp=%u" , + opcode, plen, tp); + + skb =__hci_cmd_sync (data->hdev, opcode, plen, + hcmd->cmd_data +3 , +HCI_CMD_TIMEOUT ); +/* HCI Err 0x11 corresponds to errno -95 (UNSUPPORTED) +* HCI Err 0x12 corresponds to errno -22 (INVAL) +* HCI Err 0x0C corresponds to errno -16 (EBUSY/CMD DISALLOWED) +*/ +if (IS_ERR (skb)) { + err =PTR_ERR (skb); + +/* Command completed with Command Status (0x0F) */ +if (err == -ENODATA ) +continue ; + +bt_dev_warn (data->hdev,"YoYo: hci command 0x%04x failed: %ld" , + opcode, err); +/* Stop on timeout or device loss instead of stacking more timeouts */ +if (err == -ETIMEDOUT || err == -ETIME || + err == -ENODEV || err == -EHOSTDOWN || err == -EINTR ) +break ; + }else { +bt_dev_dbg (data->hdev,"YoYo: hci command 0x%04x completed successfully" , + opcode); +kfree_skb (skb); + } + } + +mutex_unlock (&data->yoyo.lock); +} +static void btintel_pcie_apply_yoyo_config_sets (struct btintel_pcie_data *data,u32 time_point)
@@ -1046,11 +1129,16 @@ static void btintel_pcie_yoyo_handle_timepoint(struct btintel_pcie_data *data,if (!data || !data->yoyo.enabled)return ; +BT_DBG ("YoYo: Handling timepoint %u" , tp); +if (tp <=BTINTEL_PCIE_TP_INVALID || tp >=BTINTEL_PCIE_TP_MAX_NUM ) {BT_WARN ("YoYo: invalid timepoint %u" , tp);return ; } +/* PRE-DUMP phase: send HCMDs and apply config sets */ +btintel_pcie_yoyo_send_hcmds (data, tp); +btintel_pcie_apply_yoyo_config_sets (data, tp); }
@@ -4268,6 +4356,10 @@ static int btintel_pcie_setup(struct hci_dev *hdev)set_bit (BTINTEL_PCIE_HW_RFKILL_STATE_CHECK , &data->flags);btintel_pcie_unmask_hw_rfkill (data);btintel_delayed_hw_rfkill (data, true); + +/* Once per setup, before the HCI init reset, as on Windows */ +btintel_pcie_yoyo_handle_timepoint (data, +BTINTEL_PCIE_TP_AFTER_ALIVE ); }return err; }
drivers/bluetooth/btintel_pcie_debug.c +74 -1
110 lines not on this page · raw message
drivers/bluetooth/btintel_pcie_debug.h +36 -0
@@ -10,6 +10,7 @@#define __BTINTEL_PCIE_DEBUG_H__#include <linux/list.h> +#include <linux/mutex.h> #include <linux/types.h> #include <linux/device.h> #include <linux/firmware.h>
@@ -61,6 +62,7 @@ bool btintel_pcie_fatal_err_testmode_active(struct btintel_pcie_data *data);#define BTINTEL_PCIE_BUF_ALLOC_TLV_VERSION 1#define BTINTEL_PCIE_CONFIG_SET_TLV_VERSION 1#define BTINTEL_PCIE_REGION_TLV_VERSION 3 +#define BTINTEL_PCIE_HCMD_TLV_VERSION 1/* Debug Info TLV */ #define BTINTEL_PCIE_CONFIG_NAME_LEN 64
@@ -330,6 +332,28 @@ struct btintel_pcie_tlv_region {__le32 addrs[]; } __packed; +/* +* struct btintel_pcie_tlv_hcmd - YoYo HCI command TLV +* @hdr: Common TLV type and payload length +* @dbg_hdr: Debug TLV version and domain +* @time_point: Timepoint at which to send the command +* @period_msec: Periodic interval in milliseconds (0 for one-time execution) +* @reserved: Command header (cmd_id, group_id, le16 seq_num); written as zero +* by the tooling and not used by the driver +* @cmd_data: Variable-length raw HCI command packet +* +* Describes an HCI command to dispatch at a specified timepoint. Multi-byte +* fields are stored in little-endian format in the packed firmware TLV. +*/ +struct btintel_pcie_tlv_hcmd { +struct btintel_pcie_tlv_hdr hdr; +struct btintel_pcie_dbg_hdr dbg_hdr; +__le32 time_point; +__le32 period_msec; +u8 reserved[4 ]; +u8 cmd_data[]; +} __packed; +/* Parsed buffer allocation entry in the YoYo context */ struct btintel_pcie_buf_alloc {u32 alloc_id;
@@ -364,6 +388,15 @@ struct btintel_pcie_yoyo_region {union btintel_pcie_region_conf_params conf; }; +/* Parsed HCMD entry */ +struct btintel_pcie_yoyo_hcmd { +struct list_head list; +u32 time_point; +u32 period_msec; +u32 cmd_len; +u8 *cmd_data; +}; +/* * struct btintel_pcie_yoyo_ctx - Runtime state for YoYo debug configuration * @enabled: Whether the loaded YoYo configuration passed validation
@@ -375,6 +408,7 @@ struct btintel_pcie_yoyo_region {* @buf_alloc: Parsed buffer allocation entries * @num_buf_allocs: Number of parsed buffer allocation entries * @hdev: Associated HCI device; NULL until successful HCI registration +* @lock: Serializes HCI command dispatch against YoYo cleanup * * Stores the validation state and parsed TLV data for the optional YoYo * firmware configuration.
@@ -389,6 +423,8 @@ struct btintel_pcie_yoyo_ctx {struct btintel_pcie_buf_alloc buf_alloc[BTINTEL_PCIE_MAX_BUF_ALLOC ];int num_buf_allocs;struct hci_dev *hdev; +/* Serializes HCI command dispatch against YoYo cleanup */ +struct mutex lock; };int btintel_pcie_yoyo_init (struct btintel_pcie_yoyo_ctx *ctx);
Signature · 1 line
2.53.0
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/1208571/
---Test result---
Test Summary:
CheckPatch PASS 3.07 seconds VerifyFixes PASS 0.11 seconds VerifySignedoff PASS 0.11 seconds GitLint PASS 0.81 seconds SubjectPrefix PASS 0.31 seconds BuildKernel PASS 22.43 seconds CheckAllWarning PASS 27.62 seconds CheckSparse PASS 29.24 seconds BuildKernel32 PASS 22.08 seconds CheckKernelLLVM PASS 23.51 seconds TestRunnerSetup PASS 477.08 seconds IncrementalBuild PASS 21.04 seconds
https://github.com/bluez/bluetooth-next/pull/1114
---
Regards,
Linux Bluetooth
This series was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This series was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 8 lines · On Wed, 11 Nov 2026 18:53:30 +0200 you wrote:
From: Ajaykv <[email protected]>
Add parsing of the YoYo
CONFIG_SETTLV so that debug register configuration can be supplied through the external TLV file. EachCONFIG_SETTLV is validated, and its address/value pairs are stored in the config set list of the YoYo context.[...]
Here is the summary with links:
- [v3,1/3] Bluetooth: btintel_pcie: Add yoyo support for config set TLV
https://git.kernel.org/bluetooth/bluetooth-next/c/68e0925f16c0 - [v3,2/3] Bluetooth: btintel_pcie: Add yoyo configuration for debug region https://git.kernel.org/bluetooth/bluetooth-next/c/89ab6c52494c - [v3,3/3] Bluetooth: btintel_pcie: Add yoyo configuration for Hci cmd Tlvs https://git.kernel.org/bluetooth/bluetooth-next/c/50932a1567d6
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html