Merge "msm: ipa3: enable dataipa compilation for QCS LE"
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 11123d1..5ffed59 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa.c
@@ -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");
 
@@ -9299,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();
@@ -10264,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;
@@ -10416,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");
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h
index 64ef33f..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,6 +2409,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_endp_delay_wa;
@@ -2625,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;
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