hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * HiSilicon SoC DDRC 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>
....@@ -220,10 +217,8 @@
220217
221218 /* Read and init IRQ */
222219 irq = platform_get_irq(pdev, 0);
223
- if (irq < 0) {
224
- dev_err(&pdev->dev, "DDRC PMU get irq fail; irq:%d\n", irq);
220
+ if (irq < 0)
225221 return irq;
226
- }
227222
228223 ret = devm_request_irq(&pdev->dev, irq, hisi_ddrc_pmu_isr,
229224 IRQF_NOBALANCING | IRQF_NO_THREAD,
....@@ -248,8 +243,6 @@
248243 static int hisi_ddrc_pmu_init_data(struct platform_device *pdev,
249244 struct hisi_pmu *ddrc_pmu)
250245 {
251
- struct resource *res;
252
-
253246 /*
254247 * Use the SCCL_ID and DDRC channel ID to identify the
255248 * DDRC PMU, while SCCL_ID is in MPIDR[aff2].
....@@ -268,8 +261,7 @@
268261 /* DDRC PMUs only share the same SCCL */
269262 ddrc_pmu->ccl_id = -1;
270263
271
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
272
- ddrc_pmu->base = devm_ioremap_resource(&pdev->dev, res);
264
+ ddrc_pmu->base = devm_platform_ioremap_resource(pdev, 0);
273265 if (IS_ERR(ddrc_pmu->base)) {
274266 dev_err(&pdev->dev, "ioremap failed for ddrc_pmu resource\n");
275267 return PTR_ERR(ddrc_pmu->base);
....@@ -386,6 +378,7 @@
386378 ddrc_pmu->sccl_id, ddrc_pmu->index_id);
387379 ddrc_pmu->pmu = (struct pmu) {
388380 .name = name,
381
+ .module = THIS_MODULE,
389382 .task_ctx_nr = perf_invalid_context,
390383 .event_init = hisi_uncore_pmu_event_init,
391384 .pmu_enable = hisi_uncore_pmu_enable,
....@@ -396,13 +389,15 @@
396389 .stop = hisi_uncore_pmu_stop,
397390 .read = hisi_uncore_pmu_read,
398391 .attr_groups = hisi_ddrc_pmu_attr_groups,
392
+ .capabilities = PERF_PMU_CAP_NO_EXCLUDE,
399393 };
400394
401395 ret = perf_pmu_register(&ddrc_pmu->pmu, name, -1);
402396 if (ret) {
403397 dev_err(ddrc_pmu->dev, "DDRC PMU register failed!\n");
404
- cpuhp_state_remove_instance(CPUHP_AP_PERF_ARM_HISI_DDRC_ONLINE,
405
- &ddrc_pmu->node);
398
+ cpuhp_state_remove_instance_nocalls(
399
+ CPUHP_AP_PERF_ARM_HISI_DDRC_ONLINE, &ddrc_pmu->node);
400
+ irq_set_affinity_hint(ddrc_pmu->irq, NULL);
406401 }
407402
408403 return ret;
....@@ -413,8 +408,9 @@
413408 struct hisi_pmu *ddrc_pmu = platform_get_drvdata(pdev);
414409
415410 perf_pmu_unregister(&ddrc_pmu->pmu);
416
- cpuhp_state_remove_instance(CPUHP_AP_PERF_ARM_HISI_DDRC_ONLINE,
417
- &ddrc_pmu->node);
411
+ cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_DDRC_ONLINE,
412
+ &ddrc_pmu->node);
413
+ irq_set_affinity_hint(ddrc_pmu->irq, NULL);
418414
419415 return 0;
420416 }
....@@ -423,6 +419,7 @@
423419 .driver = {
424420 .name = "hisi_ddrc_pmu",
425421 .acpi_match_table = ACPI_PTR(hisi_ddrc_pmu_acpi_match),
422
+ .suppress_bind_attrs = true,
426423 },
427424 .probe = hisi_ddrc_pmu_probe,
428425 .remove = hisi_ddrc_pmu_remove,