Skip to content

Commit ed2c256

Browse files
committed
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 <[email protected]>
1 parent 0373e2e commit ed2c256

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sgx_main.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ static int sgx_drv_probe(struct platform_device *pdev)
313313
if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
314314
return -ENODEV;
315315

316-
if (!boot_cpu_has(X86_FEATURE_SGX)) {
316+
cpuid(7, &eax, &ebx, &ecx, &edx);
317+
if(!((ebx >> 2) & 0x1)){
317318
pr_err("intel_sgx: the CPU is missing SGX\n");
318319
return -ENODEV;
319320
}

0 commit comments

Comments
 (0)