All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: btqca: sequential validation
@ 2021-12-08  8:26 Sai Teja Aluvala
  2021-12-08 13:27   ` kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Sai Teja Aluvala @ 2021-12-08  8:26 UTC (permalink / raw)
  To: marcel, johan.hedberg
  Cc: mka, linux-kernel, linux-bluetooth, quic_hemantg, linux-arm-msm,
	quic_bgodavar, rjliao, hbandi, abhishekpandit, mcchou,
	quic_pharish, Sai Teja Aluvala

This change will have sequential validation support
& patch config command is added

Signed-off-by: Sai Teja Aluvala <quic_saluvala@quicinc.com>
---
 drivers/bluetooth/btqca.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/bluetooth/btqca.h |  3 +++
 2 files changed, 48 insertions(+)

diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index be04d74..9a2fd17 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -141,6 +141,49 @@ static int qca_read_fw_build_info(struct hci_dev *hdev)
 	return err;
 }
 
+int qca_send_patch_config_cmd(struct hci_dev *hdev, enum qca_btsoc_type soc_type)
+{
+	struct sk_buff *skb;
+	int err = 0;
+	u8 cmd[5] = {EDL_PATCH_CONFIG_CMD, 0x01, 0, 0, 0};
+	u8 rlen = 0x02;
+	struct edl_event_hdr *edl;
+	u8 rtype = EDL_PATCH_CONFIG_CMD;
+
+	bt_dev_dbg(hdev, "QCA Patch config");
+
+	skb = __hci_cmd_sync_ev(hdev, EDL_PATCH_CMD_OPCODE, EDL_PATCH_CONFIG_CMD_LEN,
+			cmd, HCI_EV_VENDOR, HCI_INIT_TIMEOUT);
+	if (IS_ERR(skb)) {
+		err = PTR_ERR(skb);
+		bt_dev_err(hdev, "Sending QCA Patch config failed (%d)", err);
+		return err;
+	}
+	if (skb->len != rlen) {
+		bt_dev_err(hdev, "QCA Patch config cmd size mismatch len %d", skb->len);
+		err = -EILSEQ;
+		goto out;
+	}
+	edl = (struct edl_event_hdr *)(skb->data);
+	if (!edl) {
+		bt_dev_err(hdev, "QCA Patch config with no header");
+		err = -EILSEQ;
+		goto out;
+	}
+	if (edl->cresp != EDL_PATCH_CONFIG_RES_EVT || edl->rtype != rtype) {
+		bt_dev_err(hdev, "QCA Wrong packet received %d %d", edl->cresp,
+		 edl->rtype);
+		err = -EIO;
+		goto out;
+	}
+out:
+	kfree(skb);
+	if (err)
+		bt_dev_err(hdev, "QCA Patch config cmd failed (%d)", err);
+
+	return err;
+}
+
 static int qca_send_reset(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
@@ -551,6 +594,8 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
 	 */
 	rom_ver = ((soc_ver & 0x00000f00) >> 0x04) | (soc_ver & 0x0000000f);
 
+	if (soc_type == QCA_WCN6750)
+		qca_send_patch_config_cmd(hdev, soc_type);
 	/* Download rampatch file */
 	config.type = TLV_TYPE_PATCH;
 	if (qca_is_wcn399x(soc_type)) {
diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
index 30afa77..8fbb4c7 100644
--- a/drivers/bluetooth/btqca.h
+++ b/drivers/bluetooth/btqca.h
@@ -13,6 +13,8 @@
 #define EDL_PATCH_TLV_REQ_CMD		(0x1E)
 #define EDL_GET_BUILD_INFO_CMD		(0x20)
 #define EDL_NVM_ACCESS_SET_REQ_CMD	(0x01)
+#define EDL_PATCH_CONFIG_CMD_LEN	(0x05)
+#define EDL_PATCH_CONFIG_CMD		(0x28)
 #define MAX_SIZE_PER_TLV_SEGMENT	(243)
 #define QCA_PRE_SHUTDOWN_CMD		(0xFC08)
 #define QCA_DISABLE_LOGGING		(0xFC17)
@@ -24,6 +26,7 @@
 #define EDL_CMD_EXE_STATUS_EVT		(0x00)
 #define EDL_SET_BAUDRATE_RSP_EVT	(0x92)
 #define EDL_NVM_ACCESS_CODE_EVT		(0x0B)
+#define EDL_PATCH_CONFIG_RES_EVT	(0x00)
 #define QCA_DISABLE_LOGGING_SUB_OP	(0x14)
 
 #define EDL_TAG_ID_HCI			(17)
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc.


^ permalink raw reply related	[flat|nested] 10+ messages in thread
* Re: [PATCH] Bluetooth: btqca: sequential validation
  2021-12-08  8:26 [PATCH] Bluetooth: btqca: sequential validation Sai Teja Aluvala
  2021-12-08 13:27   ` kernel test robot
