From a348c2498b742d4d36a01b26037c9ea39f42ca63 Mon Sep 17 00:00:00 2001 From: Amir Levy Date: Wed, 28 Apr 2021 13:25:47 +0300 Subject: [PATCH] msm: ipa: update IPA SRAM mapping Update IPA SRAM mapping to accommodate with RQoS Q6 changes. Modem memory is increased and NAT table moved after modem memory to allow it to expend once needed. Change-Id: I803693f2a337abb2f7219e6de48d25a57111df5b Signed-off-by: Amir Levy --- drivers/platform/msm/ipa/ipa_v3/ipa.c | 21 +- drivers/platform/msm/ipa/ipa_v3/ipa_utils.c | 238 ++++++++++---------- 2 files changed, 135 insertions(+), 124 deletions(-) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa.c b/drivers/platform/msm/ipa/ipa_v3/ipa.c index 84b0004cba..8d4b54a868 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa.c @@ -4647,14 +4647,14 @@ int _ipa_init_sram_v3(void) IPA_MEM_PART(modem_hdr_proc_ctx_ofst)); if (ipa_get_hw_type_internal() >= IPA_HW_v4_5 && ipa_get_hw_type_internal() < IPA_HW_v5_0) { + /* 4.5, 4.7, 4.9, 4.11 */ ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(nat_tbl_ofst) - 12); - } else if (ipa_get_hw_type_internal() >= IPA_HW_v5_0) { - ipa3_sram_set_canary(ipa_sram_mmio, - IPA_MEM_PART(nat_tbl_ofst) - 28); } + if (ipa_get_hw_type_internal() >= IPA_HW_v4_0) { if (ipa_get_hw_type_internal() < IPA_HW_v4_5) { + /* 4.0, 4.1, 4.2 */ ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(pdn_config_ofst) - 4); ipa3_sram_set_canary(ipa_sram_mmio, @@ -4663,12 +4663,20 @@ int _ipa_init_sram_v3(void) IPA_MEM_PART(stats_quota_q6_ofst) - 4); ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(stats_quota_q6_ofst)); - } else { + } else if (ipa_get_hw_type_internal() < IPA_HW_v5_0) { + /* 4.5, 4.7, 4.11 */ ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(stats_quota_q6_ofst) - 12); + } else { + /* 5.0 and above */ + ipa3_sram_set_canary(ipa_sram_mmio, + IPA_MEM_PART(stats_quota_q6_ofst) - 4); + ipa3_sram_set_canary(ipa_sram_mmio, + IPA_MEM_PART(stats_quota_q6_ofst)); } } + /* all excluding 3.5.1, 4.0, 4.1, 4.2 */ if (ipa_get_hw_type_internal() <= IPA_HW_v3_5 || ipa_get_hw_type_internal() >= IPA_HW_v4_5) { ipa3_sram_set_canary(ipa_sram_mmio, @@ -4688,7 +4696,10 @@ int _ipa_init_sram_v3(void) } if (ipa_get_hw_type_internal() >= IPA_HW_v5_0) { - ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(pdn_config_ofst)); + ipa3_sram_set_canary(ipa_sram_mmio, + IPA_MEM_PART(pdn_config_ofst - 4)); + ipa3_sram_set_canary(ipa_sram_mmio, + IPA_MEM_PART(pdn_config_ofst)); } else { ipa3_sram_set_canary(ipa_sram_mmio, (ipa_get_hw_type_internal() >= IPA_HW_v3_5) ? diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c index 821ed428da..bf3b840a7e 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c @@ -4908,6 +4908,99 @@ static const struct ipa_ep_configuration ipa3_ep_mapping IPA_TX_INSTANCE_DL }, }; +static struct ipa3_mem_partition ipa_3_0_mem_part = { + .uc_ofst = 0x0, + .uc_size = 0x80, + .ofst_start = 0x280, + .v4_flt_hash_ofst = 0x288, + .v4_flt_hash_size = 0x78, + .v4_flt_hash_size_ddr = 0x4000, + .v4_flt_nhash_ofst = 0x308, + .v4_flt_nhash_size = 0x78, + .v4_flt_nhash_size_ddr = 0x4000, + .v6_flt_hash_ofst = 0x388, + .v6_flt_hash_size = 0x78, + .v6_flt_hash_size_ddr = 0x4000, + .v6_flt_nhash_ofst = 0x408, + .v6_flt_nhash_size = 0x78, + .v6_flt_nhash_size_ddr = 0x4000, + .v4_rt_num_index = 0xf, + .v4_modem_rt_index_lo = 0x0, + .v4_modem_rt_index_hi = 0x7, + .v4_apps_rt_index_lo = 0x8, + .v4_apps_rt_index_hi = 0xe, + .v4_rt_hash_ofst = 0x488, + .v4_rt_hash_size = 0x78, + .v4_rt_hash_size_ddr = 0x4000, + .v4_rt_nhash_ofst = 0x508, + .v4_rt_nhash_size = 0x78, + .v4_rt_nhash_size_ddr = 0x4000, + .v6_rt_num_index = 0xf, + .v6_modem_rt_index_lo = 0x0, + .v6_modem_rt_index_hi = 0x7, + .v6_apps_rt_index_lo = 0x8, + .v6_apps_rt_index_hi = 0xe, + .v6_rt_hash_ofst = 0x588, + .v6_rt_hash_size = 0x78, + .v6_rt_hash_size_ddr = 0x4000, + .v6_rt_nhash_ofst = 0x608, + .v6_rt_nhash_size = 0x78, + .v6_rt_nhash_size_ddr = 0x4000, + .modem_hdr_ofst = 0x688, + .modem_hdr_size = 0x140, + .apps_hdr_ofst = 0x7c8, + .apps_hdr_size = 0x0, + .apps_hdr_size_ddr = 0x800, + .modem_hdr_proc_ctx_ofst = 0x7d0, + .modem_hdr_proc_ctx_size = 0x200, + .apps_hdr_proc_ctx_ofst = 0x9d0, + .apps_hdr_proc_ctx_size = 0x200, + .apps_hdr_proc_ctx_size_ddr = 0x0, + .modem_comp_decomp_ofst = 0x0, + .modem_comp_decomp_size = 0x0, + .modem_ofst = 0xBD8, + .modem_size = 0x1424, + .apps_v4_flt_hash_ofst = 0x2000, + .apps_v4_flt_hash_size = 0x0, + .apps_v4_flt_nhash_ofst = 0x2000, + .apps_v4_flt_nhash_size = 0x0, + .apps_v6_flt_hash_ofst = 0x2000, + .apps_v6_flt_hash_size = 0x0, + .apps_v6_flt_nhash_ofst = 0x2000, + .apps_v6_flt_nhash_size = 0x0, + .uc_info_ofst = 0x80, + .uc_info_size = 0x200, + .end_ofst = 0x2000, + .apps_v4_rt_hash_ofst = 0x2000, + .apps_v4_rt_hash_size = 0x0, + .apps_v4_rt_nhash_ofst = 0x2000, + .apps_v4_rt_nhash_size = 0x0, + .apps_v6_rt_hash_ofst = 0x2000, + .apps_v6_rt_hash_size = 0x0, + .apps_v6_rt_nhash_ofst = 0x2000, + .apps_v6_rt_nhash_size = 0x0, + .uc_descriptor_ram_ofst = 0x2000, + .uc_descriptor_ram_size = 0x0, + .pdn_config_ofst = 0x2000, + .pdn_config_size = 0x0, + .stats_quota_q6_ofst = 0x2000, + .stats_quota_q6_size = 0x0, + .stats_quota_ap_ofst = 0, + .stats_quota_ap_size = 0, + .stats_tethering_ofst = 0x2000, + .stats_tethering_size = 0x0, + .stats_flt_v4_ofst = 0x2000, + .stats_flt_v4_size = 0x0, + .stats_flt_v6_ofst = 0x2000, + .stats_flt_v6_size = 0x0, + .stats_rt_v4_ofst = 0x2000, + .stats_rt_v4_size = 0x0, + .stats_rt_v6_ofst = 0x2000, + .stats_rt_v6_size = 0x0, + .stats_drop_ofst = 0x2000, + .stats_drop_size = 0x0, +}; + static struct ipa3_mem_partition ipa_4_1_mem_part = { .uc_ofst = 0x0, .uc_size = 0x80, @@ -5534,17 +5627,15 @@ static struct ipa3_mem_partition ipa_5_0_mem_part = { .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_ofst = 0x2868, .stats_quota_q6_size = 0x48, - .stats_quota_ap_ofst = 0x31d8, + .stats_quota_ap_ofst = 0x28B0, .stats_quota_ap_size = 0x60, - .stats_tethering_ofst = 0x3238, + .stats_tethering_ofst = 0x2910, .stats_tethering_size = 0x0, - .apps_v4_flt_nhash_ofst = 0x3240, + .apps_v4_flt_nhash_ofst = 0x2918, .apps_v4_flt_nhash_size = 0x188, - .apps_v6_flt_nhash_ofst = 0x33c8, + .apps_v6_flt_nhash_ofst = 0x2aa0, .apps_v6_flt_nhash_size = 0x228, .stats_flt_v4_ofst = 0, .stats_flt_v4_size = 0, @@ -5554,14 +5645,16 @@ static struct ipa3_mem_partition ipa_5_0_mem_part = { .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_fnr_ofst = 0x2cd0, + .stats_fnr_size = 0xba0, + .stats_drop_ofst = 0x3870, .stats_drop_size = 0x20, .modem_comp_decomp_ofst = 0x0, .modem_comp_decomp_size = 0x0, - .modem_ofst = 0x3e20, - .modem_size = 0xc00, + .modem_ofst = 0x3898, + .modem_size = 0xd48, + .nat_tbl_ofst = 0x45e0, + .nat_tbl_size = 0x900, .apps_v4_flt_hash_ofst = 0x2718, .apps_v4_flt_hash_size = 0x0, .apps_v6_flt_hash_ofst = 0x2718, @@ -5574,9 +5667,9 @@ static struct ipa3_mem_partition ipa_5_0_mem_part = { .apps_v6_rt_hash_size = 0x0, .apps_v6_rt_nhash_ofst = 0x2718, .apps_v6_rt_nhash_size = 0x0, - .pdn_config_ofst = 0x4c00, + .pdn_config_ofst = 0x4ee8, .pdn_config_size = 0x100, - .end_ofst = 0x4d00, + .end_ofst = 0x4fe8, }; static struct ipa3_mem_partition ipa_5_1_mem_part = { @@ -5631,13 +5724,11 @@ static struct ipa3_mem_partition ipa_5_1_mem_part = { .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_ofst = 0x2868, .stats_quota_q6_size = 0x48, - .stats_quota_ap_ofst = 0x31d8, + .stats_quota_ap_ofst = 0x28B0, .stats_quota_ap_size = 0x60, - .stats_tethering_ofst = 0x3238, + .stats_tethering_ofst = 0x2910, .stats_tethering_size = 0x3c0, .stats_flt_v4_ofst = 0, .stats_flt_v4_size = 0, @@ -5647,14 +5738,16 @@ static struct ipa3_mem_partition ipa_5_1_mem_part = { .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_fnr_ofst = 0x2cd0, + .stats_fnr_size = 0xba0, + .stats_drop_ofst = 0x3870, .stats_drop_size = 0x20, .modem_comp_decomp_ofst = 0x0, .modem_comp_decomp_size = 0x0, - .modem_ofst = 0x3e20, - .modem_size = 0xc00, + .modem_ofst = 0x3898, + .modem_size = 0xd48, + .nat_tbl_ofst = 0x45e0, + .nat_tbl_size = 0x900, .apps_v4_flt_hash_ofst = 0x2718, .apps_v4_flt_hash_size = 0x0, .apps_v4_flt_nhash_ofst = 0x2718, @@ -5671,102 +5764,9 @@ static struct ipa3_mem_partition ipa_5_1_mem_part = { .apps_v6_rt_hash_size = 0x0, .apps_v6_rt_nhash_ofst = 0x2718, .apps_v6_rt_nhash_size = 0x0, - .pdn_config_ofst = 0x4c00, + .pdn_config_ofst = 0x4ee8, .pdn_config_size = 0x100, - .end_ofst = 0x4d00, -}; - -static struct ipa3_mem_partition ipa_3_0_mem_part = { - .uc_ofst = 0x0, - .uc_size = 0x80, - .ofst_start = 0x280, - .v4_flt_hash_ofst = 0x288, - .v4_flt_hash_size = 0x78, - .v4_flt_hash_size_ddr = 0x4000, - .v4_flt_nhash_ofst = 0x308, - .v4_flt_nhash_size = 0x78, - .v4_flt_nhash_size_ddr = 0x4000, - .v6_flt_hash_ofst = 0x388, - .v6_flt_hash_size = 0x78, - .v6_flt_hash_size_ddr = 0x4000, - .v6_flt_nhash_ofst = 0x408, - .v6_flt_nhash_size = 0x78, - .v6_flt_nhash_size_ddr = 0x4000, - .v4_rt_num_index = 0xf, - .v4_modem_rt_index_lo = 0x0, - .v4_modem_rt_index_hi = 0x7, - .v4_apps_rt_index_lo = 0x8, - .v4_apps_rt_index_hi = 0xe, - .v4_rt_hash_ofst = 0x488, - .v4_rt_hash_size = 0x78, - .v4_rt_hash_size_ddr = 0x4000, - .v4_rt_nhash_ofst = 0x508, - .v4_rt_nhash_size = 0x78, - .v4_rt_nhash_size_ddr = 0x4000, - .v6_rt_num_index = 0xf, - .v6_modem_rt_index_lo = 0x0, - .v6_modem_rt_index_hi = 0x7, - .v6_apps_rt_index_lo = 0x8, - .v6_apps_rt_index_hi = 0xe, - .v6_rt_hash_ofst = 0x588, - .v6_rt_hash_size = 0x78, - .v6_rt_hash_size_ddr = 0x4000, - .v6_rt_nhash_ofst = 0x608, - .v6_rt_nhash_size = 0x78, - .v6_rt_nhash_size_ddr = 0x4000, - .modem_hdr_ofst = 0x688, - .modem_hdr_size = 0x140, - .apps_hdr_ofst = 0x7c8, - .apps_hdr_size = 0x0, - .apps_hdr_size_ddr = 0x800, - .modem_hdr_proc_ctx_ofst = 0x7d0, - .modem_hdr_proc_ctx_size = 0x200, - .apps_hdr_proc_ctx_ofst = 0x9d0, - .apps_hdr_proc_ctx_size = 0x200, - .apps_hdr_proc_ctx_size_ddr = 0x0, - .modem_comp_decomp_ofst = 0x0, - .modem_comp_decomp_size = 0x0, - .modem_ofst = 0xBD8, - .modem_size = 0x1424, - .apps_v4_flt_hash_ofst = 0x2000, - .apps_v4_flt_hash_size = 0x0, - .apps_v4_flt_nhash_ofst = 0x2000, - .apps_v4_flt_nhash_size = 0x0, - .apps_v6_flt_hash_ofst = 0x2000, - .apps_v6_flt_hash_size = 0x0, - .apps_v6_flt_nhash_ofst = 0x2000, - .apps_v6_flt_nhash_size = 0x0, - .uc_info_ofst = 0x80, - .uc_info_size = 0x200, - .end_ofst = 0x2000, - .apps_v4_rt_hash_ofst = 0x2000, - .apps_v4_rt_hash_size = 0x0, - .apps_v4_rt_nhash_ofst = 0x2000, - .apps_v4_rt_nhash_size = 0x0, - .apps_v6_rt_hash_ofst = 0x2000, - .apps_v6_rt_hash_size = 0x0, - .apps_v6_rt_nhash_ofst = 0x2000, - .apps_v6_rt_nhash_size = 0x0, - .uc_descriptor_ram_ofst = 0x2000, - .uc_descriptor_ram_size = 0x0, - .pdn_config_ofst = 0x2000, - .pdn_config_size = 0x0, - .stats_quota_q6_ofst = 0x2000, - .stats_quota_q6_size = 0x0, - .stats_quota_ap_ofst = 0, - .stats_quota_ap_size = 0, - .stats_tethering_ofst = 0x2000, - .stats_tethering_size = 0x0, - .stats_flt_v4_ofst = 0x2000, - .stats_flt_v4_size = 0x0, - .stats_flt_v6_ofst = 0x2000, - .stats_flt_v6_size = 0x0, - .stats_rt_v4_ofst = 0x2000, - .stats_rt_v4_size = 0x0, - .stats_rt_v6_ofst = 0x2000, - .stats_rt_v6_size = 0x0, - .stats_drop_ofst = 0x2000, - .stats_drop_size = 0x0, + .end_ofst = 0x4fe8, }; const char *ipa_clients_strings[IPA_CLIENT_MAX] = {