Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2005670rbb; Tue, 27 Feb 2024 07:54:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX/TaMIOPo9//hipbgyvv9wCzvT637EcWs3Z3TGOE7SwmhA5yn5IBlwB4Xo06ykBOaDLuj7iIqp4cYeHWMAjfrMIxbkE1udsIKx7NNcbw== X-Google-Smtp-Source: AGHT+IF9QPF/DsS4voDp8dL4Yg7hHT95fx9FaGxqIawj6c1C514MviUqOz6Ubh6lKJ/7GuFi2c8N X-Received: by 2002:a05:622a:64a:b0:42e:482c:efa5 with SMTP id a10-20020a05622a064a00b0042e482cefa5mr13969456qtb.25.1709049273232; Tue, 27 Feb 2024 07:54:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709049273; cv=pass; d=google.com; s=arc-20160816; b=xJniSdsOFgcFOZuPH+ftRF7lU8omD39fV7Zj0qn7Xf/ZP7iagPvfFOADsN1KYYARuN HK1ZYun9LItcIBrJjusdw63SiMaM6x6ujUbgDcwDOzIOBFrvqNRS+WUhN8IAQ+mFmh/L yyNKc1wkVrurJR45BmLJu860A1oFcuCuAmSQV9mp/zD4OfFGz6kHip+H/fYP0gtCpzuI EBbnD5AypfpEgTspJ7PsLAEwGxXGwlTEGTimXQ+xwnKNxv4y1oFbf8kK8cUuJB3XwMuh dlhnW5n2jdEidbjq8B5hsRaHL52G4Ok3T9rkwhSiEetlyD+mrm4V9q2bxXIDZuVxVPe2 32gw== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83549-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f12-20020ac85d0c000000b0042e28a34addsi8464733qtx.648.2024.02.27.07.54.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 07:54:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83549-linux.lists.archive=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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83549-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 038381C23A1B for ; Tue, 27 Feb 2024 15:54:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 42BBA146E91; Tue, 27 Feb 2024 15:53:45 +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 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 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"); -- 2.43.0.254.ga26002b62827