linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v10 0/2] soc: qcom: Add SoC info driver
@ 2017-02-20 16:47 Imran Khan
  2017-02-20 16:47 ` [PATCH v10 1/2] " Imran Khan
  2017-02-20 16:47 ` [PATCH v10 2/2] Documentation/ABI: Add ABI information for QCOM socinfo driver Imran Khan
  0 siblings, 2 replies; 15+ messages in thread
From: Imran Khan @ 2017-02-20 16:47 UTC (permalink / raw)
  To: bjorn.andersson, sboyd
  Cc: agross, linux-arm-msm, linux-kernel, linux-soc, Imran Khan

This is patchset v10, it takes care of review comments provided in
v8 and v9. 

v9 --> v10:
 - Removed version specific socinfo objects.
 - Added a couple of PMIC models in pmic_model array.
 - Corrected interpretation of PMIC information related
   fields.
v8 --> v9:
 - Removed qcom_odm attribute.
 - Re-introduce soc_of_id array to map soc-id
   into human readable string.
v7 --> v8:
 - Fixed compilation warning detected in v7
v6 --> v7:
 - Some minor style changes
 - Rather than showing string for h/w types, just show the
   number obtained from SMEM. The reader of this number
   is supposed to parse this into a human readable string 
   as this information may be different for different ODMs
 - Create an attribute 'qcom_odm' depending on the presence
   of corresponding property in SMEM DT entry. This information
   can be used for ODM specific interpretation of SMEM socinfo
   content
 - Read machine value from DT, rather than using soc-id as index
   in an ever increasing array of machine names

v5 --> v6:
 - use dev_ext_attribute to represent SMEM image items
 - Avoid redundant function calls
 - Avoid use of unnecessary global variables
 - Remove redundant enums
 - Avoid redundant checking of socinfo being NULL or not
 - Avoid redundant checking of socinfo format version
 - Rename show/store function of attributes as _show/_store
   rather than _get/_set
 - Use an array to represent socinfo attributes and create
   attribute files in a loop depending on the minimum 
   socinfo format version for which these attributes are 
   supported
 - if obtained socinfo format version is greater than the
   maximum known version return an error rather than falling
   back to maximum known version
 
v4 --> v5:
 - Removed redundant function socinfo_print

v3 --> v4:
 - Corrected makefile so that smem and socinfo are treated as one module
 - Moved the code snippet to get socinfo smem item into socinfo.c
 - Removed redundant use of socinfo major version as it is always zero
 - Removed unused enums
 - Removed redundant indirections
 - Use image_version object to store information about each entry in the
   smem image table
 - Replaced usage of snprintf with sprintf and scnprintf
 - Get the address of image version table at the beginning and setup
   image version attributes only if image version table is available
 - Do the same for platform_subtype
 - Make different type of image version objects read only or readable/
   writable depending on their types. For example apps image attributes
   can be modified via sysfs but the same can't be done for modem image
 - Show PMIC model in a human readable form rather than a numeric number
 - Avoid using table in single sysfs entry
 - Removed checkpatch warnings about S_IRUGO

v2 --> v3:
 - Add support to toss soc information data into entropy pool
 - Since socinfo is rolled into smem driver, compile the
   relevant portion of socinfo driver with smem driver
 
v1 --> v2:
 - Removed inclusion of system_misc.h
 - merged socinfo.h into socinfo.c
 - made platform type and subtype arrays static
 - replaced uint32_t with u32
 - made functions static to avoid exposing vendor specific interface
 - Replaced usage of IS_ERR_OR_NULL with IS_ERR.
 - Remove raw-id attribute usage as human readable soc-id will suffice here
 - Avoid using a separate platform driver for socinfo by rolling it into smem driver itself.
   The sysfs setup is being done in a separate file (socinfo.c)
 - Replaced macro BUILD_ID_LENGTH with  SMEM_SOCINFO_BUILD_ID_LENGTH.
 - For failure cases where socinfo can not be read use a single dummy socinfo with error values.
 - Removed usage of early_machine_is_xxx.


Imran Khan (2):
  soc: qcom: Add SoC info driver
  Documentation/ABI: Add ABI infomation for QCOM socinfo driver

 .../ABI/testing/sysfs-driver-qcom_socinfo          | 171 +++++++
 drivers/soc/qcom/Kconfig                           |   1 +
 drivers/soc/qcom/Makefile                          |   3 +-
 drivers/soc/qcom/smem.c                            |   5 +
 drivers/soc/qcom/socinfo.c                         | 518 +++++++++++++++++++++
 5 files changed, 697 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-qcom_socinfo
 create mode 100644 drivers/soc/qcom/socinfo.c

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* [PATCH v10 1/2] soc: qcom: Add SoC info driver
  2017-02-20 16:47 [PATCH v10 0/2] soc: qcom: Add SoC info driver Imran Khan
@ 2017-02-20 16:47 ` Imran Khan
  2017-02-20 16:47 ` [PATCH v10 2/2] Documentation/ABI: Add ABI information for QCOM socinfo driver Imran Khan
  1 sibling, 0 replies; 15+ messages in thread
From: Imran Khan @ 2017-02-20 16:47 UTC (permalink / raw)
  To: bjorn.andersson, sboyd
  Cc: agross, linux-arm-msm, linux-kernel, linux-soc, Imran Khan

The SoC info driver provides information such as Chip ID,
Chip family, serial number and other such details about
Qualcomm SoCs to user space, so that if needed some user
space utility(like antutu) can query such information
using sysfs interface.

Signed-off-by: Imran Khan <kimran@codeaurora.org>
---
 drivers/soc/qcom/Kconfig   |   1 +
 drivers/soc/qcom/Makefile  |   3 +-
 drivers/soc/qcom/smem.c    |   5 +
 drivers/soc/qcom/socinfo.c | 518 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 526 insertions(+), 1 deletion(-)
 create mode 100644 drivers/soc/qcom/socinfo.c

diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
index 461b387..f89d34d 100644
--- a/drivers/soc/qcom/Kconfig
+++ b/drivers/soc/qcom/Kconfig
@@ -24,6 +24,7 @@ config QCOM_SMEM
 	tristate "Qualcomm Shared Memory Manager (SMEM)"
 	depends on ARCH_QCOM
 	depends on HWSPINLOCK
+	select SOC_BUS
 	help
 	  Say y here to enable support for the Qualcomm Shared Memory Manager.
 	  The driver provides an interface to items in a heap shared among all
diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile
index fdd664e..438efec 100644
--- a/drivers/soc/qcom/Makefile
+++ b/drivers/soc/qcom/Makefile
@@ -2,7 +2,8 @@ obj-$(CONFIG_QCOM_GSBI)	+=	qcom_gsbi.o
 obj-$(CONFIG_QCOM_PM)	+=	spm.o
 obj-$(CONFIG_QCOM_SMD) +=	smd.o
 obj-$(CONFIG_QCOM_SMD_RPM)	+= smd-rpm.o
-obj-$(CONFIG_QCOM_SMEM) +=	smem.o
+obj-$(CONFIG_QCOM_SMEM) +=	qcom_smem.o
+qcom_smem-y := smem.o socinfo.o
 obj-$(CONFIG_QCOM_SMEM_STATE) += smem_state.o
 obj-$(CONFIG_QCOM_SMP2P)	+= smp2p.o
 obj-$(CONFIG_QCOM_SMSM)	+= smsm.o
diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
index 18ec52f..4f0ccf8 100644
--- a/drivers/soc/qcom/smem.c
+++ b/drivers/soc/qcom/smem.c
@@ -85,6 +85,9 @@
 /* Max number of processors/hosts in a system */
 #define SMEM_HOST_COUNT		9
 
