Re: Proposal v2: SBI PMU Extension


Greg Favor
 

Anup,

Can I request that the default code path for turning an event_idx value into a value to write into mhpmeventX is to simply write event_idx[XLEN-1:0] into mhpmeventX.

Future hardware can then (optionally) choose to implement their mhpmeventX's with this standardized format and avoid the need to provide implementation-specific code for translating event_idx to the value to write into the implementation's mhpmeventX's.  Other past and future implementations can of course do whatever they want and provide a custom piece of "translation" code for use within OpenSBI.

In essence, this SBI PMU extension serves to standardize the low twenty bits (event_idx.type + event_idx.code) of mhpmeventX in a way that meshes fully and cleanly with what Linux perf currently supports (which is great).  While type==RAW (and the event_idx.info field) provides support for whatever else an implementation wants to do with all the other bits of mhpmeventX.

Greg

On Thu, Jul 9, 2020 at 12:57 AM Anup Patel <Anup.Patel@...> wrote:

Based on my previous reply…

 

To monitor RAW event 0x12345678, user-space perf tool will create user space perf RAW event (i.e. perf_event_attr.type == 4 and perf_event_attr.config = = 0x12345678). The Linux RISC-V PMU driver will allocate and map matching HARDWARE counter which supports specified corrosponding SBI RAW event (event_idx.type = 2, event_idx.code = 0x678 and event_idx.info = 0x12345). Finally, the SBI_PMU_COUNTER_START call implemented by OpenSBI will write 0x12345678 (or some platform specific translated value of 0x12345678) to appropriate mhpmeventX CSR).

 

(Note: above we assume mhpmcounterX supports monitoring RAW event 0x12345678 and OpenSBI is aware of this)

 

Regards,

Anup


Join {tech-unixplatformspec@lists.riscv.org to automatically receive all group messages.