feat: update npu-ax3386 with sdk1.2.1

Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
This commit is contained in:
Han Gao
2023-10-18 22:16:33 +08:00
parent e3b22dbe54
commit c10fdb081d
9 changed files with 180 additions and 108 deletions

View File

@@ -15,6 +15,8 @@
#include <linux/platform_device.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/reset.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/pm.h>
#include <linux/version.h>
@@ -55,6 +57,10 @@ static struct poll_timer {
} irq_poll_timer;
struct vha_prvdata {
struct reset_control *rst;
};
static ssize_t info_show(struct device_driver *drv, char *buf);
static irqreturn_t dt_plat_thread_irq(int irq, void *dev_id)
@@ -107,6 +113,7 @@ static int vha_plat_probe(struct platform_device *ofdev)
struct resource res;
void __iomem *reg_addr;
uint32_t reg_size, core_size;
struct vha_prvdata *data;
char info[256];
info_show(ofdev->dev.driver, info);
@@ -164,9 +171,22 @@ static int vha_plat_probe(struct platform_device *ofdev)
goto out_add_dev;
}
data = devm_kzalloc(&ofdev->dev, sizeof(*data), GFP_KERNEL);
if (!data) {
dev_err(&ofdev->dev, "vha private data allocate error\n");
ret = -ENOMEM;
goto out_add_dev;
}
data->rst = devm_reset_control_get_optional_shared(&ofdev->dev, NULL);
if (IS_ERR(data->rst)) {
ret = PTR_ERR(data->rst);
return ret;
}
/* no 'per device' memory heaps used */
ret = vha_add_dev(&ofdev->dev, NULL, 0,
NULL /* plat priv data */, reg_addr, core_size);
data, reg_addr, core_size);
if (ret) {
dev_err(&ofdev->dev, "failed to intialize driver core!\n");
goto out_add_dev;

View File

@@ -514,12 +514,12 @@ static long vha_ioctl_import(struct vha_session *session, void __user *buf)
if (copy_from_user(&data, buf, sizeof(data)))
return -EFAULT;
dev_dbg(miscdev->this_device, "%s: session %u, buf_hnd 0x%016llx, size %llu, heap_id %u\n",
__func__, session->id, data.buf_hnd, data.size, data.heap_id);
dev_dbg(miscdev->this_device, "%s: session %u, buf_fd 0x%016llx, size %llu, heap_id %u\n",
__func__, session->id, data.buf_fd, data.size, data.heap_id);
ret = img_mem_import(session->vha->dev, session->mem_ctx, data.heap_id,
(size_t)data.size, data.attributes, data.buf_hnd,
&data.buf_id);
(size_t)data.size, data.attributes, data.buf_fd,
data.cpu_ptr, &data.buf_id);
if (ret)
return ret;