Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3278503iog; Mon, 27 Jun 2022 12:46:54 -0700 (PDT) X-Google-Smtp-Source: AGRyM1skDelIYgN2IH1qa9xtjkDsu3pFFeiHsjCAqThiokfOZ3ZJZ8aeV4CRTulLIhfTbohlag/D X-Received: by 2002:a17:906:ce:b0:715:705e:52fb with SMTP id 14-20020a17090600ce00b00715705e52fbmr14255261eji.303.1656359213862; Mon, 27 Jun 2022 12:46:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656359213; cv=none; d=google.com; s=arc-20160816; b=gqiPTuHAez/Fr1ZFBMm7PuId1axUgsExUGE7kYskfB+DU/8ywxRWvhXgW5rYBpdMWw vq9yqkhdKgzgxaYdhrzmoPwfvh+LhpVIUBbHsUBR60jsksg1+OGSGpbnoxidsKpXtReX taCSrhEMp26QdTr4Ob+emlNaT48pDt+2qlNaOeNYijFLEwwh6m8q8Kp6gZ731/OGNejU dqVIR8pdwDrQg05fFrFAg9U/GlMX9ZZQR/YxeQ73WuA4to9zj241YFBuSOul27hVAi7Q nUcP87c8B0Cob4k1g3naFzBWbQU7nB5ONjorD45ocMJV8bbzPjZV4oD34xpmJtTViU/P jMwA== 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=1FYrZSeW9sK/R9lodWLBtngH+TWjl/ETJWl63OnpmpAYHtKrksBfFqHb5/3Y4O08lg mAMwI0R/ai43sbDVwyolQe4louKOke2cu/XtfTYZ3LKM9qT1KSbvGmfNIIg89evPXDwO EUkrD+d0dTj5/FWgNJnXpPDltWSUwL0Vn+/mNTMK4w+jl4NQjb3wVDIacYrwfX6eUs+k q16yqaYXDaR9JKv2gmX9WHl997VOwP/bwudar7aKbDQpyU0R1NofMgQ+TPhhyA/Fyy+O jpxz+AAq8ZObQmwfMtpMiogkR1c7MR22xWo6HoHtR6zX4WEmbp92bwc0ezLo9PF4SbF8 suwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=gxGa2cA9; 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 eb13-20020a0564020d0d00b0043587e6b472si16338652edb.132.2022.06.27.12.46.29; Mon, 27 Jun 2022 12:46:53 -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=gxGa2cA9; 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 S240888AbiF0Toz (ORCPT + 99 others); Mon, 27 Jun 2022 15:44:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238781AbiF0Tot (ORCPT ); Mon, 27 Jun 2022 15:44:49 -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 043931902C; Mon, 27 Jun 2022 12:44:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1656359088; x=1687895088; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=36h9uKHBZ/R8K8A3gNaxdbJpvYGm7y4WLL4L2AEqb8I=; b=gxGa2cA9jTYjWrfW1NeOkSf4qgOSNkvhyFpWfTDJZX3eRqKNGt5aVE9X o3nxFtC4Eyg8YHuz23AykjkimmXgk4yCIf8+65v1R6zcjQshwzk0jqvGt BDvWyQEzYQfKOZHyko8MvVZt/GBuXkZmbhGkhIVx0WEcxKcLmqYkqthcu E=; Received: from unknown (HELO ironmsg-SD-alpha.qualcomm.com) ([10.53.140.30]) by alexa-out-sd-02.qualcomm.com with ESMTP; 27 Jun 2022 12:44:48 -0700 X-QCInternal: smtphost Received: from nasanex01b.na.qualcomm.com ([10.46.141.250]) by ironmsg-SD-alpha.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 12:44:48 -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; Mon, 27 Jun 2022 12:44:47 -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 2/5] firmware: qcom: scm: Optionally remove SCM call serialization Date: Mon, 27 Jun 2022 12:44:33 -0700 Message-ID: <1656359076-13018-3-git-send-email-quic_gurus@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1656359076-13018-1-git-send-email-quic_gurus@quicinc.com> References: <1656359076-13018-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,T_SCC_BODY_TEXT_LINE 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