diff options
Diffstat (limited to 'tools/perf/arch/s390/annotate/instructions.c')
| -rw-r--r-- | tools/perf/arch/s390/annotate/instructions.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/tools/perf/arch/s390/annotate/instructions.c b/tools/perf/arch/s390/annotate/instructions.c index 8c72b44444cb..01df9d8303e1 100644 --- a/tools/perf/arch/s390/annotate/instructions.c +++ b/tools/perf/arch/s390/annotate/instructions.c | |||
| @@ -23,12 +23,37 @@ static struct ins_ops *s390__associate_ins_ops(struct arch *arch, const char *na | |||
| 23 | return ops; | 23 | return ops; |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | static int s390__cpuid_parse(struct arch *arch, char *cpuid) | ||
| 27 | { | ||
| 28 | unsigned int family; | ||
| 29 | char model[16], model_c[16], cpumf_v[16], cpumf_a[16]; | ||
| 30 | int ret; | ||
| 31 | |||
| 32 | /* | ||
| 33 | * cpuid string format: | ||
| 34 | * "IBM,family,model-capacity,model[,cpum_cf-version,cpum_cf-authorization]" | ||
| 35 | */ | ||
| 36 | ret = sscanf(cpuid, "%*[^,],%u,%[^,],%[^,],%[^,],%s", &family, model_c, | ||
| 37 | model, cpumf_v, cpumf_a); | ||
| 38 | if (ret >= 2) { | ||
| 39 | arch->family = family; | ||
| 40 | arch->model = 0; | ||
| 41 | return 0; | ||
| 42 | } | ||
| 43 | |||
| 44 | return -1; | ||
| 45 | } | ||
| 46 | |||
| 26 | static int s390__annotate_init(struct arch *arch, char *cpuid __maybe_unused) | 47 | static int s390__annotate_init(struct arch *arch, char *cpuid __maybe_unused) |
| 27 | { | 48 | { |
| 49 | int err = 0; | ||
| 50 | |||
| 28 | if (!arch->initialized) { | 51 | if (!arch->initialized) { |
| 29 | arch->initialized = true; | 52 | arch->initialized = true; |
| 30 | arch->associate_instruction_ops = s390__associate_ins_ops; | 53 | arch->associate_instruction_ops = s390__associate_ins_ops; |
| 54 | if (cpuid) | ||
| 55 | err = s390__cpuid_parse(arch, cpuid); | ||
| 31 | } | 56 | } |
| 32 | 57 | ||
| 33 | return 0; | 58 | return err; |
| 34 | } | 59 | } |
