Merge 7ec7e2e43e3a9a4a89eb089b2b0adbd6a480b4d8 on remote branch

Change-Id: I0f6309b161bebdf8aaa3df3dde7c57ae7ded8f7d
diff --git a/Makefile b/Makefile
index a92554b..aaf4bf4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
-obj-$(CONFIG_ARCH_QCOM) += drivers/platform/msm/
+all:
+	cd drivers/platform/msm/ && $(MAKE)
+
+obj-m += drivers/platform/msm/
+
diff --git a/config/dataipa_le.h b/config/dataipa_le.h
new file mode 100644
index 0000000..53ec1c4
--- /dev/null
+++ b/config/dataipa_le.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+*/
+
+#define CONFIG_GSI 1
+#define CONFIG_RMNET_IPA3 1
+#define CONFIG_RNDIS_IPA 1
+#define CONFIG_IPA_WDI_UNIFIED_API 1
+#define CONFIG_IPA3_MHI_PRIME_MANAGER 1
+#define CONFIG_IPA3_REGDUMP 1
+#define CONFIG_IPA3_REGDUMP_IPA_5_5 1
+#define CONFIG_KALAMA_IPA_LE 1
diff --git a/drivers/platform/msm/Kbuild b/drivers/platform/msm/Kbuild
index 246c267..c382850 100644
--- a/drivers/platform/msm/Kbuild
+++ b/drivers/platform/msm/Kbuild
@@ -27,6 +27,7 @@
 endif
 
 ifeq ($(filter $(CONFIG_ARCH_KALAMA) $(CONFIG_ARCH_CROW), y), y)
+ifneq ($(CONFIG_KALAMA_IPA_LE), y)
 DATAIPADRVTOP = $(srctree)/../../vendor/qcom/opensource/dataipa/drivers/platform/msm
 LINUXINCLUDE    += -include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_vendor.h
 include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_GKI.conf
@@ -35,6 +36,7 @@
 LINUXINCLUDE    += -include $(srctree)/../../vendor/qcom/opensource/dataipa/config/dataipa_debug.h
 endif
 endif
+endif
 
 ifeq ($(filter $(CONFIG_ARCH_KHAJE) $(CONFIG_ARCH_MONACO) $(CONFIG_ARCH_TRINKET), y), y)
 DATAIPADRVTOP = $(srctree)/../../vendor/qcom/opensource/dataipa/drivers/platform/msm
@@ -46,6 +48,19 @@
 endif
 endif
 
+#APQS-LE
+ifeq ($(CONFIG_ARCH_KALAMA),y)
+ifeq ($(CONFIG_KALAMA_IPA_LE),y)
+DATAIPADRVTOP = $(srctree)/../../../dataipa/drivers/platform/msm
+LINUXINCLUDE    += -include $(srctree)/../../../dataipa/config/dataipa_le.h
+include $(srctree)/../../../dataipa/config/dataipa_GKI.conf
+ifeq ($(CONFIG_LOCALVERSION), "-gki-consolidate")
+include $(srctree)/../../../dataipa/config/dataipa_GKI_consolidate.conf
+LINUXINCLUDE    += -include $(srctree)/../../../dataipa/config/dataipa_debug.h
+endif
+endif
+endif
+
 #MDMs
 ifeq ($(CONFIG_ARCH_SDXLEMUR), y)
 LINUXINCLUDE    += -include $(srctree)/techpack/dataipa/config/dataipa.h
diff --git a/drivers/platform/msm/gsi/gsi_trace.h b/drivers/platform/msm/gsi/gsi_trace.h
index e73689e..d24947f 100644
--- a/drivers/platform/msm/gsi/gsi_trace.h
+++ b/drivers/platform/msm/gsi/gsi_trace.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #undef TRACE_SYSTEM
@@ -50,6 +50,8 @@
 #undef TRACE_INCLUDE_PATH
 #ifdef CONFIG_IPA_VENDOR_DLKM
 #define TRACE_INCLUDE_PATH ../../../../vendor/qcom/opensource/dataipa/drivers/platform/msm/gsi
+#elif CONFIG_KALAMA_IPA_LE
+#define TRACE_INCLUDE_PATH ../gsi
 #else
 #define TRACE_INCLUDE_PATH ../../techpack/dataipa/drivers/platform/msm/gsi
 #endif
