From 983a445b37ff454ef87d38784f67dbda5721dc66 Mon Sep 17 00:00:00 2001 From: Sravan Kumar Kairam Date: Tue, 20 Mar 2018 13:30:22 +0530 Subject: [PATCH] qcacld-3.0: Move IPA SMMU functions to IPA component IPA module has been moved to CLD component under the converged driver model. Move the legacy HDD IPA SMMU functions to the IPA component. Change-Id: I3ac5ebe87cc48913f3e8e075e60737e78664f861 CRs-Fixed: 2177925 --- components/ipa/core/inc/wlan_ipa_core.h | 13 ++++++++++ components/ipa/core/inc/wlan_ipa_main.h | 10 ++++++++ components/ipa/core/src/wlan_ipa_core.c | 25 ++++++++++++++++--- components/ipa/core/src/wlan_ipa_main.c | 5 ++++ .../ipa/dispatcher/inc/wlan_ipa_ucfg_api.h | 16 ++++++++++++ .../ipa/dispatcher/src/wlan_ipa_ucfg_api.c | 5 ++++ core/cds/src/cds_api.c | 2 +- core/hdd/src/wlan_hdd_driver_ops.c | 4 +-- 8 files changed, 74 insertions(+), 6 deletions(-) diff --git a/components/ipa/core/inc/wlan_ipa_core.h b/components/ipa/core/inc/wlan_ipa_core.h index 13ac5b41662b..2ce6ee6c340f 100644 --- a/components/ipa/core/inc/wlan_ipa_core.h +++ b/components/ipa/core/inc/wlan_ipa_core.h @@ -548,5 +548,18 @@ QDF_STATUS wlan_ipa_wlan_evt(qdf_netdev_t net_dev, uint8_t device_mode, enum wlan_ipa_wlan_event ipa_event_type, uint8_t *mac_addr); +/** + * wlan_ipa_uc_smmu_map() - Map / Unmap DMA buffer to IPA UC + * @map: Map / unmap operation + * @num_buf: Number of buffers in array + * @buf_arr: Buffer array of DMA mem mapping info + * + * This API maps/unmaps WLAN-IPA buffers if SMMU S1 translation + * is enabled. + * + * Return: Status of map operation + */ +int wlan_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr); + #endif /* IPA_OFFLOAD */ #endif /* _WLAN_IPA_CORE_H_ */ diff --git a/components/ipa/core/inc/wlan_ipa_main.h b/components/ipa/core/inc/wlan_ipa_main.h index 27afa900e17d..4b15b5b51e77 100644 --- a/components/ipa/core/inc/wlan_ipa_main.h +++ b/components/ipa/core/inc/wlan_ipa_main.h @@ -350,5 +350,15 @@ QDF_STATUS ipa_wlan_evt(struct wlan_objmgr_pdev *pdev, qdf_netdev_t net_dev, enum wlan_ipa_wlan_event ipa_event_type, uint8_t *mac_addr); +/** + * ipa_uc_smmu_map() - Map / Unmap DMA buffer to IPA UC + * @map: Map / unmap operation + * @num_buf: Number of buffers in array + * @buf_arr: Buffer array of DMA mem mapping info + * + * Return: Status of map operation + */ +int ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr); + #endif /* IPA_OFFLOAD */ #endif /* end of _WLAN_IPA_MAIN_H_ */ diff --git a/components/ipa/core/src/wlan_ipa_core.c b/components/ipa/core/src/wlan_ipa_core.c index 363950fc0e3a..b3c642f59199 100644 --- a/components/ipa/core/src/wlan_ipa_core.c +++ b/components/ipa/core/src/wlan_ipa_core.c @@ -216,9 +216,7 @@ static inline void wlan_ipa_wdi_get_wdi_version(struct wlan_ipa_priv *ipa_ctx) static inline bool wlan_ipa_wdi_is_smmu_enabled(struct wlan_ipa_priv *ipa_ctx, qdf_device_t osdev) { - /* TODO: Need to check if SMMU is supported on cld_3.2 */ - /* return hdd_ipa->is_smmu_enabled && qdf_mem_smmu_s1_enabled(osdev); */ - return 0; + return ipa_ctx->is_smmu_enabled && qdf_mem_smmu_s1_enabled(osdev); } static inline QDF_STATUS wlan_ipa_wdi_setup(struct wlan_ipa_priv *ipa_ctx, @@ -331,6 +329,12 @@ static inline void wlan_ipa_wdi_get_wdi_version(struct wlan_ipa_priv *ipa_ctx) { } +static inline int wlan_ipa_wdi_is_smmu_enabled(struct wlan_ipa_priv *ipa_ctx, + qdf_device_t osdev) +{ + return qdf_mem_smmu_s1_enabled(osdev); +} + static inline QDF_STATUS wlan_ipa_wdi_setup(struct wlan_ipa_priv *ipa_ctx, qdf_device_t osdev) { @@ -2587,3 +2591,18 @@ QDF_STATUS wlan_ipa_uc_ol_deinit(struct wlan_ipa_priv *ipa_ctx) ipa_debug("exit: ret=%d", status); return status; } + +int wlan_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr) +{ + ipa_debug("Map: %d Num_buf: %d", map, num_buf); + + if (!num_buf) { + ipa_info("No buffers to map/unmap"); + return 0; + } + + if (map) + return qdf_ipa_create_wdi_mapping(num_buf, buf_arr); + else + return qdf_ipa_release_wdi_mapping(num_buf, buf_arr); +} diff --git a/components/ipa/core/src/wlan_ipa_main.c b/components/ipa/core/src/wlan_ipa_main.c index 4cf4c51994df..0bfd7426417c 100644 --- a/components/ipa/core/src/wlan_ipa_main.c +++ b/components/ipa/core/src/wlan_ipa_main.c @@ -530,3 +530,8 @@ QDF_STATUS ipa_wlan_evt(struct wlan_objmgr_pdev *pdev, qdf_netdev_t net_dev, return wlan_ipa_wlan_evt(net_dev, device_mode, sta_id, session_id, ipa_event_type, mac_addr); } + +int ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr) +{ + return wlan_ipa_uc_smmu_map(map, num_buf, buf_arr); +} diff --git a/components/ipa/dispatcher/inc/wlan_ipa_ucfg_api.h b/components/ipa/dispatcher/inc/wlan_ipa_ucfg_api.h index 99f1a3ac86d9..0f0073c370d6 100644 --- a/components/ipa/dispatcher/inc/wlan_ipa_ucfg_api.h +++ b/components/ipa/dispatcher/inc/wlan_ipa_ucfg_api.h @@ -25,6 +25,7 @@ #include "wlan_ipa_public_struct.h" #include "wlan_ipa_obj_mgmt_api.h" #include "wlan_objmgr_pdev_obj.h" +#include "qdf_types.h" #ifdef IPA_OFFLOAD @@ -271,6 +272,16 @@ QDF_STATUS ucfg_ipa_wlan_evt(struct wlan_objmgr_pdev *pdev, enum wlan_ipa_wlan_event ipa_event_type, uint8_t *mac_addr); +/** + * ucfg_ipa_uc_smmu_map() - Map / Unmap DMA buffer to IPA UC + * @map: Map / unmap operation + * @num_buf: Number of buffers in array + * @buf_arr: Buffer array of DMA mem mapping info + * + * Return: Status of map operation + */ +int ucfg_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr); + #else static inline bool ucfg_ipa_is_present(void) @@ -422,5 +433,10 @@ QDF_STATUS ucfg_ipa_wlan_evt(struct wlan_objmgr_pdev *pdev, return QDF_STATUS_SUCCESS; } +static inline +int ucfg_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr) +{ + return 0; +} #endif /* IPA_OFFLOAD */ #endif /* _WLAN_IPA_UCFG_API_H_ */ diff --git a/components/ipa/dispatcher/src/wlan_ipa_ucfg_api.c b/components/ipa/dispatcher/src/wlan_ipa_ucfg_api.c index c5c5eff2b4d9..3a9f8555d6db 100644 --- a/components/ipa/dispatcher/src/wlan_ipa_ucfg_api.c +++ b/components/ipa/dispatcher/src/wlan_ipa_ucfg_api.c @@ -164,3 +164,8 @@ QDF_STATUS ucfg_ipa_wlan_evt(struct wlan_objmgr_pdev *pdev, return ipa_wlan_evt(pdev, net_dev, device_mode, sta_id, session_id, ipa_event_type, mac_addr); } + +int ucfg_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr) +{ + return ipa_uc_smmu_map(map, num_buf, buf_arr); +} diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c index 1554f3567dcd..51fe41e60cce 100644 --- a/core/cds/src/cds_api.c +++ b/core/cds/src/cds_api.c @@ -2920,7 +2920,7 @@ QDF_STATUS cds_smmu_mem_map_setup(qdf_device_t osdev, bool ipa_present) #ifdef IPA_OFFLOAD int cds_smmu_map_unmap(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr) { - return hdd_ipa_uc_smmu_map(map, num_buf, buf_arr); + return ucfg_ipa_uc_smmu_map(map, num_buf, buf_arr); } #else 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 d74607d683fe..003fb24d59fe 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -47,7 +47,7 @@ #include "cdp_txrx_misc.h" #include "pld_common.h" #include "wlan_hdd_driver_ops.h" -#include "wlan_hdd_ipa.h" +#include "wlan_ipa_ucfg_api.h" #ifdef MODULE #define WLAN_MODULE_NAME module_name(THIS_MODULE) @@ -324,7 +324,7 @@ static int hdd_init_qdf_ctx(struct device *dev, void *bdev, qdf_dev->bus_type = bus_type; qdf_dev->bid = bid; - if (cds_smmu_mem_map_setup(qdf_dev, hdd_ipa_is_present()) != + if (cds_smmu_mem_map_setup(qdf_dev, ucfg_ipa_is_present()) != QDF_STATUS_SUCCESS) { hdd_err("cds_smmu_mem_map_setup() failed"); return -EFAULT;