From 739492cc3d7bba812fbac493c202e581a2d19d00 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 --- ipa/core/inc/wlan_ipa_core.h | 13 +++++++++++++ ipa/core/inc/wlan_ipa_main.h | 10 ++++++++++ ipa/core/src/wlan_ipa_core.c | 25 ++++++++++++++++++++++--- 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 +++++ 6 files changed, 71 insertions(+), 3 deletions(-) diff --git a/ipa/core/inc/wlan_ipa_core.h b/ipa/core/inc/wlan_ipa_core.h index 13ac5b4166..2ce6ee6c34 100644 --- a/ipa/core/inc/wlan_ipa_core.h +++ b/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/ipa/core/inc/wlan_ipa_main.h b/ipa/core/inc/wlan_ipa_main.h index 27afa900e1..4b15b5b51e 100644 --- a/ipa/core/inc/wlan_ipa_main.h +++ b/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/ipa/core/src/wlan_ipa_core.c b/ipa/core/src/wlan_ipa_core.c index 363950fc0e..b3c642f591 100644 --- a/ipa/core/src/wlan_ipa_core.c +++ b/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/ipa/core/src/wlan_ipa_main.c b/ipa/core/src/wlan_ipa_main.c index 4cf4c51994..0bfd742641 100644 --- a/ipa/core/src/wlan_ipa_main.c +++ b/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/ipa/dispatcher/inc/wlan_ipa_ucfg_api.h b/ipa/dispatcher/inc/wlan_ipa_ucfg_api.h index 99f1a3ac86..0f0073c370 100644 --- a/ipa/dispatcher/inc/wlan_ipa_ucfg_api.h +++ b/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/ipa/dispatcher/src/wlan_ipa_ucfg_api.c b/ipa/dispatcher/src/wlan_ipa_ucfg_api.c index c5c5eff2b4..3a9f8555d6 100644 --- a/ipa/dispatcher/src/wlan_ipa_ucfg_api.c +++ b/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); +}