linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/2] Bluetooth: hci_qca: Add qcomm devcoredump sysfs support
@ 2023-04-28  7:16 Sai Teja Aluvala
  2023-04-28 19:36 ` kernel test robot
  0 siblings, 1 reply; 3+ messages in thread
From: Sai Teja Aluvala @ 2023-04-28  7:16 UTC (permalink / raw)
  To: marcel, johan.hedberg
  Cc: linux-kernel, linux-bluetooth, quic_hemantg, quic_bgodavar,
	quic_rameshn, jiangzp, mmandlik, Sai Teja Aluvala

This patch implements the hci_qca driver side .coredump() callback to
trigger a devcoredump via sysfs and .enable_coredump() callback to
check if the devcoredump functionality is enabled for a device.

Signed-off-by: Sai Teja Aluvala <quic_saluvala@quicinc.com>
Reviewed-by: Manish Mandlik <mmandlik@google.com>

---
 drivers/bluetooth/hci_qca.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 1b06450..e21180d 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1702,6 +1702,15 @@ static int qca_power_on(struct hci_dev *hdev)
 	return ret;
 }
 
+#ifdef CONFIG_DEV_COREDUMP
+static bool hciqca_coredump_enabled(struct hci_dev *hdev)
+{
+	struct hci_uart *hu = hci_get_drvdata(hdev);
+
+	return !hu->serdev->dev.coredump_disabled;
+}
+#endif
+
 static int qca_setup(struct hci_uart *hu)
 {
 	struct hci_dev *hdev = hu->hdev;
@@ -1780,6 +1789,9 @@ static int qca_setup(struct hci_uart *hu)
 		qca_debugfs_init(hdev);
 		hu->hdev->hw_error = qca_hw_error;
 		hu->hdev->cmd_timeout = qca_cmd_timeout;
+#ifdef CONFIG_DEV_COREDUMP
+		hu->hdev->dump.enabled = hciqca_coredump_enabled;
+#endif
 		if (device_can_wakeup(hu->serdev->ctrl->dev.parent))
 			hu->hdev->wakeup = qca_wakeup;
 	} else if (ret == -ENOENT) {
@@ -2380,6 +2392,18 @@ static const struct acpi_device_id qca_bluetooth_acpi_match[] = {
 MODULE_DEVICE_TABLE(acpi, qca_bluetooth_acpi_match);
 #endif
 
+#ifdef CONFIG_DEV_COREDUMP
+static void hciqca_coredump(struct device *dev)
+{
+	struct serdev_device *serdev = to_serdev_device(dev);
+	struct qca_serdev *qcadev = serdev_device_get_drvdata(serdev);
+	struct hci_uart *hu = &qcadev->serdev_hu;
+	struct hci_dev  *hdev = hu->hdev;
+
+	if (!dev->coredump_disabled && hdev->dump.coredump)
+		hdev->dump.coredump(hdev);
+}
+#endif
 
 static struct serdev_device_driver qca_serdev_driver = {
 	.probe = qca_serdev_probe,
@@ -2390,6 +2414,9 @@ static struct serdev_device_driver qca_serdev_driver = {
 		.acpi_match_table = ACPI_PTR(qca_bluetooth_acpi_match),
 		.shutdown = qca_serdev_shutdown,
 		.pm = &qca_pm_ops,
+#ifdef CONFIG_DEV_COREDUMP
+		.coredump = hciqca_coredump,
+#endif
 	},
 };
 
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc.


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

* Re: [PATCH v1 1/2] Bluetooth: hci_qca: Add qcomm devcoredump sysfs support
  2023-04-28  7:16 [PATCH v1 1/2] Bluetooth: hci_qca: Add qcomm devcoredump sysfs support Sai Teja Aluvala
@ 2023-04-28 19:36 ` kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2023-04-28 19:36 UTC (permalink / raw)
  To: Sai Teja Aluvala, marcel, johan.hedberg
  Cc: oe-kbuild-all, linux-kernel, linux-bluetooth, quic_hemantg,
	quic_bgodavar, quic_rameshn, jiangzp, mmandlik, Sai Teja Aluvala

Hi Sai,

kernel test robot noticed the following build errors:

