msm: ipa: enable MPM module

Make changes to enable APQ based target out of 5_1.
Enable IPA MPM module. Make changes to init MPM
from IPA driver to avoid cycling dependency.

Change-Id: Id1e28198305c785d93a39b9093aaa230dfbb9b55
Signed-off-by: Chaitanya Pratapa <cpratapa@codeaurora.org>
This commit is contained in:
Chaitanya Pratapa
2021-03-03 23:26:56 -08:00
committed by Gerrit - the friendly Code Review server
vanhempi 59d0c3ec7a
commit 23cb08e81e
7 muutettua tiedostoa jossa 153 lisäystä ja 7 poistoa

Näytä tiedosto

@@ -2,4 +2,5 @@ export CONFIG_GSI=m
export CONFIG_IPA_CLIENTS_MANAGER=m
export CONFIG_IPA_WDI_UNIFIED_API=y
export CONFIG_RMNET_IPA3=y
export CONFIG_IPA3_MHI_PRIME_MANAGER=y
export CONFIG_RNDIS_IPA=m

Näytä tiedosto

@@ -8,3 +8,4 @@
#define CONFIG_RNDIS_IPA 1
#define CONFIG_IPA_WDI_UNIFIED_API 1
#define CONFIG_IPA_VENDOR_DLKM 1
#define CONFIG_IPA3_MHI_PRIME_MANAGER 1

Näytä tiedosto

@@ -38,6 +38,8 @@ ipam-$(CONFIG_RMNET_IPA3) += ipa_v3/rmnet_ipa.o ipa_v3/ipa_qmi_service_v01.o \
ipa_v3/ipa_qmi_service.o ipa_v3/rmnet_ctl_ipa.o \
ipa_v3/rmnet_ipa_fd_ioctl.o
ipam-$(CONFIG_IPA3_MHI_PRIME_MANAGER) += ipa_v3/ipa_mpm.o
ipam-$(CONFIG_IPA3_MHI_PROXY) += ipa_v3/ipa_mhi_proxy.o
ipam-$(CONFIG_IPA_EMULATION) += ipa_v3/ipa_dt_replacement.o
ipam-$(CONFIG_IPA3_REGDUMP) += ipa_v3/dump/ipa_reg_dump.o

Näytä tiedosto

