Skip to content

Commit 4db74c0

Browse files
committed
accel/habanalabs/gaudi2: fix spmu mask creation
event_types_num received from the user can be 0. In that case, the event_mask should be 0. In addition, to create a correct mask we need to match the number of event types to the bit location such that bit 0 represents a single event type, bit 1 represents 2 types and so on. Signed-off-by: Oded Gabbay <[email protected]> Reviewed-by: Ofir Bitton <[email protected]>
1 parent 0426e03 commit 4db74c0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/accel/habanalabs/gaudi2/gaudi2_coresight.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2500,7 +2500,8 @@ static int gaudi2_config_spmu(struct hl_device *hdev, struct hl_debug_params *pa
25002500
* set enabled events mask based on input->event_types_num
25012501
*/
25022502
event_mask = 0x80000000;
2503-
event_mask |= GENMASK(input->event_types_num, 0);
2503+
if (input->event_types_num)
2504+
event_mask |= GENMASK(input->event_types_num - 1, 0);
25042505

25052506
WREG32(base_reg + mmSPMU_PMCNTENSET_EL0_OFFSET, event_mask);
25062507
} else {

0 commit comments

Comments
 (0)