Skip to content

Commit 807907d

Browse files
77liuqiwilldeacon
authored andcommitted
drivers/perf: hisi: Associate PMUs in SICL with CPUs online
If a PMU is in a SICL (Super IO cluster), it is not appropriate to associate this PMU with a CPU die. So we associate it with all CPUs online, rather than CPUs in the nearest SCCL. As the firmware of Hip09 platform hasn't been published yet, change of PMU driver will not influence backwards compatibility between driver and firmware. Signed-off-by: Qi Liu <[email protected]> Reviewed-by: John Garry <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 47a9ed8 commit 807907d

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

drivers/perf/hisilicon/hisi_uncore_pa_pmu.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,12 @@ static int hisi_pa_pmu_init_data(struct platform_device *pdev,
258258
struct hisi_pmu *pa_pmu)
259259
{
260260
/*
261-
* Use the SCCL_ID and the index ID to identify the PA PMU,
262-
* while SCCL_ID is the nearst SCCL_ID from this SICL and
263-
* CPU core is chosen from this SCCL to manage this PMU.
261+
* As PA PMU is in a SICL, use the SICL_ID and the index ID
262+
* to identify the PA PMU.
264263
*/
265264
if (device_property_read_u32(&pdev->dev, "hisilicon,scl-id",
266-
&pa_pmu->sccl_id)) {
267-
dev_err(&pdev->dev, "Cannot read sccl-id!\n");
265+
&pa_pmu->sicl_id)) {
266+
dev_err(&pdev->dev, "Cannot read sicl-id!\n");
268267
return -EINVAL;
269268
}
270269

@@ -275,6 +274,7 @@ static int hisi_pa_pmu_init_data(struct platform_device *pdev,
275274
}
276275

277276
pa_pmu->ccl_id = -1;
277+
pa_pmu->sccl_id = -1;
278278

279279
pa_pmu->base = devm_platform_ioremap_resource(pdev, 0);
280280
if (IS_ERR(pa_pmu->base)) {
@@ -399,13 +399,9 @@ static int hisi_pa_pmu_probe(struct platform_device *pdev)
399399
ret = hisi_pa_pmu_dev_probe(pdev, pa_pmu);
400400
if (ret)
401401
return ret;
402-
/*
403-
* PA is attached in SICL and the CPU core is chosen to manage this
404-
* PMU which is the nearest SCCL, while its SCCL_ID is greater than
405-
* one with the SICL_ID.
406-
*/
402+
407403
name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "hisi_sicl%u_pa%u",
408-
pa_pmu->sccl_id - 1, pa_pmu->index_id);
404+
pa_pmu->sicl_id, pa_pmu->index_id);
409405
if (!name)
410406
return -ENOMEM;
411407

drivers/perf/hisilicon/hisi_uncore_pmu.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,10 @@ static bool hisi_pmu_cpu_is_associated_pmu(struct hisi_pmu *hisi_pmu)
458458
{
459459
int sccl_id, ccl_id;
460460

461+
/* If SCCL_ID is -1, the PMU is in a SICL and has no CPU affinity */
462+
if (hisi_pmu->sccl_id == -1)
463+
return true;
464+
461465
if (hisi_pmu->ccl_id == -1) {
462466
/* If CCL_ID is -1, the PMU only shares the same SCCL */
463467
hisi_read_sccl_and_ccl_id(&sccl_id, NULL);

drivers/perf/hisilicon/hisi_uncore_pmu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ struct hisi_pmu {
8181
struct device *dev;
8282
struct hlist_node node;
8383
int sccl_id;
84+
int sicl_id;
8485
int ccl_id;
8586
void __iomem *base;
8687
/* the ID of the PMU modules */

0 commit comments

Comments
 (0)