From patchwork Tue Feb 27 15:53:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mukesh Ojha X-Patchwork-Id: 207289 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2786098dyb; Tue, 27 Feb 2024 07:54:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVGgGV1ONQvVWMGcCV0N+/JhXBk6tObGIwrGaMuhNJUGrgUwqNTEnnp8oo42YcXnou4RFoPOnkn6KdttdN8zv3nI1jWwg== X-Google-Smtp-Source: AGHT+IGNDpcNUfvmG9h3Ts3ru/2OHCqBOl8mQBEsnYlKgXKOyOolNJrWEKo6Mm3yCF0weudlDuLn X-Received: by 2002:a1f:cac7:0:b0:4d1:3f59:5c79 with SMTP id a190-20020a1fcac7000000b004d13f595c79mr6136181vkg.15.1709049248584; Tue, 27 Feb 2024 07:54:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709049248; cv=pass; d=google.com; s=arc-20160816; b=iZVmyXnLvplzZiOqsrKOrcHlKmlfvLhDbRBoEoPRCOJpltMymN6Luflua4n+yChDQp ssLIIhuTxnPNY6Pr/9O/AIa+wQS+iQhXA60atn4vX5955iFaEA2aEQZBhKT7DexCqH93 yEibnEx9nyWClFs3tv4UUA2PpoP3EbKtTH3uW4gBbdSTqGz8xt2v/ryUNPUa6SC7xUBc dIqXJaApdFWAUoEY6dAD5kYNpD+YPb0kPFbVJZdNGriLHjrFcAcdqB8WfiqyyryyxBDN Q0FJRYO/4ooId6n1N5TSlk/UgBqSmpfXpkalNysO948q+HXjeIz2qbvLOcM17qaPcmDM OGXw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=CY0FaMU4wnVsLsp43Ffy9Z005ivffcYHL55Q9T5ds0I=; fh=v/J7FZ7kroLF8arNv1lU638DioI58lxpdVQAXxWjgAc=; b=pieMSoM1lsi204a76PxjpC32iiYY/Jn3dfSy9M3FTVpLdhZqQrgfBEYyFhLQBlWHTE ybmF3AX1JfASsiFzEdwzc4KAvSCZso6uEs0QWexdk4b7xEp3PLNrQWKNM82TpEfJSWVD bOdA3+qEF23NVk1PbDt4yBS8f5oYs+tNOoPILtwzBE0YDmQbiUUF5E7RHHzZsSpAEASm Az4vcCMWEEiu4ZXM70Jy4KZNvQR+FmHKjgp1dsnVmxuHLCAqSPx4pZdvqJFTCbnwRxF2 Ap971TNbWt7OlwtqGUsNa01kTIf1AEw6crC2Q5msm5NPqKwJXruGrMie+zs+uZ5cJXPA rTPg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=NpZBAkLR; 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-83547-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83547-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id g6-20020ac84686000000b0042c11e50969si7499088qto.753.2024.02.27.07.54.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 07:54:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83547-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=NpZBAkLR; 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-83547-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83547-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 3EE5F1C23758 for ; Tue, 27 Feb 2024 15:54:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED6DF14831C; Tue, 27 Feb 2024 15:53:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="NpZBAkLR" 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 ACE291474B0; Tue, 27 Feb 2024 15:53:35 +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=1709049217; cv=none; b=NbYEMzAZKdHhuHKFpwTGudBDl6xYmWfN/6vs8AfD20ZqE9gPtFTHTBmHSz3SiD2N2RtXQ+gOAHdmfYwKErIJu5YbhTZdd/4yMxAY+tzwlCoQxke+IqyFHIWn7V4qFSCT8an+y8HIFBn3iWa9l+2uy6q9tvMYZdFxVwvTwbVHBXM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709049217; c=relaxed/simple; bh=sQ2CJTGlHNoB9WmLGpGyTeqk7Y9gIegE3u6Fo9P3dpw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SwfX7iXW9bijG/iKReOPWXo59T80pmoIdobQSsFCx/zwSCzRNWQbtA4tlYMZOs7bYlAPjPXwgWV8go1e7HqbJCdCeEJwq7rTTrsHcTBKczDg1o73yzeKwjgWAnv+7dSmxU07Oa1CG+gY+q3ql7G2KlBiPkzhee+1yOStw3+4p98= 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=NpZBAkLR; 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 (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41R9XvuI030790; Tue, 27 Feb 2024 15:53:32 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-transfer-encoding:content-type; s= qcppdkim1; bh=CY0FaMU4wnVsLsp43Ffy9Z005ivffcYHL55Q9T5ds0I=; b=Np ZBAkLRKQPHL+rMvc8JN7dZZkQV9HtRU10KNyuMxJcdj82No1iSgVKKCRBt+ELkU8 XoOnEGSQDM75/zgrrd3tIsWEIEcBjARNePMNhFcKWiEfu+x+GWtFYEGrQ68cvqlp K7+YnTIx1OasNHjvOOWc7GoPSFNaHr8QM2D8QP+zDlTynmL6ZNlT11HJKjiO9CwF 7DzulVGXpZzp/fpWUefJt1VhN7hdf8B1xmeO7ntv2X23Eyg/743AoO5vp+FRYIb0 jHYFe3M3PCmsjN1ygEUjTim5/Y2E+CJ1j/nggchstG5XENARbDVSnTKgbOUlC4Qz caqrlBmFdkRLtphramtg== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wh6nrhqvq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 15:53:32 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41RFrVOF028519 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 15:53:31 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.1118.40; Tue, 27 Feb 2024 07:53:28 -0800 From: Mukesh Ojha To: , CC: , , , , Mukesh Ojha Subject: [PATCH v12 1/9] firmware: qcom: scm: Rename scm_query_lock to scm_lock Date: Tue, 27 Feb 2024 21:23:00 +0530 Message-ID: <20240227155308.18395-2-quic_mojha@quicinc.com> X-Mailer: git-send-email 2.43.0.254.ga26002b62827 In-Reply-To: <20240227155308.18395-1-quic_mojha@quicinc.com> References: <20240227155308.18395-1-quic_mojha@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 4n1UIskjC0S9WQu48wQhmjLTyl4s4iLX X-Proofpoint-ORIG-GUID: 4n1UIskjC0S9WQu48wQhmjLTyl4s4iLX 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-02-27_01,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 phishscore=0 clxscore=1015 suspectscore=0 bulkscore=0 adultscore=0 malwarescore=0 mlxlogscore=999 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402270123 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792068025046281215 X-GMAIL-MSGID: 1792068025046281215 scm_query_lock is global spin lock and only used for query purpose with trustzone and that too for one time to get the convention of scm communication. It is possible that, it can reused for other purpose. Rename scm_query_lock to scm_lock. Signed-off-by: Mukesh Ojha --- drivers/firmware/qcom/qcom_scm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c index 520de9b5633a..2d0ba529cf56 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -193,7 +193,7 @@ static void qcom_scm_bw_disable(void) } enum qcom_scm_convention qcom_scm_convention = SMC_CONVENTION_UNKNOWN; -static DEFINE_SPINLOCK(scm_query_lock); +static DEFINE_SPINLOCK(scm_lock); static enum qcom_scm_convention __get_convention(void) { @@ -250,14 +250,14 @@ static enum qcom_scm_convention __get_convention(void) probed_convention = SMC_CONVENTION_LEGACY; found: - spin_lock_irqsave(&scm_query_lock, flags); + spin_lock_irqsave(&scm_lock, flags); if (probed_convention != qcom_scm_convention) { qcom_scm_convention = probed_convention; pr_info("qcom_scm: convention: %s%s\n", qcom_scm_convention_names[qcom_scm_convention], forced ? " (forced)" : ""); } - spin_unlock_irqrestore(&scm_query_lock, flags); + spin_unlock_irqrestore(&scm_lock, flags); return qcom_scm_convention; } From patchwork Tue Feb 27 15:53:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mukesh Ojha X-Patchwork-Id: 207290 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2786272dyb; Tue, 27 Feb 2024 07:54:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUT3CfCJRL1Di5aibU3Y9+b54pOuqcMj5tITjlJB5hcMaUMF7PMqW0AfiI+1043qvH0o3quSV9nPhkT+yT07GhYS5OOrQ== X-Google-Smtp-Source: AGHT+IFVlIOe743yPe5yxgso8NSkpuPRAhoVaBfjy/uLBhf+C0LNLSUaKGLbficav8jk4NtqsJ0r X-Received: by 2002:a1f:c8c2:0:b0:4c7:e255:72aa with SMTP id y185-20020a1fc8c2000000b004c7e25572aamr5946929vkf.8.1709049265225; Tue, 27 Feb 2024 07:54:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709049265; cv=pass; d=google.com; s=arc-20160816; b=Oqg1f8SRwmdqsHb2YayXQGuDDVj5zKHDX0WYxGKvh2M5ytm6Zw30+UEAtrkzxxs4m2 kOq+IWrLID1HEtkGUsoKtIvQKauG2k5AqqDJuzF3icDKXxWYm/29OztM0T9CiGU+4k7R HYUcGXLd4vt+1qsmN62p6U3+7Nj/H73KimdRqkWdo5vBQjqh10bYUu1znB3zZtd+8Rcd hhiH4q7HOtARZz0rJh+wuUmKF+ETHaGjC4mZN+sygAzhRHw6/3dumLq3+yFSWBZhbRIr QXwdOQkdz98mRTMRLGZFQ94wil99YcTRZVfSZvfBZ26IMpgYxTthusth6krK5TV9PBRS jkyQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=q0+hUnOoICebzhHPGRPxXfQBp7yrZlY1ry35Sv9WcxE=; fh=VuRJ6dsm2z3EE7Yt1RnAVb56tmISmwvz3wBP7KlVHII=; b=Mx5jOh1L+SWY2CnISf/nxVQiD1/qMNFoz/ncHCbzhI3wmmpAgbqAUG1TKII0QJptrw BNlD2mTmjmnh54l3zkimJRepZ5m3RfF3CI52svyohMrEIZevAB4SV3Egc1wkLsKDvgSS 3arI5/A8SZzukKY3ylq+wp4Q2l3vH+8x7s5WVNLXLSiuTVLzrZP6wXkdznNbdFhP+4NT 6qnGt7rqXQyDx4Hs9ZmgMJ/lLJBuqyZNevIM6gk8DwAks4xBORhYeSNKXk4F+0XE4EUp mnDMx7uoFrzy13lofQzY5Fi/D4eAwLLdGoaFRzbZzPeFP2Kl6U1UF3qH2AycomNYPntw B9Hg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=m8OqEVLJ; 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-83548-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83548-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id g6-20020ac84686000000b0042c11e50969si7499088qto.753.2024.02.27.07.54.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 07:54:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83548-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=m8OqEVLJ; 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-83548-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83548-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E6F0E1C23A46 for ; Tue, 27 Feb 2024 15:54:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 852351487EF; Tue, 27 Feb 2024 15:53:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="m8OqEVLJ" 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 32582146012; Tue, 27 Feb 2024 15:53:38 +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=1709049220; cv=none; b=aIXSjkCslx14CfMSDeS0D0mPeqK971+ItaVmjPjvb0cTQyS8Y2Nwhb+1avyGcZV79NbAmrnNzhnwFMpYsCaQ4avf5CBHBgL3qm4H9IQTpYKT+7+Ysg6rhE+Wr1JsEl6/Hala7yijBBEJKPFIUs9QsrhqwK20RbA1nPoTlYgjiSY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709049220; c=relaxed/simple; bh=wNqr7/bTktWDZ9rqRhsDSN0LgRZjviGp6/h+Aufs2WE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EPvTIRoXQQkbSQEHcKrm00RKNum5RdWm67Dm8Zk8MxNE3xabOpfYf15o9lTvGqoijpEsW8IpTjSNEUE0Giq/0/cywLum6PEStaTG5XwL1JkdJUxoiR8VnXFcqiC2/jXq73ybe+Pps628DrsstVwqbQXkKyBzPqL5RdJkha5PrSI= 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=m8OqEVLJ; 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 41R9Y8Dn014703; Tue, 27 Feb 2024 15:53:35 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-transfer-encoding:content-type; s= qcppdkim1; bh=q0+hUnOoICebzhHPGRPxXfQBp7yrZlY1ry35Sv9WcxE=; b=m8 OqEVLJ/W/O5pQC5XrB7QZNutY5MYCh2ADqBo3IvzmUj55uHkPttliiYqr7lLuUFK N4nqLmjjLZZsACQErMPzpkz7AfcemGCQzI1VElpXvBGQ3FSWNRcjr7AAKEBc0GGk lFGmtS4M7tybsJzVEwu/3yLnFHc8ZDmPg7W56VSddDoyWwKCZHdXClxOYOSAazll LtINOY7NUsMRrKrjXyTw/r1JMUXERfWTUWXYzkyS0fNJEh3C0BS1mYvqzaR8L1Fg c26i0Fkoz4PNlFy27VUAJrck6mThP9M+kHzaD+CZynWSSt5t+Byq3gdNWtPy1ppa 0BN7WDXetcvdAx3d6tSw== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wh64h1u0r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 15:53:35 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41RFrYCY016565 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 15:53:34 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.1118.40; Tue, 27 Feb 2024 07:53:31 -0800 From: Mukesh Ojha To: , CC: , , , , Mukesh Ojha , Srinivas Kandagatla , Kathiravan Thirumoorthy Subject: [PATCH v12 2/9] firmware: qcom: scm: provide a read-modify-write function Date: Tue, 27 Feb 2024 21:23:01 +0530 Message-ID: <20240227155308.18395-3-quic_mojha@quicinc.com> X-Mailer: git-send-email 2.43.0.254.ga26002b62827 In-Reply-To: <20240227155308.18395-1-quic_mojha@quicinc.com> References: <20240227155308.18395-1-quic_mojha@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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-ORIG-GUID: aSHyXBmahNJyxya09-AOGp953LnYpJp1 X-Proofpoint-GUID: aSHyXBmahNJyxya09-AOGp953LnYpJp1 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-02-27_01,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1011 bulkscore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 mlxlogscore=910 priorityscore=1501 adultscore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402270123 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792068042370140303 X-GMAIL-MSGID: 1792068042370140303 It is possible that different bits of a secure register is used for different purpose and currently, there is no such available function from SCM driver to do that; one similar usage was pointed by Srinivas K. inside pinctrl-msm where interrupt configuration register lying in secure region and written via read-modify-write operation. Export qcom_scm_io_rmw() to do read-modify-write operation on secure register and reuse it wherever applicable, also document scm_lock to convey its usage. Suggested-by: Srinivas Kandagatla Signed-off-by: Mukesh Ojha Tested-by: Kathiravan Thirumoorthy # IPQ9574 and IPQ5332 --- drivers/firmware/qcom/qcom_scm.c | 33 ++++++++++++++++++++++++++ include/linux/firmware/qcom/qcom_scm.h | 1 + 2 files changed, 34 insertions(+) diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c index 2d0ba529cf56..8f766fce5f7c 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -193,6 +193,11 @@ static void qcom_scm_bw_disable(void) } enum qcom_scm_convention qcom_scm_convention = SMC_CONVENTION_UNKNOWN; +/* + * scm_lock to serialize call to query SMC convention and + * to atomically operate(read-modify-write) on different + * bits of secure register. + */ static DEFINE_SPINLOCK(scm_lock); static enum qcom_scm_convention __get_convention(void) @@ -481,6 +486,34 @@ static int qcom_scm_disable_sdi(void) return ret ? : res.result[0]; } +int qcom_scm_io_rmw(phys_addr_t addr, unsigned int mask, unsigned int val) +{ + unsigned long flags; + unsigned int old; + unsigned int new; + int ret; + + if (!__scm) + return -EPROBE_DEFER; + + /* + * Lock to atomically do rmw operation on different bits + * of secure register + */ + spin_lock_irqsave(&scm_lock, flags); + ret = qcom_scm_io_readl(addr, &old); + if (ret) + goto unlock; + + new = (old & ~mask) | (val & mask); + + ret = qcom_scm_io_writel(addr, new); +unlock: + spin_unlock_irqrestore(&scm_lock, flags); + return ret; +} +EXPORT_SYMBOL_GPL(qcom_scm_io_rmw); + 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 ccaf28846054..3a8bb2e603b3 100644 --- a/include/linux/firmware/qcom/qcom_scm.h +++ b/include/linux/firmware/qcom/qcom_scm.h @@ -82,6 +82,7 @@ bool qcom_scm_pas_supported(u32 peripheral); int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val); int qcom_scm_io_writel(phys_addr_t addr, unsigned int val); +int qcom_scm_io_rmw(phys_addr_t addr, unsigned int mask, unsigned int val); bool qcom_scm_restore_sec_cfg_available(void); int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare); From patchwork Tue Feb 27 15:53:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mukesh Ojha X-Patchwork-Id: 207291 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2786388dyb; Tue, 27 Feb 2024 07:54:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUZlXnEv4yXud+LOy+elhr/Od7SYE7hNkUPYtxu2Vq3GNh5PEyhZu+5cr8VEpUZSvKTUIWgnYDRGIXB+FlMIOxAALApYA== X-Google-Smtp-Source: AGHT+IFrqovbjMFd/G73AIrzKYXuElPJTUFmEhLc61mTBofCQMIFuCmJ6dcc/TZmZ1k26gf+S2FV X-Received: by 2002:a05:620a:5818:b0:787:6c14:e934 with SMTP id wm24-20020a05620a581800b007876c14e934mr3799100qkn.29.1709049280899; Tue, 27 Feb 2024 07:54:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709049280; cv=pass; d=google.com; s=arc-20160816; b=ldE777VtXcfD2NrEcpdr0ZiT9BZhVRC4ci0j6UVqudO26r+CdiNy8AK2zinUF00DQP 90jEcOz33mq5xtXPEDrOblQrxzyZx9ohcELN4eRDxE4ErI0OgcTlCdZ1bPCq/9vNWCW+ dzTe4gnXidbB5Dj9p00QZ6sxIx/dYh2+SyNYEVb5v2YEc1KhT9ZXe8aQT7NXyW2rNBCs 8unxlNGCWQX4tGTMVb7qqSvytb5p8YprZtCqnRl1QwOs1al3/2ettdkqzPyorRbQKmXV qa1bHdYflV9rHPy4hpT+yOvnia9GcHkFGhhcowhT2H/P6Q743HK0X1Vz4WtcpOiJGkq4 IfzQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=EWhV6ok4mosUQ6nG76a23dljc45DgMGnmQ2BCi1x2zk=; fh=epl1Lcmjx5pldMchpPIoRu0rUOcGj6KcJykRZJHEIXA=; b=FovUQpyKFXy3yM/icmG3k5HzMmCe31qKJu/AR/pu4yvied++rK7Fkjz/agQ4Cjcqww I4aHCZJQQzKYjLGZAwqgeGrAyvmCPg1qSPP2IuifGsAh6z/Q7CvmglP9pVVAGaXPGW5w s3O+Rmotzs307kO7g3rAHyOJwJDQdzLnDrnODJPQqQpRG6m1O74jmaqejl7Tp2DUZ3dM RsyGIKaUzvTkuOmNiVvlCerLCyK2EnxtluYX1ixb5Eh6CzK4nxVFBAppa9Qep5B6MUT2 G3wEQQf/4KmkgtoX6IpZahnxFL8WwKfYwXIDejtxaEu1W4cwsqXntSGn/5QbQXLecXFa sQOA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=LexsFGC+; 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-83549-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83549-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ya2-20020a05620a5e4200b00787b883714csi7248640qkn.711.2024.02.27.07.54.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 07:54:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83549-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=LexsFGC+; 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-83549-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83549-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id AEF151C21C63 for ; Tue, 27 Feb 2024 15:54:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2EBF414900D; Tue, 27 Feb 2024 15:53:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="LexsFGC+" 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 D62171487E2; Tue, 27 Feb 2024 15:53:42 +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=1709049224; cv=none; b=uMqYHh6pLsXo7ZgM8HPkbXrAHFT30Wh7mKpF0DqZ6rzLsVupoD7jCSikQmP1EjjIDV87VERne0veOkv1bJkhQMl1hGq4H+Hz30VwIwgRjgnBjOYbyxKPBnagK8N/6EG2FbTivwbZ8fo9MSt87rOC8HGPgXh63rMTUNT8oAlniRA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709049224; c=relaxed/simple; bh=DCLxGX64iJCKm6zkS1ZFcJgYIa515nf3xKUvrPp6b/k=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WhBp+U1jLH7+HtjNaRfQubo7HRWg3gIj1HwfACgnNF9pEfRlnbdOVUH7erlBWPyDpplTT+ZNcI9RuC3wuY3HCmQKmbDfnMwb3k+7CXPV4aKdyUUr5xCejKXfYn82yvaPnTNnKQI4xPKYC33TWNxWT8bMeKMhkJL9qQAoYw9yJak= 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=LexsFGC+; 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 41R9ZMav017235; Tue, 27 Feb 2024 15:53:39 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-transfer-encoding:content-type; s= qcppdkim1; bh=EWhV6ok4mosUQ6nG76a23dljc45DgMGnmQ2BCi1x2zk=; b=Le xsFGC+X629X8vakyyU0JRBshE37H71ohTtJdWkmbqAXWShDcZ5TbvwKTLWZK3CxT ZLGMLz2UilQlih4ClLYVojYwvqqAUuTszpDuj2VDK3Vl9soDbJYzsKn8BszMranA g3+PcjOPVam3+OzhbcUKd14ByAhOfNU9LWXuv7i3naZ5joufYXcCOoJE+6CHUD/l 52a2QlbouBMzTU3Qb2FA1mHoBAFpxGrssvJYBldtILWqgY2SY7TqVIRCE5bAdO3Z YPFEncJL4eUIieHmy2v293slr3XrqrIZcKuiuQXu9pPvVlGv6CLge/B4EP2NEtc2 RlcUKS+XIYAMC3pAcopg== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wh64h1u0t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 15:53:38 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41RFrbf1011853 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 15:53:37 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.1118.40; Tue, 27 Feb 2024 07:53:34 -0800 From: Mukesh Ojha To: , CC: , , , , Mukesh Ojha , Poovendhan Selvaraj , Kathiravan Thirumoorthy , Dmitry Baryshkov , Elliot Berman Subject: [PATCH v12 3/9] firmware: qcom: scm: Modify only the download bits in TCSR register Date: Tue, 27 Feb 2024 21:23:02 +0530 Message-ID: <20240227155308.18395-4-quic_mojha@quicinc.com> X-Mailer: git-send-email 2.43.0.254.ga26002b62827 In-Reply-To: <20240227155308.18395-1-quic_mojha@quicinc.com> References: <20240227155308.18395-1-quic_mojha@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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-ORIG-GUID: MR5MoUEM4sVeJM8UpoTgttk7pznD7OVU X-Proofpoint-GUID: MR5MoUEM4sVeJM8UpoTgttk7pznD7OVU 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-02-27_01,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 bulkscore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 mlxlogscore=999 priorityscore=1501 adultscore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402270123 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792068058846888774 X-GMAIL-MSGID: 1792068058846888774 Crashdump collection is done based on DLOAD bits of TCSR register. To retain other bits, scm driver need to read the register and modify only the DLOAD bits, as other bits in TCSR may have their own significance. Co-developed-by: Poovendhan Selvaraj Signed-off-by: Poovendhan Selvaraj Signed-off-by: Mukesh Ojha Tested-by: Kathiravan Thirumoorthy # IPQ9574 and IPQ5332 Reviewed-by: Dmitry Baryshkov Reviewed-by: Elliot Berman --- drivers/firmware/qcom/qcom_scm.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c index 8f766fce5f7c..bd6bfdf2d828 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -4,6 +4,8 @@ */ #include +#include +#include #include #include #include @@ -114,6 +116,12 @@ static const u8 qcom_scm_cpu_warm_bits[QCOM_SCM_BOOT_MAX_CPUS] = { #define QCOM_SMC_WAITQ_FLAG_WAKE_ONE BIT(0) #define QCOM_SMC_WAITQ_FLAG_WAKE_ALL BIT(1) +#define QCOM_DLOAD_MASK GENMASK(5, 4) +enum qcom_dload_mode { + QCOM_DLOAD_NODUMP = 0, + QCOM_DLOAD_FULLDUMP = 1, +}; + static const char * const qcom_scm_convention_names[] = { [SMC_CONVENTION_UNKNOWN] = "unknown", [SMC_CONVENTION_ARM_32] = "smc arm 32", @@ -531,6 +539,7 @@ static int __qcom_scm_set_dload_mode(struct device *dev, bool enable) static void qcom_scm_set_download_mode(bool enable) { + u32 val = enable ? QCOM_DLOAD_FULLDUMP : QCOM_DLOAD_NODUMP; bool avail; int ret = 0; @@ -540,8 +549,9 @@ static void qcom_scm_set_download_mode(bool enable) if (avail) { ret = __qcom_scm_set_dload_mode(__scm->dev, enable); } else if (__scm->dload_mode_addr) { - ret = qcom_scm_io_writel(__scm->dload_mode_addr, - enable ? QCOM_SCM_BOOT_SET_DLOAD_MODE : 0); + ret = qcom_scm_io_rmw(__scm->dload_mode_addr, + QCOM_DLOAD_MASK, + FIELD_PREP(QCOM_DLOAD_MASK, val)); } else { dev_err(__scm->dev, "No available mechanism for setting download mode\n"); From patchwork Tue Feb 27 15:53:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mukesh Ojha X-Patchwork-Id: 207292 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2786545dyb; Tue, 27 Feb 2024 07:55:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWcEeqq6XPYC7TpX44i3qitD4wE6Rln1DZWD9LhfftuxIFt/dy0542JyvM7w2r6BAPYtUtMkSZhxGbyfDt5JI/5inBZ6A== X-Google-Smtp-Source: AGHT+IEGo2bG1vwO2djTSX9jQTM/DdB/LGRKR0cKJagJEcemlSwuotL+kcATIyVDED9sDdqdkXAP X-Received: by 2002:a2e:a70d:0:b0:2d2:4637:63f with SMTP id s13-20020a2ea70d000000b002d24637063fmr4865641lje.45.1709049300567; Tue, 27 Feb 2024 07:55:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709049300; cv=pass; d=google.com; s=arc-20160816; b=V/rwWfXLCLm9XZlGojrgBVZiKTsl/gi78Cy6/GnJbgUuYa+BEZSbChNYokBLMkXYXD TBDKUhijA2zRp9Lt7uxmfagj2JQZjdClnqID1psAtn6dXiOz1svFTLV+SapcKBWitkim CGCG7c+5bJKbIcmrZRKu0HBOtNtHGRSMO4qhow5LLNHdLnzluGfE07iv3beV4icrNViv 23XkSrlAaqS5kmmsQ7xSXxL3e2qostjQ0ZI3Vhsjlm2eOmx0szShMuM48W2CsbZcybT4 QJeDYgRF+Hxf7Z+oYtRPjhV/sihyi6KUNa7djCgRrzhtGx9Te1349++BuQZO0Fe9Ftfd 0GCA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=w8c41ad81/MRv0zfE48SHuFTPr0UWUHFxzg7N35gGnc=; fh=pbj13JBcgzlDY1KlH4HTVK4tpMAKP2EJ7GoliizJeRw=; b=kSVNNaLWvtONgdrvUkQPv0PNhI4ll0KwdRQaAeGZV1Vg9ns6uh+iFBTSbNMPcFopFk hpJtqYOJBTgph1Jo06/W/mILTwNhr7dOu1eBBBFYL25UtrTnojXwV5auB3NwrkDlxPRs 8OgE3K02JmL0OPHV8FCkaMYvFWfcTLtux6VPy1KRd1Pil4hS7BOmjdcYxF3pX/HXeTWI qAYb/hV9vKfETMuCzpdrn6EiDUt2pLpgoeh3S4oqo5nSFlcJ4K0arSEzB6JYWkgU+WMz lI+Naykb8HEY3Cy6sgjEgfFH3DxVf6p2dm/h0CEpdG/jrlp7I95EsoW8I8IygRJKbyYv 8/Ng==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=FnPC7Qmc; 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-83550-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83550-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id i20-20020a508714000000b00565f7b78dacsi817421edb.132.2024.02.27.07.55.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 07:55:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83550-ouuuleilei=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=FnPC7Qmc; 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-83550-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83550-ouuuleilei=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 2CFF91F263E9 for ; Tue, 27 Feb 2024 15:55:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C5FC6149E08; Tue, 27 Feb 2024 15:53:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="FnPC7Qmc" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 AAA57149000; Tue, 27 Feb 2024 15:53:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709049227; cv=none; b=rm7XwQTeiI72bnT9PSfO/RBJu7trW+UeBk12piJSym/CvlNYbLS8j/b/P2UhzG+tLG+9BDJCUuxFHM2/a11o9MnbfWYv2kIaYGV2ExS4n0MhkAig5tF6AvYIqKb2ajb/hWW4ktcSue9wbjl659LpsRbQRsm4Sqx6P78WV4FnL6E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709049227; c=relaxed/simple; bh=TH+CWOIlbfz9/WAFIq4BowoDplJ8YIN+rxj14bUJarY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gFjq1C5oBW2Rwl8mkfihLdUf7p4UNARmhy3htv6bDV25Ck76XbsUfvfY8Zs4EU3/Z7j0ncGN5wabz4kY8t5c2qo62RTOOEPGYlZl2GPgOBZYrvJqYyKaEcQOOk7fQd0Fyue2HEEKMkZmlQH6O4eW4IMdnxW9bAVpCVg2ijBnZSk= 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=FnPC7Qmc; arc=none smtp.client-ip=205.220.168.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 (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41R9rqVE030907; Tue, 27 Feb 2024 15:53:41 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-transfer-encoding:content-type; s= qcppdkim1; bh=w8c41ad81/MRv0zfE48SHuFTPr0UWUHFxzg7N35gGnc=; b=Fn PC7QmcxKks7u/OlBJ8WldJIiM2QYVFfecpEEEdcInQiidTqRbKTSgKSADP55A1/Q b537NfwpX9XadD5Hzx6Td3Q0QFJqam2GwO4a27HKv8nf/VcMQG2LSOezalbXbczp wDOLUO751vPA+lRJSZcV3bHzWMfXMKy+1a+I8z9YQkKjfcPCH3fTgc3ovnbIQAlh 8IofalxmzHqPn9HlMdu2yVE3g3Dp+9lq8XjjEc803qKsCGB5tgPU7woPOMj8KMAQ WcO+bBk8vBv8MZxR/oLSaMSpXV4UG6sbNdmlrMBfolDkPB3Vyg08cKFGtdOzqPZC izvbmjkULpKvJd50/QhA== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wh89t1hrs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 15:53:41 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41RFrec7032743 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 15:53:40 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.1118.40; Tue, 27 Feb 2024 07:53:38 -0800 From: Mukesh Ojha To: , CC: , , , , Mukesh Ojha , Elliot Berman Subject: [PATCH v12 4/9] firmware: qcom: scm: Rework dload mode availability check Date: Tue, 27 Feb 2024 21:23:03 +0530 Message-ID: <20240227155308.18395-5-quic_mojha@quicinc.com> X-Mailer: git-send-email 2.43.0.254.ga26002b62827 In-Reply-To: <20240227155308.18395-1-quic_mojha@quicinc.com> References: <20240227155308.18395-1-quic_mojha@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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-ORIG-GUID: _uvA-hwPGXA3AiF7huwTShQtsp5GOOGL X-Proofpoint-GUID: _uvA-hwPGXA3AiF7huwTShQtsp5GOOGL 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-02-27_01,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 mlxscore=0 phishscore=0 adultscore=0 spamscore=0 impostorscore=0 bulkscore=0 mlxlogscore=999 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402270123 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792068079363985636 X-GMAIL-MSGID: 1792068079363985636 QCOM_SCM_BOOT_SET_DLOAD_MODE was only valid for very older target and firmware and for recent targets there is dload mode tcsr registers available to set the download mode. So, it is better to keep it as fallback check instead of checking its availability and failing it always. Signed-off-by: Mukesh Ojha Reviewed-by: Elliot Berman --- drivers/firmware/qcom/qcom_scm.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c index bd6bfdf2d828..3fd89cddba3b 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -540,18 +540,16 @@ static int __qcom_scm_set_dload_mode(struct device *dev, bool enable) static void qcom_scm_set_download_mode(bool enable) { u32 val = enable ? QCOM_DLOAD_FULLDUMP : QCOM_DLOAD_NODUMP; - bool avail; int ret = 0; - avail = __qcom_scm_is_call_available(__scm->dev, - QCOM_SCM_SVC_BOOT, - QCOM_SCM_BOOT_SET_DLOAD_MODE); - if (avail) { - ret = __qcom_scm_set_dload_mode(__scm->dev, enable); - } else if (__scm->dload_mode_addr) { + if (__scm->dload_mode_addr) { ret = qcom_scm_io_rmw(__scm->dload_mode_addr, QCOM_DLOAD_MASK, FIELD_PREP(QCOM_DLOAD_MASK, val)); + } else if (__qcom_scm_is_call_available(__scm->dev, + QCOM_SCM_SVC_BOOT, + QCOM_SCM_BOOT_SET_DLOAD_MODE)) { + ret = __qcom_scm_set_dload_mode(__scm->dev, enable); } else { dev_err(__scm->dev, "No available mechanism for setting download mode\n"); From patchwork Tue Feb 27 15:53:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mukesh Ojha X-Patchwork-Id: 207296 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2787468dyb; Tue, 27 Feb 2024 07:56:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXOVVScAq4Wjmv+5nNWs95wbrbXSXbAUsEgLN2XsHiMfDF2xHDhwoy04LT1yavhjLRJes3rzijCww/ahpyEd8Yl58OtsQ== X-Google-Smtp-Source: AGHT+IFo+EJ6i7qIsqnF1axJLHHK+kiGrjBeNJ7DPRkfM4SZb7mHCXvOU95Ff51C8ba9HzfG5L75 X-Received: by 2002:a17:902:690b:b0:1dc:4bc0:dc1b with SMTP id j11-20020a170902690b00b001dc4bc0dc1bmr8553911plk.63.1709049402280; Tue, 27 Feb 2024 07:56:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709049402; cv=pass; d=google.com; s=arc-20160816; b=kjKrCzR9FHkuZwv31cEa7qyWNEw0FWsNBpC70PU/OStUut9p+KBIiw5SlzZYaAWqbu /67LE+89o8GDmZmZrvB0Fw3nhbPZqMoAeYJL44j4Rix7CPcYKiZUQXvJZEjzfMePLs+u NnutLlqe15veM+zVaubgI17DIfN2xXzbg/6Y12AyCwq+atU/ui7z1lYsuJDoOFaioEdU LOsC/kTwO1OJZAMEiGt7+DhV3DM+RL++mQ0SF0vyKAOHkSdZWWHnVehjxZFv8/McJQcL Rp9n9VZPh5hbQR+X0yWpN7Q7ZlWyZLHhE++j41s9unEP5Dra5vj1Wlsiueg+Y7cE0z+O ttBQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=iK+5IGZCTHYf95YGpbHUD4YjDMRJdiTM0LY+A4KnU0Q=; fh=v/J7FZ7kroLF8arNv1lU638DioI58lxpdVQAXxWjgAc=; b=MUaRH9Z+0J14NCBYK72zpQ4NMHNuZ434p0IEQjaJI3euR9ZiOuwYqo8FZIYMx7Sf6P 1IVSEE+0N6Yo3YeigypWMDWRRe0zRqNtABuQxedSq65XRaDfoIgT5vRMna1oiXlNrb+z 5ulrkhF95R5dLk/8HZ3Pa8ePW15zCGs78ZQD7ftY7F5+l/xpFQ7jHa4PBzKWEC+EiZ6e 79yvOAVq0tF6qbeiwZzq/FODxF5N/RZRVAzjcYJoLlxOaTtBrzzWkqbowVe7b8I7aeJc tHoTOPmzYUu0FFB/BeQfejX9BGQ46lPConq+2Uhq0neDKqI8lgGcWOvWmBg1cdburuW3 qfYQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=NAUqpgdK; 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-83551-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83551-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i7-20020a17090332c700b001dc9e788883si1557323plr.442.2024.02.27.07.56.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 07:56:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83551-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=NAUqpgdK; 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-83551-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83551-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 170CB2833C9 for ; Tue, 27 Feb 2024 15:55:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 19E4814A0A2; Tue, 27 Feb 2024 15:53:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="NAUqpgdK" 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 EE17B1487E2; Tue, 27 Feb 2024 15:53:47 +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=1709049229; cv=none; b=FLi3yWXYWvQFk7+7wIK7wVhivCji/llgtgOyLERd7iNysBdaMC+gcvRYASHKk095nhW6Bs21qQEn/0ai+iTQRjuTStCtcmIc1BEAwhT8i1H8F8j5GgJ8cjxMWJ8K8FPXpB1Iog96wiTpJLZCrByIrLMWfqjMZZhBsje4766YLhI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709049229; c=relaxed/simple; bh=cMCWwOFDDzkP/opZ4OZblcKhabLUYOPklY3q66jnb6A=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Gj6dLA5Vyd8/CzybLOxqJXCmlWmzNODV7Rwrl9VKBJ6VfdhIW7mIDSDJBhgJJjABTpldghaT7cp8X37dc09tJoVS3vPQV6fbd1fxESNwB7ClMx3izsYKpQfSOwRvEU58DX05rVeFBKfuQOuvu8rTzBgjEbISQH8Oj5WXf7L1LVk= 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=NAUqpgdK; 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 (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41REac2u021570; Tue, 27 Feb 2024 15:53:44 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-transfer-encoding:content-type; s= qcppdkim1; bh=iK+5IGZCTHYf95YGpbHUD4YjDMRJdiTM0LY+A4KnU0Q=; b=NA UqpgdKbzq7NOxihfjQK3XdK5fREzSOpfiWt/WcZc1JM56r2xktAIV8CQRDM9tLWo KKHwhtb8RSaT63nht4Yt4Q7+JYfhRUh1kyfXGG7RgzAmdxHnu4X9CSagV8X7UK3M 5IqR6FfekDy5evAsquS4+Aa1fkKS4JbQJl7yX5XboioQVeqg6eIx3KiDEABjSFUO WWvleFW/CwthFpRtPlpuO9TVrFJ0UogxKIXNvsPLl92fuy88KfepL3EMyU2BJn1O K0OaOaeJdblMWPNjjZNF7x416sRWvZcyd3VZ0BdsYpbfiYSCV/dr7GJtcpcfSH3b N4Wz/6gGeeqipP2lE/OA== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wha079bjr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 15:53:44 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41RFrhjS028712 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 15:53:43 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.1118.40; Tue, 27 Feb 2024 07:53:41 -0800 From: Mukesh Ojha To: , CC: , , , , Mukesh Ojha Subject: [PATCH v12 5/9] pinctrl: qcom: Use qcom_scm_io_rmw() function Date: Tue, 27 Feb 2024 21:23:04 +0530 Message-ID: <20240227155308.18395-6-quic_mojha@quicinc.com> X-Mailer: git-send-email 2.43.0.254.ga26002b62827 In-Reply-To: <20240227155308.18395-1-quic_mojha@quicinc.com> References: <20240227155308.18395-1-quic_mojha@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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-ORIG-GUID: kBVG0DAQQiBnusn7Yhm6ROiLjrCfJjI4 X-Proofpoint-GUID: kBVG0DAQQiBnusn7Yhm6ROiLjrCfJjI4 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-02-27_01,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 mlxlogscore=719 clxscore=1015 suspectscore=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 spamscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402270123 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792068185925950909 X-GMAIL-MSGID: 1792068185925950909 Use qcom_scm_io_rmw() exported function in pinctrl-msm driver. Signed-off-by: Mukesh Ojha Acked-by: Linus Walleij --- @Linus.Walleij, I have removed your Ack on this patch after your comment on https://lore.kernel.org/lkml/CACRpkdbnj3W3k=snTx3iadHWU+RNv9GY4B3O4K0hu8TY+DrK=Q@mail.gmail.com/ If you agree on the current solution, please ack this again. drivers/pinctrl/qcom/pinctrl-msm.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c index aeaf0d1958f5..1bd5c8c43fcd 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.c +++ b/drivers/pinctrl/qcom/pinctrl-msm.c @@ -1082,22 +1082,20 @@ static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int type) if (g->intr_target_width) intr_target_mask = GENMASK(g->intr_target_width - 1, 0); + intr_target_mask <<= g->intr_target_bit; if (pctrl->intr_target_use_scm) { u32 addr = pctrl->phys_base[0] + g->intr_target_reg; int ret; - qcom_scm_io_readl(addr, &val); - val &= ~(intr_target_mask << g->intr_target_bit); - val |= g->intr_target_kpss_val << g->intr_target_bit; - - ret = qcom_scm_io_writel(addr, val); + val = g->intr_target_kpss_val << g->intr_target_bit; + ret = qcom_scm_io_rmw(addr, intr_target_mask, val); if (ret) dev_err(pctrl->dev, "Failed routing %lu interrupt to Apps proc", d->hwirq); } else { val = msm_readl_intr_target(pctrl, g); - val &= ~(intr_target_mask << g->intr_target_bit); + val &= ~intr_target_mask; val |= g->intr_target_kpss_val << g->intr_target_bit; msm_writel_intr_target(val, pctrl, g); } From patchwork Tue Feb 27 15:53:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mukesh Ojha X-Patchwork-Id: 207297 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2787568dyb; Tue, 27 Feb 2024 07:56:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW8++jsnHw1uHoj5dl99GPIC4P3QXe3d+qjUr42UC3G1r80yEaky/GA+T68xd8UV6KBOswL7xoF8flw/u9gGTCtXKYiIQ== X-Google-Smtp-Source: AGHT+IHCpMlfiUr+qh7RpAGigt+bfWpc1gT2IXFPi9ksftUNIGkScQRV9dxvNwLXD1CMezwThCRw X-Received: by 2002:a05:6a00:5d:b0:6e5:6d2:234b with SMTP id i29-20020a056a00005d00b006e506d2234bmr6950668pfk.0.1709049411821; Tue, 27 Feb 2024 07:56:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709049411; cv=pass; d=google.com; s=arc-20160816; b=eazrXySpaHT9O3z6f9DbRozXACiRjvpVWEZjESZ2q7Svj2n4GZqxeztxLwxCOQcH0n SyCH8o00IrhJkr5TDOqZFG0DPJ5S64V8TReJIRzOXAZYi+Fv7BaWKfIy+mnnIkSJPesV 9/8kIsKFm3Nj7yNhnXpD6hF6qpsXcwhQ7h9BvqRAgPa5+zY2ewBeWPc/ho9sdEkzx2vU XWTrZ5jjNGHxiiBsrpEusYY62hWJxMqI+iDZg6rO/AZviRkdLZWWZo3QVGvBKCIAosVo MWMx7n+Q/4lcUHTz9GMaCqFiJWtThJSw33Re0/8TAy5Gv12BkhE6AtBtiId+dX4lpqIB ml6g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=gwUiJkIqL4nokAQI8FJ5IuA+Yowem9nNNMwwaK+yUv0=; fh=v/J7FZ7kroLF8arNv1lU638DioI58lxpdVQAXxWjgAc=; b=wRqqYykRYJDQITlL/r4toagzUDvecJ38/mdwcTDaFTVEQOq7NLzNKW4BDET7jz3daJ 18n62GyBQaDlm0eiilYAYIeokhTE6jYAePOHK3du4ER+2JCfGVEg3FsxbXBsx0DUA6Dv M0DgcgDUT6WBSqUR16+faO619sxDYHUEf8rIT9J+qQ3j2YvZizOMPKIUQ9rCylSR3DqO sdk1983U1MJgRRA1S9kKhiU7qKt3+n6BFOzTLWdJB8fuLwMJVkQM2bKiE8uKXblm3wp4 RopmFkwLLBHQsVQka5uokNoYtxv+qk7UFnXdtiMe2qgdCiu1r5CbsoawSy5nBFAao7HQ vfAA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=L9V4CRZk; 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-83552-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83552-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id f8-20020a056a00228800b006e550efa3eesi645731pfe.181.2024.02.27.07.56.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 07:56:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83552-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=L9V4CRZk; 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-83552-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83552-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7BA012852E8 for ; Tue, 27 Feb 2024 15:55:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A5B4A14AD23; Tue, 27 Feb 2024 15:53:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="L9V4CRZk" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 8468B149000; Tue, 27 Feb 2024 15:53:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709049231; cv=none; b=d85P2rMXvjKomIi8yAONaoctulm5v5xgv8j9pB0hBCBQn8O4M3WWRoVGrBwp5AghvF/XNMJlR9Tmhjac3b9xPyqLLAB+Y6XN8Uda8u63JTW1fG3ZXatdMF3pouVWAKpc/b0Qeo79ueVXRiC7xArZcO0AxalkfDkxVj5QOQ6d1cw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709049231; c=relaxed/simple; bh=CQNAuyTRM2K+tQB53tmQS1x2t4PZd2hpfvo2JMyAks4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XdP523hjL14aoiPxOt7Jc9W+Py01soZk1QrdPMx9nNoVgdIxsss7UurcvUHapaxdyadWTwMp0Ark6C5HvDwpNhF82wg0+HNE/xqoI7quAmy7dQqBv8+z2LWD/VpN+RfBpOfk2x689c8kibrS7IPtBHdJpuzSWMeIk6vVqcxGnfM= 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=L9V4CRZk; arc=none smtp.client-ip=205.220.168.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 (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41RERJCL026934; Tue, 27 Feb 2024 15:53:47 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-transfer-encoding:content-type; s= qcppdkim1; bh=gwUiJkIqL4nokAQI8FJ5IuA+Yowem9nNNMwwaK+yUv0=; b=L9 V4CRZk+oaqcDMn7an5oUVFDfcwIYMeqOh1+0wKtypphLYg+L5sEwvBragnbx+rUC cELrpLFThv6OktS5an2Zu3/7gjIbT+SXHTEjIKeuidQg9GbMph+/Xil/VSaHWZ6x qwbvC1DzoRtkPAexVhg/ZyOHt+B6qn7QsUfwEDB+Co5CjQvfDFgeJ/fcxsPDQOr7 l1lKqIleYKqhoIvOslZMwmdjQIItR/ym/HG2gbDt/vZd5n5Hqngby9kVlXAba+a4 yWGTKqhAwalWAi26MI/fumeWyoKyUM/cKEnTHaEZ6xzKW/fdFsYh8uU8liPEi717 ZbNXl94DS+Qff1DjjY9g== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wh8auhhy6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 15:53:46 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41RFrkrY012029 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 15:53:46 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.1118.40; Tue, 27 Feb 2024 07:53:43 -0800 From: Mukesh Ojha To: , CC: , , , , Mukesh Ojha Subject: [PATCH v12 6/9] firmware: qcom: scm: Remove log reporting memory allocation failure Date: Tue, 27 Feb 2024 21:23:05 +0530 Message-ID: <20240227155308.18395-7-quic_mojha@quicinc.com> X-Mailer: git-send-email 2.43.0.254.ga26002b62827 In-Reply-To: <20240227155308.18395-1-quic_mojha@quicinc.com> References: <20240227155308.18395-1-quic_mojha@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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-ORIG-GUID: PQ9POfKZ2x1o9oeNxfAkbq-US4XAGcss X-Proofpoint-GUID: PQ9POfKZ2x1o9oeNxfAkbq-US4XAGcss 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-02-27_01,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 bulkscore=0 suspectscore=0 phishscore=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=999 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402270122 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792068196287417638 X-GMAIL-MSGID: 1792068196287417638 Remove redundant memory allocation failure. WARNING: Possible unnecessary 'out of memory' message + if (!mdata_buf) { + dev_err(__scm->dev, "Allocation of metadata buffer failed.\n"); Signed-off-by: Mukesh Ojha Reviewed-by: Bjorn Andersson --- drivers/firmware/qcom/qcom_scm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c index 3fd89cddba3b..6c252cddd44e 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -598,10 +598,9 @@ int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size, */ mdata_buf = dma_alloc_coherent(__scm->dev, size, &mdata_phys, GFP_KERNEL); - if (!mdata_buf) { - dev_err(__scm->dev, "Allocation of metadata buffer failed.\n"); + if (!mdata_buf) return -ENOMEM; - } + memcpy(mdata_buf, metadata, size); ret = qcom_scm_clk_enable(); From patchwork Tue Feb 27 15:53:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mukesh Ojha X-Patchwork-Id: 207307 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2813430dyb; Tue, 27 Feb 2024 08:33:30 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX8M+c4KYtY0aKWsvAXbI7QdghL+nCk8zS17TDYXZDtSl55zBLcFBBC3wS7lf8y1V5zgefa29yfvKbCUu8sFqE3N3jqGw== X-Google-Smtp-Source: AGHT+IHDPi5rHx3OcRCMcjV/+jFdK+OgksIgEWK8CgV15alizAn/uuKw3tIYSWLF2+XUY6vAcYw/ X-Received: by 2002:a17:90a:6d03:b0:29a:98ad:61d4 with SMTP id z3-20020a17090a6d0300b0029a98ad61d4mr6970637pjj.33.1709051609773; Tue, 27 Feb 2024 08:33:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709051609; cv=pass; d=google.com; s=arc-20160816; b=WCq4ce/rZJUE629edKHIoTcNr40LNlKf2BkRq1uo8BhA1OMIqXIjPT8i0F/ubs5C+c WCl4LLvQhVnn40p5M7vYJSGen1sg+ESpQj0qSU0IngVLRKRbPLAxCgz+jbVntAx+Li3+ c+xxuA7ME9HVjxrOoQAu4tvUpf77CjxMySoMJG6/aPXGe1MxplT+b9Gpe4p4DWMQlIvz p3iJJbocJEswii0IpEiq1YOvGgnJZoMZYHbprgQl/eRPb+UoVIaHrF34vFer+TGoMBDp NhNgDEJwNowwCqUhRcMW5lbEevjzTdqIxs2f0wbeHrnk6F0mfSM8dYjBO3+ez1AECa+P ck5w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=cOKvVvpD1I2S/Q9+VH6NkXE2J8N1Hqi/V3A0NVLdoCA=; fh=v/J7FZ7kroLF8arNv1lU638DioI58lxpdVQAXxWjgAc=; b=E5hidU2Ncyij8FE/mK48i27tnRBhVryQAIqOJFPsr/Qhjga2fFlDn6aTRbe6VwJdip pS3pGWmZ43eUjY1qn/O1qwh5tQUpxLLp/jgYRkKPYhBrG7WlXNVIxRp2htHyixcjgLbD n9jGDyqaGJedYbJkkWF/8/P44cA/rWTMyJZeo+WB4LoFlFITofwBWbHEOGh4C4nG8ID/ 54tvI5+ZSZlMoRBqjAQt6GAAOhmT9B4qXWayU9WXajHRKekN6Q0+JjcxjRXOsZASsMuT F7qwE+9FaNqVV9VRiwXg347cqyVikV/qxzvdHAM4Kf8XWsSP8AOg0vm55bfzD1AM+iH+ ulGg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Q9I2jvRY; 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-83553-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83553-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id sx15-20020a17090b2ccf00b0029a84892664si5762289pjb.27.2024.02.27.08.33.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 08:33:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83553-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Q9I2jvRY; 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-83553-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83553-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 43AB7B2F816 for ; Tue, 27 Feb 2024 15:55:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EC6EE14C590; Tue, 27 Feb 2024 15:53:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Q9I2jvRY" 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 F0E0314A4E0; Tue, 27 Feb 2024 15:53:52 +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=1709049234; cv=none; b=epD2g+jwj/P8UGpAof74SpkEUzPNs5R4LM0xziGHcuozfDxXwwHda2G20OjqFPb9Urd2kcRW3v6fjqT+vrG5fsPCXUeapHDydHaw8izB3CkNHKYXo8EGUwf1vugdhnTMJlSYbvqRaZV67+4AcCpAXyXECId8foCVGutzN35ysss= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709049234; c=relaxed/simple; bh=+J0F74HTuPKCdwhUHHllo8INkNq/eyJeGz2YooKuLm0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=e3SUvbDQ8aaO7MtnzXJuRZWUNcx1vsj2XxwT14Os1JVP51ooYn1e8vcYUE4SeE/y2uuEQX+rR+Ql/9Cz9+qZEgh+h7rIB8EpAdV9Hez8HZDo5NCoj9fDazmHThSAk+kGxz6+nWBzK1ZK++TkiFIGjtIRDmml+ShcZn/fUlfS12U= 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=Q9I2jvRY; 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 (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41RDndPW028801; Tue, 27 Feb 2024 15:53:50 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-transfer-encoding:content-type; s= qcppdkim1; bh=cOKvVvpD1I2S/Q9+VH6NkXE2J8N1Hqi/V3A0NVLdoCA=; b=Q9 I2jvRY4Pz1xCC90Of6JV62iSOYVqavpo/eoQlat/TPanB5kBt/tMhnaMn7nqAbCi Eiy64MHm85O0lKKe0o+Sgclrs0Xyb43kMri0fjzQF+IWRmcwjJHKmzoioUUnm8oZ U0xfo55DQRd6ANWNJaj4wH1pfXXRDrqZCs4ObekhqfVfvI5rnA1lb/z42cUU1BtB TNODRjro1Mnq12Zw3+wzbq4vESecrgqhBXgDAzxx+RKfoe+l4UerHm+kD9ovkh5J YNhcO18pC9wcNfRPN6mzlXFL+e8oa8h2g8qnmO5cgvEjT3xr+C36mvoWUBU1yE/8 daw9A47TYgejLeZM2V0Q== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wh64qhtv5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 15:53:49 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41RFrmRa000472 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 15:53:48 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.1118.40; Tue, 27 Feb 2024 07:53:46 -0800 From: Mukesh Ojha To: , CC: , , , , Mukesh Ojha Subject: [PATCH v12 7/9] firmware: qcom: scm: Fix __scm->dev assignement Date: Tue, 27 Feb 2024 21:23:06 +0530 Message-ID: <20240227155308.18395-8-quic_mojha@quicinc.com> X-Mailer: git-send-email 2.43.0.254.ga26002b62827 In-Reply-To: <20240227155308.18395-1-quic_mojha@quicinc.com> References: <20240227155308.18395-1-quic_mojha@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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-ORIG-GUID: OxoyHR36EaGPMTU2SDlkdk8ZqNJP6E5g X-Proofpoint-GUID: OxoyHR36EaGPMTU2SDlkdk8ZqNJP6E5g 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-02-27_01,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 spamscore=0 priorityscore=1501 suspectscore=0 mlxlogscore=999 clxscore=1015 impostorscore=0 lowpriorityscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402270123 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792070500695310633 X-GMAIL-MSGID: 1792070500695310633 qcom_scm_is_available() gives wrong indication if __scm is initialized but __scm->dev is not. Fix this appropriately by making sure if __scm is initialized and then it is associated with its device. Signed-off-by: Mukesh Ojha --- drivers/firmware/qcom/qcom_scm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c index 6c252cddd44e..6f14254c0c10 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -1859,6 +1859,7 @@ static int qcom_scm_probe(struct platform_device *pdev) if (!scm) return -ENOMEM; + scm->dev = &pdev->dev; ret = qcom_scm_find_dload_address(&pdev->dev, &scm->dload_mode_addr); if (ret < 0) return ret; @@ -1895,7 +1896,6 @@ static int qcom_scm_probe(struct platform_device *pdev) return ret; __scm = scm; - __scm->dev = &pdev->dev; init_completion(&__scm->waitq_comp); From patchwork Tue Feb 27 15:53:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mukesh Ojha X-Patchwork-Id: 207294 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2787383dyb; Tue, 27 Feb 2024 07:56:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXhUsPKzZjVG/cI8j3OibvL2+2VC40hAYXGkAfO2QB2BvsRBSN+AcftED+7NJ506sYZeUqMKDzVlFwY92Imak9WnEbHaw== X-Google-Smtp-Source: AGHT+IF703FZgcDiwA7wQYvEpnN3NkKDYbWcaiIt0C528HElkEfxRdzhQVTlfm7HoBmPqGtyg+r7 X-Received: by 2002:a0c:cb11:0:b0:690:71e:c588 with SMTP id o17-20020a0ccb11000000b00690071ec588mr2281200qvk.62.1709049391435; Tue, 27 Feb 2024 07:56:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709049391; cv=pass; d=google.com; s=arc-20160816; b=rjs+oE4ApLd6C90gXNGfmutqpo20aWsbexYkyxncdkEXOXTKF4kOijbfhzXMofTpDb /2PrOxr+APzlUlIExRp6uiEAyDvjY5rSSbanrg03uJvGEqn5QV5l8vPwBUPPJ9+qiuT7 6Ivw0WweT/cG2RB9omU2z/LOMdIZoYjQNry/aq0sQg3DZufXjZGaKcYLxOzIVcB8jI5W iWNiQe3jYNLxsGVDghluisMynqs3D9FE0PPY0R9HQMAStTq098kZ2XozWe1EiNco+Eu2 tSLs93BLTPtlpInKYMn5+9FB0GodHE91Emy4Uw+0yw2DW2jlxTKci0dcfVZN+IuxFULm 2qCA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=l7Ww131gxLdBxg2C3FqLNC86jeC5pB1X958s5/67agE=; fh=v/J7FZ7kroLF8arNv1lU638DioI58lxpdVQAXxWjgAc=; b=WrbG6abVsAjQ8+pEkbHn/PxJ7wbSZ4vXhvdm+NuOBg/VygfB5Cb6egMRx8gS++FL4n HZePASTvAEu1UugO3xUxM5GRbpZIQUDftDay24HSYI74W97hGyRlxLNhAQkGc55QJxRq aVtTeG3a08IQmu8BL+DGSptF5JLvw/Rl10kTvK8Z0nzlS1tkGk8fNX3AUfOq2rtgtzg/ g0SvKx0ArIr8fl1/RM/Wm5MZ5zsUfSxMDSgyleGfwvxcH0WjvSIgZCgFjYPkUnGWnBDY bI9YJgEmKd0WUiwCNst4qjsFfc9ZxvBweJsmJXwTND9jr9SgrYwtVqs47mA3j+uIjYst LdKg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=MWj9tS3T; 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-83554-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83554-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id gs9-20020a056214226900b0068ff11864dasi7196128qvb.278.2024.02.27.07.56.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 07:56:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83554-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=MWj9tS3T; 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-83554-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83554-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A947C1C24AC4 for ; Tue, 27 Feb 2024 15:56:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A895A14DFF2; Tue, 27 Feb 2024 15:54:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="MWj9tS3T" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 C81E314AD08; Tue, 27 Feb 2024 15:53:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709049237; cv=none; b=E4VoCrFIcN4ZwMAJJiNWlJWCXghoz95kJGs2evtKEFQJFU0bR08//p4ISGuLJ6F6WVx3SX2O1H/G3JoRup9X5jqM+c9YeyJ5Ly/bXT+qvARXtB5iiUQ9MNXbNvkG64GfxBuk/URkHGlzw3QnKKzYDcSZeVnI017rq4QDenYB6DE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709049237; c=relaxed/simple; bh=rSsa+yFjLL58y2YixQ8e/eu3P0CRX5Wpaj//cP3ISW0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rA2Q95fbjsbNr3XEIDZXxoxJn3Uv1Efl9OTD3Yh09f92qRqQDE7vB/HRdQ0sA031kE/xRlTHrLPiSc804JUnb2i05/g+IsaO5J9fbpP9TJt+B+xN+Li+1rhVCBwlGGFagBTbMWjf4NAHPdJfFkeHU6+B7/bzOqzrhp6fFtxutRY= 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=MWj9tS3T; arc=none smtp.client-ip=205.220.168.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 (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41RBirT4021515; Tue, 27 Feb 2024 15:53:52 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-transfer-encoding:content-type; s= qcppdkim1; bh=l7Ww131gxLdBxg2C3FqLNC86jeC5pB1X958s5/67agE=; b=MW j9tS3TywMny4kfnW4YMBGip/OT+4lHdlEZpmqPID9722lS8qbkaTMoo0pcoBv4WI UHw6Mn01smq6erk92X6yG8ADwKA+RwdtgInrFIrg2ySkj1gPt5zSMRxuQmO8y1FS bqNubMNry7GRauFXPoc42ds5bdmxbfE/dJoIqQ6pTINLQ7h4EjQ01CLb8urafI1T iex/1aOEEuxLD3eaqBJZXTjEbaEm8hb60u6wFKdZ8QuYwvq5s/jssraKHoDWvzTB 6zZcULKVHpPagU1CxwwADR0PDCjO05TbVuHgfR01wykG0cL8z9X7VdqTTumy9a6l LdYn50qKTmef1zYsC7Bg== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wh8auhhya-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 15:53:52 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41RFrpeH000509 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 15:53:51 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.1118.40; Tue, 27 Feb 2024 07:53:49 -0800 From: Mukesh Ojha To: , CC: , , , , Mukesh Ojha Subject: [PATCH v12 8/9] firmware: qcom: scm: Add check to prevent Null pointer dereference Date: Tue, 27 Feb 2024 21:23:07 +0530 Message-ID: <20240227155308.18395-9-quic_mojha@quicinc.com> X-Mailer: git-send-email 2.43.0.254.ga26002b62827 In-Reply-To: <20240227155308.18395-1-quic_mojha@quicinc.com> References: <20240227155308.18395-1-quic_mojha@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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-ORIG-GUID: fyPuyRGHGIXIzs5iAnHf6unKLxvVSn0I X-Proofpoint-GUID: fyPuyRGHGIXIzs5iAnHf6unKLxvVSn0I 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-02-27_01,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 bulkscore=0 suspectscore=0 phishscore=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=999 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402270122 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792068174791002475 X-GMAIL-MSGID: 1792068174791002475 There are multiple place in SCM driver __scm->dev is being accessed without checking if it is valid or not and all not all of function needs the device but it is needed for some cases when the number of argument passed is more and dma_map_single () api is used. Add a NULL check for the cases when it is fine even to pass device as NULL and add qcom_scm_is_available() check for cases when it is needed for DMA api's. Signed-off-by: Mukesh Ojha --- drivers/firmware/qcom/qcom_scm.c | 88 ++++++++++++++++++++++++-------- 1 file changed, 66 insertions(+), 22 deletions(-) diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c index 6f14254c0c10..a1dce417e6ec 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -465,7 +465,7 @@ int qcom_scm_set_remote_state(u32 state, u32 id) struct qcom_scm_res res; int ret; - ret = qcom_scm_call(__scm->dev, &desc, &res); + ret = qcom_scm_call(__scm ? __scm->dev : NULL, &desc, &res); return ret ? : res.result[0]; } @@ -591,6 +591,9 @@ int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size, }; struct qcom_scm_res res; + if (!qcom_scm_is_available()) + return -EPROBE_DEFER; + /* * During the scm call memory protection will be enabled for the meta * data blob, so make sure it's physically contiguous, 4K aligned and @@ -637,6 +640,9 @@ EXPORT_SYMBOL_GPL(qcom_scm_pas_init_image); */ void qcom_scm_pas_metadata_release(struct qcom_scm_pas_metadata *ctx) { + if (!qcom_scm_is_available()) + return -EPROBE_DEFER; + if (!ctx->ptr) return; @@ -671,6 +677,9 @@ int qcom_scm_pas_mem_setup(u32 peripheral, phys_addr_t addr, phys_addr_t size) }; struct qcom_scm_res res; + if (!qcom_scm_is_available()) + return -EPROBE_DEFER; + ret = qcom_scm_clk_enable(); if (ret) return ret; @@ -706,6 +715,9 @@ int qcom_scm_pas_auth_and_reset(u32 peripheral) }; struct qcom_scm_res res; + if (!qcom_scm_is_available()) + return -EPROBE_DEFER; + ret = qcom_scm_clk_enable(); if (ret) return ret; @@ -740,6 +752,9 @@ int qcom_scm_pas_shutdown(u32 peripheral) }; struct qcom_scm_res res; + if (!qcom_scm_is_available()) + return -EPROBE_DEFER; + ret = qcom_scm_clk_enable(); if (ret) return ret; @@ -776,11 +791,11 @@ bool qcom_scm_pas_supported(u32 peripheral) }; struct qcom_scm_res res; - if (!__qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_PIL, + if (!__qcom_scm_is_call_available(__scm ? __scm->dev : NULL, QCOM_SCM_SVC_PIL, QCOM_SCM_PIL_PAS_IS_SUPPORTED)) return false; - ret = qcom_scm_call(__scm->dev, &desc, &res); + ret = qcom_scm_call(__scm ? __scm->dev : NULL, &desc, &res); return ret ? false : !!res.result[0]; } @@ -840,7 +855,7 @@ int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val) int ret; - ret = qcom_scm_call_atomic(__scm->dev, &desc, &res); + ret = qcom_scm_call_atomic(__scm ? __scm->dev : NULL, &desc, &res); if (ret >= 0) *val = res.result[0]; @@ -859,7 +874,7 @@ int qcom_scm_io_writel(phys_addr_t addr, unsigned int val) .owner = ARM_SMCCC_OWNER_SIP, }; - return qcom_scm_call_atomic(__scm->dev, &desc, NULL); + return qcom_scm_call_atomic(__scm ? __scm->dev : NULL, &desc, NULL); } EXPORT_SYMBOL_GPL(qcom_scm_io_writel); @@ -871,7 +886,8 @@ EXPORT_SYMBOL_GPL(qcom_scm_io_writel); */ bool qcom_scm_restore_sec_cfg_available(void) { - return __qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_MP, + return __qcom_scm_is_call_available(__scm ? __scm->dev : NULL, + QCOM_SCM_SVC_MP, QCOM_SCM_MP_RESTORE_SEC_CFG); } EXPORT_SYMBOL_GPL(qcom_scm_restore_sec_cfg_available); @@ -889,7 +905,7 @@ int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare) struct qcom_scm_res res; int ret; - ret = qcom_scm_call(__scm->dev, &desc, &res); + ret = qcom_scm_call(__scm ? __scm->dev : NULL, &desc, &res); return ret ? : res.result[0]; } @@ -907,7 +923,7 @@ int qcom_scm_iommu_secure_ptbl_size(u32 spare, size_t *size) struct qcom_scm_res res; int ret; - ret = qcom_scm_call(__scm->dev, &desc, &res); + ret = qcom_scm_call(__scm ? __scm->dev : NULL, &desc, &res); if (size) *size = res.result[0]; @@ -930,7 +946,7 @@ int qcom_scm_iommu_secure_ptbl_init(u64 addr, u32 size, u32 spare) }; int ret; - ret = qcom_scm_call(__scm->dev, &desc, NULL); + ret = qcom_scm_call(__scm ? __scm->dev : NULL, &desc, NULL); /* the pg table has been initialized already, ignore the error */ if (ret == -EPERM) @@ -951,7 +967,7 @@ int qcom_scm_iommu_set_cp_pool_size(u32 spare, u32 size) .owner = ARM_SMCCC_OWNER_SIP, }; - return qcom_scm_call(__scm->dev, &desc, NULL); + return qcom_scm_call(__scm ? __scm->dev : NULL, &desc, NULL); } EXPORT_SYMBOL_GPL(qcom_scm_iommu_set_cp_pool_size); @@ -973,7 +989,7 @@ int qcom_scm_mem_protect_video_var(u32 cp_start, u32 cp_size, }; struct qcom_scm_res res; - ret = qcom_scm_call(__scm->dev, &desc, &res); + ret = qcom_scm_call(__scm ? __scm->dev : NULL, &desc, &res); return ret ? : res.result[0]; } @@ -1038,6 +1054,9 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, int ret, i, b; u64 srcvm_bits = *srcvm; + if (!qcom_scm_is_available()) + return -EPROBE_DEFER; + src_sz = hweight64(srcvm_bits) * sizeof(*src); mem_to_map_sz = sizeof(*mem_to_map); dest_sz = dest_cnt * sizeof(*destvm); @@ -1093,7 +1112,8 @@ EXPORT_SYMBOL_GPL(qcom_scm_assign_mem); */ bool qcom_scm_ocmem_lock_available(void) { - return __qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_OCMEM, + return __qcom_scm_is_call_available(__scm ? __scm->dev : NULL, + QCOM_SCM_SVC_OCMEM, QCOM_SCM_OCMEM_LOCK_CMD); } EXPORT_SYMBOL_GPL(qcom_scm_ocmem_lock_available); @@ -1120,7 +1140,7 @@ int qcom_scm_ocmem_lock(enum qcom_scm_ocmem_client id, u32 offset, u32 size, .arginfo = QCOM_SCM_ARGS(4), }; - return qcom_scm_call(__scm->dev, &desc, NULL); + return qcom_scm_call(__scm ? __scm->dev : NULL, &desc, NULL); } EXPORT_SYMBOL_GPL(qcom_scm_ocmem_lock); @@ -1143,7 +1163,7 @@ int qcom_scm_ocmem_unlock(enum qcom_scm_ocmem_client id, u32 offset, u32 size) .arginfo = QCOM_SCM_ARGS(3), }; - return qcom_scm_call(__scm->dev, &desc, NULL); + return qcom_scm_call(__scm ? __scm->dev : NULL, &desc, NULL); } EXPORT_SYMBOL_GPL(qcom_scm_ocmem_unlock); @@ -1155,9 +1175,11 @@ EXPORT_SYMBOL_GPL(qcom_scm_ocmem_unlock); */ bool qcom_scm_ice_available(void) { - return __qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_ES, + return __qcom_scm_is_call_available(__scm ? __scm->dev : NULL, + QCOM_SCM_SVC_ES, QCOM_SCM_ES_INVALIDATE_ICE_KEY) && - __qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_ES, + __qcom_scm_is_call_available(__scm ?__scm->dev : NULL, + QCOM_SCM_SVC_ES, QCOM_SCM_ES_CONFIG_SET_ICE_KEY); } EXPORT_SYMBOL_GPL(qcom_scm_ice_available); @@ -1184,7 +1206,7 @@ int qcom_scm_ice_invalidate_key(u32 index) .owner = ARM_SMCCC_OWNER_SIP, }; - return qcom_scm_call(__scm->dev, &desc, NULL); + return qcom_scm_call(__scm ?__scm->dev : NULL, &desc, NULL); } EXPORT_SYMBOL_GPL(qcom_scm_ice_invalidate_key); @@ -1228,6 +1250,9 @@ int qcom_scm_ice_set_key(u32 index, const u8 *key, u32 key_size, dma_addr_t key_phys; int ret; + if (!qcom_scm_is_available()) + return -EPROBE_DEFER; + /* * 'key' may point to vmalloc()'ed memory, but we need to pass a * physical address that's been properly flushed. The sanctioned way to @@ -1262,7 +1287,12 @@ EXPORT_SYMBOL_GPL(qcom_scm_ice_set_key); bool qcom_scm_hdcp_available(void) { bool avail; - int ret = qcom_scm_clk_enable(); + int ret; + + if (!qcom_scm_is_available()) + return -EPROBE_DEFER; + + ret = qcom_scm_clk_enable(); if (ret) return ret; @@ -1307,6 +1337,9 @@ int qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp) }; struct qcom_scm_res res; + if (!qcom_scm_is_available()) + return -EPROBE_DEFER; + if (req_cnt > QCOM_SCM_HDCP_MAX_REQ_CNT) return -ERANGE; @@ -1335,7 +1368,7 @@ int qcom_scm_iommu_set_pt_format(u32 sec_id, u32 ctx_num, u32 pt_fmt) .owner = ARM_SMCCC_OWNER_SIP, }; - return qcom_scm_call(__scm->dev, &desc, NULL); + return qcom_scm_call(__scm ? __scm->dev : NULL, &desc, NULL); } EXPORT_SYMBOL_GPL(qcom_scm_iommu_set_pt_format); @@ -1351,13 +1384,15 @@ int qcom_scm_qsmmu500_wait_safe_toggle(bool en) }; - return qcom_scm_call_atomic(__scm->dev, &desc, NULL); + return qcom_scm_call_atomic(__scm ? __scm->dev : NULL, &desc, NULL); } EXPORT_SYMBOL_GPL(qcom_scm_qsmmu500_wait_safe_toggle); bool qcom_scm_lmh_dcvsh_available(void) { - return __qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_LMH, QCOM_SCM_LMH_LIMIT_DCVSH); + return __qcom_scm_is_call_available(__scm ? __scm->dev : NULL, + QCOM_SCM_SVC_LMH, + QCOM_SCM_LMH_LIMIT_DCVSH); } EXPORT_SYMBOL_GPL(qcom_scm_lmh_dcvsh_available); @@ -1371,7 +1406,7 @@ int qcom_scm_lmh_profile_change(u32 profile_id) .owner = ARM_SMCCC_OWNER_SIP, }; - return qcom_scm_call(__scm->dev, &desc, NULL); + return qcom_scm_call(__scm ? __scm->dev : NULL, &desc, NULL); } EXPORT_SYMBOL_GPL(qcom_scm_lmh_profile_change); @@ -1394,6 +1429,9 @@ int qcom_scm_lmh_dcvsh(u32 payload_fn, u32 payload_reg, u32 payload_val, .owner = ARM_SMCCC_OWNER_SIP, }; + if (!qcom_scm_is_available()) + return -EPROBE_DEFER; + payload_buf = dma_alloc_coherent(__scm->dev, payload_size, &payload_phys, GFP_KERNEL); if (!payload_buf) return -ENOMEM; @@ -1568,6 +1606,9 @@ int qcom_scm_qseecom_app_get_id(const char *app_name, u32 *app_id) char *name_buf; int status; + if (!qcom_scm_is_available()) + return -EPROBE_DEFER; + if (app_name_len >= name_buf_size) return -EINVAL; @@ -1638,6 +1679,9 @@ int qcom_scm_qseecom_app_send(u32 app_id, void *req, size_t req_size, void *rsp, dma_addr_t rsp_phys; int status; + if (!qcom_scm_is_available()) + return -EPROBE_DEFER; + /* Map request buffer */ req_phys = dma_map_single(__scm->dev, req, req_size, DMA_TO_DEVICE); status = dma_mapping_error(__scm->dev, req_phys); From patchwork Tue Feb 27 15:53:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mukesh Ojha X-Patchwork-Id: 207295 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2787395dyb; Tue, 27 Feb 2024 07:56:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVgOeld3Olp4KscXBB5LtpvRfQf25NlM4C7G2zz0pPg2pixnuoCAFmBKmWnSzlM1g+2D6R/KBmQf6BPMsTgnR+Lqz1Aqg== X-Google-Smtp-Source: AGHT+IG33pL0MfIWjfAQVlQm90Zv7IJ1DJHimt75rFFZqf5bVnFOH3BWvnQ537PuVx0hzPMretf9 X-Received: by 2002:a05:620a:1264:b0:787:e288:1ff5 with SMTP id b4-20020a05620a126400b00787e2881ff5mr2111379qkl.14.1709049392722; Tue, 27 Feb 2024 07:56:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709049392; cv=pass; d=google.com; s=arc-20160816; b=RdOVTNSkVqhTKvrtHE3rr0Hb5+j73CukuBUeiSncUXJRUni+Ht34kct3VEVtqpk+OD jzVJGtWT/Mi75dDSZgyj2XE0fqPmvZtaurHEV5uUiwEHIgI7Y1B946DXkVPwsbFZC7cu B8GBwrCIxqQi709svygBVt+GFIqVFTZcZo2SnN5/jf3e/I7hqZ8oYEEms3DqApL1HIJb LtOcWScmxy52JLei4BYMDW+kmv9Mh3zAxDDIxeCA+p45HLkgtEC8LJ3efOq92jwIqsoR y0G3vBRU2qvqP/kqqO9yNeyK9ijSrSAE39Z7bCxtJJWwbyjz+3Xur+fxWAh3LEp9JKKe 4Z7Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=oyNGVgf749RGIPNshcfIDi9wFWrNfE/UUoZx08FK340=; fh=v/J7FZ7kroLF8arNv1lU638DioI58lxpdVQAXxWjgAc=; b=pQcZM6ObHUIUVkuKNktE9KXE8YMPby1OScEplu+dkIyCFHbou6t5BLodWBwPGJOOTW k+F54GlcuqNx27FqOjGaVtxPzhU8vCQji9W+SWbTvkoW3M+3GiKMerV6SOwrGPrSRcDg wu3nskGfhFm2L2g2IAvPS5JfMzP6kd08z6/9hMAwVDCLK/LwXXsiP79esyfmcSgxy551 q0iCFDLoVs3aMkqkAyQz8JbbnRp0aOb/g+yweMa1EMkQUqDJKYv2TDM1yDP/xxc4m0al /M3Qv+vqzRYseZR2/0Tf+IfEbB6DZO5te662bioiKTYsrCPzXLDBClNuteyAH6D/V9X4 gfJA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=H4czaRNT; 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-83555-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83555-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d2-20020a37c402000000b0078777310b0fsi7540265qki.687.2024.02.27.07.56.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 07:56:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83555-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=H4czaRNT; 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-83555-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83555-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A58191C24E49 for ; Tue, 27 Feb 2024 15:56:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0849514DFF6; Tue, 27 Feb 2024 15:54:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="H4czaRNT" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 0ED8414CACB; Tue, 27 Feb 2024 15:53:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709049239; cv=none; b=D+aj+BFHdR0nNHqM9ToaA36NEZqu9mYUGAlgd7wtKmVxdncnz8mFPBxUOg1bzrw6ZbfCoZlPyaTtAOyY3mM+4hcXldD9qKQdPEAzka7u9R3t1W7oL32A4Mp7UOCdkQjBNw5tgtBeJZ2niwReLvW82Xy85BHAz9FlPhV6PwoXMbI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709049239; c=relaxed/simple; bh=a6HqBkmx/YMzLwbBaE70Z4ncxL4+fd7dFK32oyoWxZM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gmdSBuczMyqP+qd+kDOuGg82L71KzzOgnJC/DAI34NcWqUQBAgQwHDwAkSD2E9rFTUuM1eH7IvaCdLeZdcEu/6XLmthwqiFDVSOoYh0DSZebUIQdWkwhnzAPwUJ6nNmCfrbXD4rV1XPTaqIMsgrbArC/q5Lnx2z4NLOw2+43VaA= 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=H4czaRNT; arc=none smtp.client-ip=205.220.168.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 (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41RAuNdb009670; Tue, 27 Feb 2024 15:53:55 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-transfer-encoding:content-type; s= qcppdkim1; bh=oyNGVgf749RGIPNshcfIDi9wFWrNfE/UUoZx08FK340=; b=H4 czaRNTwEwgV1VPz8gpWMANM7SE0ArcnKq8Q8RMJQNLSXCF0cZv22iCsf4/4w3Htu rqyaUp3OXCjgapmZH2XdTWFkj5lqiNj2OYPCmJ1QnpS/3j72QoKsY3nlqKLUZLFh YrV7EuaUF5+btol18t7Uv8SPfr5xcVMcQqT7B7Tb6yNYiOybINRuNnz5sqyVbJ7l GVbypcD5ZxZZkfc3OAEowq28eF9AjZMjUbtFe/Aa375niF0R9mab07atV3Q1wubi 13FJSRS3f4TQ8+gBoZWQYdJOrWIed/W1seGoYUiUgnnPBJnSeYDs5gVK0dEOJ4IG gYA/f0IrnE83RxaWBJzg== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3whedvrr88-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 15:53:55 +0000 (GMT) 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 41RFrsDc011850 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 15:53:54 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.1118.40; Tue, 27 Feb 2024 07:53:52 -0800 From: Mukesh Ojha To: , CC: , , , , Mukesh Ojha Subject: [PATCH v12 9/9] firmware: scm: Remove redundant scm argument from qcom_scm_waitq_wakeup() Date: Tue, 27 Feb 2024 21:23:08 +0530 Message-ID: <20240227155308.18395-10-quic_mojha@quicinc.com> X-Mailer: git-send-email 2.43.0.254.ga26002b62827 In-Reply-To: <20240227155308.18395-1-quic_mojha@quicinc.com> References: <20240227155308.18395-1-quic_mojha@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: C_3KrFfEdNVvreYXkud8SuXx7N98pwtA X-Proofpoint-ORIG-GUID: C_3KrFfEdNVvreYXkud8SuXx7N98pwtA 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-02-27_01,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 mlxlogscore=947 clxscore=1015 bulkscore=0 mlxscore=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 adultscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402270122 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792068176466888310 X-GMAIL-MSGID: 1792068176466888310 Remove unused scm argument from qcom_scm_waitq_wakeup(). Signed-off-by: Mukesh Ojha --- drivers/firmware/qcom/qcom_scm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c index a1dce417e6ec..d91f5872e003 100644 --- a/drivers/firmware/qcom/qcom_scm.c +++ b/drivers/firmware/qcom/qcom_scm.c @@ -1853,7 +1853,7 @@ int qcom_scm_wait_for_wq_completion(u32 wq_ctx) return 0; } -static int qcom_scm_waitq_wakeup(struct qcom_scm *scm, unsigned int wq_ctx) +static int qcom_scm_waitq_wakeup(unsigned int wq_ctx) { int ret; @@ -1885,7 +1885,7 @@ static irqreturn_t qcom_scm_irq_handler(int irq, void *data) goto out; } - ret = qcom_scm_waitq_wakeup(scm, wq_ctx); + ret = qcom_scm_waitq_wakeup(wq_ctx); if (ret) goto out; } while (more_pending);