| .. | .. |
|---|
| 72 | 72 | |
|---|
| 73 | 73 | static struct attribute_group event_group = { |
|---|
| 74 | 74 | .name = "events", |
|---|
| 75 | | - .attrs = hv_gpci_event_attrs, |
|---|
| 75 | + /* .attrs is set in init */ |
|---|
| 76 | 76 | }; |
|---|
| 77 | 77 | |
|---|
| 78 | 78 | #define HV_CAPS_ATTR(_name, _format) \ |
|---|
| .. | .. |
|---|
| 330 | 330 | int r; |
|---|
| 331 | 331 | unsigned long hret; |
|---|
| 332 | 332 | struct hv_perf_caps caps; |
|---|
| 333 | + struct hv_gpci_request_buffer *arg; |
|---|
| 333 | 334 | |
|---|
| 334 | 335 | hv_gpci_assert_offsets_correct(); |
|---|
| 335 | 336 | |
|---|
| .. | .. |
|---|
| 353 | 354 | /* sampling not supported */ |
|---|
| 354 | 355 | h_gpci_pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT; |
|---|
| 355 | 356 | |
|---|
| 357 | + arg = (void *)get_cpu_var(hv_gpci_reqb); |
|---|
| 358 | + memset(arg, 0, HGPCI_REQ_BUFFER_SIZE); |
|---|
| 359 | + |
|---|
| 360 | + /* |
|---|
| 361 | + * hcall H_GET_PERF_COUNTER_INFO populates the output |
|---|
| 362 | + * counter_info_version value based on the system hypervisor. |
|---|
| 363 | + * Pass the counter request 0x10 corresponds to request type |
|---|
| 364 | + * 'Dispatch_timebase_by_processor', to get the supported |
|---|
| 365 | + * counter_info_version. |
|---|
| 366 | + */ |
|---|
| 367 | + arg->params.counter_request = cpu_to_be32(0x10); |
|---|
| 368 | + |
|---|
| 369 | + r = plpar_hcall_norets(H_GET_PERF_COUNTER_INFO, |
|---|
| 370 | + virt_to_phys(arg), HGPCI_REQ_BUFFER_SIZE); |
|---|
| 371 | + if (r) { |
|---|
| 372 | + pr_devel("hcall failed, can't get supported counter_info_version: 0x%x\n", r); |
|---|
| 373 | + arg->params.counter_info_version_out = 0x8; |
|---|
| 374 | + } |
|---|
| 375 | + |
|---|
| 376 | + /* |
|---|
| 377 | + * Use counter_info_version_out value to assign |
|---|
| 378 | + * required hv-gpci event list. |
|---|
| 379 | + */ |
|---|
| 380 | + if (arg->params.counter_info_version_out >= 0x8) |
|---|
| 381 | + event_group.attrs = hv_gpci_event_attrs; |
|---|
| 382 | + else |
|---|
| 383 | + event_group.attrs = hv_gpci_event_attrs_v6; |
|---|
| 384 | + |
|---|
| 385 | + put_cpu_var(hv_gpci_reqb); |
|---|
| 386 | + |
|---|
| 356 | 387 | r = perf_pmu_register(&h_gpci_pmu, h_gpci_pmu.name, -1); |
|---|
| 357 | 388 | if (r) |
|---|
| 358 | 389 | return r; |
|---|