qcacmn: add API to do IPA Tx buf smmu_unmapping for Hastings

Add API to do IPA Tx buf SMMU-S1 unmapping and register it
with cdp ops for Hastings, also assert if map/unmap failed.

Change-Id: I4071b5fccd84c3c97b9dccc40c6f798d70993189
CRs-Fixed: 2792170
This commit is contained in:
Vevek Venkatesan
2020-10-07 00:06:33 +05:30
committed by snandini
parent e2ec5b2d46
commit 3970f133ee
3 changed files with 59 additions and 19 deletions

View File

@@ -106,11 +106,9 @@ static QDF_STATUS __dp_ipa_handle_buf_smmu_mapping(struct dp_soc *soc,
size);
if (create)
qdf_ipa_wdi_create_smmu_mapping(1, &mem_map_table);
return qdf_ipa_wdi_create_smmu_mapping(1, &mem_map_table);
else
qdf_ipa_wdi_release_smmu_mapping(1, &mem_map_table);
return QDF_STATUS_SUCCESS;
return qdf_ipa_wdi_release_smmu_mapping(1, &mem_map_table);
}
QDF_STATUS dp_ipa_handle_rx_buf_smmu_mapping(struct dp_soc *soc,
@@ -169,6 +167,11 @@ static QDF_STATUS __dp_ipa_tx_buf_smmu_mapping(
qdf_nbuf_t nbuf;
uint32_t buf_len;
if (!ipa_is_ready()) {
dp_info("IPA is not READY");
return 0;
}
for (index = 0; index < tx_buffer_cnt; index++) {
nbuf = (qdf_nbuf_t)
soc->ipa_uc_tx_rsc.tx_buf_pool_vaddr_unaligned[index];
@@ -176,8 +179,10 @@ static QDF_STATUS __dp_ipa_tx_buf_smmu_mapping(
continue;
buf_len = qdf_nbuf_get_data_len(nbuf);
ret = __dp_ipa_handle_buf_smmu_mapping(
soc, nbuf, buf_len, true);
soc, nbuf, buf_len, create);
qdf_assert_always(!ret);
}
return ret;
}
@@ -294,19 +299,12 @@ static void dp_tx_ipa_uc_detach(struct dp_soc *soc, struct dp_pdev *pdev)
int idx;
qdf_nbuf_t nbuf;
struct dp_ipa_resources *ipa_res;
bool is_ipa_ready = qdf_ipa_is_ready();
uint32_t buf_len;
for (idx = 0; idx < soc->ipa_uc_tx_rsc.alloc_tx_buf_cnt; idx++) {
nbuf = (qdf_nbuf_t)
soc->ipa_uc_tx_rsc.tx_buf_pool_vaddr_unaligned[idx];
if (!nbuf)
continue;
buf_len = qdf_nbuf_get_data_len(nbuf);
if (qdf_mem_smmu_s1_enabled(soc->osdev) && is_ipa_ready)
__dp_ipa_handle_buf_smmu_mapping(
soc, nbuf, buf_len, false);
qdf_nbuf_unmap_single(soc->osdev, nbuf, QDF_DMA_BIDIRECTIONAL);
qdf_nbuf_free(nbuf);
soc->ipa_uc_tx_rsc.tx_buf_pool_vaddr_unaligned[idx] =
@@ -2049,6 +2047,30 @@ QDF_STATUS dp_ipa_tx_buf_smmu_mapping(
return QDF_STATUS_SUCCESS;
}
ret = __dp_ipa_tx_buf_smmu_mapping(soc, pdev, true);
return ret;
}
QDF_STATUS dp_ipa_tx_buf_smmu_unmapping(
struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
{
QDF_STATUS ret;
struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
struct dp_pdev *pdev =
dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id);
if (!pdev) {
dp_err("%s invalid instance", __func__);
return QDF_STATUS_E_FAILURE;
}
if (!qdf_mem_smmu_s1_enabled(soc->osdev)) {
dp_debug("SMMU S1 disabled");
return QDF_STATUS_SUCCESS;
}
ret = __dp_ipa_tx_buf_smmu_mapping(soc, pdev, false);
return ret;
}

View File

@@ -250,16 +250,27 @@ bool dp_ipa_is_mdm_platform(void);
qdf_nbuf_t dp_ipa_handle_rx_reo_reinject(struct dp_soc *soc, qdf_nbuf_t nbuf);
/**
* dp_ipa_tx_buf_smmu_mapping() Create SMMU mappings for IPA
* allocated TX buffers
* @soc_hdl - handle to the soc
* @pdev_id - pdev id number, to get the handle
* dp_ipa_tx_buf_smmu_mapping() - Create SMMU mappings for IPA
* allocated TX buffers
* @soc_hdl: handle to the soc
* @pdev_id: pdev id number, to get the handle
*
* Return: QDF_STATUS
*/
QDF_STATUS dp_ipa_tx_buf_smmu_mapping(
struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
/**
* dp_ipa_tx_buf_smmu_unmapping() - Release SMMU mappings for IPA
* allocated TX buffers
* @soc_hdl: handle to the soc
* @pdev_id: pdev id number, to get the handle
*
* Return: QDF_STATUS
*/
QDF_STATUS dp_ipa_tx_buf_smmu_unmapping(
struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
#else
static inline int dp_ipa_uc_detach(struct dp_soc *soc, struct dp_pdev *pdev)
{
@@ -291,8 +302,14 @@ static inline qdf_nbuf_t dp_ipa_handle_rx_reo_reinject(struct dp_soc *soc,
return nbuf;
}
static inline QDF_STATUS dp_ipa_tx_buf_smmu_mapping(
struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
static inline QDF_STATUS dp_ipa_tx_buf_smmu_mapping(struct cdp_soc_t *soc_hdl,
uint8_t pdev_id)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS dp_ipa_tx_buf_smmu_unmapping(struct cdp_soc_t *soc_hdl,
uint8_t pdev_id)
{
return QDF_STATUS_SUCCESS;
}

View File

@@ -11430,7 +11430,8 @@ static struct cdp_ipa_ops dp_ops_ipa = {
.ipa_disable_pipes = dp_ipa_disable_pipes,
.ipa_set_perf_level = dp_ipa_set_perf_level,
.ipa_rx_intrabss_fwd = dp_ipa_rx_intrabss_fwd,
.ipa_tx_buf_smmu_mapping = dp_ipa_tx_buf_smmu_mapping
.ipa_tx_buf_smmu_mapping = dp_ipa_tx_buf_smmu_mapping,
.ipa_tx_buf_smmu_unmapping = dp_ipa_tx_buf_smmu_unmapping
};
#endif