AsahiLinux / linux

Linux kernel source tree
Other
2.36k stars 90 forks source link

drivers/perf: apple_m1: Add mapping for branch counters #307

Closed jiegec closed 3 months ago

jiegec commented 4 months ago

Apple released their performance counters definition in /usr/share/kpep/a14.plist file on macOS. The file lists the branch counters (number of branch instructions and branch mispredictions):

"INST_BRANCH" => { "counters_mask" => 224 "description" => "Retired branch instructions including calls and returns" "number" => 141 }

and

"BRANCH_MISPRED_NONSPEC" => { "counters_mask" => 224 "description" => "Retired branch instructions including calls and returns that mispredicted" "number" => 203 }

In this commit, the performance counters numbered 0x8d(141) and 0xcb(203) are renamed to their actual names and the mappings from generalized performence event types in enum perf_hw_id to hardware performance counters are added respectively.

jannau commented 3 months ago

cherry-picked on top of Yangyu Chen work to name all registers, to be released as asahi-6.10.7-1 thanks