[PATCH 5/5] arm/perfevents: implement perf event support for ARMv6

Will Deacon will.deacon at arm.com
Thu Jan 21 07:34:22 EST 2010


Hi Jean,

* Jean Pihet wrote:

> Agree. Here is the latest version of the detection code, after merging Jamie's
> latest version:
> 
>         unsigned long cpuid = read_cpuid_id() & CPUID_MASK;
> 
>         switch (cpuid) {
>         case 0xB360:    /* ARM1136 */
>         case 0xB560:    /* ARM1156 */
>         case 0xB760:    /* ARM1176 */
> 	    ...
>                 break;
>         case 0xB020:    /* ARM11mpcore */
> 	    ...
>                 break;
>         case 0xC080:    /* Cortex-A8 */
> 	    ...
>                 break;
>         case 0xC090:    /* Cortex-A9 */
> 	    ...
>                 break;
>         default:
>                 pr_info("no hardware support available\n");
>                 perf_max_events = -1;
>        }
>        ...
> 
> Is that OK if we just add 'if (implementor == 0x41) {' before the switch
> statement, as proposed above?

For the v7 PMU, we can do a bit better than that because the PMU
is defined by the architecture. If you read the DIDR[19:16] and it
returns either 3 or 4, you have a v7 PMU present so you can make use of
the architecturally defined events regardless of the implementer.

So, in response to your question, I reckon you should wrap the switch
statement with the implementer check, but add a DIDR check in the else
block so that cores with a v7 PMU will at least get support for the
standard events.

Cheers,

Will





More information about the linux-arm-kernel mailing list