+
+extern void qcom_socinfo_init(struct device *device);
+
 /**
   * struct smem_proc_comm - proc_comm communication struct (legacy)
   * @command:	current command to be executed
@@ -751,6 +754,8 @@ static int qcom_smem_probe(struct platform_device *pdev)
 
 	__smem = smem;
 
+	qcom_socinfo_init(&pdev->dev);
+
 	return 0;
 }
 
diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c
new file mode 100644
index 0000000..2491468
--- /dev/null
+++ b/drivers/soc/qcom/socinfo.c
@@ -0,0 +1,518 @@
+/*
+ * Copyright (c) 2009-2017, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/export.h>
+#include <linux/err.h>
+#include <linux/of.h>
+#include <linux/of_fdt.h>
+#include <linux/libfdt.h>
+#include <linux/platform_device.h>
+#include <linux/sys_soc.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <linux/types.h>
+#include <linux/random.h>
+#include <linux/soc/qcom/smem.h>
+
+/*
+ * SOC version type with major number in the upper 16 bits and minor
+ * number in the lower 16 bits.  For example:
+ *   1.0 -> 0x00010000
+ *   2.3 -> 0x00020003
+ */
+#define SOC_VER_MAJ(ver) (((ver) & 0xffff0000) >> 16)
+#define SOC_VER_MIN(ver) ((ver) & 0x0000ffff)
+#define SOCINFO_VERSION_MAJOR	SOC_VER_MAJ
+#define SOCINFO_VERSION_MINOR	SOC_VER_MIN
+
+#define SMEM_SOCINFO_BUILD_ID_LENGTH		32
+#define SMEM_IMAGE_VERSION_BLOCKS_COUNT		32
+#define SMEM_IMAGE_VERSION_SIZE			4096
+#define SMEM_IMAGE_VERSION_NAME_SIZE		75
+#define SMEM_IMAGE_VERSION_VARIANT_SIZE		20
+#define SMEM_IMAGE_VERSION_OEM_SIZE		32
+
+/*
+ * SMEM item ids, used to acquire handles to respective
+ * SMEM region.
+ */
+#define SMEM_IMAGE_VERSION_TABLE	469
+#define SMEM_HW_SW_BUILD_ID		137
+
+/*
+ * SMEM Image table indices
+ */
+#define SMEM_IMAGE_TABLE_BOOT_INDEX	0
+#define SMEM_IMAGE_TABLE_TZ_INDEX	1
+#define SMEM_IMAGE_TABLE_RPM_INDEX	3
+#define SMEM_IMAGE_TABLE_APPS_INDEX	10
+#define SMEM_IMAGE_TABLE_MPSS_INDEX	11
+#define SMEM_IMAGE_TABLE_ADSP_INDEX	12
+#define SMEM_IMAGE_TABLE_CNSS_INDEX	13
+#define SMEM_IMAGE_TABLE_VIDEO_INDEX	14
+
+struct qcom_socinfo_attr {
+	struct device_attribute attr;
+	int min_ver;
+};
+
+#define QCOM_SOCINFO_ATTR(_name, _show, _min_ver) \
+	{ __ATTR(_name, 0444, _show, NULL), _min_ver }
+
+
+struct smem_image_attribute {
+	struct device_attribute version;
+	struct device_attribute variant;
+	struct device_attribute crm;
+	int index;
+};
+
+#define QCOM_SMEM_IMG_ITEM(_name, _mode, _index) \
+	static struct smem_image_attribute _name##_image_attrs = { \
+		__ATTR(_name##_image_version, _mode, \
+			qcom_show_image_version, qcom_store_image_version), \
+		__ATTR(_name##_image_variant, _mode, \
+			qcom_show_image_variant, qcom_store_image_variant), \
+		__ATTR(_name##_image_crm, _mode, \
+			qcom_show_image_crm, qcom_store_image_crm), \
+		_index \
+	}; \
+	static const struct attribute_group _name##_image_attr_group = { \
+		.attrs = (struct attribute*[]) { \
+			&_name##_image_attrs.version.attr, \
+			&_name##_image_attrs.variant.attr, \
+			&_name##_image_attrs.crm.attr, \
+			NULL \
+		} \
+	}
+
+static const char *const pmic_model[] = {
+	[0]  = "Unknown PMIC model",
+	[9]  = "PM8994",
+	[11] = "PM8916",
+	[13] = "PM8058",
+	[14] = "PM8028",
+	[15] = "PM8901",
+	[16] = "PM8027",
+	[17] = "ISL9519",
+	[18] = "PM8921",
+	[19] = "PM8018",
+	[20] = "PM8015",
+	[21] = "PM8014",
+	[22] = "PM8821",
+	[23] = "PM8038",
+	[24] = "PM8922",
+	[25] = "PM8917",
+};
+
+struct smem_image_version {
+	char name[SMEM_IMAGE_VERSION_NAME_SIZE];
+	char variant[SMEM_IMAGE_VERSION_VARIANT_SIZE];
+	char pad;
+	char oem[SMEM_IMAGE_VERSION_OEM_SIZE];
+};
+
+struct qcom_soc_info {
+	int id;
+	const char *name;
+};
+
+/* Used to parse shared memory. Must match the modem. */
+struct socinfo {
+	__le32 fmt;
+	__le32 id;
+	__le32 ver;
+	char build_id[SMEM_SOCINFO_BUILD_ID_LENGTH];
+	/* Version 2 */
+	__le32 raw_id;
+	__le32 raw_ver;
+	/* Version 3 */
+	__le32 hw_plat;
+	/* Version 4 */
+	__le32 plat_ver;
+	/* Version 5 */
+	__le32 accessory_chip;
+	/* Version 6 */
+	__le32 hw_plat_subtype;
+	/* Version 7 */
+	__le32 pmic_model;
+	__le32 pmic_die_rev;
+	/* Version 8 */
+	__le32 pmic_model_1;
+	__le32 pmic_die_rev_1;
+	__le32 pmic_model_2;
+	__le32 pmic_die_rev_2;
+	/* Version 9 */
+	__le32 foundry_id;
+	/* Version 10 */
+	__le32 serial_num;
+	/* Version 11 */
+	__le32 num_pmics;
+	__le32 pmic_array_offset;
+	/* Version 12 */
+	__le32 chip_family;
+	__le32 raw_device_family;
+	__le32 raw_device_num;
+} *socinfo;
+
+static const struct qcom_soc_info soc_of_id[] = {
+	{87, "MSM8960"},
+	{109, "APQ8064"},
+	{122, "MSM8660A"},
+	{123, "MSM8260A"},
+	{124, "APQ8060A"},
+	{126, "MSM8974"},
+	{130, "MPQ8064"},
+	{138, "MSM8960AB"},
+	{139, "APQ8060AB"},
+	{140, "MSM8260AB"},
+	{141, "MSM8660AB"},
+	{178, "APQ8084"},
+	{184, "APQ8074"},
+	{185, "MSM8274"},
+	{186, "MSM8674"},
+	{194, "MSM8974PRO"},
+	{206, "MSM8916"},
+	{208, "APQ8074-AA"},
+	{209, "APQ8074-AB"},
+	{210, "APQ8074PRO"},
+	{211, "MSM8274-AA"},
+	{212, "MSM8274-AB"},
+	{213, "MSM8274PRO"},
+	{214, "MSM8674-AA"},
+	{215, "MSM8674-AB"},
+	{216, "MSM8674PRO"},
+	{217, "MSM8974-AA"},
+	{218, "MSM8974-AB"},
+	{246, "MSM8996"},
+	{247, "APQ8016"},
+	{248, "MSM8216"},
+	{249, "MSM8116"},
+	{250, "MSM8616"},
+	{291, "APQ8096"},
+	{305, "MSM8996SG"},
+	{310, "MSM8996AU"},
+	{311, "APQ8096AU"},
+	{312, "APQ8096SG"},
+};
+
+static struct smem_image_version *smem_image_version;
+
+/* max socinfo format version supported */
+#define MAX_SOCINFO_FORMAT 12
+
+/* socinfo: sysfs functions */
+
+static ssize_t
+qcom_show_raw_version(struct device *dev, struct device_attribute *attr,
+		      char *buf)
+{
+	return scnprintf(buf, PAGE_SIZE, "%u\n", le32_to_cpu(socinfo->raw_ver));
+}
+
+static ssize_t
+qcom_show_build_id(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	return scnprintf(buf, PAGE_SIZE, "%s\n", socinfo->build_id);
+}
+
+static ssize_t
+qcom_show_hw_platform(struct device *dev, struct device_attribute *attr,
+		      char *buf)
+{
+	return scnprintf(buf, PAGE_SIZE, "%u\n", le32_to_cpu(socinfo->hw_plat));
+}
+
+static ssize_t
+qcom_show_platform_version(struct device *dev, struct device_attribute *attr,
+			   char *buf)
+{
+	return scnprintf(buf, PAGE_SIZE, "%u\n",
+			 le32_to_cpu(socinfo->plat_ver));
+}
+
+static ssize_t
+qcom_show_accessory_chip(struct device *dev, struct device_attribute *attr,
+			 char *buf)
+{
+	return scnprintf(buf, PAGE_SIZE, "%u\n",
+			 le32_to_cpu(socinfo->accessory_chip));
+}
+
+static ssize_t
+qcom_show_platform_subtype(struct device *dev, struct device_attribute *attr,
+			   char *buf)
+{
+	int subtype = le32_to_cpu(socinfo->hw_plat_subtype);
+
+	if (subtype < 0)
+		return -EINVAL;
+
+	return scnprintf(buf, PAGE_SIZE, "%u\n", subtype);
+}
+
+static ssize_t
+qcom_show_foundry_id(struct device *dev, struct device_attribute *attr,
+		     char *buf)
+{
+	return scnprintf(buf, PAGE_SIZE, "%u\n",
+			 le32_to_cpu(socinfo->foundry_id));
+}
+
+static ssize_t
+qcom_show_serial_number(struct device *dev, struct device_attribute *attr,
+			char *buf)
+{
+	return scnprintf(buf, PAGE_SIZE, "%u\n",
+			 le32_to_cpu(socinfo->serial_num));
+}
+
+static ssize_t
+qcom_show_chip_family(struct device *dev, struct device_attribute *attr,
+		      char *buf)
+{
+	return scnprintf(buf, PAGE_SIZE, "0x%x\n",
+			 le32_to_cpu(socinfo->chip_family));
+}
+
+static ssize_t
+qcom_show_raw_device_family(struct device *dev, struct device_attribute *attr,
+			    char *buf)
+{
+	return scnprintf(buf, PAGE_SIZE, "0x%x\n",
+			 le32_to_cpu(socinfo->raw_device_family));
+}
+
+static ssize_t
+qcom_show_raw_device_number(struct device *dev, struct device_attribute *attr,
+			    char *buf)
+{
+	return scnprintf(buf, PAGE_SIZE, "0x%x\n",
+			 le32_to_cpu(socinfo->raw_device_num));
+}
+
+static ssize_t
+qcom_show_pmic_model(struct device *dev, struct device_attribute *attr,
+		     char *buf)
+{
+	int model = SOC_VER_MIN(le32_to_cpu(socinfo->pmic_model));
+
+	if (model < 0)
+		return -EINVAL;
+
+	return scnprintf(buf, PAGE_SIZE, "%s\n", pmic_model[model]);
+}
+
+static ssize_t
+qcom_show_pmic_die_revision(struct device *dev, struct device_attribute *attr,
+			    char *buf)
+{
+	return scnprintf(buf, PAGE_SIZE, "%u.%u\n",
+			 SOC_VER_MAJ(le32_to_cpu(socinfo->pmic_die_rev)),
+			 SOC_VER_MIN(le32_to_cpu(socinfo->pmic_die_rev)));
+}
+
+static ssize_t
+qcom_show_image_version(struct device *dev, struct device_attribute *attr,
+			char *buf)
+{
+	struct smem_image_attribute *smem_attr;
+
+	smem_attr = container_of(attr, struct smem_image_attribute, version);
+	return scnprintf(buf, PAGE_SIZE, "%s\n",
+			 smem_image_version[smem_attr->index].name);
+}
+
+static ssize_t
+qcom_store_image_version(struct device *dev, struct device_attribute *attr,
+			 const char *buf, size_t size)
+{
+	struct smem_image_attribute *smem_attr;
+
+	smem_attr = container_of(attr, struct smem_image_attribute, version);
+	return strlcpy(smem_image_version[smem_attr->index].name, buf,
+		       SMEM_IMAGE_VERSION_NAME_SIZE);
+}
+
+static ssize_t
+qcom_show_image_variant(struct device *dev, struct device_attribute *attr,
+			char *buf)
+{
+	struct smem_image_attribute *smem_attr;
+
+	smem_attr = container_of(attr, struct smem_image_attribute, variant);
+	return scnprintf(buf, PAGE_SIZE, "%s\n",
+			 smem_image_version[smem_attr->index].variant);
+}
+
+static ssize_t
+qcom_store_image_variant(struct device *dev, struct device_attribute *attr,
+			 const char *buf, size_t size)
+{
+	struct smem_image_attribute *smem_attr;
+
+	smem_attr = container_of(attr, struct smem_image_attribute, variant);
+	return strlcpy(smem_image_version[smem_attr->index].variant, buf,
+		       SMEM_IMAGE_VERSION_VARIANT_SIZE);
+}
+
+static ssize_t
+qcom_show_image_crm(struct device *dev, struct device_attribute *attr,
+		    char *buf)
+{
+	struct smem_image_attribute *smem_attr;
+
+	smem_attr = container_of(attr, struct smem_image_attribute, crm);
+	return scnprintf(buf, PAGE_SIZE, "%s\n",
+			 smem_image_version[smem_attr->index].oem);
+}
+
+static ssize_t
+qcom_store_image_crm(struct device *dev, struct device_attribute *attr,
+		     const char *buf, size_t size)
+{
+	struct smem_image_attribute *smem_attr;
+
+	smem_attr = container_of(attr, struct smem_image_attribute, crm);
+	return strlcpy(smem_image_version[smem_attr->index].oem, buf,
+		       SMEM_IMAGE_VERSION_OEM_SIZE);
+}
+
+static const struct qcom_socinfo_attr socinfo_attrs[] = {
+	QCOM_SOCINFO_ATTR(chip_family, qcom_show_chip_family, 12),
+	QCOM_SOCINFO_ATTR(raw_device_family, qcom_show_raw_device_family, 12),
+	QCOM_SOCINFO_ATTR(raw_device_number, qcom_show_raw_device_number, 12),
+	QCOM_SOCINFO_ATTR(serial_number, qcom_show_serial_number, 10),
+	QCOM_SOCINFO_ATTR(foundry_id, qcom_show_foundry_id, 9),
+	QCOM_SOCINFO_ATTR(pmic_model, qcom_show_pmic_model, 7),
+	QCOM_SOCINFO_ATTR(pmic_die_revision, qcom_show_pmic_die_revision, 7),
+	QCOM_SOCINFO_ATTR(platform_subtype, qcom_show_platform_subtype, 6),
+	QCOM_SOCINFO_ATTR(accessory_chip, qcom_show_accessory_chip, 5),
+	QCOM_SOCINFO_ATTR(platform_version, qcom_show_platform_version, 4),
+	QCOM_SOCINFO_ATTR(hw_platform, qcom_show_hw_platform, 3),
+	QCOM_SOCINFO_ATTR(raw_version, qcom_show_raw_version, 2),
+	QCOM_SOCINFO_ATTR(build_id, qcom_show_build_id, 1),
+};
+
+QCOM_SMEM_IMG_ITEM(boot, 0444, SMEM_IMAGE_TABLE_BOOT_INDEX);
+QCOM_SMEM_IMG_ITEM(tz, 0444, SMEM_IMAGE_TABLE_TZ_INDEX);
+QCOM_SMEM_IMG_ITEM(rpm, 0444, SMEM_IMAGE_TABLE_RPM_INDEX);
+QCOM_SMEM_IMG_ITEM(apps, 0644, SMEM_IMAGE_TABLE_APPS_INDEX);
+QCOM_SMEM_IMG_ITEM(mpss, 0444, SMEM_IMAGE_TABLE_MPSS_INDEX);
+QCOM_SMEM_IMG_ITEM(adsp, 0444, SMEM_IMAGE_TABLE_ADSP_INDEX);
+QCOM_SMEM_IMG_ITEM(cnss, 0444, SMEM_IMAGE_TABLE_CNSS_INDEX);
+QCOM_SMEM_IMG_ITEM(video, 0444, SMEM_IMAGE_TABLE_VIDEO_INDEX);
+
+static const
+struct attribute_group *smem_img_tbl[SMEM_IMAGE_VERSION_BLOCKS_COUNT] = {
+		[SMEM_IMAGE_TABLE_BOOT_INDEX] = &boot_image_attr_group,
+		[SMEM_IMAGE_TABLE_TZ_INDEX] = &tz_image_attr_group,
+		[SMEM_IMAGE_TABLE_RPM_INDEX] = &rpm_image_attr_group,
+		[SMEM_IMAGE_TABLE_APPS_INDEX] = &apps_image_attr_group,
+		[SMEM_IMAGE_TABLE_MPSS_INDEX] = &mpss_image_attr_group,
+		[SMEM_IMAGE_TABLE_ADSP_INDEX] = &adsp_image_attr_group,
+		[SMEM_IMAGE_TABLE_CNSS_INDEX] = &cnss_image_attr_group,
+		[SMEM_IMAGE_TABLE_VIDEO_INDEX] = &video_image_attr_group,
+};
+
+static const char *socinfo_get_id_string(int id)
+{
+	int idx;
+
+	for (idx = 0; idx < ARRAY_SIZE(soc_of_id); idx++) {
+		if (soc_of_id[idx].id == id)
+			return soc_of_id[idx].name;
+	}
+
+	return NULL;
+}
+
+void qcom_socinfo_init(struct device *device)
+{
+	struct soc_device_attribute *attr;
+	struct soc_device *soc_dev;
+	struct device *dev;
+	size_t item_size;
+	size_t size;
+	int i;
+
+	socinfo = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_HW_SW_BUILD_ID,
+				&item_size);
+	if (IS_ERR(socinfo)) {
+		dev_err(device, "Couldn't find socinfo\n");
+		return;
+	}
+
+	if (SOCINFO_VERSION_MAJOR(le32_to_cpu(socinfo->fmt) != 0) ||
+	    SOCINFO_VERSION_MINOR(le32_to_cpu(socinfo->fmt) < 0)  ||
+	    le32_to_cpu(socinfo->fmt) > MAX_SOCINFO_FORMAT) {
+		dev_err(device, "Wrong socinfo format\n");
+		return;
+	}
+
+	if (!le32_to_cpu(socinfo->id))
+		dev_err(device, "Unknown SoC ID!\n");
+
+	smem_image_version = qcom_smem_get(QCOM_SMEM_HOST_ANY,
+					   SMEM_IMAGE_VERSION_TABLE,
+					   &size);
+	if (IS_ERR(smem_image_version) || (size != SMEM_IMAGE_VERSION_SIZE)) {
+		dev_dbg(device, "Image version table absent\n");
+		smem_image_version = NULL;
+	}
+
+	attr = kzalloc(sizeof(*attr), GFP_KERNEL);
+	if (!attr)
+		return;
+
+	attr->soc_id = kasprintf(GFP_KERNEL, "%d",
+				 le32_to_cpu(socinfo->id));
+	attr->family = "Snapdragon";
+	attr->machine = socinfo_get_id_string(le32_to_cpu(socinfo->id));
+	attr->revision = kasprintf(GFP_KERNEL, "%u.%u",
+				   SOC_VER_MAJ(le32_to_cpu(socinfo->ver)),
+				   SOC_VER_MIN(le32_to_cpu(socinfo->ver)));
+
+	soc_dev = soc_device_register(attr);
+	if (IS_ERR(soc_dev)) {
+		kfree(attr);
+		return;
+	}
+
+	dev = soc_device_to_device(soc_dev);
+
+	/*
+	 * Expose SMEM_IMAGE_TABLE to sysfs only when we have IMAGE_TABLE
+	 * available in SMEM. As IMAGE_TABLE and SOCINFO are two separate
+	 * items within SMEM, we expose the remaining soc information (i.e
+	 * only the SOCINFO item available in SMEM) to sysfs even in the
+	 * absence of an IMAGE_TABLE.
+	 */
+	if (smem_image_version) {
+		for (i = 0; i < SMEM_IMAGE_VERSION_BLOCKS_COUNT; i++) {
+			if (smem_img_tbl[i])
+				WARN_ON(sysfs_create_group(&dev->kobj,
+					smem_img_tbl[i]));
+		}
+	}
+
+	for (i = 0; i < ARRAY_SIZE(socinfo_attrs); i++) {
+		if (socinfo_attrs[i].min_ver <=	le32_to_cpu(socinfo->fmt))
+			device_create_file(dev, &socinfo_attrs[i].attr);
+	}
+
+	/* Feed the soc specific unique data into entropy pool */
+	add_device_randomness(socinfo, item_size);
+}
+EXPORT_SYMBOL(qcom_socinfo_init);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* [PATCH v10 2/2] Documentation/ABI: Add ABI information for QCOM socinfo driver
  2017-02-20 16:47 [PATCH v10 0/2] soc: qcom: Add SoC info driver Imran Khan
  2017-02-20 16:47 ` [PATCH v10 1/2] " Imran Khan
@ 2017-02-20 16:47 ` Imran Khan
  2017-02-22 14:04   ` [v10, " Rob Herring
  1 sibling, 1 reply; 15+ messages in thread
From: Imran Khan @ 2017-02-20 16:47 UTC (permalink / raw)
  To: bjorn.andersson, sboyd
  Cc: agross, linux-arm-msm, linux-kernel, linux-soc, Imran Khan

The socinfo ABI document describes the information provided
by socinfo driver and the corresponding attributes to access
that information.

Signed-off-by: Imran Khan <kimran@codeaurora.org>
---
 .../ABI/testing/sysfs-driver-qcom_socinfo          | 171 +++++++++++++++++++++
 1 file changed, 171 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-qcom_socinfo

diff --git a/Documentation/ABI/testing/sysfs-driver-qcom_socinfo b/Documentation/ABI/testing/sysfs-driver-qcom_socinfo
new file mode 100644
index 0000000..cce611f
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-driver-qcom_socinfo
@@ -0,0 +1,171 @@
+What:		/sys/devices/soc0/accessory_chip
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		This file shows the id of the accessory chip.
+
+What:		/sys/devices/soc0/adsp_image_crm
+What:		/sys/devices/soc0/adsp_image_variant
+What:		/sys/devices/soc0/adsp_image_version
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		These files respectively show the crm version, variant and
+		version of the ADSP image.
+
+What:		/sys/devices/soc0/apps_image_crm
+What:		/sys/devices/soc0/apps_image_variant
+What:		/sys/devices/soc0/apps_image_version
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		These files respectively show the crm version, variant and
+		version of the APPS(Linux kernel, rootfs) image.
+
+What:		/sys/devices/soc0/boot_image_crm
+What:		/sys/devices/soc0/boot_image_variant
+What:		/sys/devices/soc0/boot_image_version
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		These files respectively show the crm version, variant and
+		version of the Boot(bootloader) image.
+
+What:		/sys/devices/soc0/build_id
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		This file shows the unique id of current build being used on
+		the system.
+
+What:		/sys/devices/soc0/cnss_image_crm
+What:		/sys/devices/soc0/cnss_image_variant
+What:		/sys/devices/soc0/cnss_image_version
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		These files respectively show the crm version, variant and
+		version of the CNSS image.
+
+What:		/sys/devices/soc0/family
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		This file shows the family(e.g Snapdragon) of the SoC.
+
+What:		/sys/devices/soc0/foundry_id
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		This file shows the id of the foundry, where soc was
+		manufactured.
+
+What:		/sys/devices/soc0/hw_platform
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		This file shows the type of hardware platform
+		(e.g MTP, QRD etc) where SoC is being used.
+
+What:		/sys/devices/soc0/machine
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		This file shows the machine name as given in the DT.
+
+What:		/sys/devices/soc0/mpss_image_crm
+What:		/sys/devices/soc0/mpss_image_variant
+What:		/sys/devices/soc0/mpss_image_version
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		These files respectively show the crm version, variant and
+		version of the MPSS image.
+
+What:		/sys/devices/soc0/platform_subtype
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		This file shows the sub-type of hardware platform
+		(SKUAA, SKUF etc.) where SoC is being used.
+
+What:		/sys/devices/soc0/platform_version
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		This file show the version of the hardware platform.
+
+What:		/sys/devices/soc0/pmic_die_revision
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		This file shows revision of PMIC die.
+
+What:		/sys/devices/soc0/pmic_model
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		This file shows name of PMIC model.
+
+What:		/sys/devices/soc0/qcom_odm
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		This file shows the ODM using the SoC.
+
+What:		/sys/devices/soc0/raw_version
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		This file shows raw version of the SoC.
+
+What:		/sys/devices/soc0/revision
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		This file shows revision of the SoC.
+
+What:		/sys/devices/soc0/rpm_image_crm
+What:		/sys/devices/soc0/rpm_image_variant
+What:		/sys/devices/soc0/rpm_image_version
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		These files respectively show the crm version, variant and
+		version of the RPM image.
+
+What:		/sys/devices/soc0/serial_number
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		This file shows serial number of the SoC.
+
+What:		/sys/devices/soc0/soc_id
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		This file shows the unique numeric id of a Qualcomm SoC.
+
+What:		/sys/devices/soc0/tz_image_crm
+What:		/sys/devices/soc0/tz_image_variant
+What:		/sys/devices/soc0/tz_image_version
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		These files respectively show the crm version, variant and
+		version of the TZ image.
+
+What:		/sys/devices/soc0/vendor
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		This file shows the vendor of the SoC.
+
+What:		/sys/devices/soc0/video_image_crm
+What:		/sys/devices/soc0/video_image_variant
+What:		/sys/devices/soc0/video_image_version
+Date:		January 2017
+Contact:	linux-arm-msm@vger.kernel.org
+Description:
+		These files respectively show the crm version, variant and
+		version of the video image.
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [v10, 2/2] Documentation/ABI: Add ABI information for QCOM socinfo driver
  2017-02-20 16:47 ` [PATCH v10 2/2] Documentation/ABI: Add ABI information for QCOM socinfo driver Imran Khan
