Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp13865lqn; Thu, 11 Apr 2024 12:10:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXCQkZDn5lida6cOaxggktNs+y8oRkMh0vYUoDoAV/ZufmOhRZbtxi8mEP8WBDi1NgG0Iqj7RAlqlU65ysB7kaf3uU6tpRaK3A+iXbcqg== X-Google-Smtp-Source: AGHT+IEe6bhcNEaMVSnanafwLu1LRqbEovZGM8xQdsKMwAAMpZ3IzwLq7nVHF8bbcCBcAOHutgJV X-Received: by 2002:a17:906:b893:b0:a52:30f0:a9e5 with SMTP id hb19-20020a170906b89300b00a5230f0a9e5mr193662ejb.46.1712862641478; Thu, 11 Apr 2024 12:10:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712862641; cv=pass; d=google.com; s=arc-20160816; b=c09thtj71pbgwOrfrZJj0Ai1UL7e9VseRG1QdlotxrKKop1sqjU/mDCyXDHOJvaAqJ g4L924s9o8HKSGG8Alm46Mdqk/j3crO/w259HVBz8Z7MFiaeZTQLCOuIBcRUkA2tc+Ip 5BYZUOkuAWrCzL2aLF2MHyReai9Pzo+nJV5plCQCryPP4l+jy9PvklDyc+1X65TWAvZt 4SPg3dUYbhVVTF7GSm0GHt+pyVsMSmqeA2i5sZprF8lxLCO3w3s+dOuMQnaIofIHYdHT kWid/WCTWXduspzAdhHmrD2A0NidOdbwUcoKKjaqBRYXkvN3jwQVnZQFyi6jnJBU2ZKm 9o1w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=TJczgw2NJo10g7damNSFp3nzoBPPj3U5NviswaoLMck=; fh=s8CGwYSfyJZuJfoDjoorunfochexlgFCtaMwexfk7Pw=; b=h+RcSbgJIMpIl+UBkBzZf3qa66bAVcxL0rHztxBEWxglpOQjQe/SYoYxjsnW9899EN S8RlQljasgKZaabJTZDDgZRt/2EJfOlPz9RQr5Ys5ufaDELi8nO4UE3j6NxuCXF8tAK7 uYiWDlKDsVKqhm98i3e+F3AVvyR67ocNWtQw/NTuJifEALU5+sXcymQ+yHmAh22RrKo8 SHcOkHK15jQWIe6xoTWXHL/2OqX5QPJya0JGQABuyRg/Bsu7rfldoYIAkiidid0xdVum lvxB3SV+pqNVvknyowcIdJC0VTrdk1hFuVHYRqNepRd0NwHqvgr93X1598XJLRn/stQn Ao4g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=mxlTmmSm; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-141512-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141512-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ji15-20020a170907980f00b00a51d285c678si982560ejc.1028.2024.04.11.12.10.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 12:10:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141512-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=mxlTmmSm; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-141512-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141512-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D78B71F25DFD for ; Thu, 11 Apr 2024 19:10:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 146A729425; Thu, 11 Apr 2024 19:09:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="mxlTmmSm" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63F7517C9B; Thu, 11 Apr 2024 19:09:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712862564; cv=none; b=BB4AvYcmcf0o4tpEZrC1KARCZuhcl7bTOZxXmcUdaQxKqCXATmW3+zQkZDUWjz4LkfXqhVqcIQHaIdHnIfr8IwTyHfFjvKoMy4D0IiwybXQsmjcz5UPjt08C906Tvsm3Fbqinq7xhD2U6N64YbehW39PTLuGrGUJnzP+QQQy7OA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712862564; c=relaxed/simple; bh=ZpznvT0ASgNsvn4YvbYXFJDCgpE+YPZ3WIkco0Qjiq0=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=i5byGlCvJQch2oUJb2fc4jh19UclMhN56j3n73WGk2MtUqwZnkFgVRdb9zNoqBthAh8Kmyd55ql94MBlsvj4I1XalJptxSvZMvU+JOvfXUKWzHpAjvSbx025dfpm9T6lSj8ZX25DXUCbW8gizW1Umq/bLDm2VS/cLiUW9KuXQHg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=mxlTmmSm; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 43BFlvKI032218; Thu, 11 Apr 2024 19:09:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=qcppdkim1; bh=TJczgw2NJo10g7damNSFp 3nzoBPPj3U5NviswaoLMck=; b=mxlTmmSmBwpVdctPDtY0QMMcE/7OSMt3vJaE6 P5InTsKwbA7HnxRIaj36c7LSOCOADKCvfvkN3lN8yDu+kTGTusA92GF8CTYqL9oc Z82+CIoRtsfGq6NSkYfBTZ+5mQz/Wl3nOIQ6qQJRoQx02qZc2E7Kj4WK+BLi1TjA R37KjUtGkwXfEUmeb+sq33xzT7NZQySAUX+Pu5LWFPK/hq4Yeg4ycKQbF344h5Mr Q1qrZixQ2eb856H8gFn1W5h+Sfg+Ii28fFnmIJ/ATN7D8x/uAPCrrQpNLXPVIncY bhZkWWUEd2m1hzvWreFwYz4aYveCtGgSeusxjpx2c4b+KqxNg== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xedugshbk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Apr 2024 19:09:12 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 43BJ9AtT030463 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Apr 2024 19:09:10 GMT Received: from hu-eberman-lv.qualcomm.com (10.49.16.6) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 11 Apr 2024 12:09:10 -0700 Date: Thu, 11 Apr 2024 12:09:09 -0700 From: Elliot Berman To: Konrad Dybcio CC: Bjorn Andersson , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , "Daniel Vetter" , Rob Herring , Krzysztof Kozlowski , Conor Dooley , , , , , , Neil Armstrong Subject: Re: [PATCH 2/6] soc: qcom: smem: Add pcode/fcode getters Message-ID: <20240411120545744-0700.eberman@hu-eberman-lv.qualcomm.com> References: <20240405-topic-smem_speedbin-v1-0-ce2b864251b1@linaro.org> <20240405-topic-smem_speedbin-v1-2-ce2b864251b1@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20240405-topic-smem_speedbin-v1-2-ce2b864251b1@linaro.org> X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: aehUSK4nM__C7T20ZN3nRUpIN1nxnMiq X-Proofpoint-ORIG-GUID: aehUSK4nM__C7T20ZN3nRUpIN1nxnMiq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-11_10,2024-04-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 mlxscore=0 priorityscore=1501 adultscore=0 suspectscore=0 bulkscore=0 lowpriorityscore=0 mlxlogscore=999 impostorscore=0 clxscore=1015 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404110140 On Fri, Apr 05, 2024 at 10:41:30AM +0200, Konrad Dybcio wrote: > Introduce getters for SoC product and feature codes and export them. > > Signed-off-by: Konrad Dybcio > --- > drivers/soc/qcom/smem.c | 66 +++++++++++++++++++++++++++++++++++++++++++ > include/linux/soc/qcom/smem.h | 2 ++ > 2 files changed, 68 insertions(+) > > diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c > index 7191fa0c087f..e89b4d26877a 100644 > --- a/drivers/soc/qcom/smem.c > +++ b/drivers/soc/qcom/smem.c > @@ -795,6 +795,72 @@ int qcom_smem_get_soc_id(u32 *id) > } > EXPORT_SYMBOL_GPL(qcom_smem_get_soc_id); > > +/** > + * qcom_smem_get_feature_code() - return the feature code > + * @id: On success, we return the feature code here. ^^ code > + * > + * Look up the feature code identifier from SMEM and return it. > + * > + * Return: 0 on success, negative errno on failure. > + */ > +int qcom_smem_get_feature_code(u32 *code) > +{ > + struct socinfo *info; > + u32 raw_code; > + > + info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_HW_SW_BUILD_ID, NULL); > + if (IS_ERR(info)) > + return PTR_ERR(info); > + > + /* This only makes sense for socinfo >= 16 */ > + if (__le32_to_cpu(info->fmt) < SOCINFO_VERSION(0, 16)) > + return -EINVAL; > + > + raw_code = __le32_to_cpu(info->feature_code); > + > + /* Ensure the value makes sense */ > + if (raw_code >= SOCINFO_FC_INT_RESERVE) > + raw_code = SOCINFO_FC_UNKNOWN; > + > + *code = raw_code; > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(qcom_smem_get_feature_code); > + > +/** > + * qcom_smem_get_product_code() - return the product code > + * @id: On success, we return the product code here. ^^ code > + * > + * Look up feature code identifier from SMEM and return it. > + * > + * Return: 0 on success, negative errno on failure. > + */ > +int qcom_smem_get_product_code(u32 *code) > +{ > + struct socinfo *info; > + u32 raw_code; > + > + info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_HW_SW_BUILD_ID, NULL); > + if (IS_ERR(info)) > + return PTR_ERR(info); > + > + /* This only makes sense for socinfo >= 16 */ > + if (__le32_to_cpu(info->fmt) < SOCINFO_VERSION(0, 16)) > + return -EINVAL; > + > + raw_code = __le32_to_cpu(info->pcode); > + > + /* Ensure the value makes sense */ > + if (raw_code >= SOCINFO_FC_INT_RESERVE) > + raw_code = SOCINFO_FC_UNKNOWN; > + > + *code = raw_code; > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(qcom_smem_get_product_code); > + > static int qcom_smem_get_sbl_version(struct qcom_smem *smem) > { > struct smem_header *header; > diff --git a/include/linux/soc/qcom/smem.h b/include/linux/soc/qcom/smem.h > index a36a3b9d4929..aef8c9fc6c08 100644 > --- a/include/linux/soc/qcom/smem.h > +++ b/include/linux/soc/qcom/smem.h > @@ -13,5 +13,7 @@ int qcom_smem_get_free_space(unsigned host); > phys_addr_t qcom_smem_virt_to_phys(void *p); > > int qcom_smem_get_soc_id(u32 *id); > +int qcom_smem_get_feature_code(u32 *code); > +int qcom_smem_get_product_code(u32 *code); > > #endif > > -- > 2.40.1 > >