@ 2021-12-09 13:30 ` Dan Carpenter
  2021-12-08 14:48 ` Marcel Holtmann
  2 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2021-12-08 19:38 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
In-Reply-To: <1638952007-32222-1-git-send-email-quic_saluvala@quicinc.com>
References: <1638952007-32222-1-git-send-email-quic_saluvala@quicinc.com>
TO: Sai Teja Aluvala <quic_saluvala@quicinc.com>
TO: marcel(a)holtmann.org
TO: johan.hedberg(a)gmail.com
CC: mka(a)chromium.org
CC: linux-kernel(a)vger.kernel.org
CC: linux-bluetooth(a)vger.kernel.org
CC: quic_hemantg(a)quicinc.com
CC: linux-arm-msm(a)vger.kernel.org
CC: quic_bgodavar(a)quicinc.com
CC: rjliao(a)codeaurora.org
CC: hbandi(a)codeaurora.org

Hi Sai,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on linux/master linus/master v5.16-rc4 next-20211208]
[cannot apply to bluetooth/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Sai-Teja-Aluvala/Bluetooth-btqca-sequential-validation/20211208-162834
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
:::::: branch date: 11 hours ago
:::::: commit date: 11 hours ago
config: arc-randconfig-m031-20211207 (https://download.01.org/0day-ci/archive/20211209/202112090340.ohuHwTLx-lkp(a)intel.com/config)
compiler: arceb-elf-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/bluetooth/btqca.c:180 qca_send_patch_config_cmd() error: use kfree_skb() here instead of kfree(skb)

Old smatch warnings:
drivers/bluetooth/btqca.c:134 qca_read_fw_build_info() warn: potential spectre issue 'build_label' [w] (local cap)

vim +180 drivers/bluetooth/btqca.c

c0187b0bd3e94c Venkata Lakshmi Narayana Gubba 2020-12-08  143  
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  144  int qca_send_patch_config_cmd(struct hci_dev *hdev, enum qca_btsoc_type soc_type)
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  145  {
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  146  	struct sk_buff *skb;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  147  	int err = 0;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  148  	u8 cmd[5] = {EDL_PATCH_CONFIG_CMD, 0x01, 0, 0, 0};
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  149  	u8 rlen = 0x02;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  150  	struct edl_event_hdr *edl;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  151  	u8 rtype = EDL_PATCH_CONFIG_CMD;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  152  
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  153  	bt_dev_dbg(hdev, "QCA Patch config");
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  154  
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  155  	skb = __hci_cmd_sync_ev(hdev, EDL_PATCH_CMD_OPCODE, EDL_PATCH_CONFIG_CMD_LEN,
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  156  			cmd, HCI_EV_VENDOR, HCI_INIT_TIMEOUT);
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  157  	if (IS_ERR(skb)) {
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  158  		err = PTR_ERR(skb);
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  159  		bt_dev_err(hdev, "Sending QCA Patch config failed (%d)", err);
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  160  		return err;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  161  	}
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  162  	if (skb->len != rlen) {
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  163  		bt_dev_err(hdev, "QCA Patch config cmd size mismatch len %d", skb->len);
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  164  		err = -EILSEQ;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  165  		goto out;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  166  	}
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  167  	edl = (struct edl_event_hdr *)(skb->data);
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  168  	if (!edl) {
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  169  		bt_dev_err(hdev, "QCA Patch config with no header");
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  170  		err = -EILSEQ;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  171  		goto out;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  172  	}
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  173  	if (edl->cresp != EDL_PATCH_CONFIG_RES_EVT || edl->rtype != rtype) {
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  174  		bt_dev_err(hdev, "QCA Wrong packet received %d %d", edl->cresp,
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  175  		 edl->rtype);
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  176  		err = -EIO;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  177  		goto out;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  178  	}
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  179  out:
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08 @180  	kfree(skb);
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  181  	if (err)
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  182  		bt_dev_err(hdev, "QCA Patch config cmd failed (%d)", err);
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  183  
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  184  	return err;
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  185  }
1d58d86c5374c4 Sai Teja Aluvala               2021-12-08  186  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

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

end of thread, other threads:[~2021-12-09 13:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-08  8:26 [PATCH] Bluetooth: btqca: sequential validation Sai Teja Aluvala
2021-12-08 13:27 ` kernel test robot
2021-12-08 13:27   ` kernel test robot
2021-12-08 13:50 ` kernel test robot
2021-12-08 13:50   ` kernel test robot
2021-12-08 14:48 ` Marcel Holtmann
2021-12-09  5:23   ` Sai Teja Aluvala (Temp) (QUIC)
2021-12-08 19:38 kernel test robot
2021-12-09 13:30 ` [kbuild] " Dan Carpenter
2021-12-09 13:30 ` Dan Carpenter

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.