linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V6] scsi: ufs: Add configfs support for UFS provisioning
       [not found] <1531734237-27421-1-git-send-email-sayalil@codeaurora.org>
@ 2018-07-16  9:43 ` Sayali Lokhande
  2018-07-16 14:02   ` Bart Van Assche
                     ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Sayali Lokhande @ 2018-07-16  9:43 UTC (permalink / raw)
  To: subhashj, cang, vivek.gautam, rnayak, vinholikatti, jejb,
	martin.petersen, asutoshd, evgreen, riteshh
  Cc: linux-scsi, Sayali Lokhande, open list

This patch adds configfs support to provision UFS device at
runtime. This feature can be primarily useful in factory or
assembly line as some devices may be required to be configured
multiple times during initial system development phase.
Configuration Descriptors can be written multiple times until
bConfigDescrLock attribute is zero.

Configuration descriptor buffer consists of Device and Unit
descriptor configurable parameters which are parsed from vendor
specific provisioning file and then passed via configfs node at
runtime to provision ufs device.
CONFIG_CONFIGFS_FS needs to be enabled for using this feature.

Usage:
1) To read current configuration descriptor :
   cat /config/XXXX.ufshc/ufs_provision
2) To provision ufs device:
   echo <config_desc_buf> > /config/XXXX.ufshc/ufs_provision

Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
---
 Documentation/ABI/testing/configfs-driver-ufs |  18 +++
 drivers/scsi/ufs/Kconfig                      |  10 ++
 drivers/scsi/ufs/Makefile                     |   1 +
 drivers/scsi/ufs/ufs-configfs.c               | 162 ++++++++++++++++++++++++++
 drivers/scsi/ufs/ufshcd.c                     |   2 +
 drivers/scsi/ufs/ufshcd.h                     |  19 +++
 6 files changed, 212 insertions(+)
 create mode 100644 Documentation/ABI/testing/configfs-driver-ufs
 create mode 100644 drivers/scsi/ufs/ufs-configfs.c

diff --git a/Documentation/ABI/testing/configfs-driver-ufs b/Documentation/ABI/testing/configfs-driver-ufs
new file mode 100644
index 0000000..eeee499c
--- /dev/null
+++ b/Documentation/ABI/testing/configfs-driver-ufs
@@ -0,0 +1,18 @@
+What:		/config/ufshcd/ufs_provision
+Date:		Jun 2018
+KernelVersion:	4.14
+Description:
+		This file shows the current ufs configuration descriptor set in device.
+		This can be used to provision ufs device if bConfigDescrLock is 0.
+		For more details, refer 14.1.6.3 Configuration Descriptor and
+		Table 14-12 - Unit Descriptor configurable parameters from specs for
+		description of each configuration descriptor parameter.
+		Configuration descriptor buffer needs to be passed in space separated
+		format specificied as below:
+		echo <bLength> <bDescriptorIDN> <bConfDescContinue> <bBootEnable>
+		<bDescrAccessEn> <bInitPowerMode> <bHighPriorityLUN>
+		<bSecureRemovalType> <bInitActiveICCLevel> <wPeriodicRTCUpdate>
+		<0Bh:0Fh_ReservedAs_0> <bLUEnable> <bBootLunID> <bLUWriteProtect>
+		<bMemoryType> <dNumAllocUnits> <bDataReliability> <bLogicalBlockSize>
+		<bProvisioningType> <wContextCapabilities> <0Dh:0Fh_ReservedAs_0>
+		> /config/XXXX.ufshc/ufs_provision
diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig
index e27b4d4..34d89c2 100644
--- a/drivers/scsi/ufs/Kconfig
+++ b/drivers/scsi/ufs/Kconfig
@@ -100,3 +100,13 @@ config SCSI_UFS_QCOM
 
 	  Select this if you have UFS controller on QCOM chipset.
 	  If unsure, say N.
+
+config UFS_PROVISION
+	tristate "Runtime UFS Provisioning support"
+	depends on SCSI_UFSHCD_PLATFORM && CONFIGFS_FS
+	help
+	  This enables runtime UFS provisioning support. This can be used
+	  primarily during assembly line as some devices may be required to
+	  be configured multiple times during initial development phase.
+
+	  If unsure, say N.
diff --git a/drivers/scsi/ufs/Makefile b/drivers/scsi/ufs/Makefile
index 918f579..00110ea 100644
--- a/drivers/scsi/ufs/Makefile
+++ b/drivers/scsi/ufs/Makefile
@@ -5,5 +5,6 @@ obj-$(CONFIG_SCSI_UFS_DWC_TC_PLATFORM) += tc-dwc-g210-pltfrm.o ufshcd-dwc.o tc-d
 obj-$(CONFIG_SCSI_UFS_QCOM) += ufs-qcom.o
 obj-$(CONFIG_SCSI_UFSHCD) += ufshcd-core.o
 ufshcd-core-objs := ufshcd.o ufs-sysfs.o
+obj-$(CONFIG_UFS_PROVISION) += ufs-configfs.o
 obj-$(CONFIG_SCSI_UFSHCD_PCI) += ufshcd-pci.o
 obj-$(CONFIG_SCSI_UFSHCD_PLATFORM) += ufshcd-pltfrm.o
