From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Guru Das Srinagesh <quic_gurus@quicinc.com>,
Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: David Heidelberg <david@ixit.cz>,
Robert Marko <robimarko@gmail.com>,
Rajendra Nayak <quic_rjendra@quicinc.com>,
Elliot Berman <quic_eberman@quicinc.com>
Subject: Re: [RESEND PATCH v2 2/5] firmware: qcom: scm: Optionally remove SCM call serialization
Date: Wed, 31 Aug 2022 11:06:06 +0300 [thread overview]
Message-ID: <cc6374f2-dfe8-9904-1b87-fe1d18451f36@linaro.org> (raw)
In-Reply-To: <1661898311-30126-3-git-send-email-quic_gurus@quicinc.com>
On 31/08/2022 01:25, Guru Das Srinagesh wrote:
> 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 <quic_gurus@quicinc.com>
> ---
> 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 <linux/io.h>
> @@ -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 cdbfe54..978706a 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 <linux/platform_device.h>
> #include <linux/init.h>
> @@ -23,6 +24,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;
No global variables. This should be part of context/state container.
> +
> #define SCM_HAS_CORE_CLK BIT(0)
> #define SCM_HAS_IFACE_CLK BIT(1)
> #define SCM_HAS_BUS_CLK BIT(2)
> @@ -1402,6 +1405,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;
No externs for variables. You break encapsulation.
>
> #define MAX_QCOM_SCM_ARGS 10
> #define MAX_QCOM_SCM_RETS 3
Best regards,
Krzysztof
next prev parent reply other threads:[~2022-08-31 8:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-30 22:25 [RESEND PATCH v2 0/5] SCM: Add support for wait-queue aware firmware Guru Das Srinagesh
2022-08-30 22:25 ` [RESEND PATCH v2 1/5] dt-bindings: firmware: qcom-scm: Add "allow-multi-call" property Guru Das Srinagesh
2022-08-31 8:00 ` Krzysztof Kozlowski
2022-10-18 5:56 ` Sibi Sankar
2022-08-30 22:25 ` [RESEND PATCH v2 2/5] firmware: qcom: scm: Optionally remove SCM call serialization Guru Das Srinagesh
2022-08-31 8:06 ` Krzysztof Kozlowski [this message]
2022-08-30 22:25 ` [RESEND PATCH v2 3/5] dt-bindings: firmware: qcom-scm: Add optional interrupt Guru Das Srinagesh
2022-08-31 8:02 ` Krzysztof Kozlowski
2022-10-18 5:49 ` Sibi Sankar
2022-10-18 13:11 ` Krzysztof Kozlowski
2022-08-30 22:25 ` [RESEND PATCH v2 4/5] firmware: qcom: scm: Add wait-queue helper functions Guru Das Srinagesh
2022-08-31 0:32 ` kernel test robot
2022-08-31 6:30 ` kernel test robot
2022-10-19 22:52 ` Bjorn Andersson
2022-08-30 22:25 ` [RESEND PATCH v2 5/5] firmware: qcom: scm: Add wait-queue handling logic Guru Das Srinagesh
2022-10-19 23:23 ` Bjorn Andersson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cc6374f2-dfe8-9904-1b87-fe1d18451f36@linaro.org \
--to=krzysztof.kozlowski@linaro.org \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=david@ixit.cz \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=quic_eberman@quicinc.com \
--cc=quic_gurus@quicinc.com \
--cc=quic_rjendra@quicinc.com \
--cc=robimarko@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).