31 lines
942 B
Diff
31 lines
942 B
Diff
From ed2c256929962db1a8805db53bed09bb8f2f4de3 Mon Sep 17 00:00:00 2001
|
|
From: Haitao Huang <4699115+haitaohuang@users.noreply.github.com>
|
|
Date: Fri, 16 Apr 2021 20:12:10 +0000
|
|
Subject: [PATCH] Use cpuid instead of boot_cpu_has to check cpu features
|
|
|
|
For non-FLC platforms, Linux kernel 5.11 or above disables sgx feature flag
|
|
so boot_cpu_has is not usable.
|
|
|
|
Signed-off-by: Haitao Huang <4699115+haitaohuang@users.noreply.github.com>
|
|
---
|
|
sgx_main.c | 3 ++-
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/sgx_main.c b/sgx_main.c
|
|
index 4ff4e2b..ca52821 100644
|
|
--- a/sgx_main.c
|
|
+++ b/sgx_main.c
|
|
@@ -313,7 +313,8 @@ static int sgx_drv_probe(struct platform_device *pdev)
|
|
if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
|
|
return -ENODEV;
|
|
|
|
- if (!boot_cpu_has(X86_FEATURE_SGX)) {
|
|
+ cpuid(7, &eax, &ebx, &ecx, &edx);
|
|
+ if(!((ebx >> 2) & 0x1)){
|
|
pr_err("intel_sgx: the CPU is missing SGX\n");
|
|
return -ENODEV;
|
|
}
|
|
--
|
|
2.27.0
|
|
|