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");