Skip to content

Commit 732c35c

Browse files
shravankumarrjwrdegoede
authored andcommitted
platform/mellanox: mlxbf-pmc: Fix offset calculation for crspace events
The event selector fields for 2 counters are contained in one 32-bit register and the current logic does not account for this. Fixes: 423c336 ("platform/mellanox: mlxbf-pmc: Add support for BlueField-3") Signed-off-by: Shravan Kumar Ramani <[email protected]> Reviewed-by: David Thompson <[email protected]> Reviewed-by: Vadim Pasternak <[email protected]> Link: https://lore.kernel.org/r/8834cfa496c97c7c2fcebcfca5a2aa007e20ae96.1705485095.git.shravankr@nvidia.com Signed-off-by: Hans de Goede <[email protected]>
1 parent 8cbc756 commit 732c35c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/platform/mellanox/mlxbf-pmc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ static int mlxbf_pmc_program_crspace_counter(int blk_num, uint32_t cnt_num,
11701170
int ret;
11711171

11721172
addr = pmc->block[blk_num].mmio_base +
1173-
(rounddown(cnt_num, 2) * MLXBF_PMC_CRSPACE_PERFSEL_SZ);
1173+
((cnt_num / 2) * MLXBF_PMC_CRSPACE_PERFSEL_SZ);
11741174
ret = mlxbf_pmc_readl(addr, &word);
11751175
if (ret)
11761176
return ret;
@@ -1413,7 +1413,7 @@ static int mlxbf_pmc_read_crspace_event(int blk_num, uint32_t cnt_num,
14131413
int ret;
14141414

14151415
addr = pmc->block[blk_num].mmio_base +
1416-
(rounddown(cnt_num, 2) * MLXBF_PMC_CRSPACE_PERFSEL_SZ);
1416+
((cnt_num / 2) * MLXBF_PMC_CRSPACE_PERFSEL_SZ);
14171417
ret = mlxbf_pmc_readl(addr, &word);
14181418
if (ret)
14191419
return ret;

0 commit comments

Comments
 (0)