126 Star 3 Fork 18

src-openEuler/libwd

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0029-uadk-wd_alg-check-whether-the-platform-supports-SVE.patch 1.30 KB
一键复制 编辑 原始数据 按行查看 历史
JangShui Yang 提交于 2024-04-07 18:05 . libwd: update the source code
From 4163f4f6ff8534b171c8b1b044452b930629576d Mon Sep 17 00:00:00 2001
From: Weili Qian <qianweili@huawei.com>
Date: Sat, 23 Mar 2024 17:54:16 +0800
Subject: [PATCH 29/44] uadk/wd_alg: check whether the platform supports SVE
If the algorithm uses the SVE instruction, check whether
the platform supports SVE before algorithm driver registration.
If the platform does not support SVE, do not register the algorithm.
Signed-off-by: Weili Qian <qianweili@huawei.com>
---
wd_alg.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/wd_alg.c b/wd_alg.c
index f34a407..de352d7 100644
--- a/wd_alg.c
+++ b/wd_alg.c
@@ -109,6 +109,19 @@ static bool wd_check_ce_support(const char *dev_name)
return false;
}
+static bool wd_check_sve_support(void)
+{
+ unsigned long hwcaps = 0;
+
+ #if defined(__aarch64__)
+ hwcaps = getauxval(AT_HWCAP);
+ #endif
+ if (hwcaps & HWCAP_SVE)
+ return true;
+
+ return false;
+}
+
static bool wd_alg_check_available(int calc_type, const char *dev_name)
{
bool ret = false;
@@ -122,6 +135,7 @@ static bool wd_alg_check_available(int calc_type, const char *dev_name)
break;
/* Should find the CPU if not support SVE */
case UADK_ALG_SVE_INSTR:
+ ret = wd_check_sve_support();
break;
/* Check if the current driver has device support */
case UADK_ALG_HW:
--
2.25.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/libwd.git
git@gitee.com:src-openeuler/libwd.git
src-openeuler
libwd
libwd
master

搜索帮助