I have had the same diff in my local tree for ages. I am sure I mentioned it somewhere (bug report, follow-up to the commit, or just IRC).
While it does fix it when hwpmc is built into the kernel for one specific CPU, the module will not work at all, and I have not found a way to run-time detect which CPU we are running on to initialise the correct one (as for modules we need to built-in all). So in some ways this is all very backwards compared to real needs and the real problem is from months ago when the ability to run-time detect was removed from armv6/7.
Hmm I wonder if the entire struct can be exposed rather than just the class as not all "CPU_CLASS_CORTEXA" are the same and hwpmc will want to choose depending on .. hmm never mind; it's reading that directly from a register, so this will be fine. Thanks for doing it!
Too late but still...
What exactly is "cpu_class" and why we need at all? I understand why it's useful for ARMv4, but it's near useless for ARMv7 (there is too much variants)
On ARMv6+, Performance Monitors Extension is optional unit, and its presence and version is determined by ID_DFR0[27:24]. Guessing context of ID_DFR0 using "cpu_class" doesn't look like optimal way.