@ 2017-02-22 14:04   ` Rob Herring
  2017-03-06  6:49     ` Imran Khan
  0 siblings, 1 reply; 15+ messages in thread
From: Rob Herring @ 2017-02-22 14:04 UTC (permalink / raw)
  To: Khan, Imran
  Cc: bjorn.andersson, sboyd, agross, linux-arm-msm, linux-kernel, linux-soc

On Mon, Feb 20, 2017 at 10:17:15PM +0530, Khan, Imran wrote:
> The socinfo ABI document describes the information provided
> by socinfo driver and the corresponding attributes to access
> that information.
> 
> Signed-off-by: Imran Khan <kimran@codeaurora.org>
> ---
>  .../ABI/testing/sysfs-driver-qcom_socinfo          | 171 +++++++++++++++++++++
>  1 file changed, 171 insertions(+)
>  create mode 100644 Documentation/ABI/testing/sysfs-driver-qcom_socinfo

Sorry to comment late on this (blame LWM), but I think creating this ABI 
is a mistake. The biggest issue I have is this doesn't scale if every 
SoC does its own thing. We should have a common interface so for example 
userspace can retrieve the serial number from any SoC in the same way. 
Yes, we can have custom attributes, but there should be common base.


> diff --git a/Documentation/ABI/testing/sysfs-driver-qcom_socinfo b/Documentation/ABI/testing/sysfs-driver-qcom_socinfo
> new file mode 100644
> index 0000000..cce611f
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-driver-qcom_socinfo
> @@ -0,0 +1,171 @@
> +What:		/sys/devices/soc0/accessory_chip
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		This file shows the id of the accessory chip.
> +
> +What:		/sys/devices/soc0/adsp_image_crm
> +What:		/sys/devices/soc0/adsp_image_variant
> +What:		/sys/devices/soc0/adsp_image_version
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		These files respectively show the crm version, variant and
> +		version of the ADSP image.

Shouldn't this be part of the ADSP driver?

> +
> +What:		/sys/devices/soc0/apps_image_crm
> +What:		/sys/devices/soc0/apps_image_variant
> +What:		/sys/devices/soc0/apps_image_version
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		These files respectively show the crm version, variant and
> +		version of the APPS(Linux kernel, rootfs) image.

Assuming that the kernel and rootfs are the same image and updated 
together?

> +
> +What:		/sys/devices/soc0/boot_image_crm
> +What:		/sys/devices/soc0/boot_image_variant
> +What:		/sys/devices/soc0/boot_image_version
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		These files respectively show the crm version, variant and
> +		version of the Boot(bootloader) image.
> +
> +What:		/sys/devices/soc0/build_id
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		This file shows the unique id of current build being used on
> +		the system.

Build of what? The kernel already has a build version.

> +
> +What:		/sys/devices/soc0/cnss_image_crm
> +What:		/sys/devices/soc0/cnss_image_variant
> +What:		/sys/devices/soc0/cnss_image_version
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		These files respectively show the crm version, variant and
> +		version of the CNSS image.
> +
> +What:		/sys/devices/soc0/family
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		This file shows the family(e.g Snapdragon) of the SoC.

Sounds like a standard attr.

> +
> +What:		/sys/devices/soc0/foundry_id
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		This file shows the id of the foundry, where soc was
> +		manufactured.

I don't see how userspace should care...

> +
> +What:		/sys/devices/soc0/hw_platform
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		This file shows the type of hardware platform
> +		(e.g MTP, QRD etc) where SoC is being used.

What's a platform?

> +
> +What:		/sys/devices/soc0/machine
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		This file shows the machine name as given in the DT.

This is already exposed.

> +
> +What:		/sys/devices/soc0/mpss_image_crm
> +What:		/sys/devices/soc0/mpss_image_variant
> +What:		/sys/devices/soc0/mpss_image_version
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		These files respectively show the crm version, variant and
> +		version of the MPSS image.

Part of the MPSS driver?

> +
> +What:		/sys/devices/soc0/platform_subtype
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		This file shows the sub-type of hardware platform
> +		(SKUAA, SKUF etc.) where SoC is being used.
> +
> +What:		/sys/devices/soc0/platform_version
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		This file show the version of the hardware platform.
> +
> +What:		/sys/devices/soc0/pmic_die_revision
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		This file shows revision of PMIC die.

Part of the PMIC driver?

> +
> +What:		/sys/devices/soc0/pmic_model
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		This file shows name of PMIC model.
> +
> +What:		/sys/devices/soc0/qcom_odm
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		This file shows the ODM using the SoC.

The vendor in the top-level compatible should provide this.

> +
> +What:		/sys/devices/soc0/raw_version
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		This file shows raw version of the SoC.
> +
> +What:		/sys/devices/soc0/revision
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		This file shows revision of the SoC.

Why do you need both?

> +
> +What:		/sys/devices/soc0/rpm_image_crm
> +What:		/sys/devices/soc0/rpm_image_variant
> +What:		/sys/devices/soc0/rpm_image_version
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		These files respectively show the crm version, variant and
> +		version of the RPM image.

RPM driver?

> +
> +What:		/sys/devices/soc0/serial_number
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		This file shows serial number of the SoC.

Already have a standard property in DT.

> +
> +What:		/sys/devices/soc0/soc_id
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		This file shows the unique numeric id of a Qualcomm SoC.

unique per chip or per SoC model?

> +
> +What:		/sys/devices/soc0/tz_image_crm
> +What:		/sys/devices/soc0/tz_image_variant
> +What:		/sys/devices/soc0/tz_image_version
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		These files respectively show the crm version, variant and
> +		version of the TZ image.

TZ driver?

> +
> +What:		/sys/devices/soc0/vendor
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		This file shows the vendor of the SoC.

Already in DT.

> +
> +What:		/sys/devices/soc0/video_image_crm
> +What:		/sys/devices/soc0/video_image_variant
> +What:		/sys/devices/soc0/video_image_version
> +Date:		January 2017
> +Contact:	linux-arm-msm@vger.kernel.org
> +Description:
> +		These files respectively show the crm version, variant and
> +		version of the video image.

Video as in display or video codec? Should be part of the driver.

Rob

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

* Re: [v10, 2/2] Documentation/ABI: Add ABI information for QCOM socinfo driver
  2017-02-22 14:04   ` [v10, " Rob Herring
@ 2017-03-06  6:49     ` Imran Khan
  2017-04-18 14:23       ` Imran Khan
  0 siblings, 1 reply; 15+ messages in thread
From: Imran Khan @ 2017-03-06  6:49 UTC (permalink / raw)
  To: Rob Herring
  Cc: bjorn.andersson, sboyd, agross, linux-arm-msm, linux-kernel, linux-soc

On 2/22/2017 7:34 PM, Rob Herring wrote:
> On Mon, Feb 20, 2017 at 10:17:15PM +0530, Khan, Imran wrote:
>> The socinfo ABI document describes the information provided
>> by socinfo driver and the corresponding attributes to access
>> that information.
>>
>> Signed-off-by: Imran Khan <kimran@codeaurora.org>
>> ---
>>  .../ABI/testing/sysfs-driver-qcom_socinfo          | 171 +++++++++++++++++++++
>>  1 file changed, 171 insertions(+)
>>  create mode 100644 Documentation/ABI/testing/sysfs-driver-qcom_socinfo
> 
> Sorry to comment late on this (blame LWM), but I think creating this ABI 
> is a mistake. The biggest issue I have is this doesn't scale if every 
> SoC does its own thing. We should have a common interface so for example 
> userspace can retrieve the serial number from any SoC in the same way. 
> Yes, we can have custom attributes, but there should be common base.
> 

Yeah, I agree about the scalability part. Could you please suggest some way to
implement a common base for the custom attributes. Like for serial number I think
we can put it in generic soc_device_attribute but for custom attributes like accessory_chip,
hw_platform etc., how can we implement a common base. Can we have a private pointer within
generic soc_device_attribute structure and this private pointer can point to custom attributes.
Or if you have some other suggestion to implement this common interface, please let me know.
> 
>> diff --git a/Documentation/ABI/testing/sysfs-driver-qcom_socinfo b/Documentation/ABI/testing/sysfs-driver-qcom_socinfo
>> new file mode 100644
>> index 0000000..cce611f
>> --- /dev/null
>> +++ b/Documentation/ABI/testing/sysfs-driver-qcom_socinfo
>> @@ -0,0 +1,171 @@
>> +What:		/sys/devices/soc0/accessory_chip
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		This file shows the id of the accessory chip.
>> +
>> +What:		/sys/devices/soc0/adsp_image_crm
>> +What:		/sys/devices/soc0/adsp_image_variant
>> +What:		/sys/devices/soc0/adsp_image_version
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		These files respectively show the crm version, variant and
>> +		version of the ADSP image.
> 
> Shouldn't this be part of the ADSP driver?
>
Yes, It can be but I wanted to keep the image information at a central location, 
rather than pushing it back to each driver. For image information we basically
read the same item from SMEM but use different offsets within it for different images,
so the idea was to read this information ( get SMEM handler) just once, rather than
doing it for each driver. 
But if this idea does not look correct, I can remove it from socinfo driver. 
 
>> +
>> +What:		/sys/devices/soc0/apps_image_crm
>> +What:		/sys/devices/soc0/apps_image_variant
>> +What:		/sys/devices/soc0/apps_image_version
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		These files respectively show the crm version, variant and
>> +		version of the APPS(Linux kernel, rootfs) image.
> 
> Assuming that the kernel and rootfs are the same image and updated 
> together?
> 

Yes. The kernel and rootfs are same image and they are updated together.

>> +
>> +What:		/sys/devices/soc0/boot_image_crm
>> +What:		/sys/devices/soc0/boot_image_variant
>> +What:		/sys/devices/soc0/boot_image_version
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		These files respectively show the crm version, variant and
>> +		version of the Boot(bootloader) image.
>> +
>> +What:		/sys/devices/soc0/build_id
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		This file shows the unique id of current build being used on
>> +		the system.
> 
> Build of what? The kernel already has a build version.
> 
This is not build id of the kernel. This is build ID of complete meta image.

>> +
>> +What:		/sys/devices/soc0/cnss_image_crm
>> +What:		/sys/devices/soc0/cnss_image_variant
>> +What:		/sys/devices/soc0/cnss_image_version
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		These files respectively show the crm version, variant and
>> +		version of the CNSS image.
>> +
>> +What:		/sys/devices/soc0/family
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		This file shows the family(e.g Snapdragon) of the SoC.
> 
> Sounds like a standard attr.
> 
Yeah. This is standard attribute. Will remove this from Documentation here.

>> +
>> +What:		/sys/devices/soc0/foundry_id
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		This file shows the id of the foundry, where soc was
>> +		manufactured.
> 
> I don't see how userspace should care...
> 
Yeah, usually user space would not care for such information. But sometimes we have 
come across h/w issues that were seen only on set of chips from a particular
foundry. Under such situations we use this information to confirm if a certain h/w
issue is specific to a batch from a particular foundry or not.

>> +
>> +What:		/sys/devices/soc0/hw_platform
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		This file shows the type of hardware platform
>> +		(e.g MTP, QRD etc) where SoC is being used.
> 
> What's a platform?
> 
We may use same soc on different type of platforms. For example for QCOM we have
MTP (board with which a debug board can be connected), QRD (no debug connection available).
Similarly other ODMs may have different kind of platforms based on same soc. 
hw_paltform indicates numeric id for different kind of such platforms.

>> +
>> +What:		/sys/devices/soc0/machine
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		This file shows the machine name as given in the DT.
> 
> This is already exposed.
> 
Yeah. Will remove it from this document.

>> +
>> +What:		/sys/devices/soc0/mpss_image_crm
>> +What:		/sys/devices/soc0/mpss_image_variant
>> +What:		/sys/devices/soc0/mpss_image_version
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		These files respectively show the crm version, variant and
>> +		version of the MPSS image.
> 
> Part of the MPSS driver?
> 
Agree. Kindly see my comment above for the ADSP image(adsp_image_xxx).

>> +
>> +What:		/sys/devices/soc0/platform_subtype
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		This file shows the sub-type of hardware platform
>> +		(SKUAA, SKUF etc.) where SoC is being used.
>> +
>> +What:		/sys/devices/soc0/platform_version
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		This file show the version of the hardware platform.
>> +
>> +What:		/sys/devices/soc0/pmic_die_revision
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		This file shows revision of PMIC die.
> 
> Part of the PMIC driver?
> 
Agree. Kindly see my comment above for the ADSP image(adsp_image_xxx).

>> +
>> +What:		/sys/devices/soc0/pmic_model
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		This file shows name of PMIC model.
>> +
>> +What:		/sys/devices/soc0/qcom_odm
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		This file shows the ODM using the SoC.
> 
> The vendor in the top-level compatible should provide this.
> 
Yeah. Have removed this in the latest version of driver. Will remove it 
from ABI document too.

>> +
>> +What:		/sys/devices/soc0/raw_version
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		This file shows raw version of the SoC.
>> +
>> +What:		/sys/devices/soc0/revision
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		This file shows revision of the SoC.
> 
> Why do you need both?
> 
Revision is version of the soc like 2.0, 3.0, 3.1 etc.
and raw_version is is raw chip version which is an strictly increasing 
integer counter, increasing for each version of the chip.
For example:
Version         Raw_version
1.0              0
1.1              1
2.0              2
2.1              3
2.2              4
3.0              5

>> +
>> +What:		/sys/devices/soc0/rpm_image_crm
>> +What:		/sys/devices/soc0/rpm_image_variant
>> +What:		/sys/devices/soc0/rpm_image_version
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		These files respectively show the crm version, variant and
>> +		version of the RPM image.
> 
> RPM driver?
> 
Agree. Kindly see my comment above for the ADSP image(adsp_image_xxx).

>> +
>> +What:		/sys/devices/soc0/serial_number
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		This file shows serial number of the SoC.
> 
> Already have a standard property in DT.
> 
>> +
>> +What:		/sys/devices/soc0/soc_id
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		This file shows the unique numeric id of a Qualcomm SoC.
> 
> unique per chip or per SoC model?
>
This is unique per SoC model. For example 8996 and 8996pro
would have different soc_id.
 
>> +
>> +What:		/sys/devices/soc0/tz_image_crm
>> +What:		/sys/devices/soc0/tz_image_variant
>> +What:		/sys/devices/soc0/tz_image_version
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		These files respectively show the crm version, variant and
>> +		version of the TZ image.
> 
> TZ driver?
> 
Agree. Kindly see my comment above for the ADSP image(adsp_image_xxx).

>> +
>> +What:		/sys/devices/soc0/vendor
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		This file shows the vendor of the SoC.
> 
> Already in DT.
>
Okay. Will remove this field from the driver and from the 
document.
 
>> +
>> +What:		/sys/devices/soc0/video_image_crm
>> +What:		/sys/devices/soc0/video_image_variant
>> +What:		/sys/devices/soc0/video_image_version
>> +Date:		January 2017
>> +Contact:	linux-arm-msm@vger.kernel.org
>> +Description:
>> +		These files respectively show the crm version, variant and
>> +		version of the video image.
> 
> Video as in display or video codec? Should be part of the driver.
> 
Agree. Kindly see my comment above for the ADSP image(adsp_image_xxx).
> Rob

Thanks for the review comments.

Thanks and Regards,
Imran
> --
> To unsubscribe from this list: send the line "unsubscribe linux-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a\nmember of the Code Aurora Forum, hosted by The Linux Foundation

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

* Re: [v10, 2/2] Documentation/ABI: Add ABI information for QCOM socinfo driver
  2017-03-06  6:49     ` Imran Khan
