You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Presently, the implementation of the OpenSBI calls to start / stop counters is permissive, and the semantics of a specific combination of implemented platform counters, and the counter mask bits is loosely defined (see reference code below). Per the chat with @atishp04, this can be tightened by mandating sets bits only for valid counters, and so forth.
The current Salus implementation deliberately approximates the implementation in the interest of SW compatibility. When the SBI code is fixed, we should implement stricter checks in Salus.
Snippet from existing SBI Implementation:
int sbi_pmu_ctr_start(unsigned long cbase, unsigned long cmask,
unsigned long flags, uint64_t ival)
{
int event_idx_type;
uint32_t event_code;
unsigned long ctr_mask = cmask << cbase;
int ret = SBI_EINVAL;
bool bUpdate = FALSE;
if (sbi_fls(ctr_mask) >= total_ctrs)
return ret;
if (flags & SBI_PMU_START_FLAG_SET_INIT_VALUE)
bUpdate = TRUE;
for_each_set_bit_from(cbase, &ctr_mask, total_ctrs) {
event_idx_type = pmu_ctr_validate(cbase, &event_code);
if (event_idx_type < 0)
/* Continue the start operation for other counters */
continue;
else if (event_idx_type == SBI_PMU_EVENT_TYPE_FW)
ret = pmu_ctr_start_fw(cbase, event_code, ival, bUpdate);
else
ret = pmu_ctr_start_hw(cbase, ival, bUpdate);
}
return ret;
}
The text was updated successfully, but these errors were encountered:
Presently, the implementation of the OpenSBI calls to start / stop counters is permissive, and the semantics of a specific combination of implemented platform counters, and the counter mask bits is loosely defined (see reference code below). Per the chat with @atishp04, this can be tightened by mandating sets bits only for valid counters, and so forth.
The current Salus implementation deliberately approximates the implementation in the interest of SW compatibility. When the SBI code is fixed, we should implement stricter checks in Salus.
Snippet from existing SBI Implementation:
The text was updated successfully, but these errors were encountered: