qcom/l2cache_counters: Add support to check available CPUS

Add support to check available CPUS for each cluster.

Change-Id: Ifc40333cdfe4e846b1cd527afc36a84f89bd8538
Signed-off-by: Shivnandan Kumar <quic_kshivnan@quicinc.com>
This commit is contained in:
Shivnandan Kumar
2022-09-13 21:21:27 +05:30
parent 6920b254f3
commit 2ade71c67b

View File

@@ -1037,8 +1037,8 @@ static int l2_cache_pmu_probe_cluster(struct device *parent,
struct cluster_pmu *cluster; struct cluster_pmu *cluster;
u32 fw_cluster_id; u32 fw_cluster_id;
struct resource res; struct resource res;
int ret; int ret = 0;
int irq; int irq, cpu, cpu_count = 0;
cluster = kzalloc(sizeof(*cluster), GFP_KERNEL); cluster = kzalloc(sizeof(*cluster), GFP_KERNEL);
if (!cluster) { if (!cluster) {
@@ -1064,6 +1064,14 @@ static int l2_cache_pmu_probe_cluster(struct device *parent,
goto err_put_dev; goto err_put_dev;
} }
for_each_possible_cpu(cpu) {
if (topology_physical_package_id(cpu) == fw_cluster_id) {
cpu_count++;
break;
}
}
if (cpu_count == 0)
goto err_put_dev;
ret = of_address_to_resource(cn, 0, &res); ret = of_address_to_resource(cn, 0, &res);
if (ret) { if (ret) {
pr_err(L2_COUNTERS_BUG "not able to find the resource\n"); pr_err(L2_COUNTERS_BUG "not able to find the resource\n");