diff --git a/cnss2/main.c b/cnss2/main.c index 3de5a70133..23c628a748 100644 --- a/cnss2/main.c +++ b/cnss2/main.c @@ -699,6 +699,20 @@ int cnss_wlan_disable(struct device *dev, enum cnss_driver_mode mode) } EXPORT_SYMBOL(cnss_wlan_disable); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0)) +int cnss_iommu_map(struct iommu_domain *domain, + unsigned long iova, phys_addr_t paddr, size_t size, int prot) +{ + return iommu_map(domain, iova, paddr, size, prot); +} +#else +int cnss_iommu_map(struct iommu_domain *domain, + unsigned long iova, phys_addr_t paddr, size_t size, int prot) +{ + return iommu_map(domain, iova, paddr, size, prot, GFP_KERNEL); +} +#endif + int cnss_audio_smmu_map(struct device *dev, phys_addr_t paddr, dma_addr_t iova, size_t size) { @@ -718,9 +732,9 @@ int cnss_audio_smmu_map(struct device *dev, phys_addr_t paddr, iova -= page_offset; paddr -= page_offset; - return iommu_map(plat_priv->audio_iommu_domain, iova, paddr, - roundup(size, PAGE_SIZE), IOMMU_READ | IOMMU_WRITE | - IOMMU_CACHE); + return cnss_iommu_map(plat_priv->audio_iommu_domain, iova, paddr, + roundup(size, PAGE_SIZE), IOMMU_READ | + IOMMU_WRITE | IOMMU_CACHE); } EXPORT_SYMBOL(cnss_audio_smmu_map); diff --git a/cnss2/main.h b/cnss2/main.h index d2ccc1d97d..c4344d2fe7 100644 --- a/cnss2/main.h +++ b/cnss2/main.h @@ -746,4 +746,6 @@ int cnss_dev_specific_power_on(struct cnss_plat_data *plat_priv); void cnss_recovery_handler(struct cnss_plat_data *plat_priv); size_t cnss_get_platform_name(struct cnss_plat_data *plat_priv, char *buf, const size_t buf_len); +int cnss_iommu_map(struct iommu_domain *domain, unsigned long iova, + phys_addr_t paddr, size_t size, int prot); #endif /* _CNSS_MAIN_H */ diff --git a/cnss2/pci.c b/cnss2/pci.c index e800049477..61037e0ced 100644 --- a/cnss2/pci.c +++ b/cnss2/pci.c @@ -16,7 +16,6 @@ #include #include #include - #include "main.h" #include "bus.h" #include "debug.h" @@ -427,7 +426,9 @@ static const struct mhi_controller_config cnss_mhi_config_genoa = { CNSS_MHI_SATELLITE_EVT_COUNT, .event_cfg = cnss_mhi_events, .m2_no_db = true, +#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0)) .bhie_offset = 0x0324, +#endif }; static const struct mhi_controller_config cnss_mhi_config_no_satellite = { @@ -5153,8 +5154,8 @@ int cnss_smmu_map(struct device *dev, cnss_pr_dbg("IOMMU map: iova %lx, len %zu\n", iova, len); - ret = iommu_map(pci_priv->iommu_domain, iova, - rounddown(paddr, PAGE_SIZE), len, flag); + ret = cnss_iommu_map(pci_priv->iommu_domain, iova, + rounddown(paddr, PAGE_SIZE), len, flag); if (ret) { cnss_pr_err("PA to IOVA mapping failed, ret %d\n", ret); return ret; @@ -6351,7 +6352,8 @@ static char *cnss_mhi_notify_status_to_str(enum mhi_callback status) return "FATAL_ERROR"; case MHI_CB_EE_MISSION_MODE: return "MISSION_MODE"; -#if IS_ENABLED(CONFIG_MHI_BUS_MISC) +#if IS_ENABLED(CONFIG_MHI_BUS_MISC) && \ +(LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0)) case MHI_CB_FALLBACK_IMG: return "FW_FALLBACK"; #endif @@ -6479,7 +6481,8 @@ static void cnss_mhi_notify_status(struct mhi_controller *mhi_ctrl, cnss_pci_update_status(pci_priv, CNSS_FW_DOWN); cnss_reason = CNSS_REASON_RDDM; break; -#if IS_ENABLED(CONFIG_MHI_BUS_MISC) +#if IS_ENABLED(CONFIG_MHI_BUS_MISC) && \ +(LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0)) case MHI_CB_FALLBACK_IMG: /* for kiwi_v2 binary fallback is used, skip path fallback here */ if (!(pci_priv->device_id == KIWI_DEVICE_ID && @@ -6489,6 +6492,7 @@ static void cnss_mhi_notify_status(struct mhi_controller *mhi_ctrl, } return; #endif + default: cnss_pr_err("Unsupported MHI status cb reason: %d\n", reason); return; @@ -6664,7 +6668,8 @@ static int cnss_pci_register_mhi(struct cnss_pci_data *pci_priv) mhi_ctrl->cntrl_dev = &pci_dev->dev; mhi_ctrl->fw_image = plat_priv->firmware_name; -#if IS_ENABLED(CONFIG_MHI_BUS_MISC) +#if IS_ENABLED(CONFIG_MHI_BUS_MISC) && \ +(LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0)) mhi_ctrl->fallback_fw_image = plat_priv->fw_fallback_name; #endif diff --git a/cnss2/pci.h b/cnss2/pci.h index c5160f85e6..4eebfb4286 100644 --- a/cnss2/pci.h +++ b/cnss2/pci.h @@ -20,6 +20,11 @@ #include #include #include +#include +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0)) +#include +#endif + #include "main.h" diff --git a/cnss_genl/cnss_nl.c b/cnss_genl/cnss_nl.c index 188a770cf0..b09c57aac2 100644 --- a/cnss_genl/cnss_nl.c +++ b/cnss_genl/cnss_nl.c @@ -1,5 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-only -/* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. */ +/* + * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. + */ #include #ifdef CONFIG_CNSS_OUT_OF_TREE @@ -9,6 +12,7 @@ #endif #include #include +#include #define CLD80211_GENL_NAME "cld80211" @@ -66,6 +70,24 @@ static const struct nla_policy cld80211_policy[CLD80211_ATTR_MAX + 1] = { [CLD80211_ATTR_CMD_TAG_DATA] = { .type = NLA_NESTED }, }; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0)) +static int cld80211_pre_doit(const struct genl_split_ops *ops, + struct sk_buff *skb, + struct genl_info *info) +{ + u8 cmd_id = ops->cmd; + struct cld80211_nl_data *nl = get_local_ctx(); + + if (cmd_id < 1 || cmd_id > CLD80211_MAX_COMMANDS) { + pr_err("CLD80211: Command Not supported: %u\n", cmd_id); + return -EOPNOTSUPP; + } + info->user_ptr[0] = nl->cld_ops[cmd_id - 1].cb; + info->user_ptr[1] = nl->cld_ops[cmd_id - 1].cb_ctx; + + return 0; +} +#else static int cld80211_pre_doit(const struct genl_ops *ops, struct sk_buff *skb, struct genl_info *info) { @@ -81,7 +103,7 @@ static int cld80211_pre_doit(const struct genl_ops *ops, struct sk_buff *skb, return 0; } - +#endif /* The netlink family */ static struct genl_family cld80211_fam __ro_after_init = { .name = CLD80211_GENL_NAME, diff --git a/wlan_platform_modules.bzl b/wlan_platform_modules.bzl index 996863a565..dcc0b64e0f 100644 --- a/wlan_platform_modules.bzl +++ b/wlan_platform_modules.bzl @@ -9,7 +9,7 @@ _default_module_enablement_list = [ "wlan_firmware_service" ] -_cnss2_enabled_target = ["pineapple"] +_cnss2_enabled_target = ["pineapple", "sun"] _icnss2_enabled_target = ["blair", "pineapple"] def _get_module_list(target, variant):