msm: eva: Enable Lanai compiling

EVA Kernel driver.

Change-Id: Ie415075a05707a20d9eac1e478a2f18c741b3446
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
This commit is contained in:
George Shen
2022-09-28 18:27:35 -07:00
parent fcbb3d87ab
commit 991125b3b1
16 ha cambiato i file con 182 aggiunte e 30 eliminazioni

Vedi File

@@ -28,6 +28,15 @@ KBUILD_CPPFLAGS += -DCONFIG_EVA_KALAMA=1
ccflags-y += -DCONFIG_EVA_KALAMA=1
endif
ifeq ($(CONFIG_ARCH_PINEAPPLE), y)
$(info within KBUILD file CONFIG_ARCH_PINEAPPLE = $(CONFIG_ARCH_PINEAPPLE))
KBUILD_CPPFLAGS += -DCONFIG_EVA_PINEAPPLE=1
ccflags-y += -DCONFIG_EVA_PINEAPPLE=1
ccflags-y += -I$(EVA_ROOT)/../synx-kernel/msm/synx/ \
-I$(EVA_ROOT)/../synx-kernel/include/uapi/synx/media/
endif
ifeq ($(CONFIG_EVA_LE), 1)
ccflags-y += -DCONFIG_EVA_TVM=1
endif

Vedi File

@@ -263,7 +263,7 @@ static ssize_t boot_store(struct device *dev,
return -EINVAL;
}
if (val > 0 && booted == 0) {
if (val == 1 && booted == 0) {
struct msm_cvp_inst *inst;
inst = msm_cvp_open(MSM_CORE_CVP, MSM_CVP_BOOT, current);
@@ -278,7 +278,7 @@ static ssize_t boot_store(struct device *dev,
"Failed to close cvp instance\n");
return rc;
}
} else if ((val == 2) && booted) {
} else if (val == 2) {
struct msm_cvp_inst *inst;
inst = msm_cvp_open(MSM_CORE_CVP, MSM_CVP_USER, current);
@@ -650,3 +650,4 @@ module_exit(msm_cvp_exit);
MODULE_SOFTDEP("pre: msm-mmrm");
MODULE_LICENSE("GPL v2");
MODULE_IMPORT_NS(DMA_BUF);

Vedi File

@@ -28,9 +28,16 @@ enum queue_state {
#else /* LA target starts here */
#ifdef CONFIG_EVA_KALAMA
#define CVP_SYNX_ENABLED 1
#define CVP_MMRM_ENABLED 1
#define CVP_FASTRPC_ENABLED 1
#endif /* End of CONFIG_EVA_KALAMA */
#ifdef CONFIG_EVA_PINEAPPLE
#define CVP_MMRM_ENABLED 1
#endif /* End of CONFIG_EVA_PINEAPPLE */
#ifdef CONFIG_EVA_WAIPIO
#define CVP_MINIDUMP_ENABLED 1

Vedi File

@@ -253,7 +253,6 @@
#define CVP_CC_MVS1_GDSCR (CVP_CC_BASE_OFFS + 0xCC)
#define CVP_CC_MVS1_CBCR (CVP_CC_BASE_OFFS + 0xE0)
#ifdef CONFIG_EVA_KALAMA
#define CVP_GCC_VIDEO_AXI1_CBCR (0x22024)
#endif /*End of CONFIG_EVA_KALAMA */
#endif

Vedi File

@@ -22,10 +22,11 @@
static void * __cvp_dma_buf_vmap(struct dma_buf *dbuf)
{
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 13, 0))
return dma_buf_vmap(dbuf);
#else
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0))
struct dma_buf_map map;
#else
struct iosys_map map;
#endif
void *dma_map;
int err;
@@ -35,22 +36,23 @@ static void * __cvp_dma_buf_vmap(struct dma_buf *dbuf)
dprintk(CVP_ERR, "map to kvaddr failed\n");
return dma_map;
#endif
}
static void __cvp_dma_buf_vunmap(struct dma_buf *dbuf, void *vaddr)
{
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 13, 0))
dma_buf_vunmap(dbuf, vaddr);
#else
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0))
struct dma_buf_map map = { \
.vaddr = vaddr, \
.is_iomem = false, \
};
#else
struct iosys_map map = { \
.vaddr = vaddr, \
.is_iomem = false, \
};
#endif
if (vaddr)
dma_buf_vunmap(dbuf, &map);
#endif
}
static int msm_dma_get_device_address(struct dma_buf *dbuf, u32 align,

Vedi File

@@ -643,7 +643,6 @@ wait:
exit:
dprintk(CVP_SYNX, "%s exit\n", current->comm);
cvp_put_inst(inst);
do_exit(rc);
return rc;
}