@ 2017-04-18 14:23       ` Imran Khan
  2017-04-24 16:00         ` Imran Khan
  0 siblings, 1 reply; 15+ messages in thread
From: Imran Khan @ 2017-04-18 14:23 UTC (permalink / raw)
  To: Rob Herring
  Cc: bjorn.andersson, sboyd, agross, linux-arm-msm, linux-kernel, linux-soc

Hi Rob,

On 3/6/2017 12:19 PM, Imran Khan wrote:
> On 2/22/2017 7:34 PM, Rob Herring wrote:
>> On Mon, Feb 20, 2017 at 10:17:15PM +0530, Khan, Imran wrote:
>>> The socinfo ABI document describes the information provided
>>> by socinfo driver and the corresponding attributes to access
>>> that information.
>>>
>>> Signed-off-by: Imran Khan <kimran@codeaurora.org>
>>> ---
>>>  .../ABI/testing/sysfs-driver-qcom_socinfo          | 171 +++++++++++++++++++++
>>>  1 file changed, 171 insertions(+)
>>>  create mode 100644 Documentation/ABI/testing/sysfs-driver-qcom_socinfo
>>
>> Sorry to comment late on this (blame LWM), but I think creating this ABI 
>> is a mistake. The biggest issue I have is this doesn't scale if every 
>> SoC does its own thing. We should have a common interface so for example 
>> userspace can retrieve the serial number from any SoC in the same way. 
>> Yes, we can have custom attributes, but there should be common base.
>>
> 
> Yeah, I agree about the scalability part. Could you please suggest some way to
> implement a common base for the custom attributes. Like for serial number I think
> we can put it in generic soc_device_attribute but for custom attributes like accessory_chip,
> hw_platform etc., how can we implement a common base. Can we have a private pointer within
> generic soc_device_attribute structure and this private pointer can point to custom attributes.
> Or if you have some other suggestion to implement this common interface, please let me know.

Could you please provide some feedback regarding this?

>>
>>> diff --git a/Documentation/ABI/testing/sysfs-driver-qcom_socinfo b/Documentation/ABI/testing/sysfs-driver-qcom_socinfo
>>> new file mode 100644
>>> index 0000000..cce611f
>>> --- /dev/null
>>> +++ b/Documentation/ABI/testing/sysfs-driver-qcom_socinfo
>>> @@ -0,0 +1,171 @@
>>> +What:		/sys/devices/soc0/accessory_chip
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		This file shows the id of the accessory chip.
>>> +
>>> +What:		/sys/devices/soc0/adsp_image_crm
>>> +What:		/sys/devices/soc0/adsp_image_variant
>>> +What:		/sys/devices/soc0/adsp_image_version
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		These files respectively show the crm version, variant and
>>> +		version of the ADSP image.
>>
>> Shouldn't this be part of the ADSP driver?
>>
> Yes, It can be but I wanted to keep the image information at a central location, 
> rather than pushing it back to each driver. For image information we basically
> read the same item from SMEM but use different offsets within it for different images,
> so the idea was to read this information ( get SMEM handler) just once, rather than
> doing it for each driver. 
> But if this idea does not look correct, I can remove it from socinfo driver. 
>  

Could you please provide some feedback regarding this?

>>> +
>>> +What:		/sys/devices/soc0/apps_image_crm
>>> +What:		/sys/devices/soc0/apps_image_variant
>>> +What:		/sys/devices/soc0/apps_image_version
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		These files respectively show the crm version, variant and
>>> +		version of the APPS(Linux kernel, rootfs) image.
>>
>> Assuming that the kernel and rootfs are the same image and updated 
>> together?
>>
> 
> Yes. The kernel and rootfs are same image and they are updated together.
> 
>>> +
>>> +What:		/sys/devices/soc0/boot_image_crm
>>> +What:		/sys/devices/soc0/boot_image_variant
>>> +What:		/sys/devices/soc0/boot_image_version
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		These files respectively show the crm version, variant and
>>> +		version of the Boot(bootloader) image.
>>> +
>>> +What:		/sys/devices/soc0/build_id
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		This file shows the unique id of current build being used on
>>> +		the system.
>>
>> Build of what? The kernel already has a build version.
>>
> This is not build id of the kernel. This is build ID of complete meta image.
> 
>>> +
>>> +What:		/sys/devices/soc0/cnss_image_crm
>>> +What:		/sys/devices/soc0/cnss_image_variant
>>> +What:		/sys/devices/soc0/cnss_image_version
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		These files respectively show the crm version, variant and
>>> +		version of the CNSS image.
>>> +
>>> +What:		/sys/devices/soc0/family
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		This file shows the family(e.g Snapdragon) of the SoC.
>>
>> Sounds like a standard attr.
>>
> Yeah. This is standard attribute. Will remove this from Documentation here.
> 
>>> +
>>> +What:		/sys/devices/soc0/foundry_id
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		This file shows the id of the foundry, where soc was
>>> +		manufactured.
>>
>> I don't see how userspace should care...
>>
> Yeah, usually user space would not care for such information. But sometimes we have 
> come across h/w issues that were seen only on set of chips from a particular
> foundry. Under such situations we use this information to confirm if a certain h/w
> issue is specific to a batch from a particular foundry or not.
> 
Could you please provide some feedback regarding this?

>>> +
>>> +What:		/sys/devices/soc0/hw_platform
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		This file shows the type of hardware platform
>>> +		(e.g MTP, QRD etc) where SoC is being used.
>>
>> What's a platform?
>>
> We may use same soc on different type of platforms. For example for QCOM we have
> MTP (board with which a debug board can be connected), QRD (no debug connection available).
> Similarly other ODMs may have different kind of platforms based on same soc. 
> hw_paltform indicates numeric id for different kind of such platforms.
> 
>>> +
>>> +What:		/sys/devices/soc0/machine
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		This file shows the machine name as given in the DT.
>>
>> This is already exposed.
>>
> Yeah. Will remove it from this document.
> 
>>> +
>>> +What:		/sys/devices/soc0/mpss_image_crm
>>> +What:		/sys/devices/soc0/mpss_image_variant
>>> +What:		/sys/devices/soc0/mpss_image_version
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		These files respectively show the crm version, variant and
>>> +		version of the MPSS image.
>>
>> Part of the MPSS driver?
>>
> Agree. Kindly see my comment above for the ADSP image(adsp_image_xxx).
> 
>>> +
>>> +What:		/sys/devices/soc0/platform_subtype
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		This file shows the sub-type of hardware platform
>>> +		(SKUAA, SKUF etc.) where SoC is being used.
>>> +
>>> +What:		/sys/devices/soc0/platform_version
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		This file show the version of the hardware platform.
>>> +
>>> +What:		/sys/devices/soc0/pmic_die_revision
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		This file shows revision of PMIC die.
>>
>> Part of the PMIC driver?
>>
> Agree. Kindly see my comment above for the ADSP image(adsp_image_xxx).
> 
>>> +
>>> +What:		/sys/devices/soc0/pmic_model
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		This file shows name of PMIC model.
>>> +
>>> +What:		/sys/devices/soc0/qcom_odm
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		This file shows the ODM using the SoC.
>>
>> The vendor in the top-level compatible should provide this.
>>
> Yeah. Have removed this in the latest version of driver. Will remove it 
> from ABI document too.
> 
>>> +
>>> +What:		/sys/devices/soc0/raw_version
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		This file shows raw version of the SoC.
>>> +
>>> +What:		/sys/devices/soc0/revision
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		This file shows revision of the SoC.
>>
>> Why do you need both?
>>
> Revision is version of the soc like 2.0, 3.0, 3.1 etc.
> and raw_version is is raw chip version which is an strictly increasing 
> integer counter, increasing for each version of the chip.
> For example:
> Version         Raw_version
> 1.0              0
> 1.1              1
> 2.0              2
> 2.1              3
> 2.2              4
> 3.0              5
> 
>>> +
>>> +What:		/sys/devices/soc0/rpm_image_crm
>>> +What:		/sys/devices/soc0/rpm_image_variant
>>> +What:		/sys/devices/soc0/rpm_image_version
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		These files respectively show the crm version, variant and
>>> +		version of the RPM image.
>>
>> RPM driver?
>>
> Agree. Kindly see my comment above for the ADSP image(adsp_image_xxx).
> 
>>> +
>>> +What:		/sys/devices/soc0/serial_number
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		This file shows serial number of the SoC.
>>
>> Already have a standard property in DT.
>>
>>> +
>>> +What:		/sys/devices/soc0/soc_id
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		This file shows the unique numeric id of a Qualcomm SoC.
>>
>> unique per chip or per SoC model?
>>
> This is unique per SoC model. For example 8996 and 8996pro
> would have different soc_id.
>  
>>> +
>>> +What:		/sys/devices/soc0/tz_image_crm
>>> +What:		/sys/devices/soc0/tz_image_variant
>>> +What:		/sys/devices/soc0/tz_image_version
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		These files respectively show the crm version, variant and
>>> +		version of the TZ image.
>>
>> TZ driver?
>>
> Agree. Kindly see my comment above for the ADSP image(adsp_image_xxx).
> 
>>> +
>>> +What:		/sys/devices/soc0/vendor
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		This file shows the vendor of the SoC.
>>
>> Already in DT.
>>
> Okay. Will remove this field from the driver and from the 
> document.
>  
>>> +
>>> +What:		/sys/devices/soc0/video_image_crm
>>> +What:		/sys/devices/soc0/video_image_variant
>>> +What:		/sys/devices/soc0/video_image_version
>>> +Date:		January 2017
>>> +Contact:	linux-arm-msm@vger.kernel.org
>>> +Description:
>>> +		These files respectively show the crm version, variant and
>>> +		version of the video image.
>>
>> Video as in display or video codec? Should be part of the driver.
>>
> Agree. Kindly see my comment above for the ADSP image(adsp_image_xxx).
>> Rob
> 
> Thanks for the review comments.
> 
> Thanks and Regards,
> Imran
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-soc" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> 
> 
Thanks and Regards,
Imran

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a\nmember of the Code Aurora Forum, hosted by The Linux Foundation

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

* Re: [v10, 2/2] Documentation/ABI: Add ABI information for QCOM socinfo driver
  2017-04-18 14:23       ` Imran Khan
@ 2017-04-24 16:00         ` Imran Khan
  2017-04-24 16:27           ` Rob Herring
  0 siblings, 1 reply; 15+ messages in thread
From: Imran Khan @ 2017-04-24 16:00 UTC (permalink / raw)
  To: Rob Herring
  Cc: bjorn.andersson, sboyd, agross, linux-arm-msm, linux-kernel, linux-soc

On 4/18/2017 7:53 PM, Imran Khan wrote:
Hi Rob,
Could you please provide some feedback so that this discussion can move forward
and ABI document can be finalized?
Without the ABI document we are not able to get the corresponding driver
finalized and get merged.

Thanks again for your time,
Imran
> Hi Rob,
> 
> On 3/6/2017 12:19 PM, Imran Khan wrote:
>> On 2/22/2017 7:34 PM, Rob Herring wrote:
>>> On Mon, Feb 20, 2017 at 10:17:15PM +0530, Khan, Imran wrote:
>>>> The socinfo ABI document describes the information provided
>>>> by socinfo driver and the corresponding attributes to access
>>>> that information.
>>>>
>>>> Signed-off-by: Imran Khan <kimran@codeaurora.org>
>>>> ---
>>>>  .../ABI/testing/sysfs-driver-qcom_socinfo          | 171 +++++++++++++++++++++
>>>>  1 file changed, 171 insertions(+)
>>>>  create mode 100644 Documentation/ABI/testing/sysfs-driver-qcom_socinfo
>>>
>>> Sorry to comment late on this (blame LWM), but I think creating this ABI 
>>> is a mistake. The biggest issue I have is this doesn't scale if every 
>>> SoC does its own thing. We should have a common interface so for example 
>>> userspace can retrieve the serial number from any SoC in the same way. 
>>> Yes, we can have custom attributes, but there should be common base.
>>>
>>
>> Yeah, I agree about the scalability part. Could you please suggest some way to
>> implement a common base for the custom attributes. Like for serial number I think
>> we can put it in generic soc_device_attribute but for custom attributes like accessory_chip,
>> hw_platform etc., how can we implement a common base. Can we have a private pointer within
>> generic soc_device_attribute structure and this private pointer can point to custom attributes.
>> Or if you have some other suggestion to implement this common interface, please let me know.
> 
> Could you please provide some feedback regarding this?
> 
>>>
>>>> diff --git a/Documentation/ABI/testing/sysfs-driver-qcom_socinfo b/Documentation/ABI/testing/sysfs-driver-qcom_socinfo
>>>> new file mode 100644
>>>> index 0000000..cce611f
>>>> --- /dev/null
>>>> +++ b/Documentation/ABI/testing/sysfs-driver-qcom_socinfo
>>>> @@ -0,0 +1,171 @@
>>>> +What:		/sys/devices/soc0/accessory_chip
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		This file shows the id of the accessory chip.
>>>> +
>>>> +What:		/sys/devices/soc0/adsp_image_crm
>>>> +What:		/sys/devices/soc0/adsp_image_variant
>>>> +What:		/sys/devices/soc0/adsp_image_version
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		These files respectively show the crm version, variant and
>>>> +		version of the ADSP image.
>>>
>>> Shouldn't this be part of the ADSP driver?
>>>
>> Yes, It can be but I wanted to keep the image information at a central location, 
>> rather than pushing it back to each driver. For image information we basically
>> read the same item from SMEM but use different offsets within it for different images,
>> so the idea was to read this information ( get SMEM handler) just once, rather than
>> doing it for each driver. 
>> But if this idea does not look correct, I can remove it from socinfo driver. 
>>  
> 
> Could you please provide some feedback regarding this?
> 
>>>> +
>>>> +What:		/sys/devices/soc0/apps_image_crm
>>>> +What:		/sys/devices/soc0/apps_image_variant
>>>> +What:		/sys/devices/soc0/apps_image_version
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		These files respectively show the crm version, variant and
>>>> +		version of the APPS(Linux kernel, rootfs) image.
>>>
>>> Assuming that the kernel and rootfs are the same image and updated 
>>> together?
>>>
>>
>> Yes. The kernel and rootfs are same image and they are updated together.
>>
>>>> +
>>>> +What:		/sys/devices/soc0/boot_image_crm
>>>> +What:		/sys/devices/soc0/boot_image_variant
>>>> +What:		/sys/devices/soc0/boot_image_version
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		These files respectively show the crm version, variant and
>>>> +		version of the Boot(bootloader) image.
>>>> +
>>>> +What:		/sys/devices/soc0/build_id
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		This file shows the unique id of current build being used on
>>>> +		the system.
>>>
>>> Build of what? The kernel already has a build version.
>>>
>> This is not build id of the kernel. This is build ID of complete meta image.
>>
>>>> +
>>>> +What:		/sys/devices/soc0/cnss_image_crm
>>>> +What:		/sys/devices/soc0/cnss_image_variant
>>>> +What:		/sys/devices/soc0/cnss_image_version
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		These files respectively show the crm version, variant and
>>>> +		version of the CNSS image.
>>>> +
>>>> +What:		/sys/devices/soc0/family
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		This file shows the family(e.g Snapdragon) of the SoC.
>>>
>>> Sounds like a standard attr.
>>>
>> Yeah. This is standard attribute. Will remove this from Documentation here.
>>
>>>> +
>>>> +What:		/sys/devices/soc0/foundry_id
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		This file shows the id of the foundry, where soc was
>>>> +		manufactured.
>>>
>>> I don't see how userspace should care...
>>>
>> Yeah, usually user space would not care for such information. But sometimes we have 
>> come across h/w issues that were seen only on set of chips from a particular
>> foundry. Under such situations we use this information to confirm if a certain h/w
>> issue is specific to a batch from a particular foundry or not.
>>
> Could you please provide some feedback regarding this?
> 
>>>> +
>>>> +What:		/sys/devices/soc0/hw_platform
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		This file shows the type of hardware platform
>>>> +		(e.g MTP, QRD etc) where SoC is being used.
>>>
>>> What's a platform?
>>>
>> We may use same soc on different type of platforms. For example for QCOM we have
>> MTP (board with which a debug board can be connected), QRD (no debug connection available).
>> Similarly other ODMs may have different kind of platforms based on same soc. 
>> hw_paltform indicates numeric id for different kind of such platforms.
>>
>>>> +
>>>> +What:		/sys/devices/soc0/machine
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		This file shows the machine name as given in the DT.
>>>
>>> This is already exposed.
>>>
>> Yeah. Will remove it from this document.
>>
>>>> +
>>>> +What:		/sys/devices/soc0/mpss_image_crm
>>>> +What:		/sys/devices/soc0/mpss_image_variant
>>>> +What:		/sys/devices/soc0/mpss_image_version
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		These files respectively show the crm version, variant and
>>>> +		version of the MPSS image.
>>>
>>> Part of the MPSS driver?
>>>
>> Agree. Kindly see my comment above for the ADSP image(adsp_image_xxx).
>>
>>>> +
>>>> +What:		/sys/devices/soc0/platform_subtype
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		This file shows the sub-type of hardware platform
>>>> +		(SKUAA, SKUF etc.) where SoC is being used.
>>>> +
>>>> +What:		/sys/devices/soc0/platform_version
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		This file show the version of the hardware platform.
>>>> +
>>>> +What:		/sys/devices/soc0/pmic_die_revision
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		This file shows revision of PMIC die.
>>>
>>> Part of the PMIC driver?
>>>
>> Agree. Kindly see my comment above for the ADSP image(adsp_image_xxx).
>>
>>>> +
>>>> +What:		/sys/devices/soc0/pmic_model
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		This file shows name of PMIC model.
>>>> +
>>>> +What:		/sys/devices/soc0/qcom_odm
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		This file shows the ODM using the SoC.
>>>
>>> The vendor in the top-level compatible should provide this.
>>>
>> Yeah. Have removed this in the latest version of driver. Will remove it 
>> from ABI document too.
>>
>>>> +
>>>> +What:		/sys/devices/soc0/raw_version
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		This file shows raw version of the SoC.
>>>> +
>>>> +What:		/sys/devices/soc0/revision
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		This file shows revision of the SoC.
>>>
>>> Why do you need both?
>>>
>> Revision is version of the soc like 2.0, 3.0, 3.1 etc.
>> and raw_version is is raw chip version which is an strictly increasing 
>> integer counter, increasing for each version of the chip.
>> For example:
>> Version         Raw_version
>> 1.0              0
>> 1.1              1
>> 2.0              2
>> 2.1              3
>> 2.2              4
>> 3.0              5
>>
>>>> +
>>>> +What:		/sys/devices/soc0/rpm_image_crm
>>>> +What:		/sys/devices/soc0/rpm_image_variant
>>>> +What:		/sys/devices/soc0/rpm_image_version
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		These files respectively show the crm version, variant and
>>>> +		version of the RPM image.
>>>
>>> RPM driver?
>>>
>> Agree. Kindly see my comment above for the ADSP image(adsp_image_xxx).
>>
>>>> +
>>>> +What:		/sys/devices/soc0/serial_number
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		This file shows serial number of the SoC.
>>>
>>> Already have a standard property in DT.
>>>
>>>> +
>>>> +What:		/sys/devices/soc0/soc_id
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		This file shows the unique numeric id of a Qualcomm SoC.
>>>
>>> unique per chip or per SoC model?
>>>
>> This is unique per SoC model. For example 8996 and 8996pro
>> would have different soc_id.
>>  
>>>> +
>>>> +What:		/sys/devices/soc0/tz_image_crm
>>>> +What:		/sys/devices/soc0/tz_image_variant
>>>> +What:		/sys/devices/soc0/tz_image_version
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		These files respectively show the crm version, variant and
>>>> +		version of the TZ image.
>>>
>>> TZ driver?
>>>
>> Agree. Kindly see my comment above for the ADSP image(adsp_image_xxx).
>>
>>>> +
>>>> +What:		/sys/devices/soc0/vendor
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		This file shows the vendor of the SoC.
>>>
>>> Already in DT.
>>>
>> Okay. Will remove this field from the driver and from the 
>> document.
>>  
>>>> +
>>>> +What:		/sys/devices/soc0/video_image_crm
>>>> +What:		/sys/devices/soc0/video_image_variant
>>>> +What:		/sys/devices/soc0/video_image_version
>>>> +Date:		January 2017
>>>> +Contact:	linux-arm-msm@vger.kernel.org
>>>> +Description:
>>>> +		These files respectively show the crm version, variant and
>>>> +		version of the video image.
>>>
>>> Video as in display or video codec? Should be part of the driver.
>>>
>> Agree. Kindly see my comment above for the ADSP image(adsp_image_xxx).
>>> Rob
>>
>> Thanks for the review comments.
>>
>> Thanks and Regards,
>> Imran
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-soc" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>
>>
>>
> Thanks and Regards,
> Imran
> 


-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a\nmember of the Code Aurora Forum, hosted by The Linux Foundation

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

* Re: [v10, 2/2] Documentation/ABI: Add ABI information for QCOM socinfo driver
  2017-04-24 16:00         ` Imran Khan
