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