[auto build test ERROR on bluetooth/master]
[also build test ERROR on bluetooth-next/master linus/master v6.3 next-20230427]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Sai-Teja-Aluvala/Bluetooth-hci_qca-Add-qcomm-devcoredump-support/20230428-152145
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master
patch link:    https://lore.kernel.org/r/1682666213-7973-1-git-send-email-quic_saluvala%40quicinc.com
patch subject: [PATCH v1 1/2] Bluetooth: hci_qca: Add qcomm devcoredump sysfs support
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20230429/202304290337.5apzPPgA-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/14f992843ff24a60f1eab6bb1024679f5f0aafae
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Sai-Teja-Aluvala/Bluetooth-hci_qca-Add-qcomm-devcoredump-support/20230428-152145
        git checkout 14f992843ff24a60f1eab6bb1024679f5f0aafae
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304290337.5apzPPgA-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/bluetooth/hci_qca.c: In function 'hciqca_coredump_enabled':
>> drivers/bluetooth/hci_qca.c:1705:32: error: 'struct device' has no member named 'coredump_disabled'
    1705 |         return !hu->serdev->dev.coredump_disabled;
         |                                ^
   drivers/bluetooth/hci_qca.c: In function 'qca_setup':
>> drivers/bluetooth/hci_qca.c:1785:25: error: 'struct hci_dev' has no member named 'dump'
    1785 |                 hu->hdev->dump.enabled = hciqca_coredump_enabled;
         |                         ^~
   drivers/bluetooth/hci_qca.c: In function 'hciqca_coredump':
   drivers/bluetooth/hci_qca.c:2374:17: error: 'struct device' has no member named 'coredump_disabled'
    2374 |         if (!dev->coredump_disabled && hdev->dump.coredump)
         |                 ^~
   drivers/bluetooth/hci_qca.c:2374:44: error: 'struct hci_dev' has no member named 'dump'
    2374 |         if (!dev->coredump_disabled && hdev->dump.coredump)
         |                                            ^~
   drivers/bluetooth/hci_qca.c:2375:21: error: 'struct hci_dev' has no member named 'dump'
    2375 |                 hdev->dump.coredump(hdev);
         |                     ^~


vim +1705 drivers/bluetooth/hci_qca.c

  1699	
  1700	#ifdef CONFIG_DEV_COREDUMP
  1701	static bool hciqca_coredump_enabled(struct hci_dev *hdev)
  1702	{
  1703		struct hci_uart *hu = hci_get_drvdata(hdev);
  1704	
> 1705		return !hu->serdev->dev.coredump_disabled;
  1706	}
  1707	#endif
  1708	
  1709	static int qca_setup(struct hci_uart *hu)
  1710	{
  1711		struct hci_dev *hdev = hu->hdev;
  1712		struct qca_data *qca = hu->priv;
  1713		unsigned int speed, qca_baudrate = QCA_BAUDRATE_115200;
  1714		unsigned int retries = 0;
  1715		enum qca_btsoc_type soc_type = qca_soc_type(hu);
  1716		const char *firmware_name = qca_get_firmware_name(hu);
  1717		int ret;
  1718		struct qca_btsoc_version ver;
  1719	
  1720		ret = qca_check_speeds(hu);
  1721		if (ret)
  1722			return ret;
  1723	
  1724		clear_bit(QCA_ROM_FW, &qca->flags);
  1725		/* Patch downloading has to be done without IBS mode */
  1726		set_bit(QCA_IBS_DISABLED, &qca->flags);
  1727	
  1728		/* Enable controller to do both LE scan and BR/EDR inquiry
  1729		 * simultaneously.
  1730		 */
  1731		set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
  1732	
  1733		bt_dev_info(hdev, "setting up %s",
  1734			qca_is_wcn399x(soc_type) ? "wcn399x" :
  1735			(soc_type == QCA_WCN6750) ? "wcn6750" : "ROME/QCA6390");
  1736	
  1737		qca->memdump_state = QCA_MEMDUMP_IDLE;
  1738	
  1739	retry:
  1740		ret = qca_power_on(hdev);
  1741		if (ret)
  1742			goto out;
  1743	
  1744		clear_bit(QCA_SSR_TRIGGERED, &qca->flags);
  1745	
  1746		if (qca_is_wcn399x(soc_type) ||
  1747		    qca_is_wcn6750(soc_type)) {
  1748			set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
  1749			hci_set_aosp_capable(hdev);
  1750	
  1751			ret = qca_read_soc_version(hdev, &ver, soc_type);
  1752			if (ret)
  1753				goto out;
  1754		} else {
  1755			qca_set_speed(hu, QCA_INIT_SPEED);
  1756		}
  1757	
  1758		/* Setup user speed if needed */
  1759		speed = qca_get_speed(hu, QCA_OPER_SPEED);
  1760		if (speed) {
  1761			ret = qca_set_speed(hu, QCA_OPER_SPEED);
  1762			if (ret)
  1763				goto out;
  1764	
  1765			qca_baudrate = qca_get_baudrate_value(speed);
  1766		}
  1767	
  1768		if (!(qca_is_wcn399x(soc_type) ||
  1769		     qca_is_wcn6750(soc_type))) {
  1770			/* Get QCA version information */
  1771			ret = qca_read_soc_version(hdev, &ver, soc_type);
  1772			if (ret)
  1773				goto out;
  1774		}
  1775	
  1776		/* Setup patch / NVM configurations */
  1777		ret = qca_uart_setup(hdev, qca_baudrate, soc_type, ver,
  1778				firmware_name);
  1779		if (!ret) {
  1780			clear_bit(QCA_IBS_DISABLED, &qca->flags);
  1781			qca_debugfs_init(hdev);
  1782			hu->hdev->hw_error = qca_hw_error;
  1783			hu->hdev->cmd_timeout = qca_cmd_timeout;
  1784	#ifdef CONFIG_DEV_COREDUMP
> 1785			hu->hdev->dump.enabled = hciqca_coredump_enabled;
  1786	#endif
  1787			if (device_can_wakeup(hu->serdev->ctrl->dev.parent))
  1788				hu->hdev->wakeup = qca_wakeup;
  1789		} else if (ret == -ENOENT) {
  1790			/* No patch/nvm-config found, run with original fw/config */
  1791			set_bit(QCA_ROM_FW, &qca->flags);
  1792			ret = 0;
  1793		} else if (ret == -EAGAIN) {
  1794			/*
  1795			 * Userspace firmware loader will return -EAGAIN in case no
  1796			 * patch/nvm-config is found, so run with original fw/config.
  1797			 */
  1798			set_bit(QCA_ROM_FW, &qca->flags);
  1799			ret = 0;
  1800		}
  1801	
  1802	out:
  1803		if (ret && retries < MAX_INIT_RETRIES) {
  1804			bt_dev_warn(hdev, "Retry BT power ON:%d", retries);
  1805			qca_power_shutdown(hu);
  1806			if (hu->serdev) {
  1807				serdev_device_close(hu->serdev);
  1808				ret = serdev_device_open(hu->serdev);
  1809				if (ret) {
  1810					bt_dev_err(hdev, "failed to open port");
  1811					return ret;
  1812				}
  1813			}
  1814			retries++;
  1815			goto retry;
  1816		}
  1817	
  1818		/* Setup bdaddr */
  1819		if (soc_type == QCA_ROME)
  1820			hu->hdev->set_bdaddr = qca_set_bdaddr_rome;
  1821		else
  1822			hu->hdev->set_bdaddr = qca_set_bdaddr;
  1823	
  1824		return ret;
  1825	}
  1826	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

