hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * HiSilicon SoC L3C uncore Hardware event counters support
34 *
....@@ -6,10 +7,6 @@
67 * Shaokun Zhang <zhangshaokun@hisilicon.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>
....@@ -209,10 +206,8 @@
209206
210207 /* Read and init IRQ */
211208 irq = platform_get_irq(pdev, 0);
212
- if (irq < 0) {
213
- dev_err(&pdev->dev, "L3C PMU get irq fail; irq:%d\n", irq);
209
+ if (irq < 0)
214210 return irq;
215
- }
216211
217212 ret = devm_request_irq(&pdev->dev, irq, hisi_l3c_pmu_isr,
218213 IRQF_NOBALANCING | IRQF_NO_THREAD,
....@@ -238,7 +233,6 @@
238233 struct hisi_pmu *l3c_pmu)
239234 {
240235 unsigned long long id;
241
- struct resource *res;
242236 acpi_status status;
243237
244238 status = acpi_evaluate_integer(ACPI_HANDLE(&pdev->dev),
....@@ -264,8 +258,7 @@
264258 return -EINVAL;
265259 }
266260
267
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
268
- l3c_pmu->base = devm_ioremap_resource(&pdev->dev, res);
261
+ l3c_pmu->base = devm_platform_ioremap_resource(pdev, 0);
269262 if (IS_ERR(l3c_pmu->base)) {
270263 dev_err(&pdev->dev, "ioremap failed for l3c_pmu resource\n");
271264 return PTR_ERR(l3c_pmu->base);
....@@ -387,6 +380,7 @@
387380 l3c_pmu->sccl_id, l3c_pmu->index_id);
388381 l3c_pmu->pmu = (struct pmu) {
389382 .name = name,
383
+ .module = THIS_MODULE,
390384 .task_ctx_nr = perf_invalid_context,
391385 .event_init = hisi_uncore_pmu_event_init,
392386 .pmu_enable = hisi_uncore_pmu_enable,
....@@ -397,13 +391,15 @@
397391 .stop = hisi_uncore_pmu_stop,
398392 .read = hisi_uncore_pmu_read,
399393 .attr_groups = hisi_l3c_pmu_attr_groups,
394
+ .capabilities = PERF_PMU_CAP_NO_EXCLUDE,
400395 };
401396
402397 ret = perf_pmu_register(&l3c_pmu->pmu, name, -1);
403398 if (ret) {
404399 dev_err(l3c_pmu->dev, "L3C PMU register failed!\n");
405
- cpuhp_state_remove_instance(CPUHP_AP_PERF_ARM_HISI_L3_ONLINE,
406
- &l3c_pmu->node);
400
+ cpuhp_state_remove_instance_nocalls(
401
+ CPUHP_AP_PERF_ARM_HISI_L3_ONLINE, &l3c_pmu->node);
402
+ irq_set_affinity_hint(l3c_pmu->irq, NULL);
407403 }
408404
409405 return ret;
....@@ -414,8 +410,9 @@
414410 struct hisi_pmu *l3c_pmu = platform_get_drvdata(pdev);
415411
416412 perf_pmu_unregister(&l3c_pmu->pmu);
417
- cpuhp_state_remove_instance(CPUHP_AP_PERF_ARM_HISI_L3_ONLINE,
418
- &l3c_pmu->node);
413
+ cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_L3_ONLINE,
414
+ &l3c_pmu->node);
415
+ irq_set_affinity_hint(l3c_pmu->irq, NULL);
419416
420417 return 0;
421418 }
....@@ -424,6 +421,7 @@
424421 .driver = {
425422 .name = "hisi_l3c_pmu",
426423 .acpi_match_table = ACPI_PTR(hisi_l3c_pmu_acpi_match),
424
+ .suppress_bind_attrs = true,
427425 },
428426 .probe = hisi_l3c_pmu_probe,
429427 .remove = hisi_l3c_pmu_remove,