@ 2017-04-24 16:27           ` Rob Herring
  2017-04-24 23:05             ` Bjorn Andersson
  0 siblings, 1 reply; 15+ messages in thread
From: Rob Herring @ 2017-04-24 16:27 UTC (permalink / raw)
  To: Imran Khan
  Cc: Bjorn Andersson, Stephen Boyd, Andy Gross, linux-arm-msm,
	linux-kernel, open list:ARM/QUALCOMM SUPPORT

On Mon, Apr 24, 2017 at 11:00 AM, Imran Khan <kimran@codeaurora.org> wrote:
> On 4/18/2017 7:53 PM, Imran Khan wrote:
> Hi Rob,
> Could you please provide some feedback so that this discussion can move forward
> and ABI document can be finalized?
> Without the ABI document we are not able to get the corresponding driver
> finalized and get merged.
>
> Thanks again for your time,
> Imran
>> Hi Rob,
>>
>> On 3/6/2017 12:19 PM, Imran Khan wrote:
>>> On 2/22/2017 7:34 PM, Rob Herring wrote:
>>>> On Mon, Feb 20, 2017 at 10:17:15PM +0530, Khan, Imran wrote:
>>>>> The socinfo ABI document describes the information provided
>>>>> by socinfo driver and the corresponding attributes to access
>>>>> that information.
>>>>>
>>>>> Signed-off-by: Imran Khan <kimran@codeaurora.org>
>>>>> ---
>>>>>  .../ABI/testing/sysfs-driver-qcom_socinfo          | 171 +++++++++++++++++++++
>>>>>  1 file changed, 171 insertions(+)
>>>>>  create mode 100644 Documentation/ABI/testing/sysfs-driver-qcom_socinfo
>>>>
>>>> Sorry to comment late on this (blame LWM), but I think creating this ABI
>>>> is a mistake. The biggest issue I have is this doesn't scale if every
>>>> SoC does its own thing. We should have a common interface so for example
>>>> userspace can retrieve the serial number from any SoC in the same way.
>>>> Yes, we can have custom attributes, but there should be common base.
>>>>
>>>
>>> Yeah, I agree about the scalability part. Could you please suggest some way to
>>> implement a common base for the custom attributes. Like for serial number I think
>>> we can put it in generic soc_device_attribute but for custom attributes like accessory_chip,
>>> hw_platform etc., how can we implement a common base. Can we have a private pointer within
>>> generic soc_device_attribute structure and this private pointer can point to custom attributes.
>>> Or if you have some other suggestion to implement this common interface, please let me know.
>>
>> Could you please provide some feedback regarding this?

Splitting things between common and private seems like a good direction.

>>>>> diff --git a/Documentation/ABI/testing/sysfs-driver-qcom_socinfo b/Documentation/ABI/testing/sysfs-driver-qcom_socinfo
>>>>> new file mode 100644
>>>>> index 0000000..cce611f
>>>>> --- /dev/null
>>>>> +++ b/Documentation/ABI/testing/sysfs-driver-qcom_socinfo
>>>>> @@ -0,0 +1,171 @@
>>>>> +What:             /sys/devices/soc0/accessory_chip
>>>>> +Date:             January 2017
>>>>> +Contact:  linux-arm-msm@vger.kernel.org
>>>>> +Description:
>>>>> +          This file shows the id of the accessory chip.
>>>>> +
>>>>> +What:             /sys/devices/soc0/adsp_image_crm
>>>>> +What:             /sys/devices/soc0/adsp_image_variant
>>>>> +What:             /sys/devices/soc0/adsp_image_version
>>>>> +Date:             January 2017
>>>>> +Contact:  linux-arm-msm@vger.kernel.org
>>>>> +Description:
>>>>> +          These files respectively show the crm version, variant and
>>>>> +          version of the ADSP image.
>>>>
>>>> Shouldn't this be part of the ADSP driver?
>>>>
>>> Yes, It can be but I wanted to keep the image information at a central location,
>>> rather than pushing it back to each driver. For image information we basically
>>> read the same item from SMEM but use different offsets within it for different images,
>>> so the idea was to read this information ( get SMEM handler) just once, rather than
>>> doing it for each driver.
>>> But if this idea does not look correct, I can remove it from socinfo driver.
>>>
>>
>> Could you please provide some feedback regarding this?

I don't think parsing things once will save you much.

>>
>>>>> +
>>>>> +What:             /sys/devices/soc0/apps_image_crm
>>>>> +What:             /sys/devices/soc0/apps_image_variant
>>>>> +What:             /sys/devices/soc0/apps_image_version
>>>>> +Date:             January 2017
>>>>> +Contact:  linux-arm-msm@vger.kernel.org
>>>>> +Description:
>>>>> +          These files respectively show the crm version, variant and
>>>>> +          version of the APPS(Linux kernel, rootfs) image.
>>>>
>>>> Assuming that the kernel and rootfs are the same image and updated
>>>> together?
>>>>
>>>
>>> Yes. The kernel and rootfs are same image and they are updated together.

Maybe for you, but generally those are separate pieces.

>>>
>>>>> +
>>>>> +What:             /sys/devices/soc0/boot_image_crm
>>>>> +What:             /sys/devices/soc0/boot_image_variant
>>>>> +What:             /sys/devices/soc0/boot_image_version
>>>>> +Date:             January 2017
>>>>> +Contact:  linux-arm-msm@vger.kernel.org
>>>>> +Description:
>>>>> +          These files respectively show the crm version, variant and
>>>>> +          version of the Boot(bootloader) image.
>>>>> +
>>>>> +What:             /sys/devices/soc0/build_id
>>>>> +Date:             January 2017
>>>>> +Contact:  linux-arm-msm@vger.kernel.org
>>>>> +Description:
>>>>> +          This file shows the unique id of current build being used on
>>>>> +          the system.
>>>>
>>>> Build of what? The kernel already has a build version.
>>>>
>>> This is not build id of the kernel. This is build ID of complete meta image.

That's assuming everything is built together which generally isn't
true. It doesn't seem like that is information the kernel should
provide.

>>>
>>>>> +
>>>>> +What:             /sys/devices/soc0/cnss_image_crm
>>>>> +What:             /sys/devices/soc0/cnss_image_variant
>>>>> +What:             /sys/devices/soc0/cnss_image_version
>>>>> +Date:             January 2017
>>>>> +Contact:  linux-arm-msm@vger.kernel.org
>>>>> +Description:
>>>>> +          These files respectively show the crm version, variant and
>>>>> +          version of the CNSS image.
>>>>> +
>>>>> +What:             /sys/devices/soc0/family
>>>>> +Date:             January 2017
>>>>> +Contact:  linux-arm-msm@vger.kernel.org
>>>>> +Description:
>>>>> +          This file shows the family(e.g Snapdragon) of the SoC.
>>>>
>>>> Sounds like a standard attr.
>>>>
>>> Yeah. This is standard attribute. Will remove this from Documentation here.
>>>
>>>>> +
>>>>> +What:             /sys/devices/soc0/foundry_id
>>>>> +Date:             January 2017
>>>>> +Contact:  linux-arm-msm@vger.kernel.org
>>>>> +Description:
>>>>> +          This file shows the id of the foundry, where soc was
>>>>> +          manufactured.
>>>>
>>>> I don't see how userspace should care...
>>>>
>>> Yeah, usually user space would not care for such information. But sometimes we have
>>> come across h/w issues that were seen only on set of chips from a particular
>>> foundry. Under such situations we use this information to confirm if a certain h/w
>>> issue is specific to a batch from a particular foundry or not.
>>>
>> Could you please provide some feedback regarding this?

The qcom compatible string format already provides this. I don't think
we need 2 ABIs that are both vendor specific to expose this. Now if
there's other vendors wanting to expose the foundry, then a common
attr would make sense.

compatible = "qcom,<SoC>[-<soc_version>][-<foundry_id>]-<board>[/<subtype>][-<board_version>]"

>>
>>>>> +
>>>>> +What:             /sys/devices/soc0/hw_platform
>>>>> +Date:             January 2017
>>>>> +Contact:  linux-arm-msm@vger.kernel.org
>>>>> +Description:
>>>>> +          This file shows the type of hardware platform
>>>>> +          (e.g MTP, QRD etc) where SoC is being used.
>>>>
>>>> What's a platform?
>>>>
>>> We may use same soc on different type of platforms. For example for QCOM we have
>>> MTP (board with which a debug board can be connected), QRD (no debug connection available).
>>> Similarly other ODMs may have different kind of platforms based on same soc.
>>> hw_paltform indicates numeric id for different kind of such platforms.

As above, I believe /compatible already provides that information.

Rob

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

* Re: [v10, 2/2] Documentation/ABI: Add ABI information for QCOM socinfo driver
  2017-04-24 16:27           ` Rob Herring
@ 2017-04-24 23:05             ` Bjorn Andersson
  2017-04-25  7:35               ` Imran Khan
  2017-04-25 17:13               ` Rob Herring
  0 siblings, 2 replies; 15+ messages in thread
From: Bjorn Andersson @ 2017-04-24 23:05 UTC (permalink / raw)
  To: Rob Herring
  Cc: Imran Khan, Stephen Boyd, Andy Gross, linux-arm-msm,
	linux-kernel, open list:ARM/QUALCOMM SUPPORT

On Mon 24 Apr 09:27 PDT 2017, Rob Herring wrote:

> On Mon, Apr 24, 2017 at 11:00 AM, Imran Khan <kimran@codeaurora.org> wrote:
> > On 4/18/2017 7:53 PM, Imran Khan wrote:
> > Hi Rob,
> > Could you please provide some feedback so that this discussion can move forward
> > and ABI document can be finalized?
> > Without the ABI document we are not able to get the corresponding driver
> > finalized and get merged.
> >
> > Thanks again for your time,
> > Imran
> >> Hi Rob,
> >>
> >> On 3/6/2017 12:19 PM, Imran Khan wrote:
> >>> On 2/22/2017 7:34 PM, Rob Herring wrote:
> >>>> On Mon, Feb 20, 2017 at 10:17:15PM +0530, Khan, Imran wrote:
> >>>>> The socinfo ABI document describes the information provided
> >>>>> by socinfo driver and the corresponding attributes to access
> >>>>> that information.
> >>>>>
> >>>>> Signed-off-by: Imran Khan <kimran@codeaurora.org>
> >>>>> ---
> >>>>>  .../ABI/testing/sysfs-driver-qcom_socinfo          | 171 +++++++++++++++++++++
> >>>>>  1 file changed, 171 insertions(+)
> >>>>>  create mode 100644 Documentation/ABI/testing/sysfs-driver-qcom_socinfo
> >>>>
> >>>> Sorry to comment late on this (blame LWM), but I think creating this ABI
> >>>> is a mistake. The biggest issue I have is this doesn't scale if every
> >>>> SoC does its own thing. We should have a common interface so for example
> >>>> userspace can retrieve the serial number from any SoC in the same way.
> >>>> Yes, we can have custom attributes, but there should be common base.
> >>>>
> >>>
> >>> Yeah, I agree about the scalability part. Could you please suggest some way to
> >>> implement a common base for the custom attributes. Like for serial number I think
> >>> we can put it in generic soc_device_attribute but for custom attributes like accessory_chip,
> >>> hw_platform etc., how can we implement a common base. Can we have a private pointer within
> >>> generic soc_device_attribute structure and this private pointer can point to custom attributes.
> >>> Or if you have some other suggestion to implement this common interface, please let me know.
> >>
> >> Could you please provide some feedback regarding this?
> 
> Splitting things between common and private seems like a good direction.
> 

