Skip to content
Snippets Groups Projects
Commit 4c871ce2 authored by Hesham Almatary's avatar Hesham Almatary Committed by James Morse
Browse files

MPAM: Fix calculating the bandwidth granularity


The minimum bandwidth granularity is calculated from
MPAMF_MBW_IDR.BWA_WD, which represents the number of bits for
a fixed-point fraction (See Section 11.3.8 MPAM Reference Manual).

Right now, the calculation works fine for 1, but
is wrong for 2 bits and more. For example, 1 bit will equal 50%.
In the current implementation, 2 bits will equal 33% instead of 25%.
Similarly, 3 bits will equal 25% instead of 12.5%.
This commit corrects the calculation.

Signed-off-by: default avatarHesham Almatary <hesham.almatary@huawei.com>
Signed-off-by: default avatarJames Morse <james.morse@arm.com>
parent 5ebc753c
No related branches found
No related tags found
No related merge requests found
......@@ -515,7 +515,7 @@ static u32 get_mba_granularity(struct mpam_props *cprops)
* bwa_wd is the number of bits implemented in the 0.xxx
* fixed point fraction. 1 bit is 50%, 2 is 25% etc.
*/
return MAX_MBA_BW / (cprops->bwa_wd + 1);
return (MAX_MBA_BW / BIT(cprops->bwa_wd));
}
return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment