فهرست منبع

Merge "ipa: Update SRAM partitioning for IPA5.0"

qctecmdr 3 سال پیش
والد
کامیت
62e9bc1275

+ 19 - 0
drivers/platform/msm/ipa/ipa_v3/ipa.c

@@ -4676,6 +4676,17 @@ int _ipa_init_sram_v3(void)
 		ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(modem_ofst));
 	}
 
+	if (ipa_get_hw_type_internal() == IPA_HW_v5_0) {
+		ipa3_sram_set_canary(ipa_sram_mmio,
+			IPA_MEM_PART(apps_v4_flt_nhash_ofst) - 4);
+		ipa3_sram_set_canary(ipa_sram_mmio,
+			IPA_MEM_PART(apps_v4_flt_nhash_ofst));
+		ipa3_sram_set_canary(ipa_sram_mmio,
+			IPA_MEM_PART(stats_fnr_ofst) - 4);
+		ipa3_sram_set_canary(ipa_sram_mmio,
+			IPA_MEM_PART(stats_fnr_ofst));
+	}
+
 	if (ipa_get_hw_type_internal() >= IPA_HW_v5_0) {
 		ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(pdn_config_ofst));
 	} else {
@@ -6965,6 +6976,14 @@ static int ipa3_post_init(const struct ipa3_plat_drv_res *resource_p,
 	else
 		IPADBG(":stats init ok\n");
 
+	if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_5) {
+		result = ipa_init_flt_rt_stats();
+		if (result)
+			IPAERR("fail to init FnR stats %d\n", result);
+		else
+			IPADBG(":FnR stats init ok\n");
+	}
+
 	result = ipa_drop_stats_init();
 	if (result)
 		IPAERR("fail to init stats %d\n", result);

+ 23 - 14
drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c

@@ -45,6 +45,10 @@ int ipa_hw_stats_init(void)
 	/* initialize stats here */
 	ipa3_ctx->hw_stats->enabled = true;
 
+	/* for IPA_HW_v5_0, reserved teth_stats sram for flt-tbls */
+	if (ipa3_ctx->ipa_hw_type == IPA_HW_v5_0)
+		return 0;
+
 	teth_stats_init = kzalloc(sizeof(*teth_stats_init), GFP_KERNEL);
 	if (!teth_stats_init) {
 		IPAERR("mem allocated failed!\n");
@@ -190,7 +194,7 @@ int ipa_hw_stats_init(void)
 			mask = ipa_hw_stats_get_ep_bit_n_idx(
 				IPA_CLIENT_WIGIG1_CONS,
 				&reg_idx);
-			teth_stats_init->dst_ep_mask[ep_index][reg_idx]	|= mask;
+			teth_stats_init->dst_ep_mask[ep_index][reg_idx] |= mask;
 			mask = ipa_hw_stats_get_ep_bit_n_idx(
 				IPA_CLIENT_WIGIG2_CONS,
 				&reg_idx);
@@ -209,7 +213,7 @@ int ipa_hw_stats_init(void)
 			IPA_CLIENT_Q6_DL_NLO_DATA_PROD,
 			&reg_idx) && (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_5)) {
 			ep_index = ipa3_get_ep_mapping(
-					IPA_CLIENT_Q6_DL_NLO_DATA_PROD);
+				IPA_CLIENT_Q6_DL_NLO_DATA_PROD);
 			if (ep_index == -1) {
 				IPAERR("Invalid client.\n");
 				ret = -EINVAL;
@@ -371,14 +375,13 @@ int ipa_hw_stats_init(void)
 
 
 	ret = ipa_init_teth_stats(teth_stats_init);
-	if (ret != 0)
+	if (ret != 0) {
 		IPAERR("init teth stats fails\n");
-	kfree(teth_stats_init);
-	if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_5) {
-		ret = ipa_init_flt_rt_stats();
-		if (ret != 0)
-			IPAERR("init flt rt stats fails\n");
+		goto fail_free_stats_ctx;
 	}
+
+	ipa3_ctx->hw_stats->teth_stats_enabled = true;
+	kfree(teth_stats_init);
 	return ret;
 
 fail_free_stats_ctx:
@@ -1030,7 +1033,8 @@ int ipa_get_teth_stats(void)
 	struct ipahal_stats_init_tethering *init;
 	int num_cmd = 0;
 
-	if (!(ipa3_ctx->hw_stats && ipa3_ctx->hw_stats->enabled))
+	if (!(ipa3_ctx->hw_stats && ipa3_ctx->hw_stats->enabled &&
+		ipa3_ctx->hw_stats->teth_stats_enabled))
 		return 0;
 
 	sw_stats = &ipa3_ctx->hw_stats->teth;
@@ -1202,7 +1206,8 @@ free_dma_mem:
 int ipa_query_teth_stats(enum ipa_client_type prod,
 	struct ipa_quota_stats_all *out, bool reset)
 {
-	if (!(ipa3_ctx->hw_stats && ipa3_ctx->hw_stats->enabled))
+	if (!(ipa3_ctx->hw_stats && ipa3_ctx->hw_stats->enabled &&
+		ipa3_ctx->hw_stats->teth_stats_enabled))
 		return 0;
 
 	if (!IPA_CLIENT_IS_PROD(prod) || ipa3_get_ep_mapping(prod) == -1) {
@@ -1223,7 +1228,8 @@ int ipa_reset_teth_stats(enum ipa_client_type prod, enum ipa_client_type cons)
 	int ret;
 	struct ipa_quota_stats *stats;
 
-	if (!(ipa3_ctx->hw_stats && ipa3_ctx->hw_stats->enabled))
+	if (!(ipa3_ctx->hw_stats && ipa3_ctx->hw_stats->enabled &&
+		ipa3_ctx->hw_stats->teth_stats_enabled))
 		return 0;
 
 	if (!IPA_CLIENT_IS_PROD(prod) || !IPA_CLIENT_IS_CONS(cons)) {
@@ -1250,7 +1256,8 @@ int ipa_reset_all_cons_teth_stats(enum ipa_client_type prod)
 	int i;
 	struct ipa_quota_stats *stats;
 
-	if (!(ipa3_ctx->hw_stats && ipa3_ctx->hw_stats->enabled))
+	if (!(ipa3_ctx->hw_stats && ipa3_ctx->hw_stats->enabled &&
+		ipa3_ctx->hw_stats->teth_stats_enabled))
 		return 0;
 
 	if (!IPA_CLIENT_IS_PROD(prod)) {
@@ -1280,7 +1287,8 @@ int ipa_reset_all_teth_stats(void)
 	int ret;
 	struct ipa_quota_stats_all *stats;
 
-	if (!(ipa3_ctx->hw_stats && ipa3_ctx->hw_stats->enabled))
+	if (!(ipa3_ctx->hw_stats && ipa3_ctx->hw_stats->enabled &&
+		ipa3_ctx->hw_stats->teth_stats_enabled))
 		return 0;
 
 	/* reading stats will reset them in hardware */
@@ -2296,7 +2304,8 @@ static ssize_t ipa_debugfs_print_tethering_stats(struct file *file,
 	if (!out)
 		return -ENOMEM;
 
-	if (!(ipa3_ctx->hw_stats && ipa3_ctx->hw_stats->enabled))
+	if (!(ipa3_ctx->hw_stats && ipa3_ctx->hw_stats->enabled &&
+		ipa3_ctx->hw_stats->teth_stats_enabled))
 		return 0;
 
 	mutex_lock(&ipa3_ctx->lock);

+ 1 - 0
drivers/platform/msm/ipa/ipa_v3/ipa_i.h

@@ -1818,6 +1818,7 @@ struct ipa_hw_stats {
 	struct ipa_hw_stats_teth teth;
 	struct ipa_hw_stats_flt_rt flt_rt;
 	struct ipa_hw_stats_drop drop;
+	bool teth_stats_enabled;
 };
 
 struct ipa_cne_evt {

+ 100 - 1
drivers/platform/msm/ipa/ipa_v3/ipa_utils.c

@@ -5483,6 +5483,103 @@ static struct ipa3_mem_partition ipa_4_11_mem_part = {
 };
 
 static struct ipa3_mem_partition ipa_5_0_mem_part = {
+	.uc_descriptor_ram_ofst = 0x0,
+	.uc_descriptor_ram_size = 0x1000,
+	.uc_ofst = 0x1000,
+	.uc_size = 0x80,
+	.uc_info_ofst = 0x1080,
+	.uc_info_size = 0x200,
+	.ofst_start = 0x1280,
+	.v4_flt_hash_ofst = 0x1288,
+	.v4_flt_hash_size = 0x78,
+	.v4_flt_hash_size_ddr = 0x4000,
+	.v4_flt_nhash_ofst = 0x1308,
+	.v4_flt_nhash_size = 0x78,
+	.v4_flt_nhash_size_ddr = 0x4000,
+	.v6_flt_hash_ofst = 0x1388,
+	.v6_flt_hash_size = 0x78,
+	.v6_flt_hash_size_ddr = 0x4000,
+	.v6_flt_nhash_ofst = 0x1408,
+	.v6_flt_nhash_size = 0x78,
+	.v6_flt_nhash_size_ddr = 0x4000,
+	.v4_rt_num_index = 0x13,
+	.v4_modem_rt_index_lo = 0x0,
+	.v4_modem_rt_index_hi = 0xa,
+	.v4_apps_rt_index_lo = 0xb,
+	.v4_apps_rt_index_hi = 0x12,
+	.v4_rt_hash_ofst = 0x1488,
+	.v4_rt_hash_size = 0x98,
+	.v4_rt_hash_size_ddr = 0x4000,
+	.v4_rt_nhash_ofst = 0x1528,
+	.v4_rt_nhash_size = 0x98,
+	.v4_rt_nhash_size_ddr = 0x4000,
+	.v6_rt_num_index = 0x13,
+	.v6_modem_rt_index_lo = 0x0,
+	.v6_modem_rt_index_hi = 0xa,
+	.v6_apps_rt_index_lo = 0xb,
+	.v6_apps_rt_index_hi = 0x12,
+	.v6_rt_hash_ofst = 0x15c8,
+	.v6_rt_hash_size = 0x98,
+	.v6_rt_hash_size_ddr = 0x4000,
+	.v6_rt_nhash_ofst = 0x1668,
+	.v6_rt_nhash_size = 0x098,
+	.v6_rt_nhash_size_ddr = 0x4000,
+	.modem_hdr_ofst = 0x1708,
+	.modem_hdr_size = 0x240,
+	.apps_hdr_ofst = 0x1948,
+	.apps_hdr_size = 0x1e0,
+	.apps_hdr_size_ddr = 0x800,
+	.modem_hdr_proc_ctx_ofst = 0x1b40,
+	.modem_hdr_proc_ctx_size = 0xb20,
+	.apps_hdr_proc_ctx_ofst = 0x2660,
+	.apps_hdr_proc_ctx_size = 0x200,
+	.apps_hdr_proc_ctx_size_ddr = 0x0,
+	.nat_tbl_ofst = 0x2880,
+	.nat_tbl_size = 0x900,
+	.stats_quota_q6_ofst = 0x3190,
+	.stats_quota_q6_size = 0x48,
+	.stats_quota_ap_ofst = 0x31d8,
+	.stats_quota_ap_size = 0x60,
+	.stats_tethering_ofst = 0x3238,
+	.stats_tethering_size = 0x0,
+	.apps_v4_flt_nhash_ofst = 0x3240,
+	.apps_v4_flt_nhash_size = 0x188,
+	.apps_v6_flt_nhash_ofst = 0x33c8,
+	.apps_v6_flt_nhash_size = 0x228,
+	.stats_flt_v4_ofst = 0,
+	.stats_flt_v4_size = 0,
+	.stats_flt_v6_ofst = 0,
+	.stats_flt_v6_size = 0,
+	.stats_rt_v4_ofst = 0,
+	.stats_rt_v4_size = 0,
+	.stats_rt_v6_ofst = 0,
+	.stats_rt_v6_size = 0,
+	.stats_fnr_ofst = 0x35f8,
+	.stats_fnr_size = 0x800,
+	.stats_drop_ofst = 0x3df8,
+	.stats_drop_size = 0x20,
+	.modem_comp_decomp_ofst = 0x0,
+	.modem_comp_decomp_size = 0x0,
+	.modem_ofst = 0x3e20,
+	.modem_size = 0xc00,
+	.apps_v4_flt_hash_ofst = 0x2718,
+	.apps_v4_flt_hash_size = 0x0,
+	.apps_v6_flt_hash_ofst = 0x2718,
+	.apps_v6_flt_hash_size = 0x0,
+	.apps_v4_rt_hash_ofst = 0x2718,
+	.apps_v4_rt_hash_size = 0x0,
+	.apps_v4_rt_nhash_ofst = 0x2718,
+	.apps_v4_rt_nhash_size = 0x0,
+	.apps_v6_rt_hash_ofst = 0x2718,
+	.apps_v6_rt_hash_size = 0x0,
+	.apps_v6_rt_nhash_ofst = 0x2718,
+	.apps_v6_rt_nhash_size = 0x0,
+	.pdn_config_ofst = 0x4c00,
+	.pdn_config_size = 0x100,
+	.end_ofst = 0x4d00,
+};
+
+static struct ipa3_mem_partition ipa_5_1_mem_part = {
 	.uc_descriptor_ram_ofst = 0x0,
 	.uc_descriptor_ram_size = 0x1000,
 	.uc_ofst = 0x1000,
@@ -8515,9 +8612,11 @@ int ipa3_init_mem_partition(enum ipa_hw_type type)
 		ipa3_ctx->ctrl->mem_partition = &ipa_4_11_mem_part;
 		break;
 	case IPA_HW_v5_0:
-	case IPA_HW_v5_1:
 		ipa3_ctx->ctrl->mem_partition = &ipa_5_0_mem_part;
 		break;
+	case IPA_HW_v5_1:
+		ipa3_ctx->ctrl->mem_partition = &ipa_5_1_mem_part;
+		break;
 	case IPA_HW_None:
 	case IPA_HW_v1_0:
 	case IPA_HW_v1_1: