riscv-non-isa/riscv-iommu

Should a set of OF in iohpmctr1-31 CSR generate a pmip

viktoryou opened this issue · 1 comments

From the spec,

The OF bit is set when the iohpmcycles counter overflows, and remains set until cleared by software.

From my understanding, it is also allowed to set the OF by software since the bit has the attribute of RW instead of RW1S. Would the behavior that setting the OF by software be regarded as another counter overflows?

If the iohpmcycles counter overflows when the OF bit is zero, then a HPM Counter Overflow interrupt is generated by setting ipsr.pmip bit to 1. If the OF bit is already one, then no interrupt request is generated. Consequently the OF bit also functions as a count overflow interrupt disable for the iohpmcycles.

Then, should a HPM Counter Overflow interrupt be generated due to setting the OF by software from zero?

It is only the "counter overflows when OF bit is zero" that can cause the interrupt. It is not a 0->1 edge of the OF that sets the interrupt pending. It is the carry out from the counter when OF is 0 that sets the interrupt pending.