@@ -6944,6 +6944,12 @@ static int ipa3_post_init(const struct ipa3_plat_drv_res *resource_p,
ipa3_debugfs_init();
result = ipa_mpm_init();
if (result)
IPAERR("fail to init mpm %d\n", result);
else
IPADBG(":mpm init init ok\n");
mutex_lock(&ipa3_ctx->lock);
ipa3_ctx->ipa_initialization_complete = true;
if (ipa3_ctx->clients_registered)

Näytä tiedosto

@@ -3253,6 +3253,8 @@ int ipa3_get_gsi_chan_info(struct gsi_chan_info *gsi_chan_info,
int ipa3_disable_apps_wan_cons_deaggr(uint32_t agg_size, uint32_t agg_count);
#if IS_ENABLED(CONFIG_IPA3_MHI_PRIME_MANAGER)
int ipa_mpm_init(void);
void ipa_mpm_exit(void);
int ipa_mpm_mhip_xdci_pipe_enable(enum ipa_usb_teth_prot prot);
int ipa_mpm_mhip_xdci_pipe_disable(enum ipa_usb_teth_prot xdci_teth_prot);
int ipa_mpm_notify_wan_state(struct wan_ioctl_notify_wan_state *state);
@@ -3263,6 +3265,14 @@ int ipa_mpm_panic_handler(char *buf, int size);
int ipa3_mpm_enable_adpl_over_odl(bool enable);
int ipa3_get_mhip_gsi_stats(struct ipa_uc_dbg_ring_stats *stats);
#else /* IS_ENABLED(CONFIG_IPA3_MHI_PRIME_MANAGER) */
static inline int ipa_mpm_init(void)
{
return 0;
}
static inline void ipa_mpm_exit(void)
{
return;
}
static inline int ipa_mpm_mhip_xdci_pipe_enable(
enum ipa_usb_teth_prot prot)
{

Näytä tiedosto

@@ -560,7 +560,7 @@ static int ipa_mpm_set_dma_mode(enum ipa_client_type src_pipe,
ep_cfg.mode.dst = dst_pipe;
ep_cfg.seq.set_dynamic = true;
result = ipa_cfg_ep(ipa_get_ep_mapping(src_pipe), &ep_cfg);
result = ipa3_cfg_ep(ipa_get_ep_mapping(src_pipe), &ep_cfg);
IPA_MPM_FUNC_EXIT();
destroy_imm_cmd:
@@ -1649,7 +1649,11 @@ static int ipa_mpm_start_stop_remote_mhip_chan(
IPA_MPM_DBG("Remote channel already started for %d\n",
probe_id);
} else {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0))
ret = mhi_start_transfer(mhi_dev);
#else
ret = mhi_resume_transfer(mhi_dev);
#endif
mutex_lock(&ipa_mpm_ctx->md[probe_id].mhi_mutex);
if (ret)
ipa_mpm_ctx->md[probe_id].remote_state =
@@ -1665,7 +1669,11 @@ static int ipa_mpm_start_stop_remote_mhip_chan(
IPA_MPM_DBG("Remote channel already stopped for %d\n",
probe_id);
} else {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0))
ret = mhi_stop_transfer(mhi_dev);
#else
ret = mhi_pause_transfer(mhi_dev);
#endif
mutex_lock(&ipa_mpm_ctx->md[probe_id].mhi_mutex);
if (ret)
ipa_mpm_ctx->md[probe_id].remote_state =
@@ -1684,7 +1692,7 @@ static enum mhip_status_type ipa_mpm_start_stop_mhip_chan(
int probe_id,
enum ipa_mpm_start_stop_type start_stop)
{
int ipa_ep_idx;
int ipa_ep_idx = IPA_EP_NOT_ALLOCATED;
struct ipa3_ep_context *ep;
bool is_start;
enum ipa_client_type ul_chan, dl_chan;
@@ -2753,6 +2761,7 @@ static void ipa_mpm_mhi_status_cb(struct mhi_device *mhi_dev,
case MHI_CB_FATAL_ERROR:
case MHI_CB_EE_MISSION_MODE:
case MHI_CB_DTR_SIGNAL:
default:
IPA_MPM_ERR("unexpected event %d\n", mhi_cb);
break;
}
@@ -2784,7 +2793,7 @@ int ipa_mpm_mhip_xdci_pipe_enable(enum ipa_usb_teth_prot xdci_teth_prot)
int probe_id = IPA_MPM_MHIP_CH_ID_MAX;
int i;
enum ipa_mpm_mhip_client_type mhip_client;
enum mhip_status_type status;
enum mhip_status_type status = MHIP_STATUS_SUCCESS;
int pipe_idx;
bool is_acted = true;
int ret = 0;
@@ -2919,6 +2928,7 @@ int ipa_mpm_mhip_xdci_pipe_enable(enum ipa_usb_teth_prot xdci_teth_prot)
}
return ret;
}
EXPORT_SYMBOL(ipa_mpm_mhip_xdci_pipe_enable);
int ipa_mpm_mhip_xdci_pipe_disable(enum ipa_usb_teth_prot xdci_teth_prot)
{
@@ -3042,6 +3052,7 @@ int ipa_mpm_mhip_xdci_pipe_disable(enum ipa_usb_teth_prot xdci_teth_prot)
return ret;
}
EXPORT_SYMBOL(ipa_mpm_mhip_xdci_pipe_disable);
static int ipa_mpm_populate_smmu_info(struct platform_device *pdev)
{
@@ -3228,13 +3239,13 @@ static struct platform_driver ipa_ipa_mpm_driver = {
*
* Return: None
*/
static int __init ipa_mpm_init(void)
int ipa_mpm_init(void)
{
IPA_MPM_DBG("register ipa_mpm platform device\n");
return platform_driver_register(&ipa_ipa_mpm_driver);
}
static void __exit ipa_mpm_exit(void)
void ipa_mpm_exit(void)
{
IPA_MPM_DBG("unregister ipa_mpm platform device\n");
platform_driver_unregister(&ipa_ipa_mpm_driver);
@@ -3253,6 +3264,7 @@ int ipa3_is_mhip_offload_enabled(void)
else
return 1;
}
EXPORT_SYMBOL(ipa3_is_mhip_offload_enabled);
int ipa_mpm_panic_handler(char *buf, int size)
{
@@ -3406,7 +3418,5 @@ int ipa3_mpm_enable_adpl_over_odl(bool enable)
return ret;
}
late_initcall(ipa_mpm_init);
module_exit(ipa_mpm_exit);
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("MHI Proxy Manager Driver");

Näytä tiedosto

@@ -291,6 +291,7 @@ enum ipa_ver {
IPA_5_0,
IPA_5_0_MHI,
IPA_5_1,
IPA_5_1_APQ,
IPA_VER_MAX,
};
@@ -551,6 +552,21 @@ static const struct rsrc_min_max ipa3_rsrc_src_grp_config
[IPA_v5_0_RSRC_GRP_TYPE_SRC_ACK_ENTRIES] = {
{22, 22}, {16, 16}, {0, 0}, {0, 0}, {16, 16}, {0, 0}, {0, 0}, },
},
[IPA_5_1_APQ] = {
/* UL DL unused unused URLLC UC_RX_Q N/A */
[IPA_v5_0_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS] = {
{3, 9}, {4, 10}, {0, 0}, {0, 0}, {1, 63}, {0, 63}, {0, 0}, },
[IPA_v5_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_LISTS] = {
{9, 9}, {12, 12}, {0, 0}, {0, 0}, {10, 10}, {0, 0}, {0, 0}, },
[IPA_v5_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF] = {
{9, 9}, {24, 24}, {0, 0}, {0, 0}, {20, 20}, {0, 0}, {0, 0}, },
[IPA_v5_0_RSRC_GRP_TYPE_SRC_HPS_DMARS] = {
{0, 63}, {0, 63}, {0, 63}, {0, 63}, {1, 63}, {0, 63}, {0, 0}, },
[IPA_v5_0_RSRC_GRP_TYPE_SRC_ACK_ENTRIES] = {
{22, 22}, {16, 16}, {0, 0}, {0, 0}, {16, 16}, {0, 0}, {0, 0}, },
},
};
static const struct rsrc_min_max ipa3_rsrc_dst_grp_config
@@ -691,6 +707,15 @@ static const struct rsrc_min_max ipa3_rsrc_dst_grp_config
[IPA_v5_0_RSRC_GRP_TYPE_DST_DPS_DMARS] = {
{0, 3}, {0, 3}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, },
},
[IPA_5_1_APQ] = {
/* UL DL unused unused unused UC_RX_Q DRBIP N/A */
[IPA_v5_0_RSRC_GRP_TYPE_DST_DATA_SECTORS] = {
{6, 6}, {5, 5}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {39, 39}, },
[IPA_v5_0_RSRC_GRP_TYPE_DST_DPS_DMARS] = {
{0, 3}, {0, 3}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, },
},
};
static const struct rsrc_min_max ipa3_rsrc_rx_grp_config
@@ -791,6 +816,13 @@ static const struct rsrc_min_max ipa3_rsrc_rx_grp_config
[IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ] = {
{3, 3}, {3, 3}, {0, 0}, {0, 0}, {3, 3}, {0, 0} },
},
[IPA_5_1_APQ] = {
/* UL DL unused unused URLLC UC_RX_Q */
[IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ] = {
{3, 3}, {3, 3}, {0, 0}, {0, 0}, {3, 3}, {0, 0} },
},
};
static const u32 ipa3_rsrc_rx_grp_hps_weight_config
@@ -4790,6 +4822,86 @@ static const struct ipa_ep_configuration ipa3_ep_mapping
QMB_MASTER_SELECT_PCIE,
{ 34, 25, 9, 9, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3 },
IPA_TX_INSTANCE_DL },
/* IPA_5_1_APQ */
[IPA_5_1_APQ][IPA_CLIENT_MHI_PRIME_DPL_PROD] = {
true, IPA_v5_0_GROUP_DL,
true,
IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
QMB_MASTER_SELECT_DDR,
{8, 18, 8, 16, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0 },
IPA_TX_INSTANCE_NA },
[IPA_5_1_APQ][IPA_CLIENT_MHI_PRIME_RMNET_PROD] = {
true, IPA_v5_0_GROUP_DL,
true,
IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
QMB_MASTER_SELECT_DDR,
{ 3, 15, 8, 16, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3 },
IPA_TX_INSTANCE_NA },
[IPA_5_1_APQ][IPA_CLIENT_USB_PROD] = {
true, IPA_v5_0_GROUP_UL,
true,
IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
QMB_MASTER_SELECT_DDR,
{ 1, 0, 8, 16, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0},
IPA_TX_INSTANCE_NA },
[IPA_5_1_APQ][IPA_CLIENT_APPS_WAN_PROD] = {
true, IPA_v5_0_GROUP_UL,
true,
IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
QMB_MASTER_SELECT_DDR,
{ 2, 11, 25, 32, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3},
IPA_TX_INSTANCE_NA },
[IPA_5_1_APQ][IPA_CLIENT_APPS_LAN_PROD] = {
true, IPA_v5_0_GROUP_UL,
false,
IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
QMB_MASTER_SELECT_DDR,
{ 9, 19, 26, 32, IPA_EE_AP, GSI_SMART_PRE_FETCH, 4},
IPA_TX_INSTANCE_NA },
[IPA_5_1_APQ][IPA_CLIENT_APPS_CMD_PROD] = {
true, IPA_v5_0_GROUP_UL,
false,
IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
QMB_MASTER_SELECT_DDR,
{ 14, 12, 20, 24, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0},
IPA_TX_INSTANCE_NA },
[IPA_5_1_APQ][IPA_CLIENT_MHI_PRIME_RMNET_CONS] = {
true, IPA_v5_0_GROUP_UL,
false,
IPA_DPS_HPS_SEQ_TYPE_INVALID,
QMB_MASTER_SELECT_DDR,
{ 31, 8, 9, 9, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3 },
IPA_TX_INSTANCE_DL },
[IPA_5_1_APQ][IPA_CLIENT_APPS_LAN_CONS] = {
true, IPA_v5_0_GROUP_UL,
false,
IPA_DPS_HPS_SEQ_TYPE_INVALID,
QMB_MASTER_SELECT_DDR,
{ 16, 13, 9, 9, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0},
IPA_TX_INSTANCE_UL },
[IPA_5_1_APQ][IPA_CLIENT_USB_DPL_CONS] = {
true, IPA_v5_0_GROUP_DL,
false,
IPA_DPS_HPS_SEQ_TYPE_INVALID,
QMB_MASTER_SELECT_DDR,
{ 24, 20, 5, 5, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0},
IPA_TX_INSTANCE_DL },
[IPA_5_1_APQ][IPA_CLIENT_ODL_DPL_CONS] = {
true, IPA_v5_0_GROUP_DL,
false,
IPA_DPS_HPS_SEQ_TYPE_INVALID,
QMB_MASTER_SELECT_DDR,
{ 25, 2, 5, 5, IPA_EE_AP, GSI_ESCAPE_BUF_ONLY, 0},
IPA_TX_INSTANCE_DL },
[IPA_5_1_APQ][IPA_CLIENT_USB_CONS] = {
true, IPA_v5_0_GROUP_DL,
false,
IPA_DPS_HPS_SEQ_TYPE_INVALID,
QMB_MASTER_SELECT_DDR,
{ 29, 23, 9, 9, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3},
IPA_TX_INSTANCE_DL },
};
static struct ipa3_mem_partition ipa_4_1_mem_part = {
@@ -6189,6 +6301,8 @@ u8 ipa3_get_hw_type_index(void)
break;
case IPA_HW_v5_1:
hw_type_index = IPA_5_1;
if (ipa3_ctx->platform_type == IPA_PLAT_TYPE_APQ)
hw_type_index = IPA_5_1_APQ;
break;
default:
IPAERR("Incorrect IPA version %d\n", ipa3_ctx->ipa_hw_type);
@@ -10009,6 +10123,7 @@ static void ipa3_write_rsrc_grp_type_reg(int group_index,
case IPA_5_0:
case IPA_5_0_MHI:
case IPA_5_1:
case IPA_5_1_APQ:
if (src) {
switch (group_index) {
case IPA_v5_0_GROUP_UL:
@@ -10250,6 +10365,7 @@ void ipa3_set_resorce_groups_min_max_limits(void)
case IPA_5_0:
case IPA_5_0_MHI:
case IPA_5_1:
case IPA_5_1_APQ:
src_rsrc_type_max = IPA_v5_0_RSRC_GRP_TYPE_SRC_MAX;
dst_rsrc_type_max = IPA_v5_0_RSRC_GRP_TYPE_DST_MAX;
src_grp_idx_max = IPA_v5_0_SRC_GROUP_MAX;