lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <wyfv5abzo2ow37gbnktormshgasd64cjyf4rjyl3onvq2tgr7y@6hh4nxmk3rpg>
Date: Thu, 30 Oct 2025 12:11:13 -0500
From: Bjorn Andersson <andersson@...nel.org>
To: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@....qualcomm.com>
Cc: Konrad Dybcio <konradybcio@...nel.org>, linux-arm-msm@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] soc: qcom: socinfo: add support to extract more than
 32 image versions

On Thu, Oct 30, 2025 at 03:07:49PM +0530, Kathiravan Thirumoorthy wrote:
> SMEM_IMAGE_VERSION_TABLE contains the version of the first 32 images.
> Add images beyond that and read these from SMEM_IMAGE_VERSION_TABLE_2.
> 
> Not all platforms define the SMEM item number 667, in that case
> qcom_smem_get() will throw the invalid item warning. To avoid that,
> validate the SMEM item before fetching the version details.
> 
> Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@....qualcomm.com>
> ---
>  drivers/soc/qcom/socinfo.c | 46 ++++++++++++++++++++++++++++++++++++++--------
>  1 file changed, 38 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c
> index 4fd09e2bfd021424b9489cd29eec29dc7c7a16d3..f832ae36942b10f68f0c3304f98d946796e8d1bd 100644
> --- a/drivers/soc/qcom/socinfo.c
> +++ b/drivers/soc/qcom/socinfo.c
> @@ -67,7 +67,17 @@
>  #define SMEM_IMAGE_TABLE_GEARVM_INDEX	29
>  #define SMEM_IMAGE_TABLE_UEFI_INDEX	30
>  #define SMEM_IMAGE_TABLE_CDSP3_INDEX	31
> +#define SMEM_IMAGE_TABLE_AUDIOPD_ADSP1_INDEX	32
> +#define SMEM_IMAGE_TABLE_AUDIOPD_ADSP2_INDEX	33
> +#define SMEM_IMAGE_TABLE_DCP_INDEX	34
> +#define SMEM_IMAGE_TABLE_OOBS_INDEX	35
> +#define SMEM_IMAGE_TABLE_OOBNS_INDEX	36
> +#define SMEM_IMAGE_TABLE_DEVCFG_INDEX	37
> +#define SMEM_IMAGE_TABLE_BTPD_INDEX	38
> +#define SMEM_IMAGE_TABLE_QECP_INDEX	39
> +
>  #define SMEM_IMAGE_VERSION_TABLE       469
> +#define SMEM_IMAGE_VERSION_TABLE_2	667
>  
>  /*
>   * SMEM Image table names
> @@ -79,13 +89,18 @@ static const char *const socinfo_image_names[] = {
>  	[SMEM_IMAGE_TABLE_APPSBL_INDEX] = "appsbl",
>  	[SMEM_IMAGE_TABLE_APPS_INDEX] = "apps",
>  	[SMEM_IMAGE_TABLE_AUDIOPD_INDEX] = "audiopd",
> +	[SMEM_IMAGE_TABLE_AUDIOPD_ADSP1_INDEX] = "audiopd_adsp1",
> +	[SMEM_IMAGE_TABLE_AUDIOPD_ADSP2_INDEX] = "audiopd_adsp2",
>  	[SMEM_IMAGE_TABLE_BOOT_INDEX] = "boot",
> +	[SMEM_IMAGE_TABLE_BTPD_INDEX] = "btpd",
>  	[SMEM_IMAGE_TABLE_CDSP1_INDEX] = "cdsp1",
>  	[SMEM_IMAGE_TABLE_CDSP2_INDEX] = "cdsp2",
>  	[SMEM_IMAGE_TABLE_CDSP3_INDEX] = "cdsp3",
>  	[SMEM_IMAGE_TABLE_CDSP_INDEX] = "cdsp",
>  	[SMEM_IMAGE_TABLE_CHARGERPD_INDEX] = "chargerpd",
>  	[SMEM_IMAGE_TABLE_CNSS_INDEX] = "cnss",
> +	[SMEM_IMAGE_TABLE_DCP_INDEX] = "dcp",
> +	[SMEM_IMAGE_TABLE_DEVCFG_INDEX] = "devcfg",
>  	[SMEM_IMAGE_TABLE_DSPS_INDEX] = "dsps",
>  	[SMEM_IMAGE_TABLE_GEARVM_INDEX] = "gearvm",
>  	[SMEM_IMAGE_TABLE_GPDSP1_INDEX] = "gpdsp1",
> @@ -95,6 +110,9 @@ static const char *const socinfo_image_names[] = {
>  	[SMEM_IMAGE_TABLE_NPU_INDEX] = "npu",
>  	[SMEM_IMAGE_TABLE_OEMPD_INDEX] = "oempd",
>  	[SMEM_IMAGE_TABLE_OISPD_INDEX] = "oispd",
> +	[SMEM_IMAGE_TABLE_OOBNS_INDEX] = "oobns",
> +	[SMEM_IMAGE_TABLE_OOBS_INDEX] = "oobs",
> +	[SMEM_IMAGE_TABLE_QECP_INDEX] = "qecp",
>  	[SMEM_IMAGE_TABLE_RPM_INDEX] = "rpm",
>  	[SMEM_IMAGE_TABLE_SDI_INDEX] = "sdi",
>  	[SMEM_IMAGE_TABLE_SENSORPD_INDEX] = "sensorpd",
> @@ -644,7 +662,7 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo,
>  	struct smem_image_version *versions;
>  	struct dentry *dentry;
>  	size_t size;
> -	int i;
> +	int i, j;
>  	unsigned int num_pmics;
>  	unsigned int pmic_array_offset;
>  
> @@ -788,20 +806,32 @@ static void socinfo_debugfs_init(struct qcom_socinfo *qcom_socinfo,
>  		break;
>  	}
>  
> -	versions = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_IMAGE_VERSION_TABLE,
> -				 &size);
> -
> -	for (i = 0; i < ARRAY_SIZE(socinfo_image_names); i++) {
> +	for (i = 0, j = 0; i < ARRAY_SIZE(socinfo_image_names); i++, j++) {
>  		if (!socinfo_image_names[i])
>  			continue;
>  
> +		if (i == 0) {
> +			versions = qcom_smem_get(QCOM_SMEM_HOST_ANY,
> +						 SMEM_IMAGE_VERSION_TABLE,
> +						 &size);
> +		}
> +		if (i == 32) {

Probably nicer to do } else if (...) { here...

> +			if (!qcom_smem_validate_item(SMEM_IMAGE_VERSION_TABLE_2))

Let's see if we can clean up patch 1 and get rid of this.
Other than that, this patch looks good.

Regards,
Bjorn

> +				break;
> +
> +			j = 0;
> +			versions = qcom_smem_get(QCOM_SMEM_HOST_ANY,
> +						 SMEM_IMAGE_VERSION_TABLE_2,
> +						 &size);
> +		}
> +
>  		dentry = debugfs_create_dir(socinfo_image_names[i],
>  					    qcom_socinfo->dbg_root);
> -		debugfs_create_file("name", 0444, dentry, &versions[i],
> +		debugfs_create_file("name", 0444, dentry, &versions[j],
>  				    &qcom_image_name_ops);
> -		debugfs_create_file("variant", 0444, dentry, &versions[i],
> +		debugfs_create_file("variant", 0444, dentry, &versions[j],
>  				    &qcom_image_variant_ops);
> -		debugfs_create_file("oem", 0444, dentry, &versions[i],
> +		debugfs_create_file("oem", 0444, dentry, &versions[j],
>  				    &qcom_image_oem_ops);
>  	}
>  }
> 
> -- 
> 2.34.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