Loading drivers/platform/msm/ipa/ipa_v3/ipa.c +14 −13 Original line number Diff line number Diff line Loading @@ -3869,22 +3869,23 @@ int _ipa_init_sram_v3(void) if (ipa_get_hw_type() >= IPA_HW_v4_5) { ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(nat_tbl_ofst) - 12); ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(nat_tbl_ofst) - 8); ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(nat_tbl_ofst) - 4); ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(nat_tbl_ofst)); } if (ipa_get_hw_type() >= IPA_HW_v4_0) { if (ipa_get_hw_type() < IPA_HW_v4_5) { 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)); ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(stats_quota_ofst) - 4); IPA_MEM_PART(stats_quota_q6_ofst) - 4); ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(stats_quota_q6_ofst)); } else { ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(stats_quota_ofst)); IPA_MEM_PART(stats_quota_q6_ofst) - 12); } } if (ipa_get_hw_type() <= IPA_HW_v3_5 || ipa_get_hw_type() >= IPA_HW_v4_5) { ipa3_sram_set_canary(ipa_sram_mmio, Loading drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c +26 −7 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. */ #include <linux/debugfs.h> Loading Loading @@ -271,6 +271,27 @@ static void ipa_close_coal_frame(struct ipahal_imm_cmd_pyld **coal_cmd_pyld) ®_write_coal_close, false); } static bool ipa_validate_quota_stats_sram_size(u32 needed_len) { u32 sram_size; /* Starting IPA4.5 Quota stats is split between Q6 and AP */ if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_5) { IPAERR("Not supported ipa_ver=%d\n", ipa3_ctx->ipa_hw_type); return false; } sram_size = IPA_MEM_PART(stats_quota_ap_size); if (needed_len > sram_size) { IPAERR("SRAM partition too small: %u needed %u\n", sram_size, needed_len); return false; } return true; } int ipa_init_quota_stats(u32 pipe_bitmask) { struct ipahal_stats_init_pyld *pyld; Loading Loading @@ -301,9 +322,7 @@ int ipa_init_quota_stats(u32 pipe_bitmask) return -EPERM; } if (pyld->len > IPA_MEM_PART(stats_quota_size)) { IPAERR("SRAM partition too small: %d needed %d\n", IPA_MEM_PART(stats_quota_size), pyld->len); if (!ipa_validate_quota_stats_sram_size(pyld->len)) { ret = -EPERM; goto destroy_init_pyld; } Loading Loading @@ -356,7 +375,7 @@ int ipa_init_quota_stats(u32 pipe_bitmask) quota_base.offset = ipahal_get_reg_n_ofst(IPA_STAT_QUOTA_BASE_n, ipa3_ctx->ee); quota_base.value = ipa3_ctx->smem_restricted_bytes + IPA_MEM_PART(stats_quota_ofst); IPA_MEM_PART(stats_quota_ap_ofst); quota_base.value_mask = ~0; quota_base_pyld = ipahal_construct_imm_cmd(IPA_IMM_CMD_REGISTER_WRITE, "a_base, false); Loading @@ -377,7 +396,7 @@ int ipa_init_quota_stats(u32 pipe_bitmask) cmd.size = pyld->len; cmd.system_addr = dma_address; cmd.local_addr = ipa3_ctx->smem_restricted_bytes + IPA_MEM_PART(stats_quota_ofst); IPA_MEM_PART(stats_quota_ap_ofst); cmd_pyld = ipahal_construct_imm_cmd( IPA_IMM_CMD_DMA_SHARED_MEM, &cmd, false); if (!cmd_pyld) { Loading Loading @@ -476,7 +495,7 @@ int ipa_get_quota_stats(struct ipa_quota_stats_all *out) cmd.size = mem.size; cmd.system_addr = mem.phys_base; cmd.local_addr = ipa3_ctx->smem_restricted_bytes + IPA_MEM_PART(stats_quota_ofst) + offset.offset; IPA_MEM_PART(stats_quota_ap_ofst) + offset.offset; cmd_pyld[num_cmd] = ipahal_construct_imm_cmd( IPA_IMM_CMD_DMA_SHARED_MEM, &cmd, false); if (!cmd_pyld[num_cmd]) { Loading drivers/platform/msm/ipa/ipa_v3/ipa_i.h +4 −2 Original line number Diff line number Diff line Loading @@ -2250,8 +2250,10 @@ struct ipa3_mem_partition { u32 uc_descriptor_ram_size; u32 pdn_config_ofst; u32 pdn_config_size; u32 stats_quota_ofst; u32 stats_quota_size; u32 stats_quota_q6_ofst; u32 stats_quota_q6_size; u32 stats_quota_ap_ofst; u32 stats_quota_ap_size; u32 stats_tethering_ofst; u32 stats_tethering_size; u32 stats_fnr_ofst; Loading drivers/platform/msm/ipa/ipa_v3/ipa_qmi_service.c +3 −3 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved. */ #include <linux/module.h> Loading Loading @@ -590,10 +590,10 @@ static int ipa3_qmi_init_modem_send_sync_msg(void) } req.hw_stats_quota_base_addr_valid = true; req.hw_stats_quota_base_addr = IPA_MEM_PART(stats_quota_ofst) + smem_restr_bytes; IPA_MEM_PART(stats_quota_q6_ofst) + smem_restr_bytes; req.hw_stats_quota_size_valid = true; req.hw_stats_quota_size = IPA_MEM_PART(stats_quota_size); req.hw_stats_quota_size = IPA_MEM_PART(stats_quota_q6_size); req.hw_drop_stats_base_addr_valid = true; req.hw_drop_stats_base_addr = Loading drivers/platform/msm/ipa/ipa_v3/ipa_utils.c +32 −14 Original line number Diff line number Diff line Loading @@ -2956,8 +2956,10 @@ static struct ipa3_mem_partition ipa_4_1_mem_part = { .uc_descriptor_ram_size = 0x400, .pdn_config_ofst = 0xbd8, .pdn_config_size = 0x50, .stats_quota_ofst = 0xc30, .stats_quota_size = 0x60, .stats_quota_q6_ofst = 0xc30, .stats_quota_q6_size = 0x60, .stats_quota_ap_ofst = 0, .stats_quota_ap_size = 0, .stats_tethering_ofst = 0xc90, .stats_tethering_size = 0x140, .stats_flt_v4_ofst = 0xdd0, Loading Loading @@ -3045,8 +3047,10 @@ static struct ipa3_mem_partition ipa_4_2_mem_part = { .uc_descriptor_ram_size = 0x0, .pdn_config_ofst = 0x9F8, .pdn_config_size = 0x50, .stats_quota_ofst = 0xa50, .stats_quota_size = 0x60, .stats_quota_q6_ofst = 0xa50, .stats_quota_q6_size = 0x60, .stats_quota_ap_ofst = 0, .stats_quota_ap_size = 0, .stats_tethering_ofst = 0xab0, .stats_tethering_size = 0x140, .stats_flt_v4_ofst = 0xbf0, Loading Loading @@ -3111,8 +3115,10 @@ static struct ipa3_mem_partition ipa_4_5_mem_part = { .apps_hdr_proc_ctx_size_ddr = 0x0, .nat_tbl_ofst = 0x1800, .nat_tbl_size = 0xd00, .stats_quota_ofst = 0x2510, .stats_quota_size = 0x78, .stats_quota_q6_ofst = 0x2510, .stats_quota_q6_size = 0x30, .stats_quota_ap_ofst = 0x2540, .stats_quota_ap_size = 0x48, .stats_tethering_ofst = 0x2588, .stats_tethering_size = 0x238, .stats_flt_v4_ofst = 0, Loading Loading @@ -3206,8 +3212,10 @@ static struct ipa3_mem_partition ipa_4_7_mem_part = { .nat_tbl_size = 0xd00, .pdn_config_ofst = 0x24A8, .pdn_config_size = 0x50, .stats_quota_ofst = 0x2500, .stats_quota_size = 0x78, .stats_quota_q6_ofst = 0x2500, .stats_quota_q6_size = 0x30, .stats_quota_ap_ofst = 0x2530, .stats_quota_ap_size = 0x48, .stats_tethering_ofst = 0x2578, .stats_tethering_size = 0x238, .stats_flt_v4_ofst = 0, Loading Loading @@ -5840,13 +5848,23 @@ int ipa3_init_mem_partition(enum ipa_hw_type type) return -ENODEV; } IPADBG("QUOTA STATS OFST 0x%x SIZE 0x%x\n", IPA_MEM_PART(stats_quota_ofst), IPA_MEM_PART(stats_quota_size)); IPADBG("Q6 QUOTA STATS OFST 0x%x SIZE 0x%x\n", IPA_MEM_PART(stats_quota_q6_ofst), IPA_MEM_PART(stats_quota_q6_size)); if (IPA_MEM_PART(stats_quota_ofst) & 7) { IPAERR("QUOTA STATS OFST 0x%x is unaligned\n", IPA_MEM_PART(stats_quota_ofst)); if (IPA_MEM_PART(stats_quota_q6_ofst) & 7) { IPAERR("Q6 QUOTA STATS OFST 0x%x is unaligned\n", IPA_MEM_PART(stats_quota_q6_ofst)); return -ENODEV; } IPADBG("AP QUOTA STATS OFST 0x%x SIZE 0x%x\n", IPA_MEM_PART(stats_quota_ap_ofst), IPA_MEM_PART(stats_quota_ap_size)); if (IPA_MEM_PART(stats_quota_ap_ofst) & 7) { IPAERR("AP QUOTA STATS OFST 0x%x is unaligned\n", IPA_MEM_PART(stats_quota_ap_ofst)); return -ENODEV; } Loading Loading
drivers/platform/msm/ipa/ipa_v3/ipa.c +14 −13 Original line number Diff line number Diff line Loading @@ -3869,22 +3869,23 @@ int _ipa_init_sram_v3(void) if (ipa_get_hw_type() >= IPA_HW_v4_5) { ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(nat_tbl_ofst) - 12); ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(nat_tbl_ofst) - 8); ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(nat_tbl_ofst) - 4); ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(nat_tbl_ofst)); } if (ipa_get_hw_type() >= IPA_HW_v4_0) { if (ipa_get_hw_type() < IPA_HW_v4_5) { 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)); ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(stats_quota_ofst) - 4); IPA_MEM_PART(stats_quota_q6_ofst) - 4); ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(stats_quota_q6_ofst)); } else { ipa3_sram_set_canary(ipa_sram_mmio, IPA_MEM_PART(stats_quota_ofst)); IPA_MEM_PART(stats_quota_q6_ofst) - 12); } } if (ipa_get_hw_type() <= IPA_HW_v3_5 || ipa_get_hw_type() >= IPA_HW_v4_5) { ipa3_sram_set_canary(ipa_sram_mmio, Loading
drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c +26 −7 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. */ #include <linux/debugfs.h> Loading Loading @@ -271,6 +271,27 @@ static void ipa_close_coal_frame(struct ipahal_imm_cmd_pyld **coal_cmd_pyld) ®_write_coal_close, false); } static bool ipa_validate_quota_stats_sram_size(u32 needed_len) { u32 sram_size; /* Starting IPA4.5 Quota stats is split between Q6 and AP */ if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_5) { IPAERR("Not supported ipa_ver=%d\n", ipa3_ctx->ipa_hw_type); return false; } sram_size = IPA_MEM_PART(stats_quota_ap_size); if (needed_len > sram_size) { IPAERR("SRAM partition too small: %u needed %u\n", sram_size, needed_len); return false; } return true; } int ipa_init_quota_stats(u32 pipe_bitmask) { struct ipahal_stats_init_pyld *pyld; Loading Loading @@ -301,9 +322,7 @@ int ipa_init_quota_stats(u32 pipe_bitmask) return -EPERM; } if (pyld->len > IPA_MEM_PART(stats_quota_size)) { IPAERR("SRAM partition too small: %d needed %d\n", IPA_MEM_PART(stats_quota_size), pyld->len); if (!ipa_validate_quota_stats_sram_size(pyld->len)) { ret = -EPERM; goto destroy_init_pyld; } Loading Loading @@ -356,7 +375,7 @@ int ipa_init_quota_stats(u32 pipe_bitmask) quota_base.offset = ipahal_get_reg_n_ofst(IPA_STAT_QUOTA_BASE_n, ipa3_ctx->ee); quota_base.value = ipa3_ctx->smem_restricted_bytes + IPA_MEM_PART(stats_quota_ofst); IPA_MEM_PART(stats_quota_ap_ofst); quota_base.value_mask = ~0; quota_base_pyld = ipahal_construct_imm_cmd(IPA_IMM_CMD_REGISTER_WRITE, "a_base, false); Loading @@ -377,7 +396,7 @@ int ipa_init_quota_stats(u32 pipe_bitmask) cmd.size = pyld->len; cmd.system_addr = dma_address; cmd.local_addr = ipa3_ctx->smem_restricted_bytes + IPA_MEM_PART(stats_quota_ofst); IPA_MEM_PART(stats_quota_ap_ofst); cmd_pyld = ipahal_construct_imm_cmd( IPA_IMM_CMD_DMA_SHARED_MEM, &cmd, false); if (!cmd_pyld) { Loading Loading @@ -476,7 +495,7 @@ int ipa_get_quota_stats(struct ipa_quota_stats_all *out) cmd.size = mem.size; cmd.system_addr = mem.phys_base; cmd.local_addr = ipa3_ctx->smem_restricted_bytes + IPA_MEM_PART(stats_quota_ofst) + offset.offset; IPA_MEM_PART(stats_quota_ap_ofst) + offset.offset; cmd_pyld[num_cmd] = ipahal_construct_imm_cmd( IPA_IMM_CMD_DMA_SHARED_MEM, &cmd, false); if (!cmd_pyld[num_cmd]) { Loading
drivers/platform/msm/ipa/ipa_v3/ipa_i.h +4 −2 Original line number Diff line number Diff line Loading @@ -2250,8 +2250,10 @@ struct ipa3_mem_partition { u32 uc_descriptor_ram_size; u32 pdn_config_ofst; u32 pdn_config_size; u32 stats_quota_ofst; u32 stats_quota_size; u32 stats_quota_q6_ofst; u32 stats_quota_q6_size; u32 stats_quota_ap_ofst; u32 stats_quota_ap_size; u32 stats_tethering_ofst; u32 stats_tethering_size; u32 stats_fnr_ofst; Loading
drivers/platform/msm/ipa/ipa_v3/ipa_qmi_service.c +3 −3 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved. */ #include <linux/module.h> Loading Loading @@ -590,10 +590,10 @@ static int ipa3_qmi_init_modem_send_sync_msg(void) } req.hw_stats_quota_base_addr_valid = true; req.hw_stats_quota_base_addr = IPA_MEM_PART(stats_quota_ofst) + smem_restr_bytes; IPA_MEM_PART(stats_quota_q6_ofst) + smem_restr_bytes; req.hw_stats_quota_size_valid = true; req.hw_stats_quota_size = IPA_MEM_PART(stats_quota_size); req.hw_stats_quota_size = IPA_MEM_PART(stats_quota_q6_size); req.hw_drop_stats_base_addr_valid = true; req.hw_drop_stats_base_addr = Loading
drivers/platform/msm/ipa/ipa_v3/ipa_utils.c +32 −14 Original line number Diff line number Diff line Loading @@ -2956,8 +2956,10 @@ static struct ipa3_mem_partition ipa_4_1_mem_part = { .uc_descriptor_ram_size = 0x400, .pdn_config_ofst = 0xbd8, .pdn_config_size = 0x50, .stats_quota_ofst = 0xc30, .stats_quota_size = 0x60, .stats_quota_q6_ofst = 0xc30, .stats_quota_q6_size = 0x60, .stats_quota_ap_ofst = 0, .stats_quota_ap_size = 0, .stats_tethering_ofst = 0xc90, .stats_tethering_size = 0x140, .stats_flt_v4_ofst = 0xdd0, Loading Loading @@ -3045,8 +3047,10 @@ static struct ipa3_mem_partition ipa_4_2_mem_part = { .uc_descriptor_ram_size = 0x0, .pdn_config_ofst = 0x9F8, .pdn_config_size = 0x50, .stats_quota_ofst = 0xa50, .stats_quota_size = 0x60, .stats_quota_q6_ofst = 0xa50, .stats_quota_q6_size = 0x60, .stats_quota_ap_ofst = 0, .stats_quota_ap_size = 0, .stats_tethering_ofst = 0xab0, .stats_tethering_size = 0x140, .stats_flt_v4_ofst = 0xbf0, Loading Loading @@ -3111,8 +3115,10 @@ static struct ipa3_mem_partition ipa_4_5_mem_part = { .apps_hdr_proc_ctx_size_ddr = 0x0, .nat_tbl_ofst = 0x1800, .nat_tbl_size = 0xd00, .stats_quota_ofst = 0x2510, .stats_quota_size = 0x78, .stats_quota_q6_ofst = 0x2510, .stats_quota_q6_size = 0x30, .stats_quota_ap_ofst = 0x2540, .stats_quota_ap_size = 0x48, .stats_tethering_ofst = 0x2588, .stats_tethering_size = 0x238, .stats_flt_v4_ofst = 0, Loading Loading @@ -3206,8 +3212,10 @@ static struct ipa3_mem_partition ipa_4_7_mem_part = { .nat_tbl_size = 0xd00, .pdn_config_ofst = 0x24A8, .pdn_config_size = 0x50, .stats_quota_ofst = 0x2500, .stats_quota_size = 0x78, .stats_quota_q6_ofst = 0x2500, .stats_quota_q6_size = 0x30, .stats_quota_ap_ofst = 0x2530, .stats_quota_ap_size = 0x48, .stats_tethering_ofst = 0x2578, .stats_tethering_size = 0x238, .stats_flt_v4_ofst = 0, Loading Loading @@ -5840,13 +5848,23 @@ int ipa3_init_mem_partition(enum ipa_hw_type type) return -ENODEV; } IPADBG("QUOTA STATS OFST 0x%x SIZE 0x%x\n", IPA_MEM_PART(stats_quota_ofst), IPA_MEM_PART(stats_quota_size)); IPADBG("Q6 QUOTA STATS OFST 0x%x SIZE 0x%x\n", IPA_MEM_PART(stats_quota_q6_ofst), IPA_MEM_PART(stats_quota_q6_size)); if (IPA_MEM_PART(stats_quota_ofst) & 7) { IPAERR("QUOTA STATS OFST 0x%x is unaligned\n", IPA_MEM_PART(stats_quota_ofst)); if (IPA_MEM_PART(stats_quota_q6_ofst) & 7) { IPAERR("Q6 QUOTA STATS OFST 0x%x is unaligned\n", IPA_MEM_PART(stats_quota_q6_ofst)); return -ENODEV; } IPADBG("AP QUOTA STATS OFST 0x%x SIZE 0x%x\n", IPA_MEM_PART(stats_quota_ap_ofst), IPA_MEM_PART(stats_quota_ap_size)); if (IPA_MEM_PART(stats_quota_ap_ofst) & 7) { IPAERR("AP QUOTA STATS OFST 0x%x is unaligned\n", IPA_MEM_PART(stats_quota_ap_ofst)); return -ENODEV; } Loading