lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cc6374f2-dfe8-9904-1b87-fe1d18451f36@linaro.org>
Date:   Wed, 31 Aug 2022 11:06:06 +0300
From:   Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To:     Guru Das Srinagesh <quic_gurus@...cinc.com>,
        Andy Gross <agross@...nel.org>,
        Bjorn Andersson <andersson@...nel.org>,
        Philipp Zabel <p.zabel@...gutronix.de>,
        linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     David Heidelberg <david@...t.cz>,
        Robert Marko <robimarko@...il.com>,
        Rajendra Nayak <quic_rjendra@...cinc.com>,
        Elliot Berman <quic_eberman@...cinc.com>
Subject: Re: [RESEND PATCH v2 2/5] firmware: qcom: scm: Optionally remove SCM
 call serialization

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@...cinc.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