diff --git a/drivers/platform/msm/ipa/ipa_clients/rndis_ipa_trace.h b/drivers/platform/msm/ipa/ipa_clients/rndis_ipa_trace.h
index 9672cdd..dbc541b 100644
--- a/drivers/platform/msm/ipa/ipa_clients/rndis_ipa_trace.h
+++ b/drivers/platform/msm/ipa/ipa_clients/rndis_ipa_trace.h
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #undef TRACE_SYSTEM
@@ -72,6 +73,8 @@
 #undef TRACE_INCLUDE_PATH
 #ifdef CONFIG_IPA_VENDOR_DLKM
 #define TRACE_INCLUDE_PATH ../../../../vendor/qcom/opensource/dataipa/drivers/platform/msm/ipa/ipa_clients
+#elif CONFIG_KALAMA_IPA_LE
+#define TRACE_INCLUDE_PATH ../ipa/ipa_clients
 #else
 #define TRACE_INCLUDE_PATH ../../techpack/dataipa/drivers/platform/msm/ipa/ipa_clients
 #endif
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa.c b/drivers/platform/msm/ipa/ipa_v3/ipa.c
index a3ae29e..5ffed59 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa.c
@@ -6299,7 +6299,7 @@
 	ipa3_ctx->clnt_hdl_data_in = 0;
 
 	if (ipa3_ctx->ipa_hw_type >= IPA_HW_v5_5 &&
-		!ipa3_ctx->ipa_config_is_apq_dma) {
+		ipa3_ctx->lan_coal_enable) {
 		/*
 		 * LAN_COAL IN (IPA->AP)
 		 */
@@ -8593,7 +8593,7 @@
 	if (ipa3_ctx->platform_type == IPA_PLAT_TYPE_APQ &&
 		ipa3_ctx->ipa3_hw_mode != IPA_HW_MODE_VIRTUAL &&
 		ipa3_ctx->ipa3_hw_mode != IPA_HW_MODE_EMULATION &&
-		!ipa3_ctx->ipa_config_is_apq_dma) {
+		ipa3_ctx->ipa_config_is_apq_uc_load) {
 
 		IPADBG("Loading IPA uC via PIL or MDT\n");
 
@@ -9289,6 +9289,7 @@
 	ipa3_ctx->tx_poll = resource_p->tx_poll;
 	ipa3_ctx->ipa_gpi_event_rp_ddr = resource_p->ipa_gpi_event_rp_ddr;
 	ipa3_ctx->rmnet_ctl_enable = resource_p->rmnet_ctl_enable;
+	ipa3_ctx->lan_coal_enable = resource_p->lan_coal_enable;
 	ipa3_ctx->rmnet_ll_enable = resource_p->rmnet_ll_enable;
 	ipa3_ctx->tx_wrapper_cache_max_size = get_tx_wrapper_cache_size(
 			resource_p->tx_wrapper_cache_max_size);
@@ -9298,6 +9299,7 @@
                         resource_p->ipa_gen_rx_cmn_temp_pool_sz_factor);
 	ipa3_ctx->ipa_config_is_auto = resource_p->ipa_config_is_auto;
 	ipa3_ctx->ipa_config_is_apq_dma = resource_p->ipa_config_is_apq_dma;
+	ipa3_ctx->ipa_config_is_apq_uc_load = resource_p->ipa_config_is_apq_uc_load;
 	ipa3_ctx->ipa_mhi_proxy = resource_p->ipa_mhi_proxy;
 	ipa3_ctx->max_num_smmu_cb = resource_p->max_num_smmu_cb;
 	ipa3_ctx->hw_type_index = ipa3_get_hw_type_index();
@@ -10263,6 +10265,7 @@
 	ipa_drv_res->ipa_gpi_event_rp_ddr = false;
 	ipa_drv_res->ipa_config_is_auto = false;
 	ipa_drv_res->ipa_config_is_apq_dma = false;
+	ipa_drv_res->ipa_config_is_apq_uc_load = false;
 	ipa_drv_res->max_num_smmu_cb = IPA_SMMU_CB_MAX;
 	ipa_drv_res->ipa_endp_delay_wa_v2 = false;
 	ipa_drv_res->use_tput_est_ep = false;
@@ -10415,6 +10418,13 @@
 		ipa_drv_res->ipa_config_is_apq_dma
 		? "True" : "False");
 
+	ipa_drv_res->ipa_config_is_apq_uc_load =
+		of_property_read_bool(pdev->dev.of_node,
+		"qcom,ipa-config-is-apq-uc-load");
+	IPADBG(": ipa-config-is-apq-uc-load = %s\n",
+		ipa_drv_res->ipa_config_is_apq_uc_load
+		? "True" : "False");
+
 	ipa_drv_res->ipa_wan_skb_page =
 			of_property_read_bool(pdev->dev.of_node,
 			"qcom,wan-use-skb-page");
