perf_cpum_cf: Add support for counters available with IBM zEC12

Increase the maximum number of available counters and check if
the hardware supports the counter.  Support is indicated by the
version of the CPU-measurement counter facility.

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
Hendrik Brueckner 2012-10-15 14:31:29 +02:00 коммит произвёл Martin Schwidefsky
Родитель cec8546638
Коммит f47586b24c
2 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -9,7 +9,7 @@
#include <asm/cpu_mf.h>
/* CPU-measurement counter facility */
#define PERF_CPUM_CF_MAX_CTR 160
#define PERF_CPUM_CF_MAX_CTR 256
/* Per-CPU flags for PMU states */
#define PMU_F_RESERVED 0x1000

Просмотреть файл

@ -94,7 +94,7 @@ static int get_counter_set(u64 event)
set = CPUMF_CTR_SET_USER;
else if (event < 128)
set = CPUMF_CTR_SET_CRYPTO;
else if (event < 160)
else if (event < 256)
set = CPUMF_CTR_SET_EXT;
return set;
@ -138,6 +138,10 @@ static int validate_ctr_version(const struct hw_perf_event *hwc)
case CPUMF_CTR_SET_EXT:
if (cpuhw->info.csvn < 1)
err = -EOPNOTSUPP;
if ((cpuhw->info.csvn == 1 && hwc->config > 159) ||
(cpuhw->info.csvn == 2 && hwc->config > 175) ||
(cpuhw->info.csvn > 2 && hwc->config > 255))
err = -EOPNOTSUPP;
break;
}