Parcourir la source

qcacld-3.0: Check IPA HW support before SMMU enable

Currently even if IPA HW support is not there during load
HOST is checking for SMMU enable status which returns error.
As a result driver load fails. So check for IPA HW support
before checking for SMMU enable status.

Change-Id: I5705f98f88d495b100af7cb2b3d2ad40e7030a8d
CRs-Fixed: 2185620
Yun Park il y a 7 ans
Parent
commit
45d3597a63

+ 2 - 1
core/cds/inc/cds_api.h

@@ -598,13 +598,14 @@ void cds_incr_arp_stats_tx_tgt_acked(void);
  * cds_smmu_mem_map_setup() - Check SMMU S1 stage enable
  *                            status and setup wlan driver
  * @osdev: Parent device instance
+ * @ipa_present: IPA HW support flag
  *
  * This API checks if SMMU S1 translation is enabled in
  * platform driver or not and sets it accordingly in driver.
  *
  * Return: QDF_STATUS
  */
-QDF_STATUS cds_smmu_mem_map_setup(qdf_device_t osdev);
+QDF_STATUS cds_smmu_mem_map_setup(qdf_device_t osdev, bool ipa_present);
 
 /**
  * cds_smmu_map_unmap() - Map / Unmap DMA buffer to IPA UC

+ 29 - 20
core/cds/src/cds_api.c

@@ -2845,40 +2845,49 @@ void cds_incr_arp_stats_tx_tgt_acked(void)
 }
 
 #ifdef ENABLE_SMMU_S1_TRANSLATION
-QDF_STATUS cds_smmu_mem_map_setup(qdf_device_t osdev)
+QDF_STATUS cds_smmu_mem_map_setup(qdf_device_t osdev, bool ipa_present)
 {
 	int attr = 0;
-	bool ipa_smmu_enable;
+	bool ipa_smmu_enable = false;
 	struct dma_iommu_mapping *mapping = pld_smmu_get_mapping(osdev->dev);
 
 	osdev->smmu_s1_enabled = false;
 
-	ipa_smmu_enable = qdf_get_ipa_smmu_enabled();
-	if (ipa_smmu_enable)
-		cds_info("SMMU enabled from IPA side");
-	else
-		cds_info("SMMU not enabled from IPA side");
+	if (ipa_present) {
+		ipa_smmu_enable = qdf_get_ipa_smmu_enabled();
+		if (ipa_smmu_enable)
+			cds_info("SMMU enabled from IPA side");
+		else
+			cds_info("SMMU not enabled from IPA side");
+	}
 
 	if (mapping && ((iommu_domain_get_attr(mapping->domain,
 			 DOMAIN_ATTR_S1_BYPASS, &attr) == 0) &&
 			 !attr)) {
 		cds_info("SMMU enabled from WLAN side");
-		if (ipa_smmu_enable) {
-			cds_info("SMMU enabled from both IPA and WLAN side");
-			osdev->smmu_s1_enabled = true;
-			return QDF_STATUS_SUCCESS;
+
+		if (ipa_present) {
+			if (ipa_smmu_enable) {
+				cds_info("SMMU enabled from both IPA and WLAN side");
+				osdev->smmu_s1_enabled = true;
+			} else {
+				cds_err("SMMU mismatch: IPA: disable, WLAN: enable");
+				return QDF_STATUS_E_FAILURE;
+			}
 		} else {
-			cds_err("SMMU mismatch: IPA: disable, WLAN: enable");
-			return QDF_STATUS_E_FAILURE;
+			osdev->smmu_s1_enabled = true;
 		}
+
 	} else {
 		cds_info("No SMMU mapping present or SMMU disabled from WLAN side");
-		if (ipa_smmu_enable) {
-			cds_err("SMMU mismatch: IPA: enable, WLAN: disable");
-			return QDF_STATUS_E_FAILURE;
-		} else {
-			cds_info("SMMU diabled from both IPA and WLAN side");
-			return QDF_STATUS_SUCCESS;
+
+		if (ipa_present) {
+			if (ipa_smmu_enable) {
+				cds_err("SMMU mismatch: IPA: enable, WLAN: disable");
+				return QDF_STATUS_E_FAILURE;
+			} else {
+				cds_info("SMMU diabled from both IPA and WLAN side");
+			}
 		}
 	}
 
@@ -2898,7 +2907,7 @@ int cds_smmu_map_unmap(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr)
 #endif
 
 #else
-QDF_STATUS cds_smmu_mem_map_setup(qdf_device_t osdev)
+QDF_STATUS cds_smmu_mem_map_setup(qdf_device_t osdev, bool ipa_present)
 {
 	osdev->smmu_s1_enabled = false;
 	return QDF_STATUS_SUCCESS;

+ 2 - 3
core/hdd/inc/wlan_hdd_ipa.h

@@ -119,7 +119,7 @@ int hdd_ipa_uc_ssr_deinit(void);
 void hdd_ipa_uc_force_pipe_shutdown(struct hdd_context *hdd_ctx);
 struct sk_buff *hdd_ipa_tx_packet_ipa(struct hdd_context *hdd_ctx,
 	struct sk_buff *skb, uint8_t session_id);
-bool hdd_ipa_is_present(struct hdd_context *hdd_ctx);
+bool hdd_ipa_is_present(void);
 void hdd_ipa_dump_info(struct hdd_context *hdd_ctx);
 QDF_STATUS hdd_ipa_uc_ol_init(struct hdd_context *hdd_ctx);
 void hdd_ipa_set_tx_flow_info(void);
@@ -268,7 +268,6 @@ static inline struct sk_buff *hdd_ipa_tx_packet_ipa(struct hdd_context *hdd_ctx,
 
 /**
  * hdd_ipa_is_present() - get IPA hw status
- * @hdd_ctx: pointer to hdd context
  *
  * ipa_uc_reg_rdyCB is not directly designed to check
  * ipa hw status. This is an undocumented function which
@@ -277,7 +276,7 @@ static inline struct sk_buff *hdd_ipa_tx_packet_ipa(struct hdd_context *hdd_ctx,
  * Return: true - ipa hw present
  *         false - ipa hw not present
  */