* [PATCH v1 1/2] Bluetooth: hci_qca: Add qcomm devcoredump sysfs support
@ 2023-05-01 12:00 Sai Teja Aluvala
  0 siblings, 0 replies; 3+ messages in thread
From: Sai Teja Aluvala @ 2023-05-01 12:00 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz
  Cc: linux-kernel, linux-bluetooth, quic_hemantg, quic_bgodavar,
	jiangzp, mmandlik, Sai Teja Aluvala

This patch implements the hci_qca driver side .coredump() callback to
trigger a devcoredump via sysfs

Signed-off-by: Sai Teja Aluvala <quic_saluvala@quicinc.com>
Reviewed-by: Manish Mandlik <mmandlik@google.com>
v1:Initial Patch
---
 drivers/bluetooth/hci_qca.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 1b06450..ca98f6d 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -2380,6 +2380,18 @@ static const struct acpi_device_id qca_bluetooth_acpi_match[] = {
 MODULE_DEVICE_TABLE(acpi, qca_bluetooth_acpi_match);
 #endif
 
+#ifdef CONFIG_DEV_COREDUMP
+static void hciqca_coredump(struct device *dev)
+{
+	struct serdev_device *serdev = to_serdev_device(dev);
+	struct qca_serdev *qcadev = serdev_device_get_drvdata(serdev);
+	struct hci_uart *hu = &qcadev->serdev_hu;
+	struct hci_dev  *hdev = hu->hdev;
+
+	if (hdev->dump.coredump)
+		hdev->dump.coredump(hdev);
+}
+#endif
 
 static struct serdev_device_driver qca_serdev_driver = {
 	.probe = qca_serdev_probe,
@@ -2390,6 +2402,9 @@ static struct serdev_device_driver qca_serdev_driver = {
 		.acpi_match_table = ACPI_PTR(qca_bluetooth_acpi_match),
 		.shutdown = qca_serdev_shutdown,
 		.pm = &qca_pm_ops,
+#ifdef CONFIG_DEV_COREDUMP
+		.coredump = hciqca_coredump,
+#endif
 	},
 };
 
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc.


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

end of thread, other threads:[~2023-05-01 12:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-28  7:16 [PATCH v1 1/2] Bluetooth: hci_qca: Add qcomm devcoredump sysfs support Sai Teja Aluvala
2023-04-28 19:36 ` kernel test robot
2023-05-01 12:00 Sai Teja Aluvala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).