Loading drivers/platform/msm/ipa/ipa_clients/ipa_uc_offload.c +4 −0 Original line number Diff line number Diff line Loading @@ -592,6 +592,10 @@ int ipa_uc_offload_conn_pipes(struct ipa_uc_offload_conn_in_params *inp, return -EPERM; } /*Store the connection info, required during disconnect pipe */ memcpy(&offload_ctx->conn, &inp->u.ntn, sizeof(struct ipa_ntn_conn_in_params)); switch (offload_ctx->proto) { case IPA_UC_NTN: ret = ipa_uc_ntn_conn_pipes(&inp->u.ntn, &outp->u.ntn, Loading drivers/platform/msm/ipa/ipa_v3/ipa_uc_ntn.c +25 −22 Original line number Diff line number Diff line /* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -263,7 +263,7 @@ static int ipa3_uc_send_ntn_setup_pipe_cmd( } static int ipa3_smmu_map_uc_ntn_pipes(struct ipa_ntn_setup_info *params, bool map) bool map, bool map_unmap_once) { struct iommu_domain *smmu_domain; int result; Loading @@ -279,14 +279,16 @@ static int ipa3_smmu_map_uc_ntn_pipes(struct ipa_ntn_setup_info *params, return -EINVAL; } result = ipa3_smmu_map_peer_reg(rounddown(params->ntn_reg_base_ptr_pa, PAGE_SIZE), map, IPA_SMMU_CB_UC); if (map_unmap_once) { result = ipa3_smmu_map_peer_reg(rounddown( params->ntn_reg_base_ptr_pa, PAGE_SIZE), map, IPA_SMMU_CB_UC); if (result) { IPAERR("failed to %s uC regs %d\n", map ? "map" : "unmap", result); goto fail; } } if (params->smmu_enabled) { IPADBG("smmu is enabled on EMAC\n"); result = ipa3_smmu_map_peer_buff((u64)params->ring_base_iova, Loading Loading @@ -349,16 +351,15 @@ static int ipa3_smmu_map_uc_ntn_pipes(struct ipa_ntn_setup_info *params, IPAERR("Fail to map 0x%llx\n", iova); } else { result = iommu_unmap(smmu_domain, iova_p, size_p); if (result != params->data_buff_size) if (result != size_p) { IPAERR("Fail to unmap 0x%llx\n", iova); } if (result) { if (params->smmu_enabled) goto fail_map_data_buff_smmu_enabled; else goto fail_map_data_buff_smmu_disabled; } } } return 0; fail_map_data_buff_smmu_enabled: Loading Loading @@ -396,6 +397,7 @@ int ipa3_setup_uc_ntn_pipes(struct ipa_ntn_conn_in_params *in, int ipa_ep_idx_ul; int ipa_ep_idx_dl; int result = 0; bool unmapped = false; if (in == NULL) { IPAERR("invalid input\n"); Loading Loading @@ -449,7 +451,7 @@ int ipa3_setup_uc_ntn_pipes(struct ipa_ntn_conn_in_params *in, goto fail; } result = ipa3_smmu_map_uc_ntn_pipes(&in->ul, true); result = ipa3_smmu_map_uc_ntn_pipes(&in->ul, true, true); if (result) { IPAERR("failed to map SMMU for UL %d\n", result); goto fail; Loading Loading @@ -488,7 +490,7 @@ int ipa3_setup_uc_ntn_pipes(struct ipa_ntn_conn_in_params *in, goto fail_disable_dp_ul; } result = ipa3_smmu_map_uc_ntn_pipes(&in->dl, true); result = ipa3_smmu_map_uc_ntn_pipes(&in->dl, true, false); if (result) { IPAERR("failed to map SMMU for DL %d\n", result); goto fail_disable_dp_ul; Loading Loading @@ -519,11 +521,12 @@ int ipa3_setup_uc_ntn_pipes(struct ipa_ntn_conn_in_params *in, fail_disable_dp_dl: ipa3_disable_data_path(ipa_ep_idx_dl); fail_smmu_unmap_dl: ipa3_smmu_map_uc_ntn_pipes(&in->dl, false); ipa3_smmu_map_uc_ntn_pipes(&in->dl, false, true); unmapped = true; fail_disable_dp_ul: ipa3_disable_data_path(ipa_ep_idx_ul); fail_smmu_unmap_ul: ipa3_smmu_map_uc_ntn_pipes(&in->ul, false); ipa3_smmu_map_uc_ntn_pipes(&in->ul, false, !unmapped); fail: IPA_ACTIVE_CLIENTS_DEC_SIMPLE(); return result; Loading Loading @@ -603,7 +606,7 @@ int ipa3_tear_down_uc_offload_pipes(int ipa_ep_idx_ul, } /* unmap the DL pipe */ result = ipa3_smmu_map_uc_ntn_pipes(¶ms->dl, false); result = ipa3_smmu_map_uc_ntn_pipes(¶ms->dl, false, true); if (result) { IPAERR("failed to unmap SMMU for DL %d\n", result); goto fail; Loading @@ -624,7 +627,7 @@ int ipa3_tear_down_uc_offload_pipes(int ipa_ep_idx_ul, } /* unmap the UL pipe */ result = ipa3_smmu_map_uc_ntn_pipes(¶ms->ul, false); result = ipa3_smmu_map_uc_ntn_pipes(¶ms->ul, false, false); if (result) { IPAERR("failed to unmap SMMU for UL %d\n", result); goto fail; Loading Loading
drivers/platform/msm/ipa/ipa_clients/ipa_uc_offload.c +4 −0 Original line number Diff line number Diff line Loading @@ -592,6 +592,10 @@ int ipa_uc_offload_conn_pipes(struct ipa_uc_offload_conn_in_params *inp, return -EPERM; } /*Store the connection info, required during disconnect pipe */ memcpy(&offload_ctx->conn, &inp->u.ntn, sizeof(struct ipa_ntn_conn_in_params)); switch (offload_ctx->proto) { case IPA_UC_NTN: ret = ipa_uc_ntn_conn_pipes(&inp->u.ntn, &outp->u.ntn, Loading
drivers/platform/msm/ipa/ipa_v3/ipa_uc_ntn.c +25 −22 Original line number Diff line number Diff line /* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -263,7 +263,7 @@ static int ipa3_uc_send_ntn_setup_pipe_cmd( } static int ipa3_smmu_map_uc_ntn_pipes(struct ipa_ntn_setup_info *params, bool map) bool map, bool map_unmap_once) { struct iommu_domain *smmu_domain; int result; Loading @@ -279,14 +279,16 @@ static int ipa3_smmu_map_uc_ntn_pipes(struct ipa_ntn_setup_info *params, return -EINVAL; } result = ipa3_smmu_map_peer_reg(rounddown(params->ntn_reg_base_ptr_pa, PAGE_SIZE), map, IPA_SMMU_CB_UC); if (map_unmap_once) { result = ipa3_smmu_map_peer_reg(rounddown( params->ntn_reg_base_ptr_pa, PAGE_SIZE), map, IPA_SMMU_CB_UC); if (result) { IPAERR("failed to %s uC regs %d\n", map ? "map" : "unmap", result); goto fail; } } if (params->smmu_enabled) { IPADBG("smmu is enabled on EMAC\n"); result = ipa3_smmu_map_peer_buff((u64)params->ring_base_iova, Loading Loading @@ -349,16 +351,15 @@ static int ipa3_smmu_map_uc_ntn_pipes(struct ipa_ntn_setup_info *params, IPAERR("Fail to map 0x%llx\n", iova); } else { result = iommu_unmap(smmu_domain, iova_p, size_p); if (result != params->data_buff_size) if (result != size_p) { IPAERR("Fail to unmap 0x%llx\n", iova); } if (result) { if (params->smmu_enabled) goto fail_map_data_buff_smmu_enabled; else goto fail_map_data_buff_smmu_disabled; } } } return 0; fail_map_data_buff_smmu_enabled: Loading Loading @@ -396,6 +397,7 @@ int ipa3_setup_uc_ntn_pipes(struct ipa_ntn_conn_in_params *in, int ipa_ep_idx_ul; int ipa_ep_idx_dl; int result = 0; bool unmapped = false; if (in == NULL) { IPAERR("invalid input\n"); Loading Loading @@ -449,7 +451,7 @@ int ipa3_setup_uc_ntn_pipes(struct ipa_ntn_conn_in_params *in, goto fail; } result = ipa3_smmu_map_uc_ntn_pipes(&in->ul, true); result = ipa3_smmu_map_uc_ntn_pipes(&in->ul, true, true); if (result) { IPAERR("failed to map SMMU for UL %d\n", result); goto fail; Loading Loading @@ -488,7 +490,7 @@ int ipa3_setup_uc_ntn_pipes(struct ipa_ntn_conn_in_params *in, goto fail_disable_dp_ul; } result = ipa3_smmu_map_uc_ntn_pipes(&in->dl, true); result = ipa3_smmu_map_uc_ntn_pipes(&in->dl, true, false); if (result) { IPAERR("failed to map SMMU for DL %d\n", result); goto fail_disable_dp_ul; Loading Loading @@ -519,11 +521,12 @@ int ipa3_setup_uc_ntn_pipes(struct ipa_ntn_conn_in_params *in, fail_disable_dp_dl: ipa3_disable_data_path(ipa_ep_idx_dl); fail_smmu_unmap_dl: ipa3_smmu_map_uc_ntn_pipes(&in->dl, false); ipa3_smmu_map_uc_ntn_pipes(&in->dl, false, true); unmapped = true; fail_disable_dp_ul: ipa3_disable_data_path(ipa_ep_idx_ul); fail_smmu_unmap_ul: ipa3_smmu_map_uc_ntn_pipes(&in->ul, false); ipa3_smmu_map_uc_ntn_pipes(&in->ul, false, !unmapped); fail: IPA_ACTIVE_CLIENTS_DEC_SIMPLE(); return result; Loading Loading @@ -603,7 +606,7 @@ int ipa3_tear_down_uc_offload_pipes(int ipa_ep_idx_ul, } /* unmap the DL pipe */ result = ipa3_smmu_map_uc_ntn_pipes(¶ms->dl, false); result = ipa3_smmu_map_uc_ntn_pipes(¶ms->dl, false, true); if (result) { IPAERR("failed to unmap SMMU for DL %d\n", result); goto fail; Loading @@ -624,7 +627,7 @@ int ipa3_tear_down_uc_offload_pipes(int ipa_ep_idx_ul, } /* unmap the UL pipe */ result = ipa3_smmu_map_uc_ntn_pipes(¶ms->ul, false); result = ipa3_smmu_map_uc_ntn_pipes(¶ms->ul, false, false); if (result) { IPAERR("failed to unmap SMMU for UL %d\n", result); goto fail; Loading