cnss2: cnss changes for sun compilation

Current code has compilation errors
when compiling for sun. sched_clock()
was moved to clock.h, and iommu_map API
was changed with new sun kernel. Fix
this by updating code for new kernel
apis.

Change-Id: I77029fcc74142f3f650dc289c8d19c121eba6445
CRs-Fixed: 3603129
This commit is contained in:
Mohammed Ahmed
2023-08-23 10:58:21 -07:00
committed by Rahul Choudhary
parent e144f654b8
commit e1dd6c2585
6 changed files with 60 additions and 12 deletions

View File

@@ -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);

View File

@@ -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 */

View File

@@ -16,7 +16,6 @@
#include <linux/suspend.h>
#include <linux/version.h>
#include <linux/sched.h>
#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

View File

@@ -20,6 +20,11 @@
#include <linux/of_reserved_mem.h>
#include <linux/pci.h>
#include <linux/sched_clock.h>
#include <linux/version.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0))
#include <linux/sched/clock.h>
#endif
#include "main.h"

View File

@@ -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 <net/genetlink.h>
#ifdef CONFIG_CNSS_OUT_OF_TREE
@@ -9,6 +12,7 @@
#endif
#include <linux/module.h>
#include <linux/of.h>
#include <linux/version.h>
#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,

View File

@@ -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):