From: Longfang Liu <liulongfang@huawei.com> In the previous UADK v2 framework, the entire UADK was bound to SVA mode, and checks were performed on device morphology and queue attributes according to SVA mode requirements. After adding the new No-SVA mode memory pool, these bindings need to be removed to ensure that UADK can normally execute business operations on an OS running in No-SVA mode Signed-off-by: Longfang Liu <liulongfang@huawei.com> Signed-off-by: Zongyu Wu <wuzongyu1@huawei.com> --- include/wd_alg.h | 25 ++++--------------- libwd.map | 4 +++ wd.c | 4 --- wd_alg.c | 64 +++++++++++++++++------------------------------- wd_util.c | 5 ---- 5 files changed, 31 insertions(+), 71 deletions(-) diff --git a/include/wd_alg.h b/include/wd_alg.h index 2fc350a..5ff73ca 100644 --- a/include/wd_alg.h +++ b/include/wd_alg.h @@ -115,26 +115,6 @@ struct wd_alg_driver { int (*get_extend_ops)(void *ops); }; -inline int wd_alg_driver_init(struct wd_alg_driver *drv, void *conf) -{ - return drv->init(drv, conf); -} - -inline void wd_alg_driver_exit(struct wd_alg_driver *drv) -{ - drv->exit(drv); -} - -inline int wd_alg_driver_send(struct wd_alg_driver *drv, handle_t ctx, void *msg) -{ - return drv->send(drv, ctx, msg); -} - -inline int wd_alg_driver_recv(struct wd_alg_driver *drv, handle_t ctx, void *msg) -{ - return drv->recv(drv, ctx, msg); -} - /* * wd_alg_driver_register() - Register a device driver. * @wd_alg_driver: a device driver that supports an algorithm. @@ -194,6 +174,11 @@ bool wd_drv_alg_support(const char *alg_name, void wd_enable_drv(struct wd_alg_driver *drv); void wd_disable_drv(struct wd_alg_driver *drv); +int wd_alg_driver_init(struct wd_alg_driver *drv, void *conf); +void wd_alg_driver_exit(struct wd_alg_driver *drv); +int wd_alg_driver_send(struct wd_alg_driver *drv, handle_t ctx, void *msg); +int wd_alg_driver_recv(struct wd_alg_driver *drv, handle_t ctx, void *msg); + struct wd_alg_list *wd_get_alg_head(void); #ifdef WD_STATIC_DRV diff --git a/libwd.map b/libwd.map index b1b90b3..90eb5c5 100644 --- a/libwd.map +++ b/libwd.map @@ -49,6 +49,10 @@ global: wd_enable_drv; wd_disable_drv; wd_get_alg_head; + wd_alg_driver_init; + wd_alg_driver_exit; + wd_alg_driver_send; + wd_alg_driver_recv; wd_find_ctx; wd_get_dev_id; diff --git a/wd.c b/wd.c index 3e867b6..657fbae 100644 --- a/wd.c +++ b/wd.c @@ -238,10 +238,6 @@ static int get_dev_info(struct uacce_dev *dev) ret = get_int_attr(dev, "flags", &dev->flags); if (ret < 0) return ret; - else if (!((unsigned int)dev->flags & UACCE_DEV_SVA)) { - WD_ERR("skip none sva uacce device!\n"); - return -WD_ENODEV; - } ret = get_int_attr(dev, "region_mmio_size", &value); if (ret < 0) diff --git a/wd_alg.c b/wd_alg.c index 08f0e2e..9c7c0fd 100644 --- a/wd_alg.c +++ b/wd_alg.c @@ -24,46 +24,6 @@ static struct wd_alg_list *alg_list_tail = &alg_list_head; static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; -static bool wd_check_dev_sva(const char *dev_name) -{ - char dev_path[PATH_MAX] = {'\0'}; - char buf[DEV_SVA_SIZE] = {'\0'}; - unsigned int val; - ssize_t ret; - int fd; - - ret = snprintf(dev_path, PATH_STR_SIZE, "%s/%s/%s", SYS_CLASS_DIR, - dev_name, SVA_FILE_NAME); - if (ret < 0) { - WD_ERR("failed to snprintf, device name: %s!\n", dev_name); - return false; - } - - /** - * The opened file is the specified device driver file. - * no need for realpath processing. - */ - fd = open(dev_path, O_RDONLY, 0); - if (fd < 0) { - WD_ERR("failed to open %s(%d)!\n", dev_path, -errno); - return false; - } - - ret = read(fd, buf, DEV_SVA_SIZE - 1); - if (ret <= 0) { - WD_ERR("failed to read anything at %s!\n", dev_path); - close(fd); - return false; - } - close(fd); - - val = strtol(buf, NULL, STR_DECIMAL); - if (val & UACCE_DEV_SVA) - return true; - - return false; -} - static bool wd_check_accel_dev(const char *dev_name) { struct dirent *dev_dir; @@ -80,8 +40,7 @@ static bool wd_check_accel_dev(const char *dev_name) !strncmp(dev_dir->d_name, "..", LINUX_PRTDIR_SIZE)) continue; - if (!strncmp(dev_dir->d_name, dev_name, strlen(dev_name)) && - wd_check_dev_sva(dev_dir->d_name)) { + if (!strncmp(dev_dir->d_name, dev_name, strlen(dev_name))) { closedir(wd_class); return true; } @@ -413,3 +372,24 @@ void wd_release_drv(struct wd_alg_driver *drv) select_node->refcnt--; pthread_mutex_unlock(&mutex); } + +int wd_alg_driver_init(struct wd_alg_driver *drv, void *conf) +{ + return drv->init(drv, conf); +} + +void wd_alg_driver_exit(struct wd_alg_driver *drv) +{ + drv->exit(drv); +} + +int wd_alg_driver_send(struct wd_alg_driver *drv, handle_t ctx, void *msg) +{ + return drv->send(drv, ctx, msg); +} + +int wd_alg_driver_recv(struct wd_alg_driver *drv, handle_t ctx, void *msg) +{ + return drv->recv(drv, ctx, msg); +} + diff --git a/wd_util.c b/wd_util.c index d0d83eb..beb4131 100644 --- a/wd_util.c +++ b/wd_util.c @@ -1984,11 +1984,6 @@ int wd_init_param_check(struct wd_ctx_config *config, struct wd_sched *sched) return -WD_EINVAL; } - if (!wd_is_sva(config->ctxs[0].ctx)) { - WD_ERR("invalid: the mode is non sva, please check system!\n"); - return -WD_EINVAL; - } - return 0; } -- 2.33.0