But the pattern of amending the common attributes with vendor or
platform-specific ones is how its done in other drivers, e.g.
integrator.

Why should we for the Qualcomm case make up some other pattern?

Or am I misunderstanding your suggestion?

> >>>>> diff --git a/Documentation/ABI/testing/sysfs-driver-qcom_socinfo b/Documentation/ABI/testing/sysfs-driver-qcom_socinfo
> >>>>> new file mode 100644
> >>>>> index 0000000..cce611f
> >>>>> --- /dev/null
> >>>>> +++ b/Documentation/ABI/testing/sysfs-driver-qcom_socinfo
> >>>>> @@ -0,0 +1,171 @@
> >>>>> +What:             /sys/devices/soc0/accessory_chip
> >>>>> +Date:             January 2017
> >>>>> +Contact:  linux-arm-msm@vger.kernel.org
> >>>>> +Description:
> >>>>> +          This file shows the id of the accessory chip.
> >>>>> +
> >>>>> +What:             /sys/devices/soc0/adsp_image_crm
> >>>>> +What:             /sys/devices/soc0/adsp_image_variant
> >>>>> +What:             /sys/devices/soc0/adsp_image_version
> >>>>> +Date:             January 2017
> >>>>> +Contact:  linux-arm-msm@vger.kernel.org
> >>>>> +Description:
> >>>>> +          These files respectively show the crm version, variant and
> >>>>> +          version of the ADSP image.
> >>>>
> >>>> Shouldn't this be part of the ADSP driver?
> >>>>
> >>> Yes, It can be but I wanted to keep the image information at a central location,
> >>> rather than pushing it back to each driver. For image information we basically
> >>> read the same item from SMEM but use different offsets within it for different images,
> >>> so the idea was to read this information ( get SMEM handler) just once, rather than
> >>> doing it for each driver.
> >>> But if this idea does not look correct, I can remove it from socinfo driver.
> >>>
> >>
> >> Could you please provide some feedback regarding this?
> 
> I don't think parsing things once will save you much.
> 

Defining the struct in some shared header file and implementing the
"parsing" throughout various drivers would probably work out fine.

What I do not fancy is where these "parsers" would be implemented and
where the information would end up in sysfs.

"The ADSP driver" has to refer to the remoteproc driver for the adsp and
it would be reasonable to have version information of the firmware
available for a running piece of remoteproc. The same would work out for
modem and wireless.

The v4l driver is responsible for controlling the venus core, so it
could provide the version attribute - which would show up somewhere in
the /sys/bus/platform hierarchy.

We have a mfd-like driver for communicating with the RPM, so perhaps we
could shoehorn in an attribute there. But the sysfs path will be
completely different, depending on platform and system configuration.

There is no driver representing the boot code.


So, when Android goes belly up and we want to produce a bugreport that
describes all the pieces of the system we will have to all over sysfs to
figure out the versions of the firmware...

> >>
> >>>>> +
> >>>>> +What:             /sys/devices/soc0/apps_image_crm
> >>>>> +What:             /sys/devices/soc0/apps_image_variant
> >>>>> +What:             /sys/devices/soc0/apps_image_version
> >>>>> +Date:             January 2017
> >>>>> +Contact:  linux-arm-msm@vger.kernel.org
> >>>>> +Description:
> >>>>> +          These files respectively show the crm version, variant and
> >>>>> +          version of the APPS(Linux kernel, rootfs) image.
> >>>>
> >>>> Assuming that the kernel and rootfs are the same image and updated
> >>>> together?
> >>>>
> >>>
> >>> Yes. The kernel and rootfs are same image and they are updated together.
> 
> Maybe for you, but generally those are separate pieces.
> 

This attribute is special in that it is populated from user space, so
any tool running on apps should be able to fetch it directly anyways
(e.g. from Android properties).

Imran, is there any users of this information outside the apps context?
E.g. does your tools for analysing memory-dumps depend on this
information being available in SMEM?

> >>>
> >>>>> +
> >>>>> +What:             /sys/devices/soc0/boot_image_crm
> >>>>> +What:             /sys/devices/soc0/boot_image_variant
> >>>>> +What:             /sys/devices/soc0/boot_image_version
> >>>>> +Date:             January 2017
> >>>>> +Contact:  linux-arm-msm@vger.kernel.org
> >>>>> +Description:
> >>>>> +          These files respectively show the crm version, variant and
> >>>>> +          version of the Boot(bootloader) image.
> >>>>> +
> >>>>> +What:             /sys/devices/soc0/build_id
> >>>>> +Date:             January 2017
> >>>>> +Contact:  linux-arm-msm@vger.kernel.org
> >>>>> +Description:
> >>>>> +          This file shows the unique id of current build being used on
> >>>>> +          the system.
> >>>>
> >>>> Build of what? The kernel already has a build version.
> >>>>
> >>> This is not build id of the kernel. This is build ID of complete meta image.
> 
> That's assuming everything is built together which generally isn't
> true.

Not necessarily compiled together, but packaged up in something that
gets a "release number" - which I presume is quite common for any type
of embedded products.

E.g. we do give the Linaro releases version numbers such as "16.09".

> It doesn't seem like that is information the kernel should
> provide.
> 

I used to say that we could just store this information in a file in
/etc (or in build.prop), then I started doing post-build composition and
realized that you really do want a new system-version if you change e.g.
the version of the boot firmware - without having to regenerate the
rootfs.

So while I agree that this is none of the kernel's business I'm not sure
how you would get this information from SMEM to a user space process for
e.g. bugreport generation purposes.

> >>>
> >>>>> +
> >>>>> +What:             /sys/devices/soc0/cnss_image_crm
> >>>>> +What:             /sys/devices/soc0/cnss_image_variant
> >>>>> +What:             /sys/devices/soc0/cnss_image_version
> >>>>> +Date:             January 2017
> >>>>> +Contact:  linux-arm-msm@vger.kernel.org
> >>>>> +Description:
> >>>>> +          These files respectively show the crm version, variant and
> >>>>> +          version of the CNSS image.
> >>>>> +
> >>>>> +What:             /sys/devices/soc0/family
> >>>>> +Date:             January 2017
> >>>>> +Contact:  linux-arm-msm@vger.kernel.org
> >>>>> +Description:
> >>>>> +          This file shows the family(e.g Snapdragon) of the SoC.
> >>>>
> >>>> Sounds like a standard attr.
> >>>>
> >>> Yeah. This is standard attribute. Will remove this from Documentation here.
> >>>
> >>>>> +
> >>>>> +What:             /sys/devices/soc0/foundry_id
> >>>>> +Date:             January 2017
> >>>>> +Contact:  linux-arm-msm@vger.kernel.org
> >>>>> +Description:
> >>>>> +          This file shows the id of the foundry, where soc was
> >>>>> +          manufactured.
> >>>>
> >>>> I don't see how userspace should care...
> >>>>
> >>> Yeah, usually user space would not care for such information. But sometimes we have
> >>> come across h/w issues that were seen only on set of chips from a particular
> >>> foundry. Under such situations we use this information to confirm if a certain h/w
> >>> issue is specific to a batch from a particular foundry or not.
> >>>
> >> Could you please provide some feedback regarding this?
> 
> The qcom compatible string format already provides this. I don't think
> we need 2 ABIs that are both vendor specific to expose this. Now if
> there's other vendors wanting to expose the foundry, then a common
> attr would make sense.
> 
> compatible = "qcom,<SoC>[-<soc_version>][-<foundry_id>]-<board>[/<subtype>][-<board_version>]"
> 

For userspace to be able to parse out this information from
/proc/device-tree/compatible we need to improve that expression quite a
bit! What's the foundry_id of <"acme,phone-a","qcom,platform-b-c">?

> >>
> >>>>> +
> >>>>> +What:             /sys/devices/soc0/hw_platform
> >>>>> +Date:             January 2017
> >>>>> +Contact:  linux-arm-msm@vger.kernel.org
> >>>>> +Description:
> >>>>> +          This file shows the type of hardware platform
> >>>>> +          (e.g MTP, QRD etc) where SoC is being used.
> >>>>
> >>>> What's a platform?
> >>>>
> >>> We may use same soc on different type of platforms. For example for QCOM we have
> >>> MTP (board with which a debug board can be connected), QRD (no debug connection available).
> >>> Similarly other ODMs may have different kind of platforms based on same soc.
> >>> hw_paltform indicates numeric id for different kind of such platforms.
> 
> As above, I believe /compatible already provides that information.
> 

I believe this is what OMAP calls "type", in a custom attribute on the
side of the common ones.

But as far as I can see this information should be trivial to derive
from the compatible of the board. Imran, what is this data used for?

Regards,
Bjorn

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

