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] [day] [month] [year] [list]
Message-ID: <204e45a9-7748-0ab6-f57e-25bfeb5d037b@quicinc.com>
Date: Fri, 13 Dec 2024 14:15:34 +0530
From: Md Sadre Alam <quic_mdalam@...cinc.com>
To: Manikanta Mylavarapu <quic_mmanikan@...cinc.com>, <vkoul@...nel.org>,
        <martin.petersen@...cle.com>, <ulf.hansson@...aro.org>,
        <av2082000@...il.com>, <linux-arm-msm@...r.kernel.org>,
        <dmaengine@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC: <uic_mdalam@...cinc.com>, <quic_srichara@...cinc.com>,
        <quic_varada@...cinc.com>
Subject: Re: [PATCH v3] dmaengine: qcom: bam_dma: Avoid writing unavailable
 register



On 12/9/2024 4:05 PM, Manikanta Mylavarapu wrote:
> 
> 
> On 12/9/2024 1:01 PM, Md Sadre Alam wrote:
>> Avoid writing unavailable register in BAM-Lite mode.
>> BAM_DESC_CNT_TRSHLD register is unavailable in BAM-Lite
>> mode. Its only available in BAM-NDP mode. So only write
>> this register for clients who is using BAM-NDP.
>>
>> Signed-off-by: Md Sadre Alam <quic_mdalam@...cinc.com>
>> ---
>>
>> Change in [v3]
>>
>> * Removed BAM_LITE macro
>>
>> * Updated commit message
>>
>> * Adjusted if condition check
>>
>> * Renamed BAM-NDP macro to BAM_NDP_REVISION_START and
>>    BAM_NDP_REVISION_END
>>
>> Change in [v2]
>>
>> * Replace 0xff with REVISION_MASK in the statement
>>    bdev->bam_revision = val & REVISION_MASK
>>
>> Change in [v1]
>>
>> * Added initial patch
>>
>>   drivers/dma/qcom/bam_dma.c | 24 ++++++++++++++++--------
>>   1 file changed, 16 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
>> index d43a881e43b9..a00dd0331ff5 100644
>> --- a/drivers/dma/qcom/bam_dma.c
>> +++ b/drivers/dma/qcom/bam_dma.c
>> @@ -59,6 +59,9 @@ struct bam_desc_hw {
>>   #define DESC_FLAG_NWD BIT(12)
>>   #define DESC_FLAG_CMD BIT(11)
>>   
>> +#define BAM_NDP_REVISION_START	0x20
>> +#define BAM_NDP_REVISION_END	0x27
>> +
>>   struct bam_async_desc {
>>   	struct virt_dma_desc vd;
>>   
>> @@ -398,6 +401,7 @@ struct bam_device {
>>   
>>   	/* dma start transaction tasklet */
>>   	struct tasklet_struct task;
>> +	u32 bam_revision;
>>   };
>>   
>>   /**
>> @@ -441,8 +445,10 @@ static void bam_reset(struct bam_device *bdev)
>>   	writel_relaxed(val, bam_addr(bdev, 0, BAM_CTRL));
>>   
>>   	/* set descriptor threshold, start with 4 bytes */
>> -	writel_relaxed(DEFAULT_CNT_THRSHLD,
>> -			bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD));
>> +	if (bdev->bam_revision >= BAM_NDP_REVISION_START &&
>> +	    bdev->bam_revision <= BAM_NDP_REVISION_END)
> 
> Please use in_range().
Ok
> 
>> +		writel_relaxed(DEFAULT_CNT_THRSHLD,
>> +			       bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD));
>>   
>>   	/* Enable default set of h/w workarounds, ie all except BAM_FULL_PIPE */
>>   	writel_relaxed(BAM_CNFG_BITS_DEFAULT, bam_addr(bdev, 0, BAM_CNFG_BITS));
>> @@ -1000,9 +1006,10 @@ static void bam_apply_new_config(struct bam_chan *bchan,
>>   			maxburst = bchan->slave.src_maxburst;
>>   		else
>>   			maxburst = bchan->slave.dst_maxburst;
>> -
>> -		writel_relaxed(maxburst,
>> -			       bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD));
>> +		if (bdev->bam_revision >= BAM_NDP_REVISION_START &&
>> +		    bdev->bam_revision <= BAM_NDP_REVISION_END)
> 
> Please use in_range().
Ok
> 
> Thanks & Regards,
> Manikanta.
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