-static inline bool hdd_ipa_is_present(struct hdd_context *hdd_ctx)
+static inline bool hdd_ipa_is_present(void)
 {
 	return false;
 }

+ 3 - 1
core/hdd/src/wlan_hdd_driver_ops.c

@@ -47,6 +47,7 @@
 #include "cdp_txrx_misc.h"
 #include "pld_common.h"
 #include "wlan_hdd_driver_ops.h"
+#include "wlan_hdd_ipa.h"
 
 #ifdef MODULE
 #define WLAN_MODULE_NAME  module_name(THIS_MODULE)
@@ -322,7 +323,8 @@ static int hdd_init_qdf_ctx(struct device *dev, void *bdev,
 	qdf_dev->drv_hdl = bdev;
 	qdf_dev->bus_type = bus_type;
 	qdf_dev->bid = bid;
-	if (cds_smmu_mem_map_setup(qdf_dev) !=
+
+	if (cds_smmu_mem_map_setup(qdf_dev, hdd_ipa_is_present()) !=
 		QDF_STATUS_SUCCESS) {
 		hdd_err("cds_smmu_mem_map_setup() failed");
 		return -EFAULT;

+ 1 - 2
core/hdd/src/wlan_hdd_ipa.c

@@ -4758,7 +4758,6 @@ static void hdd_ipa_send_pkt_to_tl(
 
 /**
  * hdd_ipa_is_present() - get IPA hw status
- * @hdd_ctx: pointer to hdd context
  *
  * ipa_uc_reg_rdyCB is not directly designed to check
  * ipa hw status. This is an undocumented function which
@@ -4767,7 +4766,7 @@ static void hdd_ipa_send_pkt_to_tl(
  * Return: true - ipa hw present
  *         false - ipa hw not present
  */
-bool hdd_ipa_is_present(struct hdd_context *hdd_ctx)
+bool hdd_ipa_is_present(void)
 {
 	/*
 	 * Check if ipa hw is enabled

+ 1 - 1
core/hdd/src/wlan_hdd_main.c

@@ -8272,7 +8272,7 @@ static void hdd_override_ini_config(struct hdd_context *hdd_ctx)
 		hdd_debug("Module enable_11d set to %d", enable_11d);
 	}
 
-	if (!hdd_ipa_is_present(hdd_ctx)) {
+	if (!hdd_ipa_is_present()) {
 		hdd_ctx->config->IpaConfig = 0;
 		hdd_debug("IpaConfig override to %d",
 			hdd_ctx->config->IpaConfig);