Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp1049263imi; Fri, 22 Jul 2022 16:05:51 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tYRrH425IUt3VbaIfGLO2OPHxK4BEnvWqpdNLwCs+doiuXtyFAifO0DAeuOzJZg7MLYbSF X-Received: by 2002:a05:6402:4247:b0:43a:d5ff:1313 with SMTP id g7-20020a056402424700b0043ad5ff1313mr2012685edb.266.1658531150970; Fri, 22 Jul 2022 16:05:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658531150; cv=none; d=google.com; s=arc-20160816; b=S6haSbviA/knVZqr3l0iNgzU8Ak5ivqviHSn2grb1RZEUqOGsDkBs6i/M40bIp2uwk T2C4ozwgL+D3n5Io/vt95p4WQ3/l8MMRGCy4b6uZmppVPZWwEBOQS7+AwnsqpTv+o6zN PocoS7sqRQZGnsSAgoshsLQDePJmKOwmZ8vbFlp/7Y2SKWwIdyx2cv8TYkhG2GqZFc6n j3P7zynSfvE5SIC69dln9GJtlau3oaQH2nTLG47NVNDNnGDVjsa1O5Kk8DGb6sfMTN2i wCBUvZR7kQfftIe3bXJjdfgBNCPIc/d9QDNJG3hSjP5qS1RAABEWUmSCJWymO4AVhE4G +xZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=36h9uKHBZ/R8K8A3gNaxdbJpvYGm7y4WLL4L2AEqb8I=; b=jRk0+A65WJSGhGKIQ7em1iIoj5XA4Qm+k18xBvAc/h+Wa9loGbaxMRe8FPIWT4H3J8 YR5Vwq4VX5Ru1UIVJiebh4YkY8u4xVLjX2nCynUv/s3XJNRHzcHeuUJItmz4JP/sDm+1 PKjsavbH/SH43Q3DgzhjvLR0yrKASOh/cBhOjGblLQ1vPrXuOEVlP+kkI9BzCeGRl+Yp DXibOe8n1eST4lkGbvIqGlyrMVS21GHYSm70e/Mluqxn2c4mePR4lm/9RSVWdFjVYdE0 CtIAjARxyYsVJ+7EBKYtqDEK6iWu8cP34SGPL8Oorqyo47Dg9vA8oadBHGBEacYeLEaQ ZOcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=SQvLYRGw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz4-20020a1709072ce400b0072f9dcfc0c9si5714639ejc.883.2022.07.22.16.05.23; Fri, 22 Jul 2022 16:05:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=SQvLYRGw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237167AbiGVWks (ORCPT + 99 others); Fri, 22 Jul 2022 18:40:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236889AbiGVWkO (ORCPT ); Fri, 22 Jul 2022 18:40:14 -0400 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA3D21A06B; Fri, 22 Jul 2022 15:38:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1658529519; x=1690065519; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=36h9uKHBZ/R8K8A3gNaxdbJpvYGm7y4WLL4L2AEqb8I=; b=SQvLYRGwK9LnrprUarXWZNI+nZ3xeV3Od0KMJXB/PStXKhxvcop6sm58 R2DSp+uNi6dJKhSgUb0zW7COlSzbWWG0DEkKPcj0Sjk08qJintUEy/A2q 03SDZjnDrQ90iM5tntTTbJGbPGpVW712DpV5xU1DKYNGZSEZDLBhIhuOv U=; Received: from unknown (HELO ironmsg02-sd.qualcomm.com) ([10.53.140.142]) by alexa-out-sd-02.qualcomm.com with ESMTP; 22 Jul 2022 15:37:26 -0700 X-QCInternal: smtphost Received: from nasanex01b.na.qualcomm.com ([10.46.141.250]) by ironmsg02-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2022 15:37:26 -0700 Received: from hu-gurus-sd.qualcomm.com (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Fri, 22 Jul 2022 15:37:26 -0700 From: Guru Das Srinagesh To: Andy Gross , Bjorn Andersson , Philipp Zabel , , CC: David Heidelberg , Robert Marko , Rajendra Nayak , Elliot Berman , Guru Das Srinagesh Subject: [PATCH v2 2/5] firmware: qcom: scm: Optionally remove SCM call serialization Date: Fri, 22 Jul 2022 15:37:15 -0700 Message-ID: <1658529438-9234-3-git-send-email-quic_gurus@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1658529438-9234-1-git-send-email-quic_gurus@quicinc.com> References: <1658529438-9234-1-git-send-email-quic_gurus@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01b.na.qualcomm.com (10.46.141.250) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some firmware versions support the handling of multiple SCM calls at the same time. Add a device tree boolean property which, when specified, allows this to happen. Signed-off-by: Guru Das Srinagesh --- drivers/firmware/qcom_scm-smc.c | 8 ++++++-- drivers/firmware/qcom_scm.c | 6 ++++++ drivers/firmware/qcom_scm.h | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/qcom_scm-smc.c b/drivers/firmware/qcom_scm-smc.c index d111833..66193c2 100644 --- a/drivers/firmware/qcom_scm-smc.c +++ b/drivers/firmware/qcom_scm-smc.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2015,2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -63,11 +64,14 @@ static void __scm_smc_do(const struct arm_smccc_args *smc, } do { - mutex_lock(&qcom_scm_lock); + if (!qcom_scm_allow_multicall) + mutex_lock(&qcom_scm_lock); __scm_smc_do_quirk(smc, res); - mutex_unlock(&qcom_scm_lock); + if (!qcom_scm_allow_multicall) + mutex_unlock(&qcom_scm_lock); + if (res->a0 == QCOM_SCM_V2_EBUSY) { if (retry_count++ > QCOM_SCM_EBUSY_MAX_RETRY) diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c index 3163660..4046073 100644 --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2010,2015,2019 The Linux Foundation. All rights reserved. * Copyright (C) 2015 Linaro Ltd. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include #include @@ -22,6 +23,8 @@ static bool download_mode = IS_ENABLED(CONFIG_QCOM_SCM_DOWNLOAD_MODE_DEFAULT); module_param(download_mode, bool, 0); +bool qcom_scm_allow_multicall = false; + #define SCM_HAS_CORE_CLK BIT(0) #define SCM_HAS_IFACE_CLK BIT(1) #define SCM_HAS_BUS_CLK BIT(2) @@ -1333,6 +1336,9 @@ static int qcom_scm_probe(struct platform_device *pdev) __scm = scm; __scm->dev = &pdev->dev; + qcom_scm_allow_multicall = of_property_read_bool(__scm->dev->of_node, + "allow-multi-call"); + __get_convention(); /* diff --git a/drivers/firmware/qcom_scm.h b/drivers/firmware/qcom_scm.h index 0d51eef..c0a4d6b 100644 --- a/drivers/firmware/qcom_scm.h +++ b/drivers/firmware/qcom_scm.h @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* Copyright (c) 2010-2015,2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef __QCOM_SCM_INT_H #define __QCOM_SCM_INT_H @@ -12,6 +13,7 @@ enum qcom_scm_convention { }; extern enum qcom_scm_convention qcom_scm_convention; +extern bool qcom_scm_allow_multicall; #define MAX_QCOM_SCM_ARGS 10 #define MAX_QCOM_SCM_RETS 3 -- 2.7.4