diff --git a/drivers/scsi/ufs/ufs-configfs.c b/drivers/scsi/ufs/ufs-configfs.c
new file mode 100644
index 0000000..3e9837a
--- /dev/null
+++ b/drivers/scsi/ufs/ufs-configfs.c
@@ -0,0 +1,162 @@
+// SPDX-License-Identifier: GPL-2.0+
+// Copyright (c) 2018, Linux Foundation.
+
+#include <linux/configfs.h>
+#include <linux/err.h>
+#include <linux/string.h>
+
+#include "ufs.h"
+#include "ufshcd.h"
+
+static inline struct ufs_hba *config_item_to_hba(struct config_item *item)
+{
+	struct config_group *group = to_config_group(item);
+	struct configfs_subsystem *subsys = to_configfs_subsystem(group);
+	struct ufs_hba *hba = container_of(subsys, struct ufs_hba, subsys);
+
+	return hba ? hba : NULL;
+}
+
+static ssize_t ufs_provision_show(struct config_item *item, char *buf)
+{
+	u8 desc_buf[QUERY_DESC_CONFIGURATION_DEF_SIZE] = {0};
+	int buff_len = QUERY_DESC_CONFIGURATION_DEF_SIZE;
+	int i, ret, curr_len = 0;
+	struct ufs_hba *hba = config_item_to_hba(item);
+
+	if (!hba)
+		return snprintf(buf, PAGE_SIZE, "ufs hba is NULL!\n");
+
+	ret = ufshcd_query_descriptor_retry(hba, UPIU_QUERY_OPCODE_READ_DESC,
+		QUERY_DESC_IDN_CONFIGURATION, 0, 0, desc_buf, &buff_len);
+
+	if (ret)
+		return snprintf(buf, PAGE_SIZE,
+		"Failed reading descriptor. desc_idn %d, opcode %x ret %d\n",
+		QUERY_DESC_IDN_CONFIGURATION,
+		UPIU_QUERY_OPCODE_READ_DESC, ret);
+
+	for (i = 0; i < buff_len; i++)
+		curr_len += snprintf((buf + curr_len), (PAGE_SIZE - curr_len),
+				"0x%x ", desc_buf[i]);
+
+	return curr_len;
+}
+
+ssize_t ufshcd_desc_configfs_store(struct ufs_hba *hba,
+		const char *buf, size_t count)
+{
+	char *strbuf;
+	char *strbuf_copy;
+	u8 desc_buf[QUERY_DESC_CONFIGURATION_DEF_SIZE] = {0};
+	int buff_len = QUERY_DESC_CONFIGURATION_DEF_SIZE;
+	char *token;
+	int i, ret, value;
+	u32 bConfigDescrLock = 0;
+
+	/* reserve one byte for null termination */
+	strbuf = kmalloc(count + 1, GFP_KERNEL);
+	if (!strbuf)
+		return -ENOMEM;
+
+	strbuf_copy = strbuf;
+	strlcpy(strbuf, buf, count + 1);
+
+	if (!hba)
+		goto out;
+
+	/* Just return if bConfigDescrLock is already set */
+	ret = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR,
+		QUERY_ATTR_IDN_CONF_DESC_LOCK, 0, 0, &bConfigDescrLock);
+	if (ret)
+		goto out;
+
+	if (bConfigDescrLock) {
+		dev_err(hba->dev, "%s: bConfigDescrLock already set to %u, cannot re-provision device!\n",
+		__func__, bConfigDescrLock);
+		goto out;
+	}
+
+	for (i = 0; i < QUERY_DESC_CONFIGURATION_DEF_SIZE; i++) {
+		token = strsep(&strbuf, " ");
+		if (!token && i)
+			break;
+
+		ret = kstrtoint(token, 0, &value);
+		if (ret) {
+			dev_err(hba->dev, "%s: kstrtoint failed %d %s\n",
+				__func__, ret, token);
+			break;
+		}
+		desc_buf[i] = (u8)value;
+	}
+
+	/* Write configuration descriptor to provision ufs */
+	ret = ufshcd_query_descriptor_retry(hba, UPIU_QUERY_OPCODE_WRITE_DESC,
+		QUERY_DESC_IDN_CONFIGURATION, 0, 0, desc_buf, &buff_len);
+
+	if (!ret)
+		dev_err(hba->dev, "%s: UFS Provisioning done, reboot now!\n",
+		__func__);
+
+out:
+	kfree(strbuf_copy);
+	return count;
+}
+
+static ssize_t ufs_provision_store(struct config_item *item,
+		const char *buf, size_t count)
+{
+	struct ufs_hba *hba = config_item_to_hba(item);
+
+	return ufshcd_desc_configfs_store(hba, buf, count);
+}
+
+static struct configfs_attribute ufshcd_attr_provision = {
+	.ca_name	= "ufs_provision",
+	.ca_mode	= 0644,
+	.ca_owner	= THIS_MODULE,
+	.show		= ufs_provision_show,
+	.store		= ufs_provision_store,
+};
+
+static struct configfs_attribute *ufshcd_attrs[] = {
+	&ufshcd_attr_provision,
+	NULL,
+};
+
+static struct config_item_type ufscfg_type = {
+	.ct_attrs	= ufshcd_attrs,
+	.ct_owner	= THIS_MODULE,
+};
+
+static struct configfs_subsystem ufscfg_subsys = {
+	.su_group = {
+		.cg_item = {
+			.ci_type = &ufscfg_type,
+		},
+	},
+};
+
+int ufshcd_configfs_init(struct ufs_hba *hba, const char *name)
+{
+	int ret;
+	struct configfs_subsystem *subsys = &hba->subsys;
+
+	strncpy(ufscfg_subsys.su_group.cg_item.ci_namebuf, name, strlen(name));
+	subsys->su_group = ufscfg_subsys.su_group;
+	config_group_init(&subsys->su_group);
+	mutex_init(&subsys->su_mutex);
+	ret = configfs_register_subsystem(subsys);
+	if (ret)
+		pr_err("Error %d while registering subsystem %s\n",
+		       ret,
+		       subsys->su_group.cg_item.ci_namebuf);
+
+	return ret;
+}
+
+void ufshcd_configfs_exit(void)
+{
+	configfs_unregister_subsystem(&ufscfg_subsys);
+}
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index c5b1bf1..bfdd502 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -7622,6 +7622,7 @@ int ufshcd_shutdown(struct ufs_hba *hba)
 void ufshcd_remove(struct ufs_hba *hba)
 {
 	ufs_sysfs_remove_nodes(hba->dev);
+	ufshcd_configfs_exit();
 	scsi_remove_host(hba->host);
 	/* disable interrupts */
 	ufshcd_disable_intr(hba, hba->intr_mask);
@@ -7875,6 +7876,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
 
 	async_schedule(ufshcd_async_scan, hba);
 	ufs_sysfs_add_nodes(hba->dev);
+	ufshcd_configfs_init(hba, dev_name(hba->dev));
 
 	return 0;
 
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 8110dcd..2ece88d 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -37,6 +37,7 @@
 #ifndef _UFSHCD_H
 #define _UFSHCD_H
 
+#include <linux/configfs.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -515,6 +516,9 @@ struct ufs_hba {
 
 	struct Scsi_Host *host;
 	struct device *dev;
+#ifdef CONFIG_UFS_PROVISION
+	struct configfs_subsystem subsys;
+#endif
 	/*
 	 * This field is to keep a reference to "scsi_device" corresponding to
 	 * "UFS device" W-LU.
@@ -866,6 +870,21 @@ int ufshcd_read_string_desc(struct ufs_hba *hba, int desc_index,
 int ufshcd_hold(struct ufs_hba *hba, bool async);
 void ufshcd_release(struct ufs_hba *hba);
 
+/* Expose UFS configfs API's */
+#ifdef CONFIG_UFS_PROVISION
+int ufshcd_configfs_init(struct ufs_hba *hba, const char *name);
+void ufshcd_configfs_exit(void);
+#else
+int ufshcd_configfs_init(struct ufs_hba *hba, const char *name)
+{
+	return 0;
+}
+
+void ufshcd_configfs_exit(void)
+{
+}
+#endif
+
 int ufshcd_map_desc_id_to_length(struct ufs_hba *hba, enum desc_idn desc_id,
 	int *desc_length);
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


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

* Re: [PATCH V6] scsi: ufs: Add configfs support for UFS provisioning
  2018-07-16  9:43 ` [PATCH V6] scsi: ufs: Add configfs support for UFS provisioning Sayali Lokhande
@ 2018-07-16 14:02   ` Bart Van Assche
  2018-07-16 14:28   ` kbuild test robot
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Bart Van Assche @ 2018-07-16 14:02 UTC (permalink / raw)
  To: vinholikatti, asutoshd, sayalil, riteshh, evgreen, cang,
	martin.petersen, subhashj, vivek.gautam, rnayak, jejb
  Cc: linux-scsi, linux-kernel

On Mon, 2018-07-16 at 15:13 +0530, Sayali Lokhande wrote:
> +		This file shows the current ufs configuration descriptor set in device.
> +		This can be used to provision ufs device if bConfigDescrLock is 0.
> +		For more details, refer 14.1.6.3 Configuration Descriptor and
> +		Table 14-12 - Unit Descriptor configurable parameters from specs for
> +		description of each configuration descriptor parameter.
> +		Configuration descriptor buffer needs to be passed in space separated
> +		format specificied as below:
> +		echo <bLength> <bDescriptorIDN> <bConfDescContinue> <bBootEnable>
> +		<bDescrAccessEn> <bInitPowerMode> <bHighPriorityLUN>
> +		<bSecureRemovalType> <bInitActiveICCLevel> <wPeriodicRTCUpdate>
> +		<0Bh:0Fh_ReservedAs_0> <bLUEnable> <bBootLunID> <bLUWriteProtect>
> +		<bMemoryType> <dNumAllocUnits> <bDataReliability> <bLogicalBlockSize>
> +		<bProvisioningType> <wContextCapabilities> <0Dh:0Fh_ReservedAs_0>
> +		> /config/XXXX.ufshc/ufs_provision

I think the person who suggested to use configfs expected you to create one configfs
attribute per value instead of writing a long list of values into a single configfs
attribute.

Bart.








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

* Re: [PATCH V6] scsi: ufs: Add configfs support for UFS provisioning
  2018-07-16  9:43 ` [PATCH V6] scsi: ufs: Add configfs support for UFS provisioning Sayali Lokhande
  2018-07-16 14:02   ` Bart Van Assche
@ 2018-07-16 14:28   ` kbuild test robot
  2018-07-16 15:28   ` kbuild test robot
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: kbuild test robot @ 2018-07-16 14:28 UTC (permalink / raw)
  To: Sayali Lokhande
  Cc: kbuild-all, subhashj, cang, vivek.gautam, rnayak, vinholikatti,
	jejb, martin.petersen, asutoshd, evgreen, riteshh, linux-scsi,
	Sayali Lokhande, open list

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

Hi Sayali,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on v4.18-rc5 next-20180716]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Sayali-Lokhande/scsi-ufs-Add-configfs-support-for-UFS-provisioning/20180716-212258
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: i386-randconfig-x005-201828 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/scsi/ufs/ufs-sysfs.o: In function `ufshcd_configfs_init':
>> drivers/scsi/ufs/ufshcd.h:900: multiple definition of `ufshcd_configfs_init'
   drivers/scsi/ufs/ufshcd.o:drivers/scsi/ufs/ufshcd.h:900: first defined here
   drivers/scsi/ufs/ufs-sysfs.o: In function `ufshcd_configfs_exit':
>> drivers/scsi/ufs/ufshcd.h:905: multiple definition of `ufshcd_configfs_exit'
   drivers/scsi/ufs/ufshcd.o:drivers/scsi/ufs/ufshcd.h:905: first defined here

vim +900 drivers/scsi/ufs/ufshcd.h

   893	
   894	/* Expose UFS configfs API's */
   895	#ifdef CONFIG_UFS_PROVISION
   896	int ufshcd_configfs_init(struct ufs_hba *hba, const char *name);
   897	void ufshcd_configfs_exit(void);
   898	#else
   899	int ufshcd_configfs_init(struct ufs_hba *hba, const char *name)
 > 900	{
   901		return 0;
   902	}
   903	
   904	void ufshcd_configfs_exit(void)
 > 905	{
   906	}
   907	#endif
   908	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32099 bytes --]

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

* Re: [PATCH V6] scsi: ufs: Add configfs support for UFS provisioning
  2018-07-16  9:43 ` [PATCH V6] scsi: ufs: Add configfs support for UFS provisioning Sayali Lokhande
  2018-07-16 14:02   ` Bart Van Assche
  2018-07-16 14:28   ` kbuild test robot
@ 2018-07-16 15:28   ` kbuild test robot
  2018-07-17 13:06   ` Adrian Hunter
  2018-07-17 21:00   ` Evan Green
  4 siblings, 0 replies; 7+ messages in thread
From: kbuild test robot @ 2018-07-16 15:28 UTC (permalink / raw)
  To: Sayali Lokhande
  Cc: kbuild-all, subhashj, cang, vivek.gautam, rnayak, vinholikatti,
	jejb, martin.petersen, asutoshd, evgreen, riteshh, linux-scsi,
	Sayali Lokhande, open list

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

Hi Sayali,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on v4.18-rc5 next-20180716]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Sayali-Lokhande/scsi-ufs-Add-configfs-support-for-UFS-provisioning/20180716-212258
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 8.1.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=8.1.0 make.cross ARCH=ia64 

All errors (new ones prefixed by >>):

   In file included from include/linux/kernel.h:10,
                    from include/linux/list.h:9,
                    from include/linux/preempt.h:11,
                    from include/linux/spinlock.h:51,
                    from include/linux/seqlock.h:36,
                    from include/linux/time.h:6,
                    from include/linux/stat.h:19,
                    from include/linux/configfs.h:38,
                    from drivers/scsi/ufs/ufs-configfs.c:4:
   drivers/scsi/ufs/ufs-configfs.c: In function 'config_item_to_hba':
>> include/linux/kernel.h:964:51: error: 'struct ufs_hba' has no member named 'subsys'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
                                                      ^~
   include/linux/compiler.h:316:19: note: in definition of macro '__compiletime_assert'
      bool __cond = !(condition);    \
                      ^~~~~~~~~
   include/linux/compiler.h:339:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:45:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:964:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
     ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:964:20: note: in expansion of macro '__same_type'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
                       ^~~~~~~~~~~
   drivers/scsi/ufs/ufs-configfs.c:15:24: note: in expansion of macro 'container_of'
     struct ufs_hba *hba = container_of(subsys, struct ufs_hba, subsys);
                           ^~~~~~~~~~~~
   In file included from include/linux/compiler_types.h:58,
                    from <command-line>:
>> include/linux/compiler-gcc.h:170:2: error: 'struct ufs_hba' has no member named 'subsys'
     __builtin_offsetof(a, b)
     ^~~~~~~~~~~~~~~~~~
   include/linux/stddef.h:17:32: note: in expansion of macro '__compiler_offsetof'
    #define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER)
                                   ^~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:967:21: note: in expansion of macro 'offsetof'
     ((type *)(__mptr - offsetof(type, member))); })
                        ^~~~~~~~
   drivers/scsi/ufs/ufs-configfs.c:15:24: note: in expansion of macro 'container_of'
     struct ufs_hba *hba = container_of(subsys, struct ufs_hba, subsys);
                           ^~~~~~~~~~~~
   drivers/scsi/ufs/ufs-configfs.c: At top level:
>> drivers/scsi/ufs/ufs-configfs.c:141:5: error: redefinition of 'ufshcd_configfs_init'
    int ufshcd_configfs_init(struct ufs_hba *hba, const char *name)
        ^~~~~~~~~~~~~~~~~~~~
   In file included from drivers/scsi/ufs/ufs-configfs.c:9:
   drivers/scsi/ufs/ufshcd.h:899:5: note: previous definition of 'ufshcd_configfs_init' was here
    int ufshcd_configfs_init(struct ufs_hba *hba, const char *name)
        ^~~~~~~~~~~~~~~~~~~~
   drivers/scsi/ufs/ufs-configfs.c: In function 'ufshcd_configfs_init':
>> drivers/scsi/ufs/ufs-configfs.c:144:42: error: 'struct ufs_hba' has no member named 'subsys'
     struct configfs_subsystem *subsys = &hba->subsys;
                                             ^~
   drivers/scsi/ufs/ufs-configfs.c: At top level:
>> drivers/scsi/ufs/ufs-configfs.c:159:6: error: redefinition of 'ufshcd_configfs_exit'
    void ufshcd_configfs_exit(void)
         ^~~~~~~~~~~~~~~~~~~~
   In file included from drivers/scsi/ufs/ufs-configfs.c:9:
   drivers/scsi/ufs/ufshcd.h:904:6: note: previous definition of 'ufshcd_configfs_exit' was here
    void ufshcd_configfs_exit(void)
         ^~~~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/kernel.h:10,
                    from include/linux/list.h:9,
                    from include/linux/preempt.h:11,
                    from include/linux/spinlock.h:51,
                    from include/linux/seqlock.h:36,
                    from include/linux/time.h:6,
                    from include/linux/stat.h:19,
                    from include/linux/configfs.h:38,
                    from drivers/scsi//ufs/ufs-configfs.c:4:
   drivers/scsi//ufs/ufs-configfs.c: In function 'config_item_to_hba':
>> include/linux/kernel.h:964:51: error: 'struct ufs_hba' has no member named 'subsys'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
                                                      ^~
   include/linux/compiler.h:316:19: note: in definition of macro '__compiletime_assert'
      bool __cond = !(condition);    \
                      ^~~~~~~~~
   include/linux/compiler.h:339:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:45:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:964:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
     ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:964:20: note: in expansion of macro '__same_type'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
                       ^~~~~~~~~~~
   drivers/scsi//ufs/ufs-configfs.c:15:24: note: in expansion of macro 'container_of'
     struct ufs_hba *hba = container_of(subsys, struct ufs_hba, subsys);
                           ^~~~~~~~~~~~
   In file included from include/linux/compiler_types.h:58,
                    from <command-line>:
>> include/linux/compiler-gcc.h:170:2: error: 'struct ufs_hba' has no member named 'subsys'
     __builtin_offsetof(a, b)
     ^~~~~~~~~~~~~~~~~~
   include/linux/stddef.h:17:32: note: in expansion of macro '__compiler_offsetof'
    #define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER)
                                   ^~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:967:21: note: in expansion of macro 'offsetof'
     ((type *)(__mptr - offsetof(type, member))); })
                        ^~~~~~~~
   drivers/scsi//ufs/ufs-configfs.c:15:24: note: in expansion of macro 'container_of'
     struct ufs_hba *hba = container_of(subsys, struct ufs_hba, subsys);
                           ^~~~~~~~~~~~
   drivers/scsi//ufs/ufs-configfs.c: At top level:
   drivers/scsi//ufs/ufs-configfs.c:141:5: error: redefinition of 'ufshcd_configfs_init'
    int ufshcd_configfs_init(struct ufs_hba *hba, const char *name)
        ^~~~~~~~~~~~~~~~~~~~
   In file included from drivers/scsi//ufs/ufs-configfs.c:9:
   drivers/scsi//ufs/ufshcd.h:899:5: note: previous definition of 'ufshcd_configfs_init' was here
    int ufshcd_configfs_init(struct ufs_hba *hba, const char *name)
        ^~~~~~~~~~~~~~~~~~~~
   drivers/scsi//ufs/ufs-configfs.c: In function 'ufshcd_configfs_init':
   drivers/scsi//ufs/ufs-configfs.c:144:42: error: 'struct ufs_hba' has no member named 'subsys'
     struct configfs_subsystem *subsys = &hba->subsys;
                                             ^~
   drivers/scsi//ufs/ufs-configfs.c: At top level:
   drivers/scsi//ufs/ufs-configfs.c:159:6: error: redefinition of 'ufshcd_configfs_exit'
    void ufshcd_configfs_exit(void)
         ^~~~~~~~~~~~~~~~~~~~
   In file included from drivers/scsi//ufs/ufs-configfs.c:9:
   drivers/scsi//ufs/ufshcd.h:904:6: note: previous definition of 'ufshcd_configfs_exit' was here
    void ufshcd_configfs_exit(void)
         ^~~~~~~~~~~~~~~~~~~~

vim +964 include/linux/kernel.h

cf14f27f Alexei Starovoitov 2018-03-28  954  
^1da177e Linus Torvalds     2005-04-16  955  /**
^1da177e Linus Torvalds     2005-04-16  956   * container_of - cast a member of a structure out to the containing structure
^1da177e Linus Torvalds     2005-04-16  957   * @ptr:	the pointer to the member.
^1da177e Linus Torvalds     2005-04-16  958   * @type:	the type of the container struct this is embedded in.
^1da177e Linus Torvalds     2005-04-16  959   * @member:	the name of the member within the struct.
^1da177e Linus Torvalds     2005-04-16  960   *
^1da177e Linus Torvalds     2005-04-16  961   */
^1da177e Linus Torvalds     2005-04-16  962  #define container_of(ptr, type, member) ({				\
c7acec71 Ian Abbott         2017-07-12  963  	void *__mptr = (void *)(ptr);					\
c7acec71 Ian Abbott         2017-07-12 @964  	BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&	\
c7acec71 Ian Abbott         2017-07-12  965  			 !__same_type(*(ptr), void),			\
c7acec71 Ian Abbott         2017-07-12  966  			 "pointer type mismatch in container_of()");	\
c7acec71 Ian Abbott         2017-07-12  967  	((type *)(__mptr - offsetof(type, member))); })
^1da177e Linus Torvalds     2005-04-16  968  

:::::: The code at line 964 was first introduced by commit
:::::: c7acec713d14c6ce8a20154f9dfda258d6bcad3b kernel.h: handle pointers to arrays better in container_of()

:::::: TO: Ian Abbott <abbotti@mev.co.uk>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 50920 bytes --]

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

* Re: [PATCH V6] scsi: ufs: Add configfs support for UFS provisioning
  2018-07-16  9:43 ` [PATCH V6] scsi: ufs: Add configfs support for UFS provisioning Sayali Lokhande
                     ` (2 preceding siblings ...)
  2018-07-16 15:28   ` kbuild test robot
@ 2018-07-17 13:06   ` Adrian Hunter
  2018-07-30  8:00     ` Sayali Lokhande
  2018-07-17 21:00   ` Evan Green
  4 siblings, 1 reply; 7+ messages in thread
From: Adrian Hunter @ 2018-07-17 13:06 UTC (permalink / raw)
  To: Sayali Lokhande, subhashj, cang, vivek.gautam, rnayak,
	vinholikatti, jejb, martin.petersen, asutoshd, evgreen, riteshh
  Cc: linux-scsi, open list

On 16/07/18 12:43, Sayali Lokhande wrote:
> This patch adds configfs support to provision UFS device at
> runtime. This feature can be primarily useful in factory or
> assembly line as some devices may be required to be configured
> multiple times during initial system development phase.
> Configuration Descriptors can be written multiple times until
> bConfigDescrLock attribute is zero.
> 
> Configuration descriptor buffer consists of Device and Unit
> descriptor configurable parameters which are parsed from vendor
> specific provisioning file and then passed via configfs node at
> runtime to provision ufs device.
> CONFIG_CONFIGFS_FS needs to be enabled for using this feature.
> 
> Usage:
> 1) To read current configuration descriptor :
>    cat /config/XXXX.ufshc/ufs_provision
> 2) To provision ufs device:
>    echo <config_desc_buf> > /config/XXXX.ufshc/ufs_provision
> 
> Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
> ---
>  Documentation/ABI/testing/configfs-driver-ufs |  18 +++
>  drivers/scsi/ufs/Kconfig                      |  10 ++
>  drivers/scsi/ufs/Makefile                     |   1 +
>  drivers/scsi/ufs/ufs-configfs.c               | 162 ++++++++++++++++++++++++++
>  drivers/scsi/ufs/ufshcd.c                     |   2 +
>  drivers/scsi/ufs/ufshcd.h                     |  19 +++
>  6 files changed, 212 insertions(+)
>  create mode 100644 Documentation/ABI/testing/configfs-driver-ufs
>  create mode 100644 drivers/scsi/ufs/ufs-configfs.c
> 
> diff --git a/Documentation/ABI/testing/configfs-driver-ufs b/Documentation/ABI/testing/configfs-driver-ufs
> new file mode 100644
> index 0000000..eeee499c
> --- /dev/null
> +++ b/Documentation/ABI/testing/configfs-driver-ufs
> @@ -0,0 +1,18 @@
> +What:		/config/ufshcd/ufs_provision
> +Date:		Jun 2018
> +KernelVersion:	4.14
> +Description:
> +		This file shows the current ufs configuration descriptor set in device.
> +		This can be used to provision ufs device if bConfigDescrLock is 0.
> +		For more details, refer 14.1.6.3 Configuration Descriptor and
> +		Table 14-12 - Unit Descriptor configurable parameters from specs for
> +		description of each configuration descriptor parameter.
> +		Configuration descriptor buffer needs to be passed in space separated
> +		format specificied as below:
> +		echo <bLength> <bDescriptorIDN> <bConfDescContinue> <bBootEnable>
> +		<bDescrAccessEn> <bInitPowerMode> <bHighPriorityLUN>
> +		<bSecureRemovalType> <bInitActiveICCLevel> <wPeriodicRTCUpdate>
> +		<0Bh:0Fh_ReservedAs_0> <bLUEnable> <bBootLunID> <bLUWriteProtect>
> +		<bMemoryType> <dNumAllocUnits> <bDataReliability> <bLogicalBlockSize>
> +		<bProvisioningType> <wContextCapabilities> <0Dh:0Fh_ReservedAs_0>
> +		> /config/XXXX.ufshc/ufs_provision
> diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig
> index e27b4d4..34d89c2 100644
> --- a/drivers/scsi/ufs/Kconfig
> +++ b/drivers/scsi/ufs/Kconfig
> @@ -100,3 +100,13 @@ config SCSI_UFS_QCOM
>  
>  	  Select this if you have UFS controller on QCOM chipset.
>  	  If unsure, say N.
> +
> +config UFS_PROVISION
> +	tristate "Runtime UFS Provisioning support"
> +	depends on SCSI_UFSHCD_PLATFORM && CONFIGFS_FS

Why SCSI_UFSHCD_PLATFORM instead of SCSI_UFSHCD?

Also please cc me in future revisions.

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

* Re: [PATCH V6] scsi: ufs: Add configfs support for UFS provisioning
  2018-07-16  9:43 ` [PATCH V6] scsi: ufs: Add configfs support for UFS provisioning Sayali Lokhande
                     ` (3 preceding siblings ...)
  2018-07-17 13:06   ` Adrian Hunter
@ 2018-07-17 21:00   ` Evan Green
  4 siblings, 0 replies; 7+ messages in thread
From: Evan Green @ 2018-07-17 21:00 UTC (permalink / raw)
  To: sayalil
  Cc: subhashj, cang, vivek.gautam, Rajendra Nayak, Vinayak Holikatti,
	jejb, martin.petersen, asutoshd, riteshh, linux-scsi,
	linux-kernel, jlbec, hch

Hi Sayali,
On Mon, Jul 16, 2018 at 2:44 AM Sayali Lokhande <sayalil@codeaurora.org> wrote:
>
> This patch adds configfs support to provision UFS device at
> runtime. This feature can be primarily useful in factory or
> assembly line as some devices may be required to be configured
> multiple times during initial system development phase.
> Configuration Descriptors can be written multiple times until
> bConfigDescrLock attribute is zero.
>
> Configuration descriptor buffer consists of Device and Unit
> descriptor configurable parameters which are parsed from vendor
> specific provisioning file and then passed via configfs node at
> runtime to provision ufs device.
> CONFIG_CONFIGFS_FS needs to be enabled for using this feature.
>
> Usage:
> 1) To read current configuration descriptor :
>    cat /config/XXXX.ufshc/ufs_provision
> 2) To provision ufs device:
>    echo <config_desc_buf> > /config/XXXX.ufshc/ufs_provision
>
> Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
> ---
>  Documentation/ABI/testing/configfs-driver-ufs |  18 +++
>  drivers/scsi/ufs/Kconfig                      |  10 ++
>  drivers/scsi/ufs/Makefile                     |   1 +
>  drivers/scsi/ufs/ufs-configfs.c               | 162 ++++++++++++++++++++++++++
>  drivers/scsi/ufs/ufshcd.c                     |   2 +
>  drivers/scsi/ufs/ufshcd.h                     |  19 +++
>  6 files changed, 212 insertions(+)
>  create mode 100644 Documentation/ABI/testing/configfs-driver-ufs
>  create mode 100644 drivers/scsi/ufs/ufs-configfs.c
>
...
> diff --git a/drivers/scsi/ufs/ufs-configfs.c b/drivers/scsi/ufs/ufs-configfs.c
> new file mode 100644
> index 0000000..3e9837a
> --- /dev/null
> +++ b/drivers/scsi/ufs/ufs-configfs.c
> @@ -0,0 +1,162 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +// Copyright (c) 2018, Linux Foundation.
> +
> +#include <linux/configfs.h>
> +#include <linux/err.h>
> +#include <linux/string.h>
> +
> +#include "ufs.h"
> +#include "ufshcd.h"
> +
> +static inline struct ufs_hba *config_item_to_hba(struct config_item *item)
> +{
> +       struct config_group *group = to_config_group(item);
> +       struct configfs_subsystem *subsys = to_configfs_subsystem(group);
> +       struct ufs_hba *hba = container_of(subsys, struct ufs_hba, subsys);
> +
> +       return hba ? hba : NULL;

Can this ever return NULL? to_config_group() and
to_configfs_subsystem() guard against null, but container_of does not,
which would make hba a small negative value. The conditional would
needs to be subsys ? hba : NULL.

> +}
> +
> +static ssize_t ufs_provision_show(struct config_item *item, char *buf)
> +{
> +       u8 desc_buf[QUERY_DESC_CONFIGURATION_DEF_SIZE] = {0};
> +       int buff_len = QUERY_DESC_CONFIGURATION_DEF_SIZE;
> +       int i, ret, curr_len = 0;
> +       struct ufs_hba *hba = config_item_to_hba(item);
> +
> +       if (!hba)
> +               return snprintf(buf, PAGE_SIZE, "ufs hba is NULL!\n");

Maybe just fail, rather than successfully returning something unexpected.

> +
> +       ret = ufshcd_query_descriptor_retry(hba, UPIU_QUERY_OPCODE_READ_DESC,
> +               QUERY_DESC_IDN_CONFIGURATION, 0, 0, desc_buf, &buff_len);
> +
> +       if (ret)
> +               return snprintf(buf, PAGE_SIZE,
> +               "Failed reading descriptor. desc_idn %d, opcode %x ret %d\n",
> +               QUERY_DESC_IDN_CONFIGURATION,
> +               UPIU_QUERY_OPCODE_READ_DESC, ret);

Same here, failing is probably better than returning unexpected text.

> +
> +       for (i = 0; i < buff_len; i++)
> +               curr_len += snprintf((buf + curr_len), (PAGE_SIZE - curr_len),
> +                               "0x%x ", desc_buf[i]);
> +
> +       return curr_len;
> +}
> +
> +ssize_t ufshcd_desc_configfs_store(struct ufs_hba *hba,
> +               const char *buf, size_t count)
> +{
> +       char *strbuf;
> +       char *strbuf_copy;
> +       u8 desc_buf[QUERY_DESC_CONFIGURATION_DEF_SIZE] = {0};
> +       int buff_len = QUERY_DESC_CONFIGURATION_DEF_SIZE;
> +       char *token;
> +       int i, ret, value;
> +       u32 bConfigDescrLock = 0;
> +
> +       /* reserve one byte for null termination */
> +       strbuf = kmalloc(count + 1, GFP_KERNEL);
> +       if (!strbuf)
> +               return -ENOMEM;
> +
> +       strbuf_copy = strbuf;
> +       strlcpy(strbuf, buf, count + 1);
> +
> +       if (!hba)
> +               goto out;
> +
> +       /* Just return if bConfigDescrLock is already set */
> +       ret = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR,
> +               QUERY_ATTR_IDN_CONF_DESC_LOCK, 0, 0, &bConfigDescrLock);
> +       if (ret)
> +               goto out;
> +
> +       if (bConfigDescrLock) {
> +               dev_err(hba->dev, "%s: bConfigDescrLock already set to %u, cannot re-provision device!\n",
> +               __func__, bConfigDescrLock);
> +               goto out;
> +       }
> +
> +       for (i = 0; i < QUERY_DESC_CONFIGURATION_DEF_SIZE; i++) {
> +               token = strsep(&strbuf, " ");
> +               if (!token && i)
> +                       break;
> +
> +               ret = kstrtoint(token, 0, &value);
> +               if (ret) {
> +                       dev_err(hba->dev, "%s: kstrtoint failed %d %s\n",
> +                               __func__, ret, token);
> +                       break;
> +               }
> +               desc_buf[i] = (u8)value;
> +       }
> +
> +       /* Write configuration descriptor to provision ufs */
> +       ret = ufshcd_query_descriptor_retry(hba, UPIU_QUERY_OPCODE_WRITE_DESC,
> +               QUERY_DESC_IDN_CONFIGURATION, 0, 0, desc_buf, &buff_len);
> +
> +       if (!ret)
> +               dev_err(hba->dev, "%s: UFS Provisioning done, reboot now!\n",
> +               __func__);
> +
> +out:
> +       kfree(strbuf_copy);
> +       return count;
> +}
> +
> +static ssize_t ufs_provision_store(struct config_item *item,
> +               const char *buf, size_t count)
> +{
> +       struct ufs_hba *hba = config_item_to_hba(item);
> +
> +       return ufshcd_desc_configfs_store(hba, buf, count);
> +}
> +
> +static struct configfs_attribute ufshcd_attr_provision = {
> +       .ca_name        = "ufs_provision",
> +       .ca_mode        = 0644,
> +       .ca_owner       = THIS_MODULE,
> +       .show           = ufs_provision_show,
> +       .store          = ufs_provision_store,
> +};
> +
> +static struct configfs_attribute *ufshcd_attrs[] = {
> +       &ufshcd_attr_provision,
> +       NULL,
> +};
> +
> +static struct config_item_type ufscfg_type = {
> +       .ct_attrs       = ufshcd_attrs,
> +       .ct_owner       = THIS_MODULE,
> +};
> +
> +static struct configfs_subsystem ufscfg_subsys = {
> +       .su_group = {
> +               .cg_item = {
> +                       .ci_type = &ufscfg_type,
> +               },
> +       },
> +};
> +
> +int ufshcd_configfs_init(struct ufs_hba *hba, const char *name)
> +{
> +       int ret;
> +       struct configfs_subsystem *subsys = &hba->subsys;
> +
> +       strncpy(ufscfg_subsys.su_group.cg_item.ci_namebuf, name, strlen(name));
> +       subsys->su_group = ufscfg_subsys.su_group;
> +       config_group_init(&subsys->su_group);
> +       mutex_init(&subsys->su_mutex);
> +       ret = configfs_register_subsystem(subsys);

Are the configfs folks okay with adding a new top level directory for
each host controller in the system? It might be better to have a
single top level directory of ufs, and then each controller as a
subdirectory underneath that. I'll defer to whatever the maintainers
think here.

> +       if (ret)
> +               pr_err("Error %d while registering subsystem %s\n",
> +                      ret,
> +                      subsys->su_group.cg_item.ci_namebuf);
> +
> +       return ret;
> +}
> +
> +void ufshcd_configfs_exit(void)
> +{
> +       configfs_unregister_subsystem(&ufscfg_subsys);
> +}

-Evan

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

* Re: [PATCH V6] scsi: ufs: Add configfs support for UFS provisioning
  2018-07-17 13:06   ` Adrian Hunter
@ 2018-07-30  8:00     ` Sayali Lokhande
  0 siblings, 0 replies; 7+ messages in thread
From: Sayali Lokhande @ 2018-07-30  8:00 UTC (permalink / raw)
  To: Adrian Hunter, subhashj, cang, vivek.gautam, rnayak,
	vinholikatti, jejb, martin.petersen, asutoshd, evgreen, riteshh
  Cc: linux-scsi, open list



On 7/17/2018 6:36 PM, Adrian Hunter wrote:
> On 16/07/18 12:43, Sayali Lokhande wrote:
>> This patch adds configfs support to provision UFS device at
>> runtime. This feature can be primarily useful in factory or
>> assembly line as some devices may be required to be configured
>> multiple times during initial system development phase.
>> Configuration Descriptors can be written multiple times until
>> bConfigDescrLock attribute is zero.
>>
>> Configuration descriptor buffer consists of Device and Unit
>> descriptor configurable parameters which are parsed from vendor
>> specific provisioning file and then passed via configfs node at
>> runtime to provision ufs device.
>> CONFIG_CONFIGFS_FS needs to be enabled for using this feature.
>>
>> Usage:
>> 1) To read current configuration descriptor :
>>     cat /config/XXXX.ufshc/ufs_provision
>> 2) To provision ufs device:
>>     echo <config_desc_buf> > /config/XXXX.ufshc/ufs_provision
>>
>> Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
>> ---
>>   Documentation/ABI/testing/configfs-driver-ufs |  18 +++
>>   drivers/scsi/ufs/Kconfig                      |  10 ++
>>   drivers/scsi/ufs/Makefile                     |   1 +
>>   drivers/scsi/ufs/ufs-configfs.c               | 162 ++++++++++++++++++++++++++
>>   drivers/scsi/ufs/ufshcd.c                     |   2 +
>>   drivers/scsi/ufs/ufshcd.h                     |  19 +++
>>   6 files changed, 212 insertions(+)
>>   create mode 100644 Documentation/ABI/testing/configfs-driver-ufs
>>   create mode 100644 drivers/scsi/ufs/ufs-configfs.c
>>
>> diff --git a/Documentation/ABI/testing/configfs-driver-ufs b/Documentation/ABI/testing/configfs-driver-ufs
>> new file mode 100644
>> index 0000000..eeee499c
>> --- /dev/null
>> +++ b/Documentation/ABI/testing/configfs-driver-ufs
>> @@ -0,0 +1,18 @@
>> +What:		/config/ufshcd/ufs_provision
>> +Date:		Jun 2018
>> +KernelVersion:	4.14
>> +Description:
>> +		This file shows the current ufs configuration descriptor set in device.
>> +		This can be used to provision ufs device if bConfigDescrLock is 0.
>> +		For more details, refer 14.1.6.3 Configuration Descriptor and
>> +		Table 14-12 - Unit Descriptor configurable parameters from specs for
>> +		description of each configuration descriptor parameter.
>> +		Configuration descriptor buffer needs to be passed in space separated
>> +		format specificied as below:
>> +		echo <bLength> <bDescriptorIDN> <bConfDescContinue> <bBootEnable>
>> +		<bDescrAccessEn> <bInitPowerMode> <bHighPriorityLUN>
>> +		<bSecureRemovalType> <bInitActiveICCLevel> <wPeriodicRTCUpdate>
>> +		<0Bh:0Fh_ReservedAs_0> <bLUEnable> <bBootLunID> <bLUWriteProtect>
>> +		<bMemoryType> <dNumAllocUnits> <bDataReliability> <bLogicalBlockSize>
>> +		<bProvisioningType> <wContextCapabilities> <0Dh:0Fh_ReservedAs_0>
>> +		> /config/XXXX.ufshc/ufs_provision
>> diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig
>> index e27b4d4..34d89c2 100644
>> --- a/drivers/scsi/ufs/Kconfig
>> +++ b/drivers/scsi/ufs/Kconfig
>> @@ -100,3 +100,13 @@ config SCSI_UFS_QCOM
>>   
>>   	  Select this if you have UFS controller on QCOM chipset.
>>   	  If unsure, say N.
>> +
>> +config UFS_PROVISION
>> +	tristate "Runtime UFS Provisioning support"
>> +	depends on SCSI_UFSHCD_PLATFORM && CONFIGFS_FS
> Why SCSI_UFSHCD_PLATFORM instead of SCSI_UFSHCD?
SCSI_UFSHCD_PLATFORM in turn depends on SCSI_UFSHCD hence used it, no 
specific reason as such.
I will update it to SCSI_UFSHCD (as provisioning is meant for UFS device 
and scsi_ufshcd config ensures support for ufs devices).
>
> Also please cc me in future revisions.
will do.

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

end of thread, other threads:[~2018-07-30  8:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1531734237-27421-1-git-send-email-sayalil@codeaurora.org>
2018-07-16  9:43 ` [PATCH V6] scsi: ufs: Add configfs support for UFS provisioning Sayali Lokhande
2018-07-16 14:02   ` Bart Van Assche
2018-07-16 14:28   ` kbuild test robot
2018-07-16 15:28   ` kbuild test robot
2018-07-17 13:06   ` Adrian Hunter
2018-07-30  8:00     ` Sayali Lokhande
2018-07-17 21:00   ` Evan Green

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).