msm: ipa3: Adding BW monitor and QUOTA support for yupik target

Adding FnR stats, BW monitor and QUOTA support for yupik target.

Change-Id: If9b2b2480bb7ece08d906b06b676f63e1e778a2c
Signed-off-by: Ashok Vuyyuru <avuyyuru@codeaurora.org>
This commit is contained in:
Ashok Vuyyuru 2021-03-10 19:39:11 +05:30
commit 7296789b5e
6 changed files with 93 additions and 25 deletions

View file

@ -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 <linux/clk.h>
@ -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,

View file

@ -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;
};
/**

View file

@ -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;
}

View file

@ -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 <net/ip.h>
@ -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,

View file

@ -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()) {

View file

@ -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 {