* Re: [v10, 2/2] Documentation/ABI: Add ABI information for QCOM socinfo driver
  2017-04-24 23:05             ` Bjorn Andersson
@ 2017-04-25  7:35               ` Imran Khan
  2017-04-25 17:13               ` Rob Herring
  1 sibling, 0 replies; 15+ messages in thread
From: Imran Khan @ 2017-04-25  7:35 UTC (permalink / raw)
  To: Bjorn Andersson, Rob Herring
  Cc: Stephen Boyd, Andy Gross, linux-arm-msm, linux-kernel,
	open list:ARM/QUALCOMM SUPPORT

On 4/25/2017 4:35 AM, Bjorn Andersson wrote:
> On Mon 24 Apr 09:27 PDT 2017, Rob Herring wrote:
> 
>> On Mon, Apr 24, 2017 at 11:00 AM, Imran Khan <kimran@codeaurora.org> wrote:
>>> On 4/18/2017 7:53 PM, Imran Khan wrote:
>>> Hi Rob,
>>> Could you please provide some feedback so that this discussion can move forward
>>> and ABI document can be finalized?
>>> Without the ABI document we are not able to get the corresponding driver
>>> finalized and get merged.
>>>
>>> Thanks again for your time,
>>> Imran
>>>> Hi Rob,
>>>>
>>>> On 3/6/2017 12:19 PM, Imran Khan wrote:
>>>>> On 2/22/2017 7:34 PM, Rob Herring wrote:
>>>>>> On Mon, Feb 20, 2017 at 10:17:15PM +0530, Khan, Imran wrote:
>>>>>>> The socinfo ABI document describes the information provided
>>>>>>> by socinfo driver and the corresponding attributes to access
>>>>>>> that information.
>>>>>>>
>>>>>>> Signed-off-by: Imran Khan <kimran@codeaurora.org>
>>>>>>> ---
>>>>>>>  .../ABI/testing/sysfs-driver-qcom_socinfo          | 171 +++++++++++++++++++++
>>>>>>>  1 file changed, 171 insertions(+)
>>>>>>>  create mode 100644 Documentation/ABI/testing/sysfs-driver-qcom_socinfo
>>>>>>
>>>>>> Sorry to comment late on this (blame LWM), but I think creating this ABI
>>>>>> is a mistake. The biggest issue I have is this doesn't scale if every
>>>>>> SoC does its own thing. We should have a common interface so for example
>>>>>> userspace can retrieve the serial number from any SoC in the same way.
>>>>>> Yes, we can have custom attributes, but there should be common base.
>>>>>>
>>>>>
>>>>> Yeah, I agree about the scalability part. Could you please suggest some way to
>>>>> implement a common base for the custom attributes. Like for serial number I think
>>>>> we can put it in generic soc_device_attribute but for custom attributes like accessory_chip,
>>>>> hw_platform etc., how can we implement a common base. Can we have a private pointer within
>>>>> generic soc_device_attribute structure and this private pointer can point to custom attributes.
>>>>> Or if you have some other suggestion to implement this common interface, please let me know.
>>>>
>>>> Could you please provide some feedback regarding this?
>>
>> Splitting things between common and private seems like a good direction.
>>
> 
> But the pattern of amending the common attributes with vendor or
> platform-specific ones is how its done in other drivers, e.g.
> integrator.
> 
> Why should we for the Qualcomm case make up some other pattern?
> 
> Or am I misunderstanding your suggestion?
> 
>>>>>>> diff --git a/Documentation/ABI/testing/sysfs-driver-qcom_socinfo b/Documentation/ABI/testing/sysfs-driver-qcom_socinfo
>>>>>>> new file mode 100644
>>>>>>> index 0000000..cce611f
>>>>>>> --- /dev/null
>>>>>>> +++ b/Documentation/ABI/testing/sysfs-driver-qcom_socinfo
>>>>>>> @@ -0,0 +1,171 @@
>>>>>>> +What:             /sys/devices/soc0/accessory_chip
>>>>>>> +Date:             January 2017
>>>>>>> +Contact:  linux-arm-msm@vger.kernel.org
>>>>>>> +Description:
>>>>>>> +          This file shows the id of the accessory chip.
>>>>>>> +
>>>>>>> +What:             /sys/devices/soc0/adsp_image_crm
>>>>>>> +What:             /sys/devices/soc0/adsp_image_variant
>>>>>>> +What:             /sys/devices/soc0/adsp_image_version
>>>>>>> +Date:             January 2017
>>>>>>> +Contact:  linux-arm-msm@vger.kernel.org
>>>>>>> +Description:
>>>>>>> +          These files respectively show the crm version, variant and
>>>>>>> +          version of the ADSP image.
>>>>>>
>>>>>> Shouldn't this be part of the ADSP driver?
>>>>>>
>>>>> Yes, It can be but I wanted to keep the image information at a central location,
>>>>> rather than pushing it back to each driver. For image information we basically
>>>>> read the same item from SMEM but use different offsets within it for different images,
>>>>> so the idea was to read this information ( get SMEM handler) just once, rather than
>>>>> doing it for each driver.
>>>>> But if this idea does not look correct, I can remove it from socinfo driver.
>>>>>
>>>>
>>>> Could you please provide some feedback regarding this?
>>
>> I don't think parsing things once will save you much.
>>
> 
> Defining the struct in some shared header file and implementing the
> "parsing" throughout various drivers would probably work out fine.
> 
> What I do not fancy is where these "parsers" would be implemented and
> where the information would end up in sysfs.
> 
> "The ADSP driver" has to refer to the remoteproc driver for the adsp and
> it would be reasonable to have version information of the firmware
> available for a running piece of remoteproc. The same would work out for
> modem and wireless.
> 
> The v4l driver is responsible for controlling the venus core, so it
> could provide the version attribute - which would show up somewhere in
> the /sys/bus/platform hierarchy.
> 
> We have a mfd-like driver for communicating with the RPM, so perhaps we
> could shoehorn in an attribute there. But the sysfs path will be
> completely different, depending on platform and system configuration.
> 
> There is no driver representing the boot code.
> 
> 
> So, when Android goes belly up and we want to produce a bugreport that
> describes all the pieces of the system we will have to all over sysfs to
> figure out the versions of the firmware...
> 
>>>>
>>>>>>> +
>>>>>>> +What:             /sys/devices/soc0/apps_image_crm
>>>>>>> +What:             /sys/devices/soc0/apps_image_variant
>>>>>>> +What:             /sys/devices/soc0/apps_image_version
>>>>>>> +Date:             January 2017
>>>>>>> +Contact:  linux-arm-msm@vger.kernel.org
>>>>>>> +Description:
>>>>>>> +          These files respectively show the crm version, variant and
>>>>>>> +          version of the APPS(Linux kernel, rootfs) image.
>>>>>>
>>>>>> Assuming that the kernel and rootfs are the same image and updated
>>>>>> together?
>>>>>>
>>>>>
>>>>> Yes. The kernel and rootfs are same image and they are updated together.
>>
>> Maybe for you, but generally those are separate pieces.
>>
> 
> This attribute is special in that it is populated from user space, so
> any tool running on apps should be able to fetch it directly anyways
> (e.g. from Android properties).
> 
> Imran, is there any users of this information outside the apps context?
> E.g. does your tools for analysing memory-dumps depend on this
> information being available in SMEM?
> 

Yes, apart from apps our memory dump analyzers and diag tools make use of this 
information

>>>>>
>>>>>>> +
>>>>>>> +What:             /sys/devices/soc0/boot_image_crm
>>>>>>> +What:             /sys/devices/soc0/boot_image_variant
>>>>>>> +What:             /sys/devices/soc0/boot_image_version
>>>>>>> +Date:             January 2017
>>>>>>> +Contact:  linux-arm-msm@vger.kernel.org
>>>>>>> +Description:
>>>>>>> +          These files respectively show the crm version, variant and
>>>>>>> +          version of the Boot(bootloader) image.
>>>>>>> +
>>>>>>> +What:             /sys/devices/soc0/build_id
>>>>>>> +Date:             January 2017
>>>>>>> +Contact:  linux-arm-msm@vger.kernel.org
>>>>>>> +Description:
>>>>>>> +          This file shows the unique id of current build being used on
>>>>>>> +          the system.
>>>>>>
>>>>>> Build of what? The kernel already has a build version.
>>>>>>
>>>>> This is not build id of the kernel. This is build ID of complete meta image.
>>
>> That's assuming everything is built together which generally isn't
>> true.
> 
> Not necessarily compiled together, but packaged up in something that
> gets a "release number" - which I presume is quite common for any type
> of embedded products.
> 
> E.g. we do give the Linaro releases version numbers such as "16.09".
> 
>> It doesn't seem like that is information the kernel should
>> provide.
>>
> 
> I used to say that we could just store this information in a file in
> /etc (or in build.prop), then I started doing post-build composition and
> realized that you really do want a new system-version if you change e.g.
> the version of the boot firmware - without having to regenerate the
> rootfs.
> 
> So while I agree that this is none of the kernel's business I'm not sure
> how you would get this information from SMEM to a user space process for
> e.g. bugreport generation purposes.
> 
>>>>>
>>>>>>> +
>>>>>>> +What:             /sys/devices/soc0/cnss_image_crm
>>>>>>> +What:             /sys/devices/soc0/cnss_image_variant
>>>>>>> +What:             /sys/devices/soc0/cnss_image_version
>>>>>>> +Date:             January 2017
>>>>>>> +Contact:  linux-arm-msm@vger.kernel.org
>>>>>>> +Description:
>>>>>>> +          These files respectively show the crm version, variant and
>>>>>>> +          version of the CNSS image.
>>>>>>> +
>>>>>>> +What:             /sys/devices/soc0/family
>>>>>>> +Date:             January 2017
>>>>>>> +Contact:  linux-arm-msm@vger.kernel.org
>>>>>>> +Description:
>>>>>>> +          This file shows the family(e.g Snapdragon) of the SoC.
>>>>>>
>>>>>> Sounds like a standard attr.
>>>>>>
>>>>> Yeah. This is standard attribute. Will remove this from Documentation here.
>>>>>
>>>>>>> +
>>>>>>> +What:             /sys/devices/soc0/foundry_id
>>>>>>> +Date:             January 2017
>>>>>>> +Contact:  linux-arm-msm@vger.kernel.org
>>>>>>> +Description:
>>>>>>> +          This file shows the id of the foundry, where soc was
>>>>>>> +          manufactured.
>>>>>>
>>>>>> I don't see how userspace should care...
>>>>>>
>>>>> Yeah, usually user space would not care for such information. But sometimes we have
>>>>> come across h/w issues that were seen only on set of chips from a particular
>>>>> foundry. Under such situations we use this information to confirm if a certain h/w
>>>>> issue is specific to a batch from a particular foundry or not.
>>>>>
>>>> Could you please provide some feedback regarding this?
>>
>> The qcom compatible string format already provides this. I don't think
>> we need 2 ABIs that are both vendor specific to expose this. Now if
>> there's other vendors wanting to expose the foundry, then a common
>> attr would make sense.
>>
>> compatible = "qcom,<SoC>[-<soc_version>][-<foundry_id>]-<board>[/<subtype>][-<board_version>]"
>>
> 
> For userspace to be able to parse out this information from
> /proc/device-tree/compatible we need to improve that expression quite a
> bit! What's the foundry_id of <"acme,phone-a","qcom,platform-b-c">?
> 
>>>>
>>>>>>> +
>>>>>>> +What:             /sys/devices/soc0/hw_platform
>>>>>>> +Date:             January 2017
>>>>>>> +Contact:  linux-arm-msm@vger.kernel.org
>>>>>>> +Description:
>>>>>>> +          This file shows the type of hardware platform
>>>>>>> +          (e.g MTP, QRD etc) where SoC is being used.
>>>>>>
>>>>>> What's a platform?
>>>>>>
>>>>> We may use same soc on different type of platforms. For example for QCOM we have
>>>>> MTP (board with which a debug board can be connected), QRD (no debug connection available).
>>>>> Similarly other ODMs may have different kind of platforms based on same soc.
>>>>> hw_paltform indicates numeric id for different kind of such platforms.
>>
>> As above, I believe /compatible already provides that information.
>>
> 
> I believe this is what OMAP calls "type", in a custom attribute on the
> side of the common ones.
> 
> But as far as I can see this information should be trivial to derive
> from the compatible of the board. Imran, what is this data used for?
> 

This data is used in several cases. For example MTP and QRD boards may use
different thermal calibration, different firmwares, different wcnss settings.
These are the some use cases, I can recall right now, there may be others too.

> Regards,
> Bjorn
> 


-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a\nmember of the Code Aurora Forum, hosted by The Linux Foundation

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

* Re: [v10, 2/2] Documentation/ABI: Add ABI information for QCOM socinfo driver
  2017-04-24 23:05             ` Bjorn Andersson
  2017-04-25  7:35               ` Imran Khan
@ 2017-04-25 17:13               ` Rob Herring
  2017-04-25 23:08                 ` Bjorn Andersson
  1 sibling, 1 reply; 15+ messages in thread
From: Rob Herring @ 2017-04-25 17:13 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Imran Khan, Stephen Boyd, Andy Gross, linux-arm-msm,
	linux-kernel, open list:ARM/QUALCOMM SUPPORT

On Mon, Apr 24, 2017 at 6:05 PM, Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
> On Mon 24 Apr 09:27 PDT 2017, Rob Herring wrote:
>
>> On Mon, Apr 24, 2017 at 11:00 AM, Imran Khan <kimran@codeaurora.org> wrote:
>> > On 4/18/2017 7:53 PM, Imran Khan wrote:
>> > Hi Rob,
>> > Could you please provide some feedback so that this discussion can move forward
>> > and ABI document can be finalized?
>> > Without the ABI document we are not able to get the corresponding driver
>> > finalized and get merged.
>> >
>> > Thanks again for your time,
>> > Imran
>> >> Hi Rob,
>> >>
>> >> On 3/6/2017 12:19 PM, Imran Khan wrote:
>> >>> On 2/22/2017 7:34 PM, Rob Herring wrote:
>> >>>> On Mon, Feb 20, 2017 at 10:17:15PM +0530, Khan, Imran wrote:
>> >>>>> The socinfo ABI document describes the information provided
>> >>>>> by socinfo driver and the corresponding attributes to access
>> >>>>> that information.
>> >>>>>
>> >>>>> Signed-off-by: Imran Khan <kimran@codeaurora.org>
>> >>>>> ---
>> >>>>>  .../ABI/testing/sysfs-driver-qcom_socinfo          | 171 +++++++++++++++++++++
>> >>>>>  1 file changed, 171 insertions(+)
>> >>>>>  create mode 100644 Documentation/ABI/testing/sysfs-driver-qcom_socinfo
>> >>>>
>> >>>> Sorry to comment late on this (blame LWM), but I think creating this ABI
>> >>>> is a mistake. The biggest issue I have is this doesn't scale if every
>> >>>> SoC does its own thing. We should have a common interface so for example
>> >>>> userspace can retrieve the serial number from any SoC in the same way.
>> >>>> Yes, we can have custom attributes, but there should be common base.
>> >>>>
>> >>>
>> >>> Yeah, I agree about the scalability part. Could you please suggest some way to
>> >>> implement a common base for the custom attributes. Like for serial number I think
>> >>> we can put it in generic soc_device_attribute but for custom attributes like accessory_chip,
>> >>> hw_platform etc., how can we implement a common base. Can we have a private pointer within
>> >>> generic soc_device_attribute structure and this private pointer can point to custom attributes.
>> >>> Or if you have some other suggestion to implement this common interface, please let me know.
>> >>
>> >> Could you please provide some feedback regarding this?
>>
>> Splitting things between common and private seems like a good direction.
>>
>
> But the pattern of amending the common attributes with vendor or
> platform-specific ones is how its done in other drivers, e.g.
> integrator.
>
> Why should we for the Qualcomm case make up some other pattern?
>
> Or am I misunderstanding your suggestion?

I'm just trying to ensure that we make things that could be common,
common. The question here was about the implementation.

Right now, drivers/soc is just a free for all dumping ground IMO.

>> >>>>> diff --git a/Documentation/ABI/testing/sysfs-driver-qcom_socinfo b/Documentation/ABI/testing/sysfs-driver-qcom_socinfo
>> >>>>> new file mode 100644
>> >>>>> index 0000000..cce611f
>> >>>>> --- /dev/null
>> >>>>> +++ b/Documentation/ABI/testing/sysfs-driver-qcom_socinfo
>> >>>>> @@ -0,0 +1,171 @@
>> >>>>> +What:             /sys/devices/soc0/accessory_chip
>> >>>>> +Date:             January 2017
>> >>>>> +Contact:  linux-arm-msm@vger.kernel.org
>> >>>>> +Description:
>> >>>>> +          This file shows the id of the accessory chip.
>> >>>>> +
>> >>>>> +What:             /sys/devices/soc0/adsp_image_crm
>> >>>>> +What:             /sys/devices/soc0/adsp_image_variant
>> >>>>> +What:             /sys/devices/soc0/adsp_image_version
>> >>>>> +Date:             January 2017
>> >>>>> +Contact:  linux-arm-msm@vger.kernel.org
>> >>>>> +Description:
>> >>>>> +          These files respectively show the crm version, variant and
>> >>>>> +          version of the ADSP image.
>> >>>>
>> >>>> Shouldn't this be part of the ADSP driver?
>> >>>>
>> >>> Yes, It can be but I wanted to keep the image information at a central location,
>> >>> rather than pushing it back to each driver. For image information we basically
>> >>> read the same item from SMEM but use different offsets within it for different images,
>> >>> so the idea was to read this information ( get SMEM handler) just once, rather than
>> >>> doing it for each driver.
>> >>> But if this idea does not look correct, I can remove it from socinfo driver.
>> >>>
>> >>
>> >> Could you please provide some feedback regarding this?
>>
>> I don't think parsing things once will save you much.
>>
>
> Defining the struct in some shared header file and implementing the
> "parsing" throughout various drivers would probably work out fine.
>
> What I do not fancy is where these "parsers" would be implemented and
> where the information would end up in sysfs.
>
> "The ADSP driver" has to refer to the remoteproc driver for the adsp and
> it would be reasonable to have version information of the firmware
> available for a running piece of remoteproc. The same would work out for
> modem and wireless.
>
> The v4l driver is responsible for controlling the venus core, so it
> could provide the version attribute - which would show up somewhere in
> the /sys/bus/platform hierarchy.
>
> We have a mfd-like driver for communicating with the RPM, so perhaps we
> could shoehorn in an attribute there. But the sysfs path will be
> completely different, depending on platform and system configuration.
>
> There is no driver representing the boot code.
>
>
> So, when Android goes belly up and we want to produce a bugreport that
> describes all the pieces of the system we will have to all over sysfs to
> figure out the versions of the firmware...

Can't you just use the meta build id? That implies the version of
*everything*, right?

>> >>
>> >>>>> +
>> >>>>> +What:             /sys/devices/soc0/apps_image_crm
>> >>>>> +What:             /sys/devices/soc0/apps_image_variant
>> >>>>> +What:             /sys/devices/soc0/apps_image_version
>> >>>>> +Date:             January 2017
>> >>>>> +Contact:  linux-arm-msm@vger.kernel.org
>> >>>>> +Description:
>> >>>>> +          These files respectively show the crm version, variant and
>> >>>>> +          version of the APPS(Linux kernel, rootfs) image.
>> >>>>
>> >>>> Assuming that the kernel and rootfs are the same image and updated
>> >>>> together?
>> >>>>
>> >>>
>> >>> Yes. The kernel and rootfs are same image and they are updated together.
>>
>> Maybe for you, but generally those are separate pieces.
>>
>
> This attribute is special in that it is populated from user space, so
> any tool running on apps should be able to fetch it directly anyways
> (e.g. from Android properties).
>
> Imran, is there any users of this information outside the apps context?
> E.g. does your tools for analysing memory-dumps depend on this
> information being available in SMEM?
>
>> >>>
>> >>>>> +
>> >>>>> +What:             /sys/devices/soc0/boot_image_crm
>> >>>>> +What:             /sys/devices/soc0/boot_image_variant
>> >>>>> +What:             /sys/devices/soc0/boot_image_version
>> >>>>> +Date:             January 2017
>> >>>>> +Contact:  linux-arm-msm@vger.kernel.org
>> >>>>> +Description:
>> >>>>> +          These files respectively show the crm version, variant and
>> >>>>> +          version of the Boot(bootloader) image.
>> >>>>> +
>> >>>>> +What:             /sys/devices/soc0/build_id
>> >>>>> +Date:             January 2017
>> >>>>> +Contact:  linux-arm-msm@vger.kernel.org
>> >>>>> +Description:
>> >>>>> +          This file shows the unique id of current build being used on
>> >>>>> +          the system.
>> >>>>
>> >>>> Build of what? The kernel already has a build version.
>> >>>>
>> >>> This is not build id of the kernel. This is build ID of complete meta image.
>>
>> That's assuming everything is built together which generally isn't
>> true.
>
> Not necessarily compiled together, but packaged up in something that
> gets a "release number" - which I presume is quite common for any type
> of embedded products.
>
> E.g. we do give the Linaro releases version numbers such as "16.09".

Yes, but I doubt the release number is visible inside the release
unless it is part of some existing version like the kernel's version
string. If this is quite common, then lets make it common.

Why not just make this a file in the filesystem? Why does the kernel
need to provide it?

>> It doesn't seem like that is information the kernel should
>> provide.
>>
>
> I used to say that we could just store this information in a file in
> /etc (or in build.prop), then I started doing post-build composition and
> realized that you really do want a new system-version if you change e.g.
> the version of the boot firmware - without having to regenerate the
> rootfs.
>
> So while I agree that this is none of the kernel's business I'm not sure
> how you would get this information from SMEM to a user space process for
> e.g. bugreport generation purposes.
>
>> >>>
>> >>>>> +
>> >>>>> +What:             /sys/devices/soc0/cnss_image_crm
>> >>>>> +What:             /sys/devices/soc0/cnss_image_variant
>> >>>>> +What:             /sys/devices/soc0/cnss_image_version
>> >>>>> +Date:             January 2017
>> >>>>> +Contact:  linux-arm-msm@vger.kernel.org
>> >>>>> +Description:
>> >>>>> +          These files respectively show the crm version, variant and
>> >>>>> +          version of the CNSS image.
>> >>>>> +
>> >>>>> +What:             /sys/devices/soc0/family
>> >>>>> +Date:             January 2017
>> >>>>> +Contact:  linux-arm-msm@vger.kernel.org
>> >>>>> +Description:
>> >>>>> +          This file shows the family(e.g Snapdragon) of the SoC.
>> >>>>
>> >>>> Sounds like a standard attr.
>> >>>>
>> >>> Yeah. This is standard attribute. Will remove this from Documentation here.
>> >>>
>> >>>>> +
>> >>>>> +What:             /sys/devices/soc0/foundry_id
>> >>>>> +Date:             January 2017
>> >>>>> +Contact:  linux-arm-msm@vger.kernel.org
>> >>>>> +Description:
>> >>>>> +          This file shows the id of the foundry, where soc was
>> >>>>> +          manufactured.
>> >>>>
>> >>>> I don't see how userspace should care...
>> >>>>
>> >>> Yeah, usually user space would not care for such information. But sometimes we have
>> >>> come across h/w issues that were seen only on set of chips from a particular
>> >>> foundry. Under such situations we use this information to confirm if a certain h/w
>> >>> issue is specific to a batch from a particular foundry or not.
>> >>>
>> >> Could you please provide some feedback regarding this?
>>
>> The qcom compatible string format already provides this. I don't think
>> we need 2 ABIs that are both vendor specific to expose this. Now if
>> there's other vendors wanting to expose the foundry, then a common
>> attr would make sense.
>>
>> compatible = "qcom,<SoC>[-<soc_version>][-<foundry_id>]-<board>[/<subtype>][-<board_version>]"
>>
>
> For userspace to be able to parse out this information from
> /proc/device-tree/compatible we need to improve that expression quite a
> bit! What's the foundry_id of <"acme,phone-a","qcom,platform-b-c">?

I can't help it if QCom defines an elaborate compatible string format
and then doesn't use it.

>> >>>>> +
>> >>>>> +What:             /sys/devices/soc0/hw_platform
>> >>>>> +Date:             January 2017
>> >>>>> +Contact:  linux-arm-msm@vger.kernel.org
>> >>>>> +Description:
>> >>>>> +          This file shows the type of hardware platform
>> >>>>> +          (e.g MTP, QRD etc) where SoC is being used.
>> >>>>
>> >>>> What's a platform?
>> >>>>
>> >>> We may use same soc on different type of platforms. For example for QCOM we have
>> >>> MTP (board with which a debug board can be connected), QRD (no debug connection available).
>> >>> Similarly other ODMs may have different kind of platforms based on same soc.
>> >>> hw_paltform indicates numeric id for different kind of such platforms.
>>
>> As above, I believe /compatible already provides that information.
>>
>
> I believe this is what OMAP calls "type", in a custom attribute on the
> side of the common ones.
>
> But as far as I can see this information should be trivial to derive
> from the compatible of the board. Imran, what is this data used for?
>
> Regards,
> Bjorn

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

* Re: [v10, 2/2] Documentation/ABI: Add ABI information for QCOM socinfo driver
  2017-04-25 17:13               ` Rob Herring
