From e2df375d79ccd2a4f399f8c9accd8041c5aa3b34 Mon Sep 17 00:00:00 2001 From: Bojun Pan Date: Mon, 9 Sep 2019 16:51:23 -0700 Subject: [PATCH 1/2] msm: ipa: update mem_part table for IPA SRAM mem_partition table update for IPA SRAM. Change-Id: I1cabeeca7eef8f82792d30f5a62c06bc3e08b049 Signed-off-by: Bojun Pan --- drivers/platform/msm/ipa/ipa_v3/ipa_utils.c | 101 +++++++++++++++++++- 1 file changed, 100 insertions(+), 1 deletion(-) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c index cf4bd73596ab..f4da982e5f3a 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c @@ -3439,6 +3439,103 @@ static struct ipa3_mem_partition ipa_4_7_mem_part = { .end_ofst = 0x3000, }; +static struct ipa3_mem_partition ipa_4_9_mem_part = { + .uc_info_ofst = 0x80, + .uc_info_size = 0x200, + .ofst_start = 0x280, + .v4_flt_hash_ofst = 0x288, + .v4_flt_hash_size = 0x78, + .v4_flt_hash_size_ddr = 0x4000, + .v4_flt_nhash_ofst = 0x308, + .v4_flt_nhash_size = 0x78, + .v4_flt_nhash_size_ddr = 0x4000, + .v6_flt_hash_ofst = 0x388, + .v6_flt_hash_size = 0x78, + .v6_flt_hash_size_ddr = 0x4000, + .v6_flt_nhash_ofst = 0x408, + .v6_flt_nhash_size = 0x78, + .v6_flt_nhash_size_ddr = 0x4000, + .v4_rt_num_index = 0xf, + .v4_modem_rt_index_lo = 0x0, + .v4_modem_rt_index_hi = 0x7, + .v4_apps_rt_index_lo = 0x8, + .v4_apps_rt_index_hi = 0xe, + .v4_rt_hash_ofst = 0x488, + .v4_rt_hash_size = 0x78, + .v4_rt_hash_size_ddr = 0x4000, + .v4_rt_nhash_ofst = 0x508, + .v4_rt_nhash_size = 0x78, + .v4_rt_nhash_size_ddr = 0x4000, + .v6_rt_num_index = 0xf, + .v6_modem_rt_index_lo = 0x0, + .v6_modem_rt_index_hi = 0x7, + .v6_apps_rt_index_lo = 0x8, + .v6_apps_rt_index_hi = 0xe, + .v6_rt_hash_ofst = 0x588, + .v6_rt_hash_size = 0x78, + .v6_rt_hash_size_ddr = 0x4000, + .v6_rt_nhash_ofst = 0x608, + .v6_rt_nhash_size = 0x78, + .v6_rt_nhash_size_ddr = 0x4000, + .modem_hdr_ofst = 0x688, + .modem_hdr_size = 0x240, + .apps_hdr_ofst = 0x8c8, + .apps_hdr_size = 0x200, + .apps_hdr_size_ddr = 0x800, + .modem_hdr_proc_ctx_ofst = 0xad0, + .modem_hdr_proc_ctx_size = 0xb20, + .apps_hdr_proc_ctx_ofst = 0x15f0, + .apps_hdr_proc_ctx_size = 0x200, + .apps_hdr_proc_ctx_size_ddr = 0x0, + .nat_tbl_ofst = 0x1800, + .nat_tbl_size = 0x800, + .nat_index_tbl_ofst = 0x2000, + .nat_index_tbl_size = 0x100, + .nat_exp_tbl_ofst = 0x2100, + .nat_exp_tbl_size = 0x400, + .stats_quota_ofst = 0x2510, + .stats_quota_size = 0x78, + .stats_tethering_ofst = 0x2588, + .stats_tethering_size = 0x238, + .stats_flt_v4_ofst = 0, + .stats_flt_v4_size = 0, + .stats_flt_v6_ofst = 0, + .stats_flt_v6_size = 0, + .stats_rt_v4_ofst = 0, + .stats_rt_v4_size = 0, + .stats_rt_v6_ofst = 0, + .stats_rt_v6_size = 0, + .stats_fnr_ofst = 0x27c0, + .stats_fnr_size = 0x800, + .stats_drop_ofst = 0x2fc0, + .stats_drop_size = 0x20, + .modem_comp_decomp_ofst = 0x0, + .modem_comp_decomp_size = 0x0, + .modem_ofst = 0x2fe8, + .modem_size = 0x800, + .apps_v4_flt_hash_ofst = 0x2718, + .apps_v4_flt_hash_size = 0x0, + .apps_v4_flt_nhash_ofst = 0x2718, + .apps_v4_flt_nhash_size = 0x0, + .apps_v6_flt_hash_ofst = 0x2718, + .apps_v6_flt_hash_size = 0x0, + .apps_v6_flt_nhash_ofst = 0x2718, + .apps_v6_flt_nhash_size = 0x0, + .apps_v4_rt_hash_ofst = 0x2718, + .apps_v4_rt_hash_size = 0x0, + .apps_v4_rt_nhash_ofst = 0x2718, + .apps_v4_rt_nhash_size = 0x0, + .apps_v6_rt_hash_ofst = 0x2718, + .apps_v6_rt_hash_size = 0x0, + .apps_v6_rt_nhash_ofst = 0x2718, + .apps_v6_rt_nhash_size = 0x0, + .uc_descriptor_ram_ofst = 0x3800, + .uc_descriptor_ram_size = 0x1000, + .pdn_config_ofst = 0x4800, + .pdn_config_size = 0x50, + .end_ofst = 0x4850, +}; + /** * ipa3_get_clients_from_rm_resource() - get IPA clients which are related to an * IPA_RM resource @@ -5796,9 +5893,11 @@ int ipa3_init_mem_partition(enum ipa_hw_type type) ipa3_ctx->ctrl->mem_partition = &ipa_4_5_mem_part; break; case IPA_HW_v4_7: - case IPA_HW_v4_9: ipa3_ctx->ctrl->mem_partition = &ipa_4_7_mem_part; break; + case IPA_HW_v4_9: + ipa3_ctx->ctrl->mem_partition = &ipa_4_9_mem_part; + break; case IPA_HW_None: case IPA_HW_v1_0: case IPA_HW_v1_1: From bc912e31b95fc9fb32414722dc2fffcfffc80c54 Mon Sep 17 00:00:00 2001 From: Bojun Pan Date: Fri, 4 Oct 2019 13:36:46 -0700 Subject: [PATCH 2/2] msm: gsi: gsi channel QoS register update GSI QoS register upgrade for GSI v2.9, introduce the new field of db_in_bytes. Change-Id: I1d0ff4381a6b6ac1f5119d0be2efea29a49a5dcc Signed-off-by: Bojun Pan --- drivers/platform/msm/gsi/gsi.c | 35 +++++++++++++++++-- drivers/platform/msm/gsi/gsi_reg_v2.h | 14 ++++++++ .../platform/msm/ipa/ipa_clients/ipa_usb.c | 1 + drivers/platform/msm/ipa/ipa_v3/ipa_dp.c | 2 ++ drivers/platform/msm/ipa/ipa_v3/ipa_mhi.c | 1 + drivers/platform/msm/ipa/ipa_v3/ipa_wdi3_i.c | 1 + drivers/platform/msm/ipa/ipa_v3/ipa_wigig_i.c | 1 + include/linux/msm_gsi.h | 1 + 8 files changed, 54 insertions(+), 2 deletions(-) diff --git a/drivers/platform/msm/gsi/gsi.c b/drivers/platform/msm/gsi/gsi.c index 857109d0df31..d196133dd899 100644 --- a/drivers/platform/msm/gsi/gsi.c +++ b/drivers/platform/msm/gsi/gsi.c @@ -2105,7 +2105,7 @@ static void gsi_program_chan_ctx_qos(struct gsi_chan_props *props, GSI_EE_n_GSI_CH_k_QOS_MAX_PREFETCH_BMSK) | ((props->use_db_eng << GSI_EE_n_GSI_CH_k_QOS_USE_DB_ENG_SHFT) & - GSI_EE_n_GSI_CH_k_QOS_USE_DB_ENG_BMSK)); + GSI_EE_n_GSI_CH_k_QOS_USE_DB_ENG_BMSK)); if (gsi_ctx->per.ver >= GSI_VER_2_0) val |= ((props->prefetch_mode << GSI_EE_n_GSI_CH_k_QOS_USE_ESCAPE_BUF_ONLY_SHFT) @@ -2141,6 +2141,35 @@ static void gsi_program_chan_ctx_qos_v2_5(struct gsi_chan_props *props, GSI_V2_5_EE_n_GSI_CH_k_QOS_OFFS(props->ch_id, ee)); } +static void gsi_program_chan_ctx_qos_v2_9(struct gsi_chan_props *props, + unsigned int ee) +{ + uint32_t val; + + val = + (((props->low_weight << + GSI_V2_9_EE_n_GSI_CH_k_QOS_WRR_WEIGHT_SHFT) & + GSI_V2_9_EE_n_GSI_CH_k_QOS_WRR_WEIGHT_BMSK) | + ((props->max_prefetch << + GSI_V2_9_EE_n_GSI_CH_k_QOS_MAX_PREFETCH_SHFT) & + GSI_V2_9_EE_n_GSI_CH_k_QOS_MAX_PREFETCH_BMSK) | + ((props->use_db_eng << + GSI_V2_9_EE_n_GSI_CH_k_QOS_USE_DB_ENG_SHFT) & + GSI_V2_9_EE_n_GSI_CH_k_QOS_USE_DB_ENG_BMSK) | + ((props->prefetch_mode << + GSI_V2_9_EE_n_GSI_CH_k_QOS_PREFETCH_MODE_SHFT) & + GSI_V2_9_EE_n_GSI_CH_k_QOS_PREFETCH_MODE_BMSK) | + ((props->empty_lvl_threshold << + GSI_V2_9_EE_n_GSI_CH_k_QOS_EMPTY_LVL_THRSHOLD_SHFT) & + GSI_V2_9_EE_n_GSI_CH_k_QOS_EMPTY_LVL_THRSHOLD_BMSK) | + ((props->db_in_bytes << + GSI_V2_9_EE_n_GSI_CH_k_QOS_DB_IN_BYTES_SHFT) & + GSI_V2_9_EE_n_GSI_CH_k_QOS_DB_IN_BYTES_BMSK)); + + gsi_writel(val, gsi_ctx->base + + GSI_V2_9_EE_n_GSI_CH_k_QOS_OFFS(props->ch_id, ee)); +} + static void gsi_program_chan_ctx(struct gsi_chan_props *props, unsigned int ee, uint8_t erindex) { @@ -2205,7 +2234,9 @@ static void gsi_program_chan_ctx(struct gsi_chan_props *props, unsigned int ee, gsi_writel(val, gsi_ctx->base + GSI_EE_n_GSI_CH_k_CNTXT_3_OFFS(props->ch_id, ee)); - if (gsi_ctx->per.ver >= GSI_VER_2_5) + if (gsi_ctx->per.ver >= GSI_VER_2_9) + gsi_program_chan_ctx_qos_v2_9(props, ee); + else if (gsi_ctx->per.ver >= GSI_VER_2_5) gsi_program_chan_ctx_qos_v2_5(props, ee); else gsi_program_chan_ctx_qos(props, ee); diff --git a/drivers/platform/msm/gsi/gsi_reg_v2.h b/drivers/platform/msm/gsi/gsi_reg_v2.h index e93180c5dee2..1615697521a0 100644 --- a/drivers/platform/msm/gsi/gsi_reg_v2.h +++ b/drivers/platform/msm/gsi/gsi_reg_v2.h @@ -550,6 +550,20 @@ #define GSI_V2_5_EE_n_GSI_CH_k_QOS_WRR_WEIGHT_BMSK 0xf #define GSI_V2_5_EE_n_GSI_CH_k_QOS_WRR_WEIGHT_SHFT 0x0 +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_OFFS(k, n) \ + (GSI_GSI_REG_BASE_OFFS + 0x0000f05c + 0x4000 * (n) + 0x80 * (k)) +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_DB_IN_BYTES_BMSK 0x1000000 +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_DB_IN_BYTES_SHFT 0x18 +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_EMPTY_LVL_THRSHOLD_BMSK 0xff0000 +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_EMPTY_LVL_THRSHOLD_SHFT 0x10 +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_PREFETCH_MODE_BMSK 0x3c00 +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_PREFETCH_MODE_SHFT 0xa +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_USE_DB_ENG_BMSK 0x200 +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_USE_DB_ENG_SHFT 0x9 +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_MAX_PREFETCH_BMSK 0x100 +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_MAX_PREFETCH_SHFT 0x8 +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_WRR_WEIGHT_BMSK 0xf +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_WRR_WEIGHT_SHFT 0x0 #define GSI_EE_n_GSI_CH_k_SCRATCH_0_OFFS(k, n) \ (GSI_GSI_REG_BASE_OFFS + 0x0000f060 + 0x4000 * (n) + 0x80 * (k)) diff --git a/drivers/platform/msm/ipa/ipa_clients/ipa_usb.c b/drivers/platform/msm/ipa/ipa_clients/ipa_usb.c index 06093bffc554..24535a2a31d7 100644 --- a/drivers/platform/msm/ipa/ipa_clients/ipa_usb.c +++ b/drivers/platform/msm/ipa/ipa_clients/ipa_usb.c @@ -1192,6 +1192,7 @@ static int ipa3_usb_request_xdci_channel( chan_params.chan_params.use_db_eng = GSI_CHAN_DIRECT_MODE; else chan_params.chan_params.use_db_eng = GSI_CHAN_DB_MODE; + chan_params.chan_params.db_in_bytes = 1; chan_params.chan_params.max_prefetch = GSI_ONE_PREFETCH_SEG; if (params->dir == GSI_CHAN_DIR_FROM_GSI) chan_params.chan_params.low_weight = diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c index ed77d983c392..ac0d6f0f2777 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c @@ -4481,6 +4481,7 @@ static int ipa_gsi_setup_transfer_ring(struct ipa3_ep_context *ep, gsi_channel_props.low_weight = IPA_GSI_MAX_CH_LOW_WEIGHT; else gsi_channel_props.low_weight = 1; + gsi_channel_props.db_in_bytes = 1; gsi_channel_props.prefetch_mode = gsi_ep_info->prefetch_mode; gsi_channel_props.empty_lvl_threshold = gsi_ep_info->prefetch_threshold; gsi_channel_props.chan_user_data = user_data; @@ -4805,6 +4806,7 @@ int ipa_gsi_ch20_wa(void) else gsi_channel_props.use_db_eng = GSI_CHAN_DB_MODE; + gsi_channel_props.db_in_bytes = 1; gsi_channel_props.max_prefetch = GSI_ONE_PREFETCH_SEG; gsi_channel_props.low_weight = 1; gsi_channel_props.err_cb = ipa_gsi_chan_err_cb; diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_mhi.c b/drivers/platform/msm/ipa/ipa_v3/ipa_mhi.c index a9816c6d4096..184c622f173c 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_mhi.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_mhi.c @@ -289,6 +289,7 @@ static int ipa_mhi_start_gsi_channel(enum ipa_client_type client, else ch_props.use_db_eng = GSI_CHAN_DB_MODE; + ch_props.db_in_bytes = 1; ch_props.max_prefetch = GSI_ONE_PREFETCH_SEG; ch_props.low_weight = 1; ch_props.prefetch_mode = ep_cfg->prefetch_mode; 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 26d9b338a8e8..eb3b3ad0222b 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_wdi3_i.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_wdi3_i.c @@ -151,6 +151,7 @@ static int ipa3_setup_wdi3_gsi_channel(u8 is_smmu_enabled, } else gsi_channel_props.ch_id = gsi_ep_info->ipa_gsi_chan_num; + gsi_channel_props.db_in_bytes = 0; gsi_channel_props.evt_ring_hdl = ep->gsi_evt_ring_hdl; gsi_channel_props.re_size = GSI_CHAN_RE_SIZE_16B; gsi_channel_props.use_db_eng = GSI_CHAN_DB_MODE; diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_wigig_i.c b/drivers/platform/msm/ipa/ipa_v3/ipa_wigig_i.c index 52546bd0374b..faab2b1fe689 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_wigig_i.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_wigig_i.c @@ -683,6 +683,7 @@ static int ipa3_wigig_config_gsi(bool Rx, channel_props.evt_ring_hdl = ep->gsi_evt_ring_hdl; channel_props.xfer_cb = NULL; + channel_props.db_in_bytes = 0; channel_props.use_db_eng = GSI_CHAN_DB_MODE; channel_props.max_prefetch = GSI_ONE_PREFETCH_SEG; channel_props.prefetch_mode = ep_gsi->prefetch_mode; diff --git a/include/linux/msm_gsi.h b/include/linux/msm_gsi.h index 33c7f3582911..7a680da1416f 100644 --- a/include/linux/msm_gsi.h +++ b/include/linux/msm_gsi.h @@ -418,6 +418,7 @@ struct gsi_chan_props { uint16_t ring_len; uint16_t max_re_expected; uint64_t ring_base_addr; + uint8_t db_in_bytes; void *ring_base_vaddr; enum gsi_chan_use_db_eng use_db_eng; enum gsi_max_prefetch max_prefetch;