Merge 22a3e1027f1747db8a683e7bfbfc89c6b3c62bff on remote branch
Change-Id: Ia5e0877aa1cf8e75e4a00c46a678d9d20abf90f5
diff --git a/drivers/platform/msm/Android.bp b/drivers/platform/msm/Android.bp
index 65a7d17..b49332b 100644
--- a/drivers/platform/msm/Android.bp
+++ b/drivers/platform/msm/Android.bp
@@ -32,3 +32,9 @@
vendor: true,
recovery_available: true
}
+
+cc_library_headers {
+ name: "qti_ipa_kernel_headers",
+ vendor: true,
+ recovery_available: true
+}
diff --git a/drivers/platform/msm/gsi/gsi.c b/drivers/platform/msm/gsi/gsi.c
index 2145042..10cd2d7 100644
--- a/drivers/platform/msm/gsi/gsi.c
+++ b/drivers/platform/msm/gsi/gsi.c
@@ -3612,7 +3612,7 @@
}
if (ctx->state == GSI_CHAN_STATE_STOP_IN_PROC) {
- GSIERR("chan=%lu busy try again\n", chan_hdl);
+ GSIDBG("chan=%lu busy try again\n", chan_hdl);
res = -GSI_STATUS_AGAIN;
goto free_lock;
}
diff --git a/drivers/platform/msm/ipa/ipa_clients/ipa_gsb.c b/drivers/platform/msm/ipa/ipa_clients/ipa_gsb.c
index d07a5d0..af95450 100644
--- a/drivers/platform/msm/ipa/ipa_clients/ipa_gsb.c
+++ b/drivers/platform/msm/ipa/ipa_clients/ipa_gsb.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/debugfs.h>
@@ -762,8 +763,6 @@
/* fetch iface handle from header */
mux_hdr = (struct ipa_gsb_mux_hdr *)skb->data;
- /* change to host order */
- *(u32 *)mux_hdr = ntohl(*(u32 *)mux_hdr);
hdl = mux_hdr->iface_hdl;
if ((hdl < 0) || (hdl >= MAX_SUPPORTED_IFACE) ||
!ipa_gsb_ctx->iface[hdl]) {
@@ -1215,9 +1214,9 @@
/* add 4 byte header for mux */
mux_hdr = (struct ipa_gsb_mux_hdr *)skb_push(skb,
sizeof(struct ipa_gsb_mux_hdr));
+ memset(mux_hdr, 0, sizeof(struct ipa_gsb_mux_hdr));
mux_hdr->iface_hdl = (u8)hdl;
- /* change to network order */
- *(u32 *)mux_hdr = htonl(*(u32 *)mux_hdr);
+ mux_hdr->qmap_id = (u8)ipa3_ctx->ep[ipa_gsb_ctx->prod_hdl].cfg.meta.qmap_id;
ret = ipa_tx_dp(IPA_CLIENT_ODU_PROD, skb, metadata);
if (ret) {
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa.c b/drivers/platform/msm/ipa/ipa_v3/ipa.c
index 24f1923..e6cce06 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa.c
@@ -8282,8 +8282,8 @@
if (ipa3_ctx->gsi_msi_addr)
ipa_gsi_map_unmap_gsi_msi_addr(true);
- if(!ipa_spearhead_stats_init())
- IPADBG("Fail to init spearhead ipa lnx module");
+ if(!ipa_tlpd_stats_init())
+ IPADBG("Fail to init tlpd ipa lnx module");
pr_info("IPA driver initialization was successful.\n");
#if IS_ENABLED(CONFIG_QCOM_VA_MINIDUMP)
@@ -9841,6 +9841,7 @@
ipa3_ctx->free_page_task_scheduled = false;
mutex_init(&ipa3_ctx->app_clock_vote.mutex);
+ mutex_init(&ipa3_ctx->ssr_lock);
ipa3_ctx->is_modem_up = false;
ipa3_ctx->mhi_ctrl_state = IPA_MHI_CTRL_NOT_SETUP;
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_client.c b/drivers/platform/msm/ipa/ipa_v3/ipa_client.c
index 37c466b..013aa9c 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_client.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_client.c
@@ -89,6 +89,11 @@
(ep->client == IPA_CLIENT_USB_CONS)) {
holb_cfg.tmr_val = IPA_HOLB_TMR_VAL_4_5;
holb_cfg.en = IPA_HOLB_TMR_EN;
+ } else if ((ipa3_ctx->ipa_hw_type >= IPA_HW_v5_5) &&
+ (ep->client == IPA_CLIENT_APPS_WAN_CONS ||
+ ep->client == IPA_CLIENT_APPS_WAN_COAL_CONS)) {
+ holb_cfg.tmr_val = IPA_HOLB_TMR_VAL_4_5;
+ holb_cfg.en = IPA_HOLB_TMR_EN;
} else {
holb_cfg.en = IPA_HOLB_TMR_DIS;
holb_cfg.tmr_val = 0;
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c b/drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c
index 4f1750b..ac14f07 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c
@@ -1613,6 +1613,11 @@
int nbytes;
int cnt = 0;
+ if (!ipa3_odl_ctx) {
+ IPADBG("ODL stats not supported\n");
+ return 0;
+ }
+
nbytes = scnprintf(dbg_buff, IPA_MAX_MSG_LEN,
"ODL received pkt =%u\n"
"ODL processed pkt to DIAG=%u\n"
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c
index ebae63a..56ddeb9 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c
@@ -2742,8 +2742,8 @@
goto fail_kmem_cache_alloc;
rx_pkt = ipa3_alloc_rx_pkt_page(GFP_KERNEL, true, sys);
if (unlikely(!rx_pkt)) {
- IPAERR("ipa3_alloc_rx_pkt_page fails\n");
- break;
+ IPAERR_RL("ipa3_alloc_rx_pkt_page fails\n");
+ goto fail_kmem_cache_alloc;
}
rx_pkt->sys = sys;
sys->repl->cache[curr] = rx_pkt;
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c b/drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c
index b255adb..2d8328c 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c
@@ -1876,6 +1876,19 @@
®_idx);
pipe_bitmask[reg_idx] |= mask;
}
+
+ /* Add drop stats for WAN & WAN_COAL if IPA_HW >=5.5 */
+ if (ipa3_ctx->ipa_hw_type >= IPA_HW_v5_5) {
+ mask = ipa_hw_stats_get_ep_bit_n_idx(
+ IPA_CLIENT_APPS_WAN_CONS,
+ ®_idx);
+ pipe_bitmask[reg_idx] |= mask;
+
+ mask = ipa_hw_stats_get_ep_bit_n_idx(
+ IPA_CLIENT_APPS_WAN_COAL_CONS,
+ ®_idx);
+ pipe_bitmask[reg_idx] |= mask;
+ }
}
/* Currently we have option to enable drop stats using debugfs.
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h
index b603378..9f1ea0b 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h
@@ -2594,6 +2594,7 @@
struct ipa3_page_recycle_stats prev_default_recycle_stats;
struct ipa3_page_recycle_stats prev_low_lat_data_recycle_stats;
struct mutex recycle_stats_collection_lock;
+ struct mutex ssr_lock;
};
struct ipa3_plat_drv_res {
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_stats.c b/drivers/platform/msm/ipa/ipa_v3/ipa_stats.c
index 43f48a9..085e1a3 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_stats.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_stats.c
@@ -51,7 +51,8 @@
static struct class *class;
static dev_t device;
-struct ipa_lnx_stats_spearhead_ctx ipa_lnx_agent_ctx;
+struct ipa_lnx_stats_tlpd_ctx ipa_lnx_agent_ctx;
+static DEFINE_MUTEX(ipa_lnx_ctx_mutex);
struct wlan_intf_mode_cnt {
u8 ap_cnt;
@@ -125,52 +126,6 @@
return 0;
}
-static bool ipa_stats_struct_mismatch()
-{
- if (IPA_LNX_EACH_INST_ALLOC_INFO_STRUCT_LEN_INT != IPA_LNX_EACH_INST_ALLOC_INFO_STRUCT_LEN ||
- IPA_LNX_STATS_ALL_INFO_STRUCT_LEN_INT != IPA_LNX_STATS_ALL_INFO_STRUCT_LEN ||
- IPA_LNX_STATS_SPEARHEAD_CTX_STRUCT_LEN_INT != IPA_LNX_STATS_SPEARHEAD_CTX_STRUCT_LEN) {
- IPA_STATS_ERR("IPA_LNX_CMD_GET_ALLOC_INFO structure size mismatch\n");
- return true;
- } else if (IPA_LNX_CONSOLIDATED_STATS_STRUCT_LEN_INT != IPA_LNX_CONSOLIDATED_STATS_STRUCT_LEN) {
- IPA_STATS_ERR("IPA_LNX_CMD_GET_CONSOLIDATED_STATS structure size mismatch\n");
- return true;
- } else if (IPA_LNX_PG_RECYCLE_STATS_STRUCT_LEN_INT != IPA_LNX_PG_RECYCLE_STATS_STRUCT_LEN ||
- IPA_LNX_EXCEPTION_STATS_STRUCT_LEN_INT != IPA_LNX_EXCEPTION_STATS_STRUCT_LEN ||
- IPA_LNX_ODL_EP_STATS_STRUCT_LEN_INT != IPA_LNX_ODL_EP_STATS_STRUCT_LEN ||
- IPA_LNX_HOLB_DISCARD_STATS_STRUCT_LEN_INT != IPA_LNX_HOLB_DISCARD_STATS_STRUCT_LEN ||
- IPA_LNX_HOLB_MONITOR_STATS_STRUCT_LEN_INT != IPA_LNX_HOLB_MONITOR_STATS_STRUCT_LEN ||
- IPA_LNX_HOLB_DROP_AND_MON_STATS_STRUCT_LEN_INT != IPA_LNX_HOLB_DROP_AND_MON_STATS_STRUCT_LEN ||
- IPA_LNX_GENERIC_STATS_STRUCT_LEN_INT != IPA_LNX_GENERIC_STATS_STRUCT_LEN) {
- IPA_STATS_ERR("IPA_LNX_CMD_GENERIC_STATS structure size mismatch\n");
- return true;
- } else if (IPA_LNX_PM_CLIENT_STATS_STRUCT_LEN_INT != IPA_LNX_PM_CLIENT_STATS_STRUCT_LEN ||
- IPA_LNX_CLOCK_STATS_STRUCT_LEN_INT != IPA_LNX_CLOCK_STATS_STRUCT_LEN) {
- IPA_STATS_ERR("IPA_LNX_CMD_CLOCK_STATS structure size mismatch\n");
- return true;
- } else if (IPA_LNX_GSI_RX_DEBUG_STATS_STRUCT_LEN_INT != IPA_LNX_GSI_RX_DEBUG_STATS_STRUCT_LEN ||
- IPA_LNX_GSI_TX_DEBUG_STATS_STRUCT_LEN_INT != IPA_LNX_GSI_TX_DEBUG_STATS_STRUCT_LEN ||
- IPA_LNX_GSI_DEBUG_STATS_STRUCT_LEN_INT != IPA_LNX_GSI_DEBUG_STATS_STRUCT_LEN ||
- IPA_LNX_PIPE_INFO_STATS_STRUCT_LEN_INT != IPA_LNX_PIPE_INFO_STATS_STRUCT_LEN ||
- IPA_LNX_WLAN_INSTANCE_INFO_STRUCT_LEN_INT != IPA_LNX_WLAN_INSTANCE_INFO_STRUCT_LEN ||
- IPA_LNX_WLAN_INST_STATS_STRUCT_LEN_INT != IPA_LNX_WLAN_INST_STATS_STRUCT_LEN) {
- IPA_STATS_ERR("IPA_LNX_CMD_WLAN_INST_STATS structure size mismatch\n");
- return true;
- } else if (IPA_LNX_ETH_INSTANCE_INFO_STRUCT_LEN_INT != IPA_LNX_ETH_INSTANCE_INFO_STRUCT_LEN ||
- IPA_LNX_ETH_INST_STATS_STRUCT_LEN_INT != IPA_LNX_ETH_INST_STATS_STRUCT_LEN) {
- IPA_STATS_ERR("IPA_LNX_CMD_ETH_INST_STATS structure size mismatch\n");
- return true;
- } else if (IPA_LNX_USB_INSTANCE_INFO_STRUCT_LEN_INT != IPA_LNX_USB_INSTANCE_INFO_STRUCT_LEN ||
- IPA_LNX_USB_INST_STATS_STRUCT_LEN_INT != IPA_LNX_USB_INST_STATS_STRUCT_LEN) {
- IPA_STATS_ERR("IPA_LNX_CMD_USB_INST_STATS structure size mismatch\n");
- return true;
- } else if (IPA_LNX_MHIP_INSTANCE_INFO_STRUCT_LEN_INT != IPA_LNX_MHIP_INSTANCE_INFO_STRUCT_LEN ||
- IPA_LNX_MHIP_INST_STATS_STRUCT_LEN_INT != IPA_LNX_MHIP_INST_STATS_STRUCT_LEN) {
- IPA_STATS_ERR("IPA_LNX_CMD_MHIP_INST_STATS structure size mismatch\n");
- return true;
- } else return false;
-}
-
static int ipa_get_generic_stats(unsigned long arg)
{
int res;
@@ -1520,14 +1475,14 @@
int eth_instance_id;
if (copy_from_user(&ipa_lnx_agent_ctx, u64_to_user_ptr((u64) arg),
- sizeof(struct ipa_lnx_stats_spearhead_ctx))) {
+ sizeof(struct ipa_lnx_stats_tlpd_ctx))) {
IPA_STATS_ERR("copy from user failed");
return -EFAULT;
}
/* For generic stats */
if (ipa_lnx_agent_ctx.log_type_mask &
- SPRHD_IPA_LOG_TYPE_GENERIC_STATS) {
+ TLPD_IPA_LOG_TYPE_GENERIC_STATS) {
for (i = 0; i < IPA_CLIENT_MAX; i++) {
int ep_idx = ipa3_get_ep_mapping(i);
@@ -1550,12 +1505,12 @@
}
/* For clock stats */
- if (ipa_lnx_agent_ctx.log_type_mask & SPRHD_IPA_LOG_TYPE_CLOCK_STATS)
+ if (ipa_lnx_agent_ctx.log_type_mask & TLPD_IPA_LOG_TYPE_CLOCK_STATS)
ipa_lnx_agent_ctx.alloc_info.num_pm_clients =
ipa3_get_max_num_pipes();
/* For WLAN instance */
- if (ipa_lnx_agent_ctx.log_type_mask & SPRHD_IPA_LOG_TYPE_WLAN_STATS) {
+ if (ipa_lnx_agent_ctx.log_type_mask & TLPD_IPA_LOG_TYPE_WLAN_STATS) {
ipa_ep_idx_tx = ipa3_get_ep_mapping(IPA_CLIENT_WLAN2_CONS);
ipa_ep_idx_rx = ipa3_get_ep_mapping(IPA_CLIENT_WLAN2_PROD);
if ((ipa_ep_idx_tx == -1) || (ipa_ep_idx_rx == -1) ||
@@ -1587,7 +1542,7 @@
}
/* For ETH instance */
- if (ipa_lnx_agent_ctx.log_type_mask & SPRHD_IPA_LOG_TYPE_ETH_STATS) {
+ if (ipa_lnx_agent_ctx.log_type_mask & TLPD_IPA_LOG_TYPE_ETH_STATS) {
ipa_lnx_agent_ctx.alloc_info.num_eth_instances = 0;
for (i = 0; i < IPA_ETH_INST_ID_MAX; i++) {
ipa_lnx_agent_ctx.alloc_info.eth_inst_info[i].num_pipes = 0;
@@ -1598,7 +1553,7 @@
= 0;
k = 0;
for (j = 0; (j < IPA_ETH_CLIENT_MAX) &&
- (k < SPEARHEAD_NUM_MAX_TX_INSTANCES); j++) {
+ (k < TLPD_NUM_MAX_TX_INSTANCES); j++) {
if (ipa_eth_client_exist(j, i) &&
(ipa_lnx_agent_ctx.alloc_info.num_eth_instances < 2)) {
eth_instance_id = ipa_lnx_agent_ctx.alloc_info.num_eth_instances;
@@ -1643,13 +1598,13 @@
}
/* For USB instance */
- if (ipa_lnx_agent_ctx.log_type_mask & SPRHD_IPA_LOG_TYPE_USB_STATS) {
+ if (ipa_lnx_agent_ctx.log_type_mask & TLPD_IPA_LOG_TYPE_USB_STATS) {
ipa_lnx_agent_ctx.alloc_info.num_usb_instances = 0;
index = 0;
for (i = 0; (i < IPA_USB_MAX_TETH_PROT_SIZE) &&
- (index < SPEARHEAD_NUM_MAX_INSTANCES); i++) {
+ (index < TLPD_NUM_MAX_INSTANCES); i++) {
if(ipa_usb_is_teth_prot_connected(i)) {
- if (index == SPEARHEAD_NUM_MAX_INSTANCES) {
+ if (index == TLPD_NUM_MAX_INSTANCES) {
IPA_STATS_ERR("USB alloc info max size reached\n");
break;
}
@@ -1697,7 +1652,7 @@
}
/* For MHIP instance */
- if (ipa_lnx_agent_ctx.log_type_mask & SPRHD_IPA_LOG_TYPE_MHIP_STATS) {
+ if (ipa_lnx_agent_ctx.log_type_mask & TLPD_IPA_LOG_TYPE_MHIP_STATS) {
#if IS_ENABLED(CONFIG_IPA3_MHI_PRIME_MANAGER)
if (!ipa3_ctx->mhip_ctx.dbg_stats.uc_dbg_stats_mmio) {
ipa_lnx_agent_ctx.alloc_info.num_mhip_instances = 0;
@@ -1735,13 +1690,13 @@
}
/* For Page recycling stats for default, coal and Low lat pipes */
- if (ipa_lnx_agent_ctx.log_type_mask & SPRHD_IPA_LOG_TYPE_RECYCLE_STATS)
+ if (ipa_lnx_agent_ctx.log_type_mask & TLPD_IPA_LOG_TYPE_RECYCLE_STATS)
ipa_lnx_agent_ctx.alloc_info.num_page_rec_interval =
IPA_LNX_PIPE_PAGE_RECYCLING_INTERVAL_COUNT;
if(copy_to_user((u8 *)arg,
&ipa_lnx_agent_ctx,
- sizeof(struct ipa_lnx_stats_spearhead_ctx))) {
+ sizeof(struct ipa_lnx_stats_tlpd_ctx))) {
IPA_STATS_ERR("copy to user failed");
return -EFAULT;
}
@@ -1765,6 +1720,7 @@
return -EPERM;
}
+ mutex_lock(&ipa_lnx_ctx_mutex);
switch (cmd) {
case IPA_LNX_IOC_GET_ALLOC_INFO:
retval = ipa_stats_get_alloc_info(arg);
@@ -1810,45 +1766,46 @@
const void __user *)arg, sizeof(struct ipa_lnx_consolidated_stats));
if (IS_ERR(consolidated_stats)) {
IPA_STATS_ERR("copy from user failed");
+ mutex_unlock(&ipa_lnx_ctx_mutex);
return -ENOMEM;
}
- if (consolidated_stats->log_type_mask & SPRHD_IPA_LOG_TYPE_GENERIC_STATS) {
+ if (consolidated_stats->log_type_mask & TLPD_IPA_LOG_TYPE_GENERIC_STATS) {
retval = ipa_get_generic_stats((unsigned long) consolidated_stats->generic_stats);
if (retval) {
IPA_STATS_ERR("ipa get generic stats fail");
break;
}
}
- if (consolidated_stats->log_type_mask & SPRHD_IPA_LOG_TYPE_CLOCK_STATS) {
+ if (consolidated_stats->log_type_mask & TLPD_IPA_LOG_TYPE_CLOCK_STATS) {
retval = ipa_get_clock_stats((unsigned long) consolidated_stats->clock_stats);
if (retval) {
IPA_STATS_ERR("ipa get clock stats fail");
break;
}
}
- if (consolidated_stats->log_type_mask & SPRHD_IPA_LOG_TYPE_WLAN_STATS) {
+ if (consolidated_stats->log_type_mask & TLPD_IPA_LOG_TYPE_WLAN_STATS) {
retval = ipa_get_wlan_inst_stats((unsigned long) consolidated_stats->wlan_stats);
if (retval) {
IPA_STATS_ERR("ipa get wlan inst stats fail");
break;
}
}
- if (consolidated_stats->log_type_mask & SPRHD_IPA_LOG_TYPE_ETH_STATS) {
+ if (consolidated_stats->log_type_mask & TLPD_IPA_LOG_TYPE_ETH_STATS) {
retval = ipa_get_eth_inst_stats((unsigned long) consolidated_stats->eth_stats);
if (retval) {
IPA_STATS_ERR("ipa get eth inst stats fail");
break;
}
}
- if (consolidated_stats->log_type_mask & SPRHD_IPA_LOG_TYPE_USB_STATS) {
+ if (consolidated_stats->log_type_mask & TLPD_IPA_LOG_TYPE_USB_STATS) {
retval = ipa_get_usb_inst_stats((unsigned long) consolidated_stats->usb_stats);
if (retval) {
IPA_STATS_ERR("ipa get usb inst stats fail");
break;
}
}
- if (consolidated_stats->log_type_mask & SPRHD_IPA_LOG_TYPE_MHIP_STATS) {
+ if (consolidated_stats->log_type_mask & TLPD_IPA_LOG_TYPE_MHIP_STATS) {
#if IS_ENABLED(CONFIG_IPA3_MHI_PRIME_MANAGER)
retval = ipa_get_mhip_inst_stats((unsigned long) consolidated_stats->mhip_stats);
if (retval) {
@@ -1857,7 +1814,7 @@
}
#endif
}
- if (consolidated_stats->log_type_mask & SPRHD_IPA_LOG_TYPE_RECYCLE_STATS) {
+ if (consolidated_stats->log_type_mask & TLPD_IPA_LOG_TYPE_RECYCLE_STATS) {
retval = ipa_get_page_recycle_stats((unsigned long) consolidated_stats->recycle_stats);
if (retval) {
IPA_STATS_ERR("ipa get page recycle stats fail\n");
@@ -1868,6 +1825,7 @@
default:
retval = -ENOTTY;
}
+ mutex_unlock(&ipa_lnx_ctx_mutex);
return retval;
}
@@ -1878,7 +1836,7 @@
.unlocked_ioctl = ipa_lnx_stats_ioctl,
};
-static int ipa_spearhead_stats_ioctl_init(void)
+static int ipa_tlpd_stats_ioctl_init(void)
{
unsigned int ipa_lnx_stats_ioctl_major = 0;
int ret;
@@ -1927,16 +1885,11 @@
return -ENODEV;
}
-int ipa_spearhead_stats_init()
+int ipa_tlpd_stats_init()
{
int ret;
- if (ipa_stats_struct_mismatch()) {
- IPA_STATS_ERR("ipa stats structure mismatch\n");
- return -1;
- }
-
- ret = ipa_spearhead_stats_ioctl_init();
+ ret = ipa_tlpd_stats_ioctl_init();
if(ret) {
IPA_STATS_ERR("IPA_LNX_STATS_IOCTL init failure = %d\n", ret);
return -1;
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_stats.h b/drivers/platform/msm/ipa/ipa_v3/ipa_stats.h
index 8e0ddfd..179c9c2 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_stats.h
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_stats.h
@@ -17,7 +17,7 @@
#define IPA_LNX_IOC_GET_ALLOC_INFO _IOWR(IPA_LNX_STATS_IOC_MAGIC, \
IPA_LNX_CMD_GET_ALLOC_INFO, \
- struct ipa_lnx_stats_spearhead_ctx)
+ struct ipa_lnx_stats_tlpd_ctx)
#define IPA_LNX_IOC_GET_GENERIC_STATS _IOWR(IPA_LNX_STATS_IOC_MAGIC, \
IPA_LNX_CMD_GENERIC_STATS, \
@@ -45,32 +45,31 @@
#define IPA_LNX_IOC_GET_CONSOLIDATED_STATS _IOWR(IPA_LNX_STATS_IOC_MAGIC, \
IPA_LNX_CMD_CONSOLIDATED_STATS, \
- struct ipa_lnx_consolidated_stats)
+ int)
#define IPA_LNX_STATS_SUCCESS 0
#define IPA_LNX_STATS_FAILURE -1
-#define SPEARHEAD_NUM_MAX_PIPES 6
-#define SPEARHEAD_NUM_MAX_TX_INSTANCES 3
-#define SPEARHEAD_NUM_MAX_RX_INSTANCES 3
+#define TLPD_NUM_MAX_PIPES 6
+#define TLPD_NUM_MAX_TX_INSTANCES 3
+#define TLPD_NUM_MAX_RX_INSTANCES 3
-#define SPEARHEAD_NUM_MAX_INSTANCES 2
+#define TLPD_NUM_MAX_INSTANCES 2
#define IPA_LNX_PIPE_PAGE_RECYCLING_INTERVAL_COUNT 5
#define IPA_LNX_PIPE_PAGE_RECYCLING_INTERVAL_TIME 10 /* In milli second */
/**
* This is used to indicate which set of logs is enabled from IPA
- * These bitmapped macros are copied from
- * spearhead/inc/spearhead_client.h
+ * These bitmapped macros.
*/
-#define SPRHD_IPA_LOG_TYPE_GENERIC_STATS 0x00001
-#define SPRHD_IPA_LOG_TYPE_CLOCK_STATS 0x00002
-#define SPRHD_IPA_LOG_TYPE_WLAN_STATS 0x00004
-#define SPRHD_IPA_LOG_TYPE_ETH_STATS 0x00008
-#define SPRHD_IPA_LOG_TYPE_USB_STATS 0x00010
-#define SPRHD_IPA_LOG_TYPE_MHIP_STATS 0x00020
-#define SPRHD_IPA_LOG_TYPE_RECYCLE_STATS 0x00040
+#define TLPD_IPA_LOG_TYPE_GENERIC_STATS 0x00001
+#define TLPD_IPA_LOG_TYPE_CLOCK_STATS 0x00002
+#define TLPD_IPA_LOG_TYPE_WLAN_STATS 0x00004
+#define TLPD_IPA_LOG_TYPE_ETH_STATS 0x00008
+#define TLPD_IPA_LOG_TYPE_USB_STATS 0x00010
+#define TLPD_IPA_LOG_TYPE_MHIP_STATS 0x00020
+#define TLPD_IPA_LOG_TYPE_RECYCLE_STATS 0x00040
/**
@@ -99,7 +98,7 @@
* is structure modification.This is NOT the sizeof(struct) but
* it is addition of the specified type of variable included
* inside the structre. Also update the internal structure lengths
- * in ipa_lnx_spearhead_stats.c to overcome backward and forward
+ * in ipa_lnx_tlpd_stats.c to overcome backward and forward
* compatibility between userspace and driver structures.
*/
/* IPA Linux generic stats structures */
@@ -109,7 +108,6 @@
uint64_t def_total_repl_buff;
uint64_t def_temp_repl_buff;
};
-#define IPA_LNX_PG_RECYCLE_STATS_STRUCT_LEN_INT 32
struct exception_stats {
uint32_t excptn_type_none;
@@ -123,7 +121,6 @@
uint32_t excptn_type_ipv6_ct;
uint32_t excptn_type_csum;
};
-#define IPA_LNX_EXCEPTION_STATS_STRUCT_LEN_INT 40
struct odl_ep_stats {
uint32_t rx_pkt;
@@ -131,7 +128,6 @@
uint32_t dropped_pkt;
uint32_t num_queue_pkt;
};
-#define IPA_LNX_ODL_EP_STATS_STRUCT_LEN_INT 16
struct holb_discard_stats {
uint32_t client_type;
@@ -139,7 +135,6 @@
uint32_t num_drp_bytes;
uint32_t reserved;
};
-#define IPA_LNX_HOLB_DISCARD_STATS_STRUCT_LEN_INT 16
struct holb_monitor_stats {
uint32_t client_type;
@@ -147,7 +142,6 @@
uint32_t num_en_cnt;
uint32_t num_dis_cnt;
};
-#define IPA_LNX_HOLB_MONITOR_STATS_STRUCT_LEN_INT 16
struct holb_drop_and_mon_stats {
uint32_t num_holb_disc_pipes;
@@ -155,7 +149,6 @@
struct holb_discard_stats holb_disc_stats[0];
struct holb_monitor_stats holb_mon_stats[0];
};
-#define IPA_LNX_HOLB_DROP_AND_MON_STATS_STRUCT_LEN_INT (8 + 16 +16)
struct ipa_lnx_generic_stats {
uint32_t tx_dma_pkts;
@@ -173,7 +166,6 @@
struct odl_ep_stats odl_stats;
struct holb_drop_and_mon_stats holb_stats;
};
-#define IPA_LNX_GENERIC_STATS_STRUCT_LEN_INT (40 + 32 + 40 + 16 + 40)
/* IPA Linux clock stats structures */
struct pm_client_stats {
@@ -184,7 +176,6 @@
uint32_t pm_client_type;
uint32_t reserved;
};
-#define IPA_LNX_PM_CLIENT_STATS_STRUCT_LEN_INT 24
struct ipa_lnx_clock_stats {
uint32_t active_clients;
@@ -195,7 +186,6 @@
uint32_t curr_clk_vote;
struct pm_client_stats pm_clnt_stats[0];
};
-#define IPA_LNX_CLOCK_STATS_STRUCT_LEN_INT (24 + 24)
/* Generic instance structures */
struct ipa_lnx_gsi_rx_debug_stats {
@@ -212,7 +202,6 @@
uint32_t gsi_debug4;
uint32_t rx_summary;
};
-#define IPA_LNX_GSI_RX_DEBUG_STATS_STRUCT_LEN_INT 48
struct ipa_lnx_gsi_tx_debug_stats {
uint32_t tx_client;
@@ -230,7 +219,6 @@
uint32_t tx_summary;
uint32_t reserved;
};
-#define IPA_LNX_GSI_TX_DEBUG_STATS_STRUCT_LEN_INT 56
struct ipa_lnx_gsi_debug_stats {
uint32_t num_tx_instances;
@@ -238,7 +226,6 @@
struct ipa_lnx_gsi_tx_debug_stats gsi_tx_dbg_stats[0];
struct ipa_lnx_gsi_rx_debug_stats gsi_rx_dbg_stats[0];
};
-#define IPA_LNX_GSI_DEBUG_STATS_STRUCT_LEN_INT (8 + 48 + 56)
struct ipa_lnx_pipe_info {
uint64_t gsi_chan_ring_bp;
@@ -266,7 +253,6 @@
uint32_t gsi_poll_mode;
uint32_t gsi_db_in_bytes;
};
-#define IPA_LNX_PIPE_INFO_STATS_STRUCT_LEN_INT 120
/* IPA Linux wlan instance stats structures */
struct wlan_instance_info {
@@ -281,14 +267,12 @@
struct ipa_lnx_gsi_debug_stats gsi_debug_stats;
struct ipa_lnx_pipe_info pipe_info[0];
};
-#define IPA_LNX_WLAN_INSTANCE_INFO_STRUCT_LEN_INT (32 + 112 + 120)
struct ipa_lnx_wlan_inst_stats {
uint32_t num_wlan_instance;
uint32_t reserved;
struct wlan_instance_info instance_info[0];
};
-#define IPA_LNX_WLAN_INST_STATS_STRUCT_LEN_INT (8 + 264)
/* IPA Linux eth instance stats structures */
struct eth_instance_info {
@@ -299,14 +283,12 @@
struct ipa_lnx_gsi_debug_stats gsi_debug_stats;
struct ipa_lnx_pipe_info pipe_info[0];
};
-#define IPA_LNX_ETH_INSTANCE_INFO_STRUCT_LEN_INT (16 + 112 + 120)
struct ipa_lnx_eth_inst_stats {
uint32_t num_eth_instance;
uint32_t reserved;
struct eth_instance_info instance_info[0];
};
-#define IPA_LNX_ETH_INST_STATS_STRUCT_LEN_INT (8 + 248)
/* IPA Linux usb instance stats structures */
struct usb_instance_info {
@@ -317,14 +299,12 @@
struct ipa_lnx_gsi_debug_stats gsi_debug_stats;
struct ipa_lnx_pipe_info pipe_info[0];
};
-#define IPA_LNX_USB_INSTANCE_INFO_STRUCT_LEN_INT (16 + 112 + 120)
struct ipa_lnx_usb_inst_stats {
uint32_t num_usb_instance;
uint32_t reserved;
struct usb_instance_info instance_info[0];
};
-#define IPA_LNX_USB_INST_STATS_STRUCT_LEN_INT (8 + 248)
/* IPA Linux mhip instance stats structures */
struct mhip_instance_info {
@@ -335,14 +315,12 @@
struct ipa_lnx_gsi_debug_stats gsi_debug_stats;
struct ipa_lnx_pipe_info pipe_info[0];
};
-#define IPA_LNX_MHIP_INSTANCE_INFO_STRUCT_LEN_INT (16 + 112 + 120)
struct ipa_lnx_mhip_inst_stats {
uint32_t num_mhip_instance;
uint32_t reserved;
struct mhip_instance_info instance_info[0];
};
-#define IPA_LNX_MHIP_INST_STATS_STRUCT_LEN_INT (8 + 248)
struct ipa_lnx_consolidated_stats {
uint64_t log_type_mask;
@@ -354,7 +332,6 @@
struct ipa_lnx_mhip_inst_stats *mhip_stats;
struct ipa_lnx_pipe_page_recycling_stats *recycle_stats;
};
-#define IPA_LNX_CONSOLIDATED_STATS_STRUCT_LEN_INT (8 + 48)
enum rx_channel_type {
RX_WAN_COALESCING,
@@ -391,15 +368,14 @@
/* Explain below structures */
struct ipa_lnx_each_inst_alloc_info {
- uint32_t pipes_client_type[SPEARHEAD_NUM_MAX_PIPES];
- uint32_t tx_inst_client_type[SPEARHEAD_NUM_MAX_TX_INSTANCES];
- uint32_t rx_inst_client_type[SPEARHEAD_NUM_MAX_RX_INSTANCES];
+ uint32_t pipes_client_type[TLPD_NUM_MAX_PIPES];
+ uint32_t tx_inst_client_type[TLPD_NUM_MAX_TX_INSTANCES];
+ uint32_t rx_inst_client_type[TLPD_NUM_MAX_RX_INSTANCES];
uint32_t num_pipes;
uint32_t num_tx_instances;
uint32_t num_rx_instances;
uint32_t reserved;
};
-#define IPA_LNX_EACH_INST_ALLOC_INFO_STRUCT_LEN_INT (24 + 12 + 12 + 16)
struct ipa_lnx_stats_alloc_info {
uint32_t num_holb_drop_stats_clients;
@@ -410,19 +386,17 @@
uint32_t num_usb_instances;
uint32_t num_mhip_instances;
uint32_t num_page_rec_interval;
- struct ipa_lnx_each_inst_alloc_info wlan_inst_info[SPEARHEAD_NUM_MAX_INSTANCES];
- struct ipa_lnx_each_inst_alloc_info eth_inst_info[SPEARHEAD_NUM_MAX_INSTANCES];
- struct ipa_lnx_each_inst_alloc_info usb_inst_info[SPEARHEAD_NUM_MAX_INSTANCES];
- struct ipa_lnx_each_inst_alloc_info mhip_inst_info[SPEARHEAD_NUM_MAX_INSTANCES];
+ struct ipa_lnx_each_inst_alloc_info wlan_inst_info[TLPD_NUM_MAX_INSTANCES];
+ struct ipa_lnx_each_inst_alloc_info eth_inst_info[TLPD_NUM_MAX_INSTANCES];
+ struct ipa_lnx_each_inst_alloc_info usb_inst_info[TLPD_NUM_MAX_INSTANCES];
+ struct ipa_lnx_each_inst_alloc_info mhip_inst_info[TLPD_NUM_MAX_INSTANCES];
};
-#define IPA_LNX_STATS_ALL_INFO_STRUCT_LEN_INT (32 + 128 + 128 + 128)
-struct ipa_lnx_stats_spearhead_ctx {
- uint32_t usb_teth_prot[SPEARHEAD_NUM_MAX_INSTANCES];
+struct ipa_lnx_stats_tlpd_ctx {
+ uint32_t usb_teth_prot[TLPD_NUM_MAX_INSTANCES];
uint32_t log_type_mask;
struct ipa_lnx_stats_alloc_info alloc_info;
};
-#define IPA_LNX_STATS_SPEARHEAD_CTX_STRUCT_LEN_INT (8 + 4 + 416)
/* enum ipa_lnx_stats_ioc_cmd_type - IOCTL Command types for IPA lnx stats
*
@@ -439,7 +413,7 @@
IPA_LNX_CMD_STATS_MAX,
};
-int ipa_spearhead_stats_init(void);
+int ipa_tlpd_stats_init(void);
/* Peripheral stats for Q6, should be in the same order, defined by Q6 */
struct ipa_peripheral_mdm_stats {
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_uc.c b/drivers/platform/msm/ipa/ipa_v3/ipa_uc.c
index 37a2916..291d0a3 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_uc.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_uc.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include "ipa_i.h"
@@ -1733,6 +1734,11 @@
struct ipa_mem_buffer cmd;
struct IpaQuotaMonitoring_t *quota_info;
+ if (!ipa3_ctx->uc_ctx.uc_event_ring_valid) {
+ IPADBG("uC event ring not configured, Quota monitor won't work\n");
+ return res;
+ }
+
cmd.size = sizeof(*quota_info);
cmd.base = dma_alloc_coherent(ipa3_ctx->uc_pdev, cmd.size,
&cmd.phys_base, GFP_KERNEL);
@@ -1801,6 +1807,11 @@
if (!info)
return -EINVAL;
+ if (!ipa3_ctx->uc_ctx.uc_event_ring_valid) {
+ IPADBG("uC event ring not configured, BW monitor won't work\n");
+ return res;
+ }
+
/* check max entry */
if (info->num > BW_MONITORING_MAX_THRESHOLD) {
IPAERR("%d, support max %d bw monitor\n", info->num,
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c
index cc48442..7b48bae 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c
@@ -13364,17 +13364,17 @@
{
bool is_up;
- mutex_lock(&ipa3_ctx->lock);
+ mutex_lock(&ipa3_ctx->ssr_lock);
is_up = ipa3_ctx->is_modem_up;
- mutex_unlock(&ipa3_ctx->lock);
+ mutex_unlock(&ipa3_ctx->ssr_lock);
return is_up;
}
void ipa3_set_modem_up(bool is_up)
{
- mutex_lock(&ipa3_ctx->lock);
+ mutex_lock(&ipa3_ctx->ssr_lock);
ipa3_ctx->is_modem_up = is_up;
- mutex_unlock(&ipa3_ctx->lock);
+ mutex_unlock(&ipa3_ctx->ssr_lock);
}
/**