.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * HiSilicon SoC HHA uncore Hardware event counters support |
---|
3 | 4 | * |
---|
.. | .. |
---|
6 | 7 | * Anurup M <anurup.m@huawei.com> |
---|
7 | 8 | * |
---|
8 | 9 | * This code is based on the uncore PMUs like arm-cci and arm-ccn. |
---|
9 | | - * |
---|
10 | | - * This program is free software; you can redistribute it and/or modify |
---|
11 | | - * it under the terms of the GNU General Public License version 2 as |
---|
12 | | - * published by the Free Software Foundation. |
---|
13 | 10 | */ |
---|
14 | 11 | #include <linux/acpi.h> |
---|
15 | 12 | #include <linux/bug.h> |
---|
.. | .. |
---|
210 | 207 | |
---|
211 | 208 | /* Read and init IRQ */ |
---|
212 | 209 | irq = platform_get_irq(pdev, 0); |
---|
213 | | - if (irq < 0) { |
---|
214 | | - dev_err(&pdev->dev, "HHA PMU get irq fail; irq:%d\n", irq); |
---|
| 210 | + if (irq < 0) |
---|
215 | 211 | return irq; |
---|
216 | | - } |
---|
217 | 212 | |
---|
218 | 213 | ret = devm_request_irq(&pdev->dev, irq, hisi_hha_pmu_isr, |
---|
219 | 214 | IRQF_NOBALANCING | IRQF_NO_THREAD, |
---|
.. | .. |
---|
239 | 234 | struct hisi_pmu *hha_pmu) |
---|
240 | 235 | { |
---|
241 | 236 | unsigned long long id; |
---|
242 | | - struct resource *res; |
---|
243 | 237 | acpi_status status; |
---|
244 | 238 | |
---|
245 | 239 | status = acpi_evaluate_integer(ACPI_HANDLE(&pdev->dev), |
---|
.. | .. |
---|
261 | 255 | /* HHA PMUs only share the same SCCL */ |
---|
262 | 256 | hha_pmu->ccl_id = -1; |
---|
263 | 257 | |
---|
264 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
---|
265 | | - hha_pmu->base = devm_ioremap_resource(&pdev->dev, res); |
---|
| 258 | + hha_pmu->base = devm_platform_ioremap_resource(pdev, 0); |
---|
266 | 259 | if (IS_ERR(hha_pmu->base)) { |
---|
267 | 260 | dev_err(&pdev->dev, "ioremap failed for hha_pmu resource\n"); |
---|
268 | 261 | return PTR_ERR(hha_pmu->base); |
---|
.. | .. |
---|
397 | 390 | hha_pmu->sccl_id, hha_pmu->index_id); |
---|
398 | 391 | hha_pmu->pmu = (struct pmu) { |
---|
399 | 392 | .name = name, |
---|
| 393 | + .module = THIS_MODULE, |
---|
400 | 394 | .task_ctx_nr = perf_invalid_context, |
---|
401 | 395 | .event_init = hisi_uncore_pmu_event_init, |
---|
402 | 396 | .pmu_enable = hisi_uncore_pmu_enable, |
---|
.. | .. |
---|
407 | 401 | .stop = hisi_uncore_pmu_stop, |
---|
408 | 402 | .read = hisi_uncore_pmu_read, |
---|
409 | 403 | .attr_groups = hisi_hha_pmu_attr_groups, |
---|
| 404 | + .capabilities = PERF_PMU_CAP_NO_EXCLUDE, |
---|
410 | 405 | }; |
---|
411 | 406 | |
---|
412 | 407 | ret = perf_pmu_register(&hha_pmu->pmu, name, -1); |
---|
413 | 408 | if (ret) { |
---|
414 | 409 | dev_err(hha_pmu->dev, "HHA PMU register failed!\n"); |
---|
415 | | - cpuhp_state_remove_instance(CPUHP_AP_PERF_ARM_HISI_HHA_ONLINE, |
---|
416 | | - &hha_pmu->node); |
---|
| 410 | + cpuhp_state_remove_instance_nocalls( |
---|
| 411 | + CPUHP_AP_PERF_ARM_HISI_HHA_ONLINE, &hha_pmu->node); |
---|
| 412 | + irq_set_affinity_hint(hha_pmu->irq, NULL); |
---|
417 | 413 | } |
---|
418 | 414 | |
---|
419 | 415 | return ret; |
---|
.. | .. |
---|
424 | 420 | struct hisi_pmu *hha_pmu = platform_get_drvdata(pdev); |
---|
425 | 421 | |
---|
426 | 422 | perf_pmu_unregister(&hha_pmu->pmu); |
---|
427 | | - cpuhp_state_remove_instance(CPUHP_AP_PERF_ARM_HISI_HHA_ONLINE, |
---|
428 | | - &hha_pmu->node); |
---|
| 423 | + cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_HHA_ONLINE, |
---|
| 424 | + &hha_pmu->node); |
---|
| 425 | + irq_set_affinity_hint(hha_pmu->irq, NULL); |
---|
429 | 426 | |
---|
430 | 427 | return 0; |
---|
431 | 428 | } |
---|
.. | .. |
---|
434 | 431 | .driver = { |
---|
435 | 432 | .name = "hisi_hha_pmu", |
---|
436 | 433 | .acpi_match_table = ACPI_PTR(hisi_hha_pmu_acpi_match), |
---|
| 434 | + .suppress_bind_attrs = true, |
---|
437 | 435 | }, |
---|
438 | 436 | .probe = hisi_hha_pmu_probe, |
---|
439 | 437 | .remove = hisi_hha_pmu_remove, |
---|