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: <6670e21a-46d7-db1f-3830-73e97786cde8@quicinc.com>
Date: Tue, 5 Mar 2024 16:24:32 +0530
From: Mukesh Ojha <quic_mojha@...cinc.com>
To: Bjorn Andersson <andersson@...nel.org>
CC: <konrad.dybcio@...aro.org>, <linux-arm-msm@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <linus.walleij@...aro.org>,
        <linux-gpio@...r.kernel.org>, Elliot Berman <quic_eberman@...cinc.com>
Subject: Re: [PATCH v12 4/9] firmware: qcom: scm: Rework dload mode
 availability check



On 3/3/2024 12:46 AM, Bjorn Andersson wrote:
> On Tue, Feb 27, 2024 at 09:23:03PM +0530, Mukesh Ojha wrote:
>> 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.
>>
> 
> I presume this implies that it will always return false, so what's the
> actual problem with that? Presumably you want this because it takes
> unnecessary time to make that call, if so please say so.

Correct, will add in commit description.

Also, __qcom_scm_is_call_available() usage legacy mode of setting DLOAD 
mode setting via command which is deprecated long back from Trust zone 
firmware also it takes or wait statically global mutex lock at the lower 
level which unnecessary adds time which is of no use.
> 
> 
> Content of the patch looks good.

Thanks.

-Mukesh

> 
> Regards,
> Bjorn
> 
>> So, it is better to keep it as fallback check instead of
>> checking its availability and failing it always.
>>
>> Signed-off-by: Mukesh Ojha <quic_mojha@...cinc.com>
>> Reviewed-by: Elliot Berman <quic_eberman@...cinc.com>
>> ---
>>   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");
>> -- 
>> 2.43.0.254.ga26002b62827
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