Message ID | 1679935281-18445-2-git-send-email-quic_mojha@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3404:b0:112:7285:5352 with SMTP id h4csp1551833rwd; Mon, 27 Mar 2023 09:47:10 -0700 (PDT) X-Google-Smtp-Source: AKy350Y7in5lRP8g9YgsQCOHREesfmahxOhX3YTp4cxF8jJ//aNdPaFvF9adDpQPM8CvHMyfsQDg X-Received: by 2002:a05:6402:1486:b0:501:cced:9c6c with SMTP id e6-20020a056402148600b00501cced9c6cmr12522276edv.7.1679935630675; Mon, 27 Mar 2023 09:47:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679935630; cv=none; d=google.com; s=arc-20160816; b=iaXfj6n32OGrA9FT8/X4BGT1FTt/u9Tolv+p/MBYUTauHdQ5heX2OeUvgGO+zhP54q ycsQxdacS0Vnw2jpfuSrtKS0NS32aV4OpOpCylGCxogPMiLPAFYXC+lf/BJTnkJmRSVC WiyfYBq1QwSjkn0T6mKwAOQYMQSTOqZ8cjzNazAGdV2ptEsgDjSRxX4hcKIBCNIm7PY5 5ymZ8AiqzVjWErHGbbZudMIOE4EEINoi5wRPeDaxTa8xQLJMWOwol1dDfETGA6ZBsCkp BULtl9aj9Rpucx2jvnBZxEjjB7bQtJINxlrhcPDxjrBdYC42S/zSKKvxFZXZurVmP2ty exeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=azGCApQlpLxOLIrzoDCuftMQf1s7q+OB2PswQwWfrxE=; b=CvEK1IleHrAbAEKyohvGmh7pD4VZUFqyiLWLZ3gD6iazU5l4RESB6jQAfQXHwkN3dB yfCK7nRXRRG4Caxz3DHDWvq1SHxIdivPQl1gRmQAC76qXpTW5ixcqaztU98iIHh0dYlm 5kAWFVmcpLahLAsMt/VNWDi/szb5UGMcAgng/lZ9w/K6gCnL9XRUk4EVqHk6gqZwtLJj 6flNR4jBa/r5Q67IAH6HtWU/+QGRlc+sTDIJHQQGwDa0wS5MnASBBLk4DGJTodnk3l0S dzcrCHDcP5BoY0kiv1lcmS3sztHYWBmKU+T1du6L7XInIkbtWRH9GBxbTuzlbT23zh9c WD2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=iJw4YbG4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z25-20020aa7cf99000000b004beb39bf058si28232276edx.83.2023.03.27.09.46.47; Mon, 27 Mar 2023 09:47:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=iJw4YbG4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230138AbjC0Qlu (ORCPT <rfc822;makky5685@gmail.com> + 99 others); Mon, 27 Mar 2023 12:41:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232446AbjC0Qlr (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 27 Mar 2023 12:41:47 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62B4F2108; Mon, 27 Mar 2023 09:41:45 -0700 (PDT) Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32RALcTA026412; Mon, 27 Mar 2023 16:41:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=azGCApQlpLxOLIrzoDCuftMQf1s7q+OB2PswQwWfrxE=; b=iJw4YbG4zBS5m9KKFTYAFGkw7m7GWsTkRVxlR1Nl9wRDY0CehlbLjE7KGNAr+3dKjwBt FHqZy+nwIc7NiP7S6dYlmU10NmAfgvMjVHRjOVnmqJwBLdE+ZXdXCT7HtE96HubYFzUu y+6UQsMq7QyilbslWREESRafUC+RrxSYlcVLupawYEUZ4OOSWc/dkWVl0PjCmK4xLrnr W9dsMx8cqgu7yzfp3KVKx043GANDp+Ip0cxnD/rq+bwpbIrYUsLCLoiJPkUfcZrJEtXt vO0pyexHKg6yd/JxJ1CHSSNYYKhglrH75cGH0w7o3ZCUCXOILh+uu0GjwYaT1l2RrWdD iA== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pk7h8s8t0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Mar 2023 16:41:42 +0000 Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 32RGfffX028907 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Mar 2023 16:41:41 GMT Received: from hu-mojha-hyd.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 27 Mar 2023 09:41:38 -0700 From: Mukesh Ojha <quic_mojha@quicinc.com> To: <agross@kernel.org>, <andersson@kernel.org>, <konrad.dybcio@linaro.org>, <linus.walleij@linaro.org> CC: <linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-gpio@vger.kernel.org>, Mukesh Ojha <quic_mojha@quicinc.com> Subject: [PATCH v4 1/5] firmware: qcom_scm: provide a read-modify-write function Date: Mon, 27 Mar 2023 22:11:17 +0530 Message-ID: <1679935281-18445-2-git-send-email-quic_mojha@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1679935281-18445-1-git-send-email-quic_mojha@quicinc.com> References: <1679935281-18445-1-git-send-email-quic_mojha@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: RsAX7rDOzTU8oaw4p8f2SggbG2wvDFc_ X-Proofpoint-ORIG-GUID: RsAX7rDOzTU8oaw4p8f2SggbG2wvDFc_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-24_11,2023-03-27_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 spamscore=0 bulkscore=0 impostorscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 clxscore=1015 mlxlogscore=647 phishscore=0 priorityscore=1501 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2303270134 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761540183973611942?= X-GMAIL-MSGID: =?utf-8?q?1761540183973611942?= |
Series |
Refactor to support multiple download mode
|
|
Commit Message
Mukesh Ojha
March 27, 2023, 4:41 p.m. UTC
It was realized by Srinivas K. that there is a need of
read-modify-write scm exported function so that it can
be used by multiple clients.
Let's introduce qcom_scm_io_update_field() which masks
out the bits and write the passed value to that
bit-offset. Subsequent patch will use this function.
Suggested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
---
drivers/firmware/qcom_scm.c | 15 +++++++++++++++
include/linux/firmware/qcom/qcom_scm.h | 2 ++
2 files changed, 17 insertions(+)
Comments
Hi Mukesh, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on next-20230327] [also build test WARNING on v6.3-rc4] [cannot apply to linusw-pinctrl/devel linusw-pinctrl/for-next linus/master v6.3-rc4 v6.3-rc3 v6.3-rc2] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Mukesh-Ojha/firmware-qcom_scm-provide-a-read-modify-write-function/20230328-004405 patch link: https://lore.kernel.org/r/1679935281-18445-2-git-send-email-quic_mojha%40quicinc.com patch subject: [PATCH v4 1/5] firmware: qcom_scm: provide a read-modify-write function config: s390-allyesconfig (https://download.01.org/0day-ci/archive/20230328/202303280535.acb66sQT-lkp@intel.com/config) compiler: s390-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/47c3bb52fbb758e2238a7ab29c00e3188afe9754 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Mukesh-Ojha/firmware-qcom_scm-provide-a-read-modify-write-function/20230328-004405 git checkout 47c3bb52fbb758e2238a7ab29c00e3188afe9754 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=s390 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash drivers/firmware/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202303280535.acb66sQT-lkp@intel.com/ All warnings (new ones prefixed by >>): drivers/firmware/qcom_scm.c: In function 'qcom_scm_io_update_field': >> drivers/firmware/qcom_scm.c:419:49: warning: suggest parentheses around '-' inside '<<' [-Wparentheses] 419 | new = (old & ~mask) | (val << ffs(mask) - 1); | ~~~~~~~~~~^~~ vim +419 drivers/firmware/qcom_scm.c 409 410 int qcom_scm_io_update_field(phys_addr_t addr, unsigned int mask, unsigned int val) 411 { 412 unsigned int old, new; 413 int ret; 414 415 ret = qcom_scm_io_readl(addr, &old); 416 if (ret) 417 return ret; 418 > 419 new = (old & ~mask) | (val << ffs(mask) - 1); 420 421 return qcom_scm_io_writel(addr, new); 422 } 423 EXPORT_SYMBOL(qcom_scm_io_update_field); 424
diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c index 5f281cb..431fe1f 100644 --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c @@ -407,6 +407,21 @@ int qcom_scm_set_remote_state(u32 state, u32 id) } EXPORT_SYMBOL(qcom_scm_set_remote_state); +int qcom_scm_io_update_field(phys_addr_t addr, unsigned int mask, unsigned int val) +{ + unsigned int old, new; + int ret; + + ret = qcom_scm_io_readl(addr, &old); + if (ret) + return ret; + + new = (old & ~mask) | (val << ffs(mask) - 1); + + return qcom_scm_io_writel(addr, new); +} +EXPORT_SYMBOL(qcom_scm_io_update_field); + static int __qcom_scm_set_dload_mode(struct device *dev, bool enable) { struct qcom_scm_desc desc = { diff --git a/include/linux/firmware/qcom/qcom_scm.h b/include/linux/firmware/qcom/qcom_scm.h index 1e449a5..203a781 100644 --- a/include/linux/firmware/qcom/qcom_scm.h +++ b/include/linux/firmware/qcom/qcom_scm.h @@ -84,6 +84,8 @@ extern bool qcom_scm_pas_supported(u32 peripheral); extern int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val); extern int qcom_scm_io_writel(phys_addr_t addr, unsigned int val); +extern int qcom_scm_io_update_field(phys_addr_t addr, unsigned int mask, + unsigned int val); extern bool qcom_scm_restore_sec_cfg_available(void); extern int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare);