diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa.c b/drivers/platform/msm/ipa/ipa_v3/ipa.c index 40aab9eee4c4..1fea493f24c6 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. */ #include @@ -1866,6 +1866,7 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) size_t sz; int pre_entry; int hdl; + u32 hw_feature_support = 0; IPADBG("cmd=%x nr=%d\n", cmd, _IOC_NR(cmd)); @@ -3080,7 +3081,24 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) retval = ipa3_app_clk_vote( (enum ipa_app_clock_vote_type) arg); break; + case IPA_IOC_GET_HW_FEATURE_SUPPORT: + pyld_sz = sizeof(u32); + /*Add new HW feature support to sent to userspace*/ + hw_feature_support |= (ipa3_ctx->is_eth_bridging_supported << + ETH_BRIDGING_SUPPORT); + param = kmemdup(&hw_feature_support, pyld_sz, + GFP_KERNEL); + if (!param) { + retval = -ENOMEM; + break; + } + if (copy_to_user((void __user *)arg, param, pyld_sz)) { + retval = -EFAULT; + break; + } + + break; default: IPA_ACTIVE_CLIENTS_DEC_SIMPLE(); return -ENOTTY; @@ -7166,6 +7184,9 @@ static int ipa3_pre_init(const struct ipa3_plat_drv_res *resource_p, } ipa3_ctx->ipa_endp_delay_wa = resource_p->ipa_endp_delay_wa; ipa3_ctx->ipa_endp_delay_wa_v2 = resource_p->ipa_endp_delay_wa_v2; + ipa3_ctx->is_eth_bridging_supported = + resource_p->is_eth_bridging_supported; + ipa3_ctx->is_bw_monitor_supported = resource_p->is_bw_monitor_supported; WARN(ipa3_ctx->ipa3_hw_mode != IPA_HW_MODE_NORMAL, "Non NORMAL IPA HW mode, is this emulation platform ?"); @@ -7914,6 +7935,8 @@ static int get_ipa_dts_configuration(struct platform_device *pdev, ipa_drv_res->manual_fw_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->is_eth_bridging_supported = false; + ipa_drv_res->is_bw_monitor_supported = false; /* Get IPA HW Version */ result = of_property_read_u32(pdev->dev.of_node, "qcom,ipa-hw-ver", @@ -8013,6 +8036,23 @@ static int get_ipa_dts_configuration(struct platform_device *pdev, ipa_drv_res->ipa_endp_delay_wa_v2 ? "True" : "False"); + if (of_property_read_bool(pdev->dev.of_node, + "qcom,eth-bridging-not-supported")) + ipa_drv_res->is_eth_bridging_supported = false; + else + ipa_drv_res->is_eth_bridging_supported = true; + + IPADBG(": ETH bridging supported = %s\n", + ipa_drv_res->is_eth_bridging_supported + ? "True" : "False"); + + ipa_drv_res->is_bw_monitor_supported = + of_property_read_bool(pdev->dev.of_node, + "qcom,bw-monitor-supported"); + + IPADBG(": BW Monitor and QUOTA stats supported = %s\n", + ipa_drv_res->is_bw_monitor_supported + ? "True" : "False"); ipa_drv_res->ipa_wdi3_over_gsi = of_property_read_bool(pdev->dev.of_node, diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h index a8b1094a8a1f..bee9c53054a0 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. */ #ifndef _IPA3_I_H_ @@ -1951,6 +1951,8 @@ struct ipa3_app_clock_vote { * @manual_fw_load: bool,if fw load is done manually * @max_num_smmu_cb: number of smmu s1 cb supported * @ipa_config_is_auto: flag to indicate auto config + * @is_eth_bridging_supported: Flag to check eth bridging supported or not + * @is_bw_monitor_supported: Flag to check BW monitor supported or not. */ struct ipa3_context { struct ipa3_char_device_context cdev; @@ -2147,6 +2149,8 @@ struct ipa3_context { u32 num_smmu_cb_probed; u32 max_num_smmu_cb; bool ipa_endp_delay_wa_v2; + bool is_eth_bridging_supported; + bool is_bw_monitor_supported; }; struct ipa3_plat_drv_res { @@ -2216,6 +2220,8 @@ struct ipa3_plat_drv_res { bool ipa_config_is_auto; u32 max_num_smmu_cb; bool ipa_endp_delay_wa_v2; + bool is_eth_bridging_supported; + bool is_bw_monitor_supported; }; /** diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_uc.c b/drivers/platform/msm/ipa/ipa_v3/ipa_uc.c index f68246c851ad..9baf455257d1 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_uc.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_uc.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. */ #include "ipa_i.h" @@ -98,6 +98,10 @@ enum ipa3_cpu_2_hw_commands { FEATURE_ENUM_VAL(IPA_HW_FEATURE_COMMON, 19), IPA_CPU_2_HW_CMD_DISABLE_HOLB_MONITOR = FEATURE_ENUM_VAL(IPA_HW_FEATURE_COMMON, 20), + IPA_CPU_2_HW_CMD_QUOTA_MONITORING_YUPIK = + FEATURE_ENUM_VAL(IPA_HW_FEATURE_COMMON, 21), + IPA_CPU_2_HW_CMD_BW_MONITORING_YUPIK = + FEATURE_ENUM_VAL(IPA_HW_FEATURE_COMMON, 22), }; /** @@ -1574,6 +1578,7 @@ int ipa3_uc_quota_monitor(uint64_t quota) struct ipa_mem_buffer cmd; struct IpaQuotaMonitoring_t *quota_info; + IPADBG("Enter\n"); cmd.size = sizeof(*quota_info); cmd.base = dma_alloc_coherent(ipa3_ctx->uc_pdev, cmd.size, &cmd.phys_base, GFP_KERNEL); @@ -1608,11 +1613,17 @@ int ipa3_uc_quota_monitor(uint64_t quota) IPA_UC_MON_INTERVAL; IPA_ACTIVE_CLIENTS_INC_SIMPLE(); - res = ipa3_uc_send_cmd((u32)(cmd.phys_base), - IPA_CPU_2_HW_CMD_QUOTA_MONITORING, - IPA_HW_2_CPU_OFFLOAD_CMD_STATUS_SUCCESS, - false, 10 * HZ); + if (ipa3_ctx->ipa_hw_type != IPA_HW_v4_11) { + res = ipa3_uc_send_cmd((u32)(cmd.phys_base), + IPA_CPU_2_HW_CMD_QUOTA_MONITORING, + IPA_HW_2_CPU_OFFLOAD_CMD_STATUS_SUCCESS, + false, 10 * HZ); + } else { + res = ipa3_uc_send_cmd((u32)(cmd.phys_base), + IPA_CPU_2_HW_CMD_QUOTA_MONITORING_YUPIK, 0, + false, 10 * HZ); + } if (res) { IPAERR(" faile to set quota %d, number offset %d\n", quota_info->params.WdiQM.Quota, @@ -1630,6 +1641,7 @@ free_cmd: dma_free_coherent(ipa3_ctx->uc_pdev, cmd.size, cmd.base, cmd.phys_base); IPA_ACTIVE_CLIENTS_DEC_SIMPLE(); + IPADBG("Exit\n"); return res; } @@ -1638,6 +1650,7 @@ int ipa3_uc_bw_monitor(struct ipa_wdi_bw_info *info) int i, ind, res = 0; struct ipa_mem_buffer cmd; struct IpaBwMonitoring_t *bw_info; + IPADBG("Enter\n"); if (!info) return -EINVAL; @@ -1712,10 +1725,16 @@ int ipa3_uc_bw_monitor(struct ipa_wdi_bw_info *info) IPA_ACTIVE_CLIENTS_INC_SIMPLE(); - res = ipa3_uc_send_cmd((u32)(cmd.phys_base), - IPA_CPU_2_HW_CMD_BW_MONITORING, - IPA_HW_2_CPU_OFFLOAD_CMD_STATUS_SUCCESS, - false, 10 * HZ); + if (ipa3_ctx->ipa_hw_type != IPA_HW_v4_11) { + res = ipa3_uc_send_cmd((u32)(cmd.phys_base), + IPA_CPU_2_HW_CMD_BW_MONITORING, + IPA_HW_2_CPU_OFFLOAD_CMD_STATUS_SUCCESS, + false, 10 * HZ); + } else { + res = ipa3_uc_send_cmd((u32)(cmd.phys_base), + IPA_CPU_2_HW_CMD_BW_MONITORING_YUPIK, 0, + false, 10 * HZ); + } if (res) { IPAERR(" faile to set bw %d level with %d coutners\n", @@ -1728,6 +1747,7 @@ free_cmd: dma_free_coherent(ipa3_ctx->uc_pdev, cmd.size, cmd.base, cmd.phys_base); IPA_ACTIVE_CLIENTS_DEC_SIMPLE(); + IPADBG("Exit\n"); return res; } diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c index 4758fd2c7d8a..4d00cf315deb 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. */ #include @@ -3994,14 +3994,14 @@ static struct ipa3_mem_partition ipa_4_11_mem_part = { .apps_hdr_proc_ctx_size = 0x200, .apps_hdr_proc_ctx_size_ddr = 0x0, .nat_tbl_ofst = 0x17A0, - .nat_tbl_size = 0x800, - .pdn_config_ofst = 0x24A8, + .nat_tbl_size = 0x500, + .pdn_config_ofst = 0x1CA8, .pdn_config_size = 0x50, - .stats_quota_q6_ofst = 0x2500, + .stats_quota_q6_ofst = 0x1D00, .stats_quota_q6_size = 0x30, - .stats_quota_ap_ofst = 0x2530, + .stats_quota_ap_ofst = 0x1D30, .stats_quota_ap_size = 0x48, - .stats_tethering_ofst = 0x2578, + .stats_tethering_ofst = 0x1D78, .stats_tethering_size = 0x238, .stats_flt_v4_ofst = 0, .stats_flt_v4_size = 0, @@ -4011,8 +4011,8 @@ static struct ipa3_mem_partition ipa_4_11_mem_part = { .stats_rt_v4_size = 0, .stats_rt_v6_ofst = 0, .stats_rt_v6_size = 0, - .stats_fnr_ofst = 0x27B0, - .stats_fnr_size = 0x0, + .stats_fnr_ofst = 0x1FB0, + .stats_fnr_size = 0x800, .stats_drop_ofst = 0x27B0, .stats_drop_size = 0x20, .modem_comp_decomp_ofst = 0x0, diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_wdi3_i.c b/drivers/platform/msm/ipa/ipa_v3/ipa_wdi3_i.c index 28636d8e5c7a..54f9f23b3b71 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_wdi3_i.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_wdi3_i.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2018 - 2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2018 - 2021, The Linux Foundation. All rights reserved. */ #include "ipa_i.h" @@ -849,8 +849,9 @@ int ipa3_enable_wdi3_pipes(int ipa_ep_idx_tx, int ipa_ep_idx_rx) IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(ipa_ep_idx_tx)); /* start uC event ring */ - if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_5 && - ipa3_ctx->ipa_hw_type != IPA_HW_v4_11) { + if ((ipa3_ctx->ipa_hw_type >= IPA_HW_v4_5 && + ipa3_ctx->ipa_hw_type != IPA_HW_v4_11) || + ipa3_ctx->is_bw_monitor_supported) { if (ipa3_ctx->uc_ctx.uc_loaded && !ipa3_ctx->uc_ctx.uc_event_ring_valid) { if (ipa3_uc_setup_event_ring()) { diff --git a/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c b/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c index 5cc4a5e02ade..84aaf08df871 100644 --- a/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c +++ b/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved. */ /* @@ -3290,8 +3290,9 @@ static int rmnet_ipa3_set_data_quota_wifi(struct wan_ioctl_set_data_quota *data) IPAWANDBG("iface name %s, quota %lu\n", data->interface_name, (unsigned long) data->quota_mbytes); - if (ipa3_ctx_get_type(IPA_HW_TYPE) >= IPA_HW_v4_5 && - ipa3_ctx_get_type(IPA_HW_TYPE) != IPA_HW_v4_11) { + if ((ipa3_ctx_get_type(IPA_HW_TYPE) >= IPA_HW_v4_5 && + ipa3_ctx_get_type(IPA_HW_TYPE) != IPA_HW_v4_11) || + ipa3_ctx->is_bw_monitor_supported) { IPADBG("use ipa-uc for quota\n"); rc = ipa3_uc_quota_monitor(data->set_quota); } else {