Parcourir la source

qcacld-3.0: Fix pm_qos API build error with kernel v5.10

pm_qos API is removed from kernel v5.7, while new API cpu_latency_qos
is defined.
Replace pm_qos API with cpu_latency_qos.

Change-Id: I7ce81c5433b6c9b5761b5330482a921d9bbfeaf4
CRs-Fixed: 3126736
Bing Sun il y a 3 ans
Parent
commit
e9a6f7bc76
1 fichiers modifiés avec 70 ajouts et 19 suppressions
  1. 70 19
      core/hdd/src/wlan_hdd_main.c

+ 70 - 19
core/hdd/src/wlan_hdd_main.c

@@ -10245,6 +10245,26 @@ static inline void hdd_pm_qos_remove_request(struct hdd_context *hdd_ctx)
 
 #else /* CLD_DEV_PM_QOS */
 
+#if defined(CONFIG_SMP) && defined(MSM_PLATFORM)
+/**
+ * hdd_set_default_pm_qos_mask() - Update PM_qos request for AFFINE_CORES
+ * @hdd_ctx: handle to hdd context
+ *
+ * Return: none
+ */
+static inline void hdd_set_default_pm_qos_mask(struct hdd_context *hdd_ctx)
+{
+	hdd_ctx->pm_qos_req.type = PM_QOS_REQ_AFFINE_CORES;
+	qdf_cpumask_clear(&hdd_ctx->pm_qos_req.cpus_affine);
+	hdd_pm_qos_update_cpu_mask(&hdd_ctx->pm_qos_req.cpus_affine, false);
+}
+#else
+static inline void hdd_set_default_pm_qos_mask(struct hdd_context *hdd_ctx)
+{
+}
+#endif
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0))
 /**
  * hdd_pm_qos_update_request() - API to request for pm_qos
  * @hdd_ctx: handle to hdd context
@@ -10258,30 +10278,35 @@ static inline void hdd_pm_qos_update_request(struct hdd_context *hdd_ctx,
 	COPY_CPU_MASK(&hdd_ctx->pm_qos_req.cpus_affine, pm_qos_cpu_mask);
 
 	if (cpumask_empty(pm_qos_cpu_mask))
-		pm_qos_update_request(&hdd_ctx->pm_qos_req,
-				      PM_QOS_DEFAULT_VALUE);
+		cpu_latency_qos_update_request(&hdd_ctx->pm_qos_req,
+					       PM_QOS_DEFAULT_VALUE);
 	else
-		pm_qos_update_request(&hdd_ctx->pm_qos_req, 1);
+		cpu_latency_qos_update_request(&hdd_ctx->pm_qos_req, 1);
 }
 
-#if defined(CONFIG_SMP) && defined(MSM_PLATFORM)
-/**
- * hdd_set_default_pm_qos_mask() - Update PM_qos request for AFFINE_CORES
- * @hdd_ctx: handle to hdd context
- *
- * Return: none
- */
-static inline void hdd_set_default_pm_qos_mask(struct hdd_context *hdd_ctx)
+static inline void hdd_pm_qos_add_request(struct hdd_context *hdd_ctx)
 {
-	hdd_ctx->pm_qos_req.type = PM_QOS_REQ_AFFINE_CORES;
-	qdf_cpumask_clear(&hdd_ctx->pm_qos_req.cpus_affine);
-	hdd_pm_qos_update_cpu_mask(&hdd_ctx->pm_qos_req.cpus_affine, false);
+	hdd_set_default_pm_qos_mask(hdd_ctx);
+	cpu_latency_qos_add_request(&hdd_ctx->pm_qos_req, PM_QOS_DEFAULT_VALUE);
+	DUMP_CPU_AFFINE();
+}
+
+static inline void hdd_pm_qos_remove_request(struct hdd_context *hdd_ctx)
+{
+	cpu_latency_qos_remove_request(&hdd_ctx->pm_qos_req);
 }
 #else
-static inline void hdd_set_default_pm_qos_mask(struct hdd_context *hdd_ctx)
+static inline void hdd_pm_qos_update_request(struct hdd_context *hdd_ctx,
+					     cpumask_t *pm_qos_cpu_mask)
 {
+	COPY_CPU_MASK(&hdd_ctx->pm_qos_req.cpus_affine, pm_qos_cpu_mask);
+
+	if (cpumask_empty(pm_qos_cpu_mask))
+		pm_qos_update_request(&hdd_ctx->pm_qos_req,
+				      PM_QOS_DEFAULT_VALUE);
+	else
+		pm_qos_update_request(&hdd_ctx->pm_qos_req, 1);
 }
-#endif
 
 static inline void hdd_pm_qos_add_request(struct hdd_context *hdd_ctx)
 {
@@ -10295,6 +10320,7 @@ static inline void hdd_pm_qos_remove_request(struct hdd_context *hdd_ctx)
 {
 	pm_qos_remove_request(&hdd_ctx->pm_qos_req);
 }
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0) */
 #endif /* CLD_DEV_PM_QOS */
 
 #else /* CLD_PM_QOS */
@@ -10344,7 +10370,31 @@ void wlan_hdd_set_pm_qos_request(struct hdd_context *hdd_ctx,
 		hdd_ctx->pm_qos_request = false;
 	}
 }
-#else
+#else /* CLD_DEV_PM_QOS */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0))
+void wlan_hdd_set_pm_qos_request(struct hdd_context *hdd_ctx,
+				 bool pm_qos_request)
+{
+	if (pm_qos_request) {
+		hdd_ctx->pm_qos_request = true;
+		if (!hdd_ctx->hbw_requested) {
+			cpumask_setall(&hdd_ctx->pm_qos_req.cpus_affine);
+			cpu_latency_qos_update_request(
+				&hdd_ctx->pm_qos_req,
+				DISABLE_KRAIT_IDLE_PS_VAL);
+			hdd_ctx->hbw_requested = true;
+		}
+	} else {
+		if (hdd_ctx->hbw_requested) {
+			cpumask_clear(&hdd_ctx->pm_qos_req.cpus_affine);
+			cpu_latency_qos_update_request(&hdd_ctx->pm_qos_req,
+						       PM_QOS_DEFAULT_VALUE);
+			hdd_ctx->hbw_requested = false;
+		}
+		hdd_ctx->pm_qos_request = false;
+	}
+}
+#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0)) */
 void wlan_hdd_set_pm_qos_request(struct hdd_context *hdd_ctx,
 				 bool pm_qos_request)
 {
@@ -10366,8 +10416,9 @@ void wlan_hdd_set_pm_qos_request(struct hdd_context *hdd_ctx,
 		hdd_ctx->pm_qos_request = false;
 	}
 }
-#endif
-#endif
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0)) */
+#endif /* CLD_DEV_PM_QOS*/
+#endif /* CLD_PM_QOS */
 
 /**
  * hdd_low_tput_gro_flush_skip_handler() - adjust GRO flush for low tput