diff options
| author | Himanshu Agarwal <himanaga@codeaurora.org> | 2017-11-17 17:36:34 +0530 |
|---|---|---|
| committer | snandini <snandini@codeaurora.org> | 2018-01-24 14:03:45 -0800 |
| commit | 1690f367b986f2df75c850ec9efa9de350aa8429 (patch) | |
| tree | 178339c65914e2a2db23c8c5989eff2f744ec5bf | |
| parent | c0906b14a0f9f6e4ffc7d90b758f6473762b6a77 (diff) | |
qcacld-3.0: Add support to get IPA SMMU status
Add support to get IPA SMMU status
Change-Id: I0e476b465bcaa2c5e8ae58c0783265e78ebc8181
CRs-Fixed: 2176317
| -rw-r--r-- | core/cds/inc/cds_api.h | 4 | ||||
| -rw-r--r-- | core/cds/src/cds_api.c | 42 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_driver_ops.c | 24 |
3 files changed, 52 insertions, 18 deletions
diff --git a/core/cds/inc/cds_api.h b/core/cds/inc/cds_api.h index cf6935f2c190..b24fa3522c46 100644 --- a/core/cds/inc/cds_api.h +++ b/core/cds/inc/cds_api.h @@ -541,9 +541,9 @@ void cds_print_htc_credit_history(uint32_t count, qdf_abstract_print * print, * This API checks if SMMU S1 translation is enabled in * platform driver or not and sets it accordingly in driver. * - * Return: none + * Return: QDF_STATUS */ -void cds_smmu_mem_map_setup(qdf_device_t osdev); +QDF_STATUS cds_smmu_mem_map_setup(qdf_device_t osdev); /** * cds_smmu_map_unmap() - Map / Unmap DMA buffer to IPA UC diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c index dfabe8813fef..b6e42932546a 100644 --- a/core/cds/src/cds_api.c +++ b/core/cds/src/cds_api.c @@ -2876,21 +2876,44 @@ cds_print_htc_credit_history(uint32_t count, qdf_abstract_print *print, #endif #ifdef ENABLE_SMMU_S1_TRANSLATION -void cds_smmu_mem_map_setup(qdf_device_t osdev) +QDF_STATUS cds_smmu_mem_map_setup(qdf_device_t osdev) { int attr = 0; + bool ipa_smmu_enable; struct dma_iommu_mapping *mapping = pld_smmu_get_mapping(osdev->dev); osdev->smmu_s1_enabled = false; - if (!mapping) { - cds_info("No SMMU mapping present"); - return; + + ipa_smmu_enable = qdf_get_ipa_smmu_status(); + 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_smmu_enable) { + cds_info("SMMU enabled from both IPA and WLAN side"); + osdev->smmu_s1_enabled = true; + return QDF_STATUS_SUCCESS; + } else { + cds_err("SMMU mismatch: IPA: disable, WLAN: enable"); + return QDF_STATUS_E_FAILURE; + } + } else { + cds_info("No SMMU mapping present or SMMU disabled from WLAN side"); + if (ipa_smmu_enable) { + cds_err("SMMU mismatch: IPA: enable, WLAN: disable"); + return QDF_STATUS_E_FAILURE; + } else { + cds_info("SMMU diabled from both IPA and WLAN side"); + return QDF_STATUS_SUCCESS; + } } - if ((iommu_domain_get_attr(mapping->domain, - DOMAIN_ATTR_S1_BYPASS, &attr) == 0) && - !attr) - osdev->smmu_s1_enabled = true; + return QDF_STATUS_SUCCESS; } #ifdef IPA_OFFLOAD @@ -2906,9 +2929,10 @@ int cds_smmu_map_unmap(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr) #endif #else -void cds_smmu_mem_map_setup(qdf_device_t osdev) +QDF_STATUS cds_smmu_mem_map_setup(qdf_device_t osdev) { osdev->smmu_s1_enabled = false; + return QDF_STATUS_SUCCESS; } int cds_smmu_map_unmap(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr) diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index 31284c07aa9d..c8fdcec3aaf4 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -301,24 +301,30 @@ void hdd_hif_close(void *hif_ctx) * @bus_type: Underlying bus type * @bid: Bus id passed by platform driver * - * Return: void + * Return: 0 - success, < 0 - failure */ -static void hdd_init_qdf_ctx(struct device *dev, void *bdev, - enum qdf_bus_type bus_type, - const struct hif_bus_id *bid) +static int hdd_init_qdf_ctx(struct device *dev, void *bdev, + enum qdf_bus_type bus_type, + const struct hif_bus_id *bid) { qdf_device_t qdf_dev = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); if (!qdf_dev) { hdd_err("Invalid QDF device"); - return; + return -EINVAL; } qdf_dev->dev = dev; qdf_dev->drv_hdl = bdev; qdf_dev->bus_type = bus_type; qdf_dev->bid = bid; - cds_smmu_mem_map_setup(qdf_dev); + if (cds_smmu_mem_map_setup(qdf_dev) != + QDF_STATUS_SUCCESS) { + hdd_err("cds_smmu_mem_map_setup() failed"); + return -EFAULT; + } + + return 0; } /** @@ -385,7 +391,10 @@ static int wlan_hdd_probe(struct device *dev, void *bdev, const struct hif_bus_i else cds_set_load_in_progress(true); - hdd_init_qdf_ctx(dev, bdev, bus_type, (const struct hif_bus_id *)bid); + ret = hdd_init_qdf_ctx(dev, bdev, bus_type, + (const struct hif_bus_id *)bid); + if (ret < 0) + goto err_init_qdf_ctx; if (reinit) { ret = hdd_wlan_re_init(); @@ -431,6 +440,7 @@ err_hdd_deinit: } else cds_set_load_in_progress(false); +err_init_qdf_ctx: hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT); hdd_remove_pm_qos(dev); |
