Browse Source

qcacld-3.0: Fix perf cluster interrupt affinity

The number of perf CPU clusters can vary across
different targets. Currently only the second CPU
cluster is considered as the perf cluster, whereas
there can be more than 1 perf clusters.

Fix this perf cluster derivation for interrupt affinity.

Change-Id: Idecc98701e38bd2315846d6500068dcdd8f1309e
CRs-Fixed: 3498023
Rakesh Pillai 2 years ago
parent
commit
ba10198e0b

+ 15 - 9
components/dp/core/src/wlan_dp_bus_bandwidth.c

@@ -41,6 +41,7 @@
 #include "wlan_dp_txrx.h"
 #include "cdp_txrx_host_stats.h"
 #include "wlan_cm_roam_api.h"
+#include "hif_main.h"
 
 #ifdef FEATURE_BUS_BANDWIDTH_MGR
 /*
@@ -1219,15 +1220,20 @@ static void dp_display_periodic_stats(struct wlan_dp_psoc_context *dp_ctx,
 static inline void dp_pm_qos_update_cpu_mask(qdf_cpu_mask *mask,
 					     bool enable_perf_cluster)
 {
-	qdf_cpumask_set_cpu(0, mask);
-	qdf_cpumask_set_cpu(1, mask);
-	qdf_cpumask_set_cpu(2, mask);
-	qdf_cpumask_set_cpu(3, mask);
-
-	if (enable_perf_cluster) {
-		qdf_cpumask_set_cpu(4, mask);
-		qdf_cpumask_set_cpu(5, mask);
-		qdf_cpumask_set_cpu(6, mask);
+	int package_id;
+	unsigned int cpus;
+	int perf_cpu_cluster = hif_get_perf_cluster_bitmap();
+	int little_cpu_cluster = BIT(CPU_CLUSTER_TYPE_LITTLE);
+
+	qdf_cpumask_clear(mask);
+	qdf_for_each_online_cpu(cpus) {
+		package_id = qdf_topology_physical_package_id(cpus);
+		if (package_id >= 0 &&
+		    (BIT(package_id) & little_cpu_cluster ||
+		     (enable_perf_cluster &&
+		      BIT(package_id) & perf_cpu_cluster))) {
+			qdf_cpumask_set_cpu(cpus, mask);
+		}
 	}
 }
 

+ 4 - 3
components/dp/core/src/wlan_dp_rx_thread.c

@@ -85,13 +85,14 @@ dp_rx_refill_thread_set_affinity(struct dp_rx_refill_thread *refill_thread)
 	unsigned int cpus;
 	char new_mask_str[10];
 	qdf_cpu_mask new_mask;
+	int perf_cpu_cluster = hif_get_perf_cluster_bitmap();
+	int package_id;
 
 	qdf_cpumask_clear(&new_mask);
 	qdf_for_each_online_cpu(cpus) {
-		if (qdf_topology_physical_package_id(cpus) ==
-		    CPU_CLUSTER_TYPE_PERF) {
+		package_id = qdf_topology_physical_package_id(cpus);
+		if (package_id >= 0 && BIT(package_id) & perf_cpu_cluster)
 			qdf_cpumask_set_cpu(cpus, &new_mask);
-		}
 	}
 
 	qdf_thread_set_cpus_allowed_mask(refill_thread->task, &new_mask);