@ 2017-04-25 23:08                 ` Bjorn Andersson
  2017-05-01 13:07                   ` Imran Khan
  0 siblings, 1 reply; 15+ messages in thread
From: Bjorn Andersson @ 2017-04-25 23:08 UTC (permalink / raw)
  To: Rob Herring
  Cc: Imran Khan, Stephen Boyd, Andy Gross, linux-arm-msm,
	linux-kernel, open list:ARM/QUALCOMM SUPPORT

On Tue 25 Apr 10:13 PDT 2017, Rob Herring wrote:

> On Mon, Apr 24, 2017 at 6:05 PM, Bjorn Andersson
> <bjorn.andersson@linaro.org> wrote:
> > On Mon 24 Apr 09:27 PDT 2017, Rob Herring wrote:
[..]
> >> Splitting things between common and private seems like a good direction.
> >>
> >
> > But the pattern of amending the common attributes with vendor or
> > platform-specific ones is how its done in other drivers, e.g.
> > integrator.
> >
> > Why should we for the Qualcomm case make up some other pattern?
> >
> > Or am I misunderstanding your suggestion?
> 
> I'm just trying to ensure that we make things that could be common,
> common. The question here was about the implementation.
> 
> Right now, drivers/soc is just a free for all dumping ground IMO.
> 

Unfortunately I fully agree with this, we did spend several revisions on
just trying to match Qualcomm properties to the common attributes - and
I don't know if we got it right.

> >> >>>>> diff --git a/Documentation/ABI/testing/sysfs-driver-qcom_socinfo b/Documentation/ABI/testing/sysfs-driver-qcom_socinfo
> >> >>>>> new file mode 100644
> >> >>>>> index 0000000..cce611f
> >> >>>>> --- /dev/null
> >> >>>>> +++ b/Documentation/ABI/testing/sysfs-driver-qcom_socinfo
> >> >>>>> @@ -0,0 +1,171 @@
> >> >>>>> +What:             /sys/devices/soc0/accessory_chip
> >> >>>>> +Date:             January 2017
> >> >>>>> +Contact:  linux-arm-msm@vger.kernel.org
> >> >>>>> +Description:
> >> >>>>> +          This file shows the id of the accessory chip.
> >> >>>>> +
> >> >>>>> +What:             /sys/devices/soc0/adsp_image_crm
> >> >>>>> +What:             /sys/devices/soc0/adsp_image_variant
> >> >>>>> +What:             /sys/devices/soc0/adsp_image_version
> >> >>>>> +Date:             January 2017
> >> >>>>> +Contact:  linux-arm-msm@vger.kernel.org
> >> >>>>> +Description:
> >> >>>>> +          These files respectively show the crm version, variant and
> >> >>>>> +          version of the ADSP image.
> >> >>>>
> >> >>>> Shouldn't this be part of the ADSP driver?
> >> >>>>
> >> >>> Yes, It can be but I wanted to keep the image information at a central location,
> >> >>> rather than pushing it back to each driver. For image information we basically
> >> >>> read the same item from SMEM but use different offsets within it for different images,
> >> >>> so the idea was to read this information ( get SMEM handler) just once, rather than
> >> >>> doing it for each driver.
> >> >>> But if this idea does not look correct, I can remove it from socinfo driver.
> >> >>>
> >> >>
> >> >> Could you please provide some feedback regarding this?
> >>
> >> I don't think parsing things once will save you much.
> >>
> >
> > Defining the struct in some shared header file and implementing the
> > "parsing" throughout various drivers would probably work out fine.
> >
> > What I do not fancy is where these "parsers" would be implemented and
> > where the information would end up in sysfs.
> >
> > "The ADSP driver" has to refer to the remoteproc driver for the adsp and
> > it would be reasonable to have version information of the firmware
> > available for a running piece of remoteproc. The same would work out for
> > modem and wireless.
> >
> > The v4l driver is responsible for controlling the venus core, so it
> > could provide the version attribute - which would show up somewhere in
> > the /sys/bus/platform hierarchy.
> >
> > We have a mfd-like driver for communicating with the RPM, so perhaps we
> > could shoehorn in an attribute there. But the sysfs path will be
> > completely different, depending on platform and system configuration.
> >
> > There is no driver representing the boot code.
> >
> >
> > So, when Android goes belly up and we want to produce a bugreport that
> > describes all the pieces of the system we will have to all over sysfs to
> > figure out the versions of the firmware...
> 
> Can't you just use the meta build id? That implies the version of
> *everything*, right?
> 

For products yes, but when _you_ ask us why WiFi doesn't work on your
Dragonboard it's quite nice to be able to get hold of the boot-loader
and wcnss-firmware versions - and you're likely not on an unmodified
meta-build.

For me this information is more valuable than the meta-build id, but
that's because I'm working with engineering builds.

[..]
> >> >>>>> +What:             /sys/devices/soc0/build_id
> >> >>>>> +Date:             January 2017
> >> >>>>> +Contact:  linux-arm-msm@vger.kernel.org
> >> >>>>> +Description:
> >> >>>>> +          This file shows the unique id of current build being used on
> >> >>>>> +          the system.
> >> >>>>
> >> >>>> Build of what? The kernel already has a build version.
> >> >>>>
> >> >>> This is not build id of the kernel. This is build ID of complete meta image.
> >>
> >> That's assuming everything is built together which generally isn't
> >> true.
> >
> > Not necessarily compiled together, but packaged up in something that
> > gets a "release number" - which I presume is quite common for any type
> > of embedded products.
> >
> > E.g. we do give the Linaro releases version numbers such as "16.09".
> 
> Yes, but I doubt the release number is visible inside the release
> unless it is part of some existing version like the kernel's version
> string. If this is quite common, then lets make it common.
> 

I don't know how common this is - as you suggest below perhaps people
just put it in one of the file systems?

> Why not just make this a file in the filesystem?

Because that forces you to rebuild your file system to update the
version of the system. That said I don't know the details of how
Qualcomm persistently encode this information.

> Why does the kernel need to provide it?
> 

Imran, can you elaborate on how this information is travels from the
build system to the SMEM item?

Regards,
Bjorn

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

* Re: [v10, 2/2] Documentation/ABI: Add ABI information for QCOM socinfo driver
  2017-04-25 23:08                 ` Bjorn Andersson
@ 2017-05-01 13:07                   ` Imran Khan
  2017-05-01 22:47                     ` Bjorn Andersson
  0 siblings, 1 reply; 15+ messages in thread
From: Imran Khan @ 2017-05-01 13:07 UTC (permalink / raw)
  To: Bjorn Andersson, Rob Herring
  Cc: Stephen Boyd, Andy Gross, linux-arm-msm, linux-kernel,
	open list:ARM/QUALCOMM SUPPORT

On 4/26/2017 4:38 AM, Bjorn Andersson wrote:
> On Tue 25 Apr 10:13 PDT 2017, Rob Herring wrote:
> 
>> On Mon, Apr 24, 2017 at 6:05 PM, Bjorn Andersson
>> <bjorn.andersson@linaro.org> wrote:
>>> On Mon 24 Apr 09:27 PDT 2017, Rob Herring wrote:
> [..]
>>>> Splitting things between common and private seems like a good direction.
>>>>
>>>
>>> But the pattern of amending the common attributes with vendor or
>>> platform-specific ones is how its done in other drivers, e.g.
>>> integrator.
>>>
>>> Why should we for the Qualcomm case make up some other pattern?
>>>
>>> Or am I misunderstanding your suggestion?
>>
>> I'm just trying to ensure that we make things that could be common,
>> common. The question here was about the implementation.
>>
>> Right now, drivers/soc is just a free for all dumping ground IMO.
>>
> 
> Unfortunately I fully agree with this, we did spend several revisions on
> just trying to match Qualcomm properties to the common attributes - and
> I don't know if we got it right.
> 

I would be glad to get further feedback in this regard as we would like it to be 
as close to the generic attributes as possible. But it is also true that 
right now generic soc_device_attributes are too few to expose the information that we are
intending to expose here.

[...]

>>>
>>> So, when Android goes belly up and we want to produce a bugreport that
>>> describes all the pieces of the system we will have to all over sysfs to
>>> figure out the versions of the firmware...
>>
>> Can't you just use the meta build id? That implies the version of
>> *everything*, right?
>>
> 
> For products yes, but when _you_ ask us why WiFi doesn't work on your
> Dragonboard it's quite nice to be able to get hold of the boot-loader
> and wcnss-firmware versions - and you're likely not on an unmodified
> meta-build.
> 
> For me this information is more valuable than the meta-build id, but
> that's because I'm working with engineering builds.
> 
> [..]
>>>>>>>>> +What:             /sys/devices/soc0/build_id
>>>>>>>>> +Date:             January 2017
>>>>>>>>> +Contact:  linux-arm-msm@vger.kernel.org
>>>>>>>>> +Description:
>>>>>>>>> +          This file shows the unique id of current build being used on
>>>>>>>>> +          the system.
>>>>>>>>
>>>>>>>> Build of what? The kernel already has a build version.
>>>>>>>>
>>>>>>> This is not build id of the kernel. This is build ID of complete meta image.
>>>>
>>>> That's assuming everything is built together which generally isn't
>>>> true.
>>>
>>> Not necessarily compiled together, but packaged up in something that
>>> gets a "release number" - which I presume is quite common for any type
>>> of embedded products.
>>>
>>> E.g. we do give the Linaro releases version numbers such as "16.09".
>>
>> Yes, but I doubt the release number is visible inside the release
>> unless it is part of some existing version like the kernel's version
>> string. If this is quite common, then lets make it common.
>>
> 
> I don't know how common this is - as you suggest below perhaps people
> just put it in one of the file systems?
> 
>> Why not just make this a file in the filesystem?
> 
> Because that forces you to rebuild your file system to update the
> version of the system. That said I don't know the details of how
> Qualcomm persistently encode this information.
> 
>> Why does the kernel need to provide it?
>>
> 
> Imran, can you elaborate on how this information is travels from the
> build system to the SMEM item?
> 

This information, along with other SMEM items for this SMEM-id is written by the bootloader (SBL).
Please let me know if this much information suffices in this regard.

Thanks and Regards,
Imran
> Regards,
> Bjorn
> 


-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a\nmember of the Code Aurora Forum, hosted by The Linux Foundation

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

* Re: [v10, 2/2] Documentation/ABI: Add ABI information for QCOM socinfo driver
  2017-05-01 13:07                   ` Imran Khan
@ 2017-05-01 22:47                     ` Bjorn Andersson
  2017-05-03 12:51                       ` Imran Khan
  0 siblings, 1 reply; 15+ messages in thread
From: Bjorn Andersson @ 2017-05-01 22:47 UTC (permalink / raw)
  To: Imran Khan
  Cc: Rob Herring, Stephen Boyd, Andy Gross, linux-arm-msm,
	linux-kernel, open list:ARM/QUALCOMM SUPPORT

On Mon 01 May 06:07 PDT 2017, Imran Khan wrote:

> On 4/26/2017 4:38 AM, Bjorn Andersson wrote:
> > On Tue 25 Apr 10:13 PDT 2017, Rob Herring wrote:
> > 
> >> On Mon, Apr 24, 2017 at 6:05 PM, Bjorn Andersson
> >> <bjorn.andersson@linaro.org> wrote:
> >>> On Mon 24 Apr 09:27 PDT 2017, Rob Herring wrote:
[..]
> >>>>>>>>> +What:             /sys/devices/soc0/build_id
[..]
> >> Why does the kernel need to provide it?
> >>
> > 
> > Imran, can you elaborate on how this information is travels from the
> > build system to the SMEM item?
> > 
> 
> This information, along with other SMEM items for this SMEM-id is
> written by the bootloader (SBL).  Please let me know if this much
> information suffices in this regard.

But where does the SBL find this information? Per my previous argument
it doesn't make sense to store this information compiled into one of the
components. Is it the CDT perhaps?

Regards,
Bjorn

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

* Re: [v10, 2/2] Documentation/ABI: Add ABI information for QCOM socinfo driver
  2017-05-01 22:47                     ` Bjorn Andersson
@ 2017-05-03 12:51                       ` Imran Khan
  0 siblings, 0 replies; 15+ messages in thread
From: Imran Khan @ 2017-05-03 12:51 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Rob Herring, Stephen Boyd, Andy Gross, linux-arm-msm,
	linux-kernel, open list:ARM/QUALCOMM SUPPORT

On 5/2/2017 4:17 AM, Bjorn Andersson wrote:
> On Mon 01 May 06:07 PDT 2017, Imran Khan wrote:
> 
>> On 4/26/2017 4:38 AM, Bjorn Andersson wrote:
>>> On Tue 25 Apr 10:13 PDT 2017, Rob Herring wrote:
>>>
>>>> On Mon, Apr 24, 2017 at 6:05 PM, Bjorn Andersson
>>>> <bjorn.andersson@linaro.org> wrote:
>>>>> On Mon 24 Apr 09:27 PDT 2017, Rob Herring wrote:
> [..]
>>>>>>>>>>> +What:             /sys/devices/soc0/build_id
> [..]
>>>> Why does the kernel need to provide it?
>>>>
>>>
>>> Imran, can you elaborate on how this information is travels from the
>>> build system to the SMEM item?
>>>
>>
>> This information, along with other SMEM items for this SMEM-id is
>> written by the bootloader (SBL).  Please let me know if this much
>> information suffices in this regard.
> 
> But where does the SBL find this information? Per my previous argument
> it doesn't make sense to store this information compiled into one of the
> components. Is it the CDT perhaps?
> 

Yes SBL is getting this information from CDT.

Thanks and Regards,
Imran
> Regards,
> Bjorn
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a\nmember of the Code Aurora Forum, hosted by The Linux Foundation

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

end of thread, other threads:[~2017-05-03 12:52 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-20 16:47 [PATCH v10 0/2] soc: qcom: Add SoC info driver Imran Khan
2017-02-20 16:47 ` [PATCH v10 1/2] " Imran Khan
2017-02-20 16:47 ` [PATCH v10 2/2] Documentation/ABI: Add ABI information for QCOM socinfo driver Imran Khan
2017-02-22 14:04   ` [v10, " Rob Herring
2017-03-06  6:49     ` Imran Khan
2017-04-18 14:23       ` Imran Khan
2017-04-24 16:00         ` Imran Khan
2017-04-24 16:27           ` Rob Herring
2017-04-24 23:05             ` Bjorn Andersson
2017-04-25  7:35               ` Imran Khan
2017-04-25 17:13               ` Rob Herring
2017-04-25 23:08                 ` Bjorn Andersson
2017-05-01 13:07                   ` Imran Khan
2017-05-01 22:47                     ` Bjorn Andersson
2017-05-03 12:51                       ` Imran Khan

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