[PATCH] cpu: virt: fix the assumption that fwts_cpu_readmsr returns 0 = FWTS_OK

Alex Hung alex.hung at canonical.com
Fri Jul 15 15:39:48 UTC 2016


Signed-off-by: Alex Hung <alex.hung at canonical.com>
---
 src/cpu/virt/virt_svm.c | 2 +-
 src/cpu/virt/virt_vmx.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/cpu/virt/virt_svm.c b/src/cpu/virt/virt_svm.c
index 7843428..a81877f 100644
--- a/src/cpu/virt/virt_svm.c
+++ b/src/cpu/virt/virt_svm.c
@@ -59,7 +59,7 @@ static int vt_locked_by_bios(void)
 	if (!can_lock_with_msr())
 		return 0;
 
-	if (fwts_cpu_readmsr(0, MSR_FEATURE_CONTROL, &msr))
+	if (fwts_cpu_readmsr(0, MSR_FEATURE_CONTROL, &msr) != FWTS_OK)
 		return -1;
 
 	return ((msr & 0x1000) == 0x1000); /* SVM capable but locked by bios*/
diff --git a/src/cpu/virt/virt_vmx.c b/src/cpu/virt/virt_vmx.c
index 58b952f..29612f5 100644
--- a/src/cpu/virt/virt_vmx.c
+++ b/src/cpu/virt/virt_vmx.c
@@ -59,7 +59,7 @@ static int vt_locked_by_bios(void)
 {
 	uint64_t msr;
 
-	if (fwts_cpu_readmsr(0, MSR_FEATURE_CONTROL, &msr))
+	if (fwts_cpu_readmsr(0, MSR_FEATURE_CONTROL, &msr) != FWTS_OK)
 		return -1;
 
 	return (msr & 5) == 1; /* VT capable but locked by bios*/
-- 
2.7.4




More information about the fwts-devel mailing list