From d0bf6403d29e1bcbc5c9354347eafef998f5afe5 Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Fri, 3 Aug 2018 16:22:56 -0700 Subject: [PATCH] qcacld-3.0: Reduce SMMU mapping logs Reduce the number of logs during the SMMU mapping process in cds_smmu_mem_map_setup by refactoring the logic to reduce the number of branches. Change-Id: I1a8b0ece31ab51eaf6f96232b284b61d77c83084 CRs-Fixed: 2291034 --- core/cds/src/cds_api.c | 74 ++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 39 deletions(-) diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c index a563285e95..8c223719be 100644 --- a/core/cds/src/cds_api.c +++ b/core/cds/src/cds_api.c @@ -2735,51 +2735,47 @@ void cds_incr_arp_stats_tx_tgt_acked(void) #ifdef ENABLE_SMMU_S1_TRANSLATION QDF_STATUS cds_smmu_mem_map_setup(qdf_device_t osdev, bool ipa_present) { - int attr = 0; - bool ipa_smmu_enable = false; - struct dma_iommu_mapping *mapping = pld_smmu_get_mapping(osdev->dev); + struct dma_iommu_mapping *mapping; + bool ipa_smmu_enabled; + bool wlan_smmu_enabled; - osdev->smmu_s1_enabled = false; - - if (ipa_present) { - ipa_smmu_enable = qdf_get_ipa_smmu_enabled(); - if (ipa_smmu_enable) - cds_info("SMMU enabled from IPA side"); - else - cds_info("SMMU not enabled from IPA side"); - } - - if (mapping && ((iommu_domain_get_attr(mapping->domain, - DOMAIN_ATTR_S1_BYPASS, &attr) == 0) && - !attr)) { - cds_info("SMMU enabled from WLAN side"); - - if (ipa_present) { - if (ipa_smmu_enable) { - cds_info("SMMU enabled from both IPA and WLAN side"); - osdev->smmu_s1_enabled = true; - } else { - cds_err("SMMU mismatch: IPA: disable, WLAN: enable"); - return QDF_STATUS_E_FAILURE; - } - } else { - osdev->smmu_s1_enabled = true; - } + mapping = pld_smmu_get_mapping(osdev->dev); + if (mapping) { + int attr = 0; + int errno = iommu_domain_get_attr(mapping->domain, + DOMAIN_ATTR_S1_BYPASS, &attr); + wlan_smmu_enabled = !errno && !attr; } else { - cds_info("No SMMU mapping present or SMMU disabled from WLAN side"); - - if (ipa_present) { - if (ipa_smmu_enable) { - cds_err("SMMU mismatch: IPA: enable, WLAN: disable"); - return QDF_STATUS_E_FAILURE; - } else { - cds_info("SMMU disabled from both IPA and WLAN side"); - } - } + cds_info("No SMMU mapping present"); + wlan_smmu_enabled = false; } + + if (!wlan_smmu_enabled) { + osdev->smmu_s1_enabled = false; + goto exit_with_success; + } + + if (!ipa_present) { + osdev->smmu_s1_enabled = true; + goto exit_with_success; + } + + ipa_smmu_enabled = qdf_get_ipa_smmu_enabled(); + + osdev->smmu_s1_enabled = ipa_smmu_enabled && wlan_smmu_enabled; + if (ipa_smmu_enabled != wlan_smmu_enabled) { + cds_err("SMMU mismatch; IPA:%s, WLAN:%s", + ipa_smmu_enabled ? "enabled" : "disabled", + wlan_smmu_enabled ? "enabled" : "disabled"); + return QDF_STATUS_E_FAILURE; + } + +exit_with_success: osdev->iommu_mapping = mapping; + cds_info("SMMU S1 %s", osdev->smmu_s1_enabled ? "enabled" : "disabled"); + return QDF_STATUS_SUCCESS; }