From bcc5c13c0af3855b949c00832baf43f36486197f Mon Sep 17 00:00:00 2001 From: Asutosh Das Date: Fri, 25 Sep 2020 16:08:15 -0700 Subject: [PATCH 1/2] scsi: ufs-qcom: Add sysfs for a debug state This sysfs entry provides the state of the driver. If it's in debug/perf state. This can be used by user-space scripts to toggle various tracing. Change-Id: If0e3d8e032f60c9134bdd5ce27fe37687e67770a Signed-off-by: Asutosh Das --- drivers/scsi/ufs/Kconfig | 11 +++++++++++ drivers/scsi/ufs/ufs-qcom.c | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig index aa2d16e2050a..f25d1491a4d4 100644 --- a/drivers/scsi/ufs/Kconfig +++ b/drivers/scsi/ufs/Kconfig @@ -68,6 +68,17 @@ config SCSI_UFSHCD_QTI However, do not compile this as a module if your root file system (the one containing the directory /) is located on a UFS device. +config UFS_DBG + bool "Universal Flash Storage Debug Mode" + depends on (SCSI_UFSHCD || SCSI_UFSHCD_QTI) + help + This selects the debug mode for ufs vendor driver. + Enables tracing for QTI ufs driver. + This also enables ftrace for ufs core and SCSI. + Enabling this would have an adverse performance impact on disk IO. + + If unsure, say N. + config SCSI_UFSHCD_PCI tristate "PCI bus based UFS Controller support" depends on SCSI_UFSHCD && PCI diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index d830784c5fa8..e5bf2e8d2605 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -3593,12 +3593,28 @@ static ssize_t err_count_show(struct device *dev, static DEVICE_ATTR_RO(err_count); +static ssize_t dbg_state_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + int dbg_en = 0; + +#if defined(CONFIG_UFS_DBG) + dbg_en = 1; +#endif + + return scnprintf(buf, PAGE_SIZE, "%d\n", dbg_en); +} + + +static DEVICE_ATTR_RO(dbg_state); + static struct attribute *ufs_qcom_sysfs_attrs[] = { &dev_attr_err_state.attr, &dev_attr_power_mode.attr, &dev_attr_bus_speed_mode.attr, &dev_attr_clk_status.attr, &dev_attr_err_count.attr, + &dev_attr_dbg_state.attr, NULL }; From 3232ccee03fc8e0661b93107cbed2b27c10e38fd Mon Sep 17 00:00:00 2001 From: Asutosh Das Date: Wed, 30 Sep 2020 17:12:06 -0700 Subject: [PATCH 2/2] defconfig: Enable CONFIG_UFS_DBG for general builds Enables ufs debug feature for general/debug builds. Disables this feature for perf builds. Change-Id: I2b30c8081d24db7871c277c67631d92fc7d9ea60 Signed-off-by: Asutosh Das --- arch/arm64/configs/vendor/lahaina_QGKI.config | 1 + arch/arm64/configs/vendor/lahaina_consolidate.config | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/arm64/configs/vendor/lahaina_QGKI.config b/arch/arm64/configs/vendor/lahaina_QGKI.config index 139ab593d035..a6a2d42f7f88 100644 --- a/arch/arm64/configs/vendor/lahaina_QGKI.config +++ b/arch/arm64/configs/vendor/lahaina_QGKI.config @@ -56,6 +56,7 @@ CONFIG_LIMIT_MOVABLE_ZONE_ALLOC=y CONFIG_MSM_BT_POWER=m CONFIG_I2C_RTC6226_QCA=m CONFIG_SCSI_UFSHCD_QTI=y +# CONFIG_UFS_DBG is not set CONFIG_SCSI_UFS_BSG=y CONFIG_MSM_EXT_DISPLAY=y CONFIG_SCSI_UFSHCD=y diff --git a/arch/arm64/configs/vendor/lahaina_consolidate.config b/arch/arm64/configs/vendor/lahaina_consolidate.config index dfc679287b80..ad2c1315e2e7 100644 --- a/arch/arm64/configs/vendor/lahaina_consolidate.config +++ b/arch/arm64/configs/vendor/lahaina_consolidate.config @@ -58,3 +58,4 @@ CONFIG_QCOM_IRQ_STAT=y CONFIG_QCOM_INITIAL_LOGBUF=y CONFIG_QCOM_DYN_MINIDUMP_STACK=y CONFIG_QCOM_MINIDUMP_PANIC_CPU_CONTEXT=y +CONFIG_UFS_DBG=y