@@ -10578,6 +10588,14 @@
 			ipa_drv_res->rmnet_ll_enable
 			? "True" : "False");
 	}
+	ipa_drv_res->lan_coal_enable =
+		of_property_read_bool(pdev->dev.of_node,
+		"qcom,lan-coal-enable");
+	IPADBG(": Enable lan coal = %s\n",
+		ipa_drv_res->lan_coal_enable
+		? "True" : "False");
+
+
 
 	result = of_property_read_string(pdev->dev.of_node,
 			"qcom,use-gsi-ipa-fw", &ipa_drv_res->gsi_fw_file_name);
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c b/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c
index f4525e8..7ea1d1b 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c
@@ -99,6 +99,7 @@
 
 		/* Check the pointer and header length to avoid dangerous overflow in HW */
 		if (unlikely(!entry->hdr || !entry->hdr->offset_entry ||
+			!entry->offset_entry ||
 			entry->hdr->hdr_len > ipa_hdr_bin_sz[IPA_HDR_BIN_MAX - 1])) {
 			IPAERR_RL("Found invalid hdr entry\n");
 			return -EINVAL;
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h
index 5eb8ad3..36223f1 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h
@@ -2271,6 +2271,7 @@
  * @ipa_wdi2: using wdi-2.0
  * @ipa_config_is_auto: is this AUTO use case
  * @ipa_config_is_apq_dma: this is for APQ DMA use case
+ * @ipa_config_is_apq_uc_load: this is for APQ uC load use case
  * @ipa_fltrt_not_hashable: filter/route rules not hashable
  * @use_xbl_boot: use xbl loading for IPA FW
  * @use_64_bit_dma_mask: using 64bits dma mask
@@ -2408,9 +2409,11 @@
 	bool ipa_wdi2;
 	bool ipa_config_is_auto;
 	bool ipa_config_is_apq_dma;
+	bool ipa_config_is_apq_uc_load;
 	bool ipa_wdi2_over_gsi;
 	bool ipa_wdi3_over_gsi;
 	bool ipa_endp_delay_wa;
+	bool lan_coal_enable;
 	bool ipa_fltrt_not_hashable;
 	bool use_xbl_boot;
 	bool use_64_bit_dma_mask;
@@ -2624,6 +2627,7 @@
 	bool ipa_wdi2;
 	bool ipa_config_is_auto;
 	bool ipa_config_is_apq_dma;
+	bool ipa_config_is_apq_uc_load;
 	bool ipa_wdi2_over_gsi;
 	bool ipa_wdi3_over_gsi;
 	bool ipa_fltrt_not_hashable;
@@ -2661,6 +2665,7 @@
 	bool ipa_gpi_event_rp_ddr;
 	bool rmnet_ctl_enable;
 	bool rmnet_ll_enable;
+	bool lan_coal_enable;
 	bool ipa_use_uc_holb_monitor;
 	u32 ipa_holb_monitor_poll_period;
 	u32 ipa_holb_monitor_max_cnt_wlan;
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_trace.h b/drivers/platform/msm/ipa/ipa_v3/ipa_trace.h
index dd0fa56..0c8d9a6 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_trace.h
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_trace.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #undef TRACE_SYSTEM
@@ -395,6 +395,8 @@
 #undef TRACE_INCLUDE_PATH
 #ifdef CONFIG_IPA_VENDOR_DLKM
 #define TRACE_INCLUDE_PATH ../../../../vendor/qcom/opensource/dataipa/drivers/platform/msm/ipa/ipa_v3
+#elif CONFIG_KALAMA_IPA_LE
+#define TRACE_INCLUDE_PATH ../ipa/ipa_v3
 #else
 #define TRACE_INCLUDE_PATH ../../techpack/dataipa/drivers/platform/msm/ipa/ipa_v3
 #endif
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c
index 320b780..504b9af 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c
@@ -6818,7 +6818,7 @@
 
 bool lan_coal_enabled()
 {
-	if ( ipa3_ctx->ipa_initialization_complete ) {
+	if ( ipa3_ctx->ipa_initialization_complete && ipa3_ctx->lan_coal_enable) {
 		int ep_idx;
 		if ( IPA_CLIENT_IS_MAPPED_VALID(IPA_CLIENT_APPS_LAN_COAL_CONS, ep_idx) ) {
 			return true;