Vedi File

@@ -16,6 +16,14 @@
#include "msm_cvp_core.h"
#include "msm_cvp_dsp.h"
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0))
#define eva_buf_map dma_buf_map
#define _buf_map_set_vaddr dma_buf_map_set_vaddr
#else
#define eva_buf_map iosys_map
#define _buf_map_set_vaddr iosys_map_set_vaddr
#endif
#define CLEAR_USE_BITMAP(idx, inst) \
do { \
clear_bit(idx, &inst->dma_cache.usage_bitmap); \
@@ -239,7 +247,7 @@ loop:
*/
if (file->f_mode & mask)
file = NULL;
else if (!get_file_rcu_many(file, refs))
else if (!get_file_rcu(file))
goto loop;
}
rcu_read_unlock();
@@ -811,7 +819,7 @@ static int _wncc_map_metadata_bufs(struct eva_kmd_hfi_packet* in_pkt,
int rc = 0, i;
struct cvp_buf_type* wncc_metadata_bufs;
struct dma_buf* dmabuf;
struct dma_buf_map map;
struct eva_buf_map map;
if (!in_pkt || !wncc_metadata ||
num_layers < 1 || num_layers > EVA_KMD_WNCC_MAX_LAYERS) {
@@ -872,7 +880,7 @@ static int _wncc_unmap_metadata_bufs(struct eva_kmd_hfi_packet* in_pkt,
int rc = 0, i;
struct cvp_buf_type* wncc_metadata_bufs;
struct dma_buf* dmabuf;
struct dma_buf_map map;
struct eva_buf_map map;
if (!in_pkt || !wncc_metadata ||
num_layers < 1 || num_layers > EVA_KMD_WNCC_MAX_LAYERS) {
@@ -898,7 +906,7 @@ static int _wncc_unmap_metadata_bufs(struct eva_kmd_hfi_packet* in_pkt,
break;
}
dma_buf_map_set_vaddr(&map, wncc_metadata[i]);
_buf_map_set_vaddr(&map, wncc_metadata[i]);
dma_buf_vunmap(dmabuf, &map);
wncc_metadata[i] = NULL;

Vedi File

@@ -1207,23 +1207,29 @@ int msm_cvp_comm_try_state(struct msm_cvp_inst *inst, int state)
rc = msm_comm_init_core(inst);
if (rc || state <= get_flipped_state(inst->state, state))
break;
/* defined in linux/compiler_attributes.h */
fallthrough;
case MSM_CVP_CORE_INIT_DONE:
rc = msm_comm_init_core_done(inst);
if (rc || state <= get_flipped_state(inst->state, state))
break;
fallthrough;
case MSM_CVP_OPEN:
rc = msm_comm_session_init(flipped_state, inst);
if (rc || state <= get_flipped_state(inst->state, state))
break;
fallthrough;
case MSM_CVP_OPEN_DONE:
rc = msm_comm_session_init_done(flipped_state, inst);
if (rc || state <= get_flipped_state(inst->state, state))
break;
fallthrough;
case MSM_CVP_CLOSE:
dprintk(CVP_INFO, "to CVP_CLOSE state\n");
rc = msm_comm_session_close(flipped_state, inst);
if (rc || state <= get_flipped_state(inst->state, state))
break;
fallthrough;
case MSM_CVP_CLOSE_DONE:
dprintk(CVP_INFO, "to CVP_CLOSE_DONE state\n");
rc = wait_for_state(inst, flipped_state, MSM_CVP_CLOSE_DONE,
@@ -1231,12 +1237,14 @@ int msm_cvp_comm_try_state(struct msm_cvp_inst *inst, int state)
if (rc || state <= get_flipped_state(inst->state, state))
break;
msm_cvp_comm_session_clean(inst);
fallthrough;
case MSM_CVP_CORE_UNINIT:
case MSM_CVP_CORE_INVALID:
dprintk(CVP_INFO, "Sending core uninit\n");
rc = msm_cvp_deinit_core(inst);
if (rc || state <= get_flipped_state(inst->state, state))
break;
fallthrough;
default:
dprintk(CVP_ERR, "State not recognized\n");
rc = -EINVAL;

Vedi File

@@ -12,7 +12,7 @@
#define CREATE_TRACE_POINTS
#define MAX_SSR_STRING_LEN 10
int msm_cvp_debug = CVP_ERR | CVP_WARN | CVP_FW;
int msm_cvp_debug = CVP_ERR | CVP_WARN | CVP_FW | CVP_DBG;
EXPORT_SYMBOL(msm_cvp_debug);
int msm_cvp_debug_out = CVP_OUT_PRINTK;
@@ -20,9 +20,9 @@ EXPORT_SYMBOL(msm_cvp_debug_out);
int msm_cvp_fw_debug = 0x18;
int msm_cvp_fw_debug_mode = 1;
int msm_cvp_fw_low_power_mode = 1;
int msm_cvp_fw_low_power_mode = 0; /*disable during initial stage*/
bool msm_cvp_fw_coverage = !true;
bool msm_cvp_auto_pil = true;
bool msm_cvp_auto_pil = !true; /*disable during initial stage*/
bool msm_cvp_cacheop_enabled = true;
bool msm_cvp_thermal_mitigation_disabled = !true;
bool msm_cvp_cacheop_disabled = !true;

Vedi File

@@ -40,16 +40,14 @@ static void __fastrpc_driver_unregister(struct fastrpc_driver *driver)
#endif
}
#ifdef CVP_FASTRPC_ENABLED
static int __fastrpc_driver_invoke(struct fastrpc_device *dev,
enum fastrpc_driver_invoke_nums invoke_num,
unsigned long invoke_param)
{
#ifdef CVP_FASTRPC_ENABLED
return fastrpc_driver_invoke(dev, invoke_num, invoke_param);
#else
return -ENODEV;
#endif
}
#endif /* End of CVP_FASTRPC_ENABLED */
static int cvp_dsp_send_cmd(struct cvp_dsp_cmd_msg *cmd, uint32_t len)
{
@@ -1014,6 +1012,7 @@ static int eva_fastrpc_dev_map_dma(struct fastrpc_device *frpc_device,
uint32_t dsp_remote_map,
uint64_t *v_dsp_addr)
{
#ifdef CVP_FASTRPC_ENABLED
struct fastrpc_dev_map_dma frpc_map_buf = {0};
int rc = 0;
@@ -1042,11 +1041,15 @@ static int eva_fastrpc_dev_map_dma(struct fastrpc_device *frpc_device,
}
return rc;
#else
return -ENODEV;
#endif /* End of CVP_FASTRPC_ENABLED */
}
static int eva_fastrpc_dev_unmap_dma(struct fastrpc_device *frpc_device,
struct cvp_internal_buf *buf)
{
#ifdef CVP_FASTRPC_ENABLED
struct fastrpc_dev_unmap_dma frpc_unmap_buf = {0};
int rc = 0;
@@ -1067,6 +1070,9 @@ static int eva_fastrpc_dev_unmap_dma(struct fastrpc_device *frpc_device,
}
return rc;
#else
return -ENODEV;
#endif /* End of CVP_FASTRPC_ENABLED */
}
static void eva_fastrpc_driver_add_sess(
@@ -2072,7 +2078,6 @@ wait_dsp:
goto wait_dsp;
exit:
dprintk(CVP_DBG, "dsp thread exit\n");
do_exit(rc);
return rc;
}

Vedi File

@@ -13,7 +13,31 @@
#include <linux/pid.h>
#include <linux/sched.h>
#ifdef CVP_FASTRPC_ENABLED
#include <linux/fastrpc.h>
#else
struct fastrpc_device {
int handle;
};
enum fastrpc_driver_status {
FASTRPC_CVP_B,
};
enum fastrpc_driver_invoke_nums {
FASTRPC_DEV_MAP_DMA = 1,
FASTRPC_DEV_UNMAP_DMA,
};
struct fastrpc_driver {
struct device_driver driver;
int handle;
int (*probe)(struct fastrpc_device *dev);
int (*callback)(struct fastrpc_device *dev,
enum fastrpc_driver_status status);
};
#endif /* End of CVP_FASTRPC_ENABLED */
#define CVP_APPS_DSP_GLINK_GUID "cvp-glink-apps-dsp"
#define CVP_APPS_DSP_SMD_GUID "cvp-smd-apps-dsp"

Vedi File

@@ -24,7 +24,6 @@
#include <media/msm_eva_private.h>
#include "cvp_hfi_api.h"
#include "cvp_hfi_helper.h"
#include <synx_api.h>
#define MAX_SUPPORTED_INSTANCES 16
#define MAX_DEBUGFS_NAME 50

Vedi File

@@ -199,6 +199,58 @@ static struct msm_cvp_common_data sm8550_tvm_common_data[] = {
}
};
static struct msm_cvp_common_data sm8650_common_data[] = {
{
.key = "qcom,pm-qos-latency-us",
.value = 50,
},
{
.key = "qcom,sw-power-collapse",
.value = 0, /* Disable during initial stage for Rumi 48 bringup */
},
{
.key = "qcom,domain-attr-non-fatal-faults",
.value = 0,
},
{
.key = "qcom,max-secure-instances",
.value = 2, /*
* As per design driver allows 3rd
* instance as well since the secure
* flags were updated later for the
* current instance. Hence total
* secure sessions would be
* max-secure-instances + 1.
*/
},
{
.key = "qcom,max-ssr-allowed",
.value = 1, /*
* Maxinum number of SSR before BUG_ON
*/
},
{
.key = "qcom,power-collapse-delay",
.value = 3000,
},
{
.key = "qcom,hw-resp-timeout",
.value = 2000,
},
{
.key = "qcom,dsp-resp-timeout",
.value = 1000,
},
{
.key = "qcom,debug-timeout",
.value = 0,
},
{
.key = "qcom,dsp-enabled",
.value = 0, /* Disable during initial stage for Rumi 48 bringup */
}
};
/* Default UBWC config for LPDDR5 */
static struct msm_cvp_ubwc_config_data kona_ubwc_data[] = {
UBWC_CONFIG(1, 1, 1, 0, 0, 0, 8, 32, 16, 0, 0),
@@ -253,6 +305,16 @@ static struct msm_cvp_platform_data sm8550_tvm_data = {
.vm_id = 2,
};
static struct msm_cvp_platform_data sm8650_data = {
.common_data = sm8650_common_data,
.common_data_length = ARRAY_SIZE(sm8650_common_data),
.sku_version = 0,
.vpu_ver = VPU_VERSION_5,
.ubwc_config = kona_ubwc_data, /*Reuse Kona setting*/
.noc_qos = &waipio_noc_qos, /*Reuse Waipio setting*/
.vm_id = 1,
};
static const struct of_device_id msm_cvp_dt_match[] = {
{
.compatible = "qcom,waipio-cvp",
@@ -266,6 +328,10 @@ static const struct of_device_id msm_cvp_dt_match[] = {
.compatible = "qcom,kalama-cvp-tvm",
.data = &sm8550_tvm_data,
},
{
.compatible = "qcom,pineapple-cvp",
.data = &sm8650_data,
},
{},
};

Vedi File

@@ -132,6 +132,12 @@ static int msm_cvp_load_ipcc_regs(struct msm_cvp_platform_resources *res)
res->ipcc_reg_base = reg_config[0];
res->ipcc_reg_size = reg_config[1];
dprintk(CVP_CORE,
"ipcc reg_base = %x, reg_size = %x\n",
res->ipcc_reg_base,
res->ipcc_reg_size
);
return ret;
}
@@ -830,8 +836,10 @@ int cvp_read_platform_resources_from_dt(
res->register_base = kres ? kres->start : -1;
res->register_size = kres ? (kres->end + 1 - kres->start) : -1;
kres = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
res->irq = kres ? kres->start : -1;
res->irq = platform_get_irq(pdev, 0);
dprintk(CVP_CORE, "%s: res->irq:%d \n",
__func__, res->irq);
rc = msm_cvp_load_subcache_info(res);
if (rc)

Vedi File

@@ -10,6 +10,17 @@
#include <media/msm_eva_private.h>
#include "cvp_comm_def.h"
#ifdef CVP_SYNX_ENABLED
#include <synx_api.h>
#else
#define SYNX_STATE_SIGNALED_SUCCESS 0
#define SYNX_STATE_SIGNALED_ERROR 0
#define SYNX_STATE_SIGNALED_CANCEL 0
struct synx_session {
u32 client_id;
};
#endif /* end of CVP_SYNX_ENABLED */
struct msm_cvp_core;
struct cvp_fence_queue {

Vedi File

@@ -51,6 +51,12 @@ struct msm_cvp_vm_manager vm_manager = {
static int msm_cvp_vm_start(struct msm_cvp_core *core)
{
if (!core || !core->platform_data) {
dprintk(CVP_ERR, "%s: Invalid params %pK %pK\n",
__func__, core, core->platform_data);
return -EINVAL;
}
vm_manager.vm_id = core->platform_data->vm_id;
return 0;
}
@@ -148,7 +154,7 @@ static int msm_cvp_vm_init_reg_and_irq(struct iris_hfi_device *device,
rc = request_irq(res->irq, cvp_hfi_isr, IRQF_TRIGGER_HIGH,
"msm_cvp", device);
if (unlikely(rc)) {
dprintk(CVP_ERR, "() :request_irq failed\n");
dprintk(CVP_ERR, "%s: request_irq failed rc: %d\n", __func__, rc);
goto error_irq_fail;
}