代码拉取完成,页面将自动刷新
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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。