forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * HiSilicon SoC HHA uncore Hardware event counters support
34 *
....@@ -6,10 +7,6 @@
67 * Anurup M <anurup.m@huawei.com>
78 *
89 * 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.
1310 */
1411 #include <linux/acpi.h>
1512 #include <linux/bug.h>
....@@ -210,10 +207,8 @@
210207
211208 /* Read and init IRQ */
212209 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)
215211 return irq;
216
- }
217212
218213 ret = devm_request_irq(&pdev->dev, irq, hisi_hha_pmu_isr,
219214 IRQF_NOBALANCING | IRQF_NO_THREAD,
....@@ -239,7 +234,6 @@
239234 struct hisi_pmu *hha_pmu)
240235 {
241236 unsigned long long id;
242
- struct resource *res;
243237 acpi_status status;
244238
245239 status = acpi_evaluate_integer(ACPI_HANDLE(&pdev->dev),
....@@ -261,8 +255,7 @@
261255 /* HHA PMUs only share the same SCCL */
262256 hha_pmu->ccl_id = -1;
263257
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);
266259 if (IS_ERR(hha_pmu->base)) {
267260 dev_err(&pdev->dev, "ioremap failed for hha_pmu resource\n");
268261 return PTR_ERR(hha_pmu->base);
....@@ -397,6 +390,7 @@
397390 hha_pmu->sccl_id, hha_pmu->index_id);
398391 hha_pmu->pmu = (struct pmu) {
399392 .name = name,
393
+ .module = THIS_MODULE,
400394 .task_ctx_nr = perf_invalid_context,
401395 .event_init = hisi_uncore_pmu_event_init,
402396 .pmu_enable = hisi_uncore_pmu_enable,
....@@ -407,13 +401,15 @@
407401 .stop = hisi_uncore_pmu_stop,
408402 .read = hisi_uncore_pmu_read,
409403 .attr_groups = hisi_hha_pmu_attr_groups,
404
+ .capabilities = PERF_PMU_CAP_NO_EXCLUDE,
410405 };
411406
412407 ret = perf_pmu_register(&hha_pmu->pmu, name, -1);
413408 if (ret) {
414409 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);
417413 }
418414
419415 return ret;
....@@ -424,8 +420,9 @@
424420 struct hisi_pmu *hha_pmu = platform_get_drvdata(pdev);
425421
426422 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);
429426
430427 return 0;
431428 }
....@@ -434,6 +431,7 @@
434431 .driver = {
435432 .name = "hisi_hha_pmu",
436433 .acpi_match_table = ACPI_PTR(hisi_hha_pmu_acpi_match),
434
+ .suppress_bind_attrs = true,
437435 },
438436 .probe = hisi_hha_pmu_probe,
439437 .remove = hisi_hha_pmu_remove,