Public bug reported:

On a laptop with Ryzen 2500U I get this result for test virt:

fwts, Version V25.01.00, 2025-01-21 03:29:52

virt: CPU Virtualisation Configuration test.
--------------------------------------------------------------------------------

Test 1 of 1: CPU Virtualisation Configuration test.
Check SVM Virtualization extensions are set up correctly.
FAILED [MEDIUM] VirtDisabledByBIOS: Test 1, Virtualization extensions
supported
but disabled by BIOS.

The test result looks incorrect:

In the BIOS 'AMD V(TM)' is enabled.
/dev/kvm is available
/proc/cpuinfo shows extensions svm and svm_lock

Bit 12 of MSR 0xc0000080 is written by a hypervisor and not by the BIOS.
The disabled state cannot be inferred from this register. Instead MSR
0xc0010114 bit 4 is set to 1 if SVM is disabled by the BIOS.

AMD64 Architecture Programmer’s Manual
Volume 2, System Programming
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
3.1.7 Extended Feature Enable Register (EFER), page 55
has this sentence:

"SVMDIS—Bit 4. When this bit is set, writes to EFER treat the SVME bit
as MBZ. When this bit is clear, EFER.SVME can be written normally. This
bit does not prevent CPUID from reporting that SVM is available."

I would assume that we need a change like the following for AMD:

diff --git a/src/cpu/virt/virt_svm.c b/src/cpu/virt/virt_svm.c
index d86f54f4..450a7f2a 100644
--- a/src/cpu/virt/virt_svm.c
+++ b/src/cpu/virt/virt_svm.c
@@ -37,7 +37,7 @@
  #include <limits.h>
  #include <errno.h>

-#define MSR_FEATURE_CONTROL    0xC0000080
+#define MSR_VM_CR              0xC0010114

  extern fwts_cpuinfo_x86 *fwts_virt_cpuinfo;

@@ -58,10 +58,10 @@ static int vt_locked_by_bios(fwts_framework *fw)
         if (!can_lock_with_msr())
                 return 0;

-       if (fwts_cpu_readmsr(fw, 0, MSR_FEATURE_CONTROL, &msr))
+       if (fwts_cpu_readmsr(fw, 0, MSR_VM_CR, &msr))
                 return -1;

-       return ((msr & 0x1000) == 0x1000); /* SVM capable but locked by
bios*/
+       return ((msr & 0x10) == 0x10); /* SVM locked */
  }

  void virt_check_svm(fwts_framework *fw)

---

The equivalent code for Intel VMX might have a problem, too:

Bit 2 of MSR 0x3a controls if VMXON outside SMX operation causes a
general protection exception. It does not control if VMX may be used.

It is unclear why this bit is checked in vt_locked_by_bios(). See

Intel® 64 and IA-32 Architectures
Software Developer’s Manual
Volume 3C:
System Programming Guide, Part 3
https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-3c-part-3-manual.pdf
23.7 ENABLING AND ENTERING VMX OPERATION

Best regards

Heinrich
--- 
ProblemType: Bug
ApportVersion: 2.31.0-0ubuntu5
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: KDE
DistroRelease: Ubuntu 25.04
InstallationDate: Installed on 2021-07-01 (1324 days ago)
InstallationMedia: Kubuntu 21.04 "Hirsute Hippo" - Release amd64 (20210420)
NonfreeKernelModules: zfs
Package: fwts 25.01.00-0ubuntu1
PackageArchitecture: amd64
ProcVersionSignature: Ubuntu 6.12.0-12.12-generic 6.12.4
SnapChanges: no changes found
Tags: plucky third-party-packages
Uname: Linux 6.12.0-12-generic x86_64
UpgradeStatus: Upgraded to plucky on 2024-11-10 (96 days ago)
UserGroups: N/A
_MarkForUpload: True

** Affects: fwts (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: apport-collected plucky third-party-packages

** Tags added: apport-collected plucky third-party-packages

** Description changed:

  On a laptop with Ryzen 2500U I get this result for test virt:
  
  fwts, Version V25.01.00, 2025-01-21 03:29:52
  
  virt: CPU Virtualisation Configuration test.
  
--------------------------------------------------------------------------------
  
  Test 1 of 1: CPU Virtualisation Configuration test.
  Check SVM Virtualization extensions are set up correctly.
  FAILED [MEDIUM] VirtDisabledByBIOS: Test 1, Virtualization extensions
  supported
  but disabled by BIOS.
  
  The test result looks incorrect:
  
  In the BIOS 'AMD V(TM)' is enabled.
  /dev/kvm is available
  /proc/cpuinfo shows extensions svm and svm_lock
  
  Bit 12 of MSR 0xc0000080 is written by a hypervisor and not by the BIOS.
  The disabled state cannot be inferred from this register. Instead MSR
  0xc0010114 bit 4 is set to 1 if SVM is disabled by the BIOS.
  
  AMD64 Architecture Programmer’s Manual
  Volume 2, System Programming
  
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf
  3.1.7 Extended Feature Enable Register (EFER), page 55
  has this sentence:
  
  "SVMDIS—Bit 4. When this bit is set, writes to EFER treat the SVME bit
  as MBZ. When this bit is clear, EFER.SVME can be written normally. This
  bit does not prevent CPUID from reporting that SVM is available."
  
  I would assume that we need a change like the following for AMD:
  
  diff --git a/src/cpu/virt/virt_svm.c b/src/cpu/virt/virt_svm.c
  index d86f54f4..450a7f2a 100644
  --- a/src/cpu/virt/virt_svm.c
  +++ b/src/cpu/virt/virt_svm.c
  @@ -37,7 +37,7 @@
    #include <limits.h>
    #include <errno.h>
  
  -#define MSR_FEATURE_CONTROL    0xC0000080
  +#define MSR_VM_CR              0xC0010114
  
    extern fwts_cpuinfo_x86 *fwts_virt_cpuinfo;
  
  @@ -58,10 +58,10 @@ static int vt_locked_by_bios(fwts_framework *fw)
           if (!can_lock_with_msr())
                   return 0;
  
  -       if (fwts_cpu_readmsr(fw, 0, MSR_FEATURE_CONTROL, &msr))
  +       if (fwts_cpu_readmsr(fw, 0, MSR_VM_CR, &msr))
                   return -1;
  
  -       return ((msr & 0x1000) == 0x1000); /* SVM capable but locked by
  bios*/
  +       return ((msr & 0x10) == 0x10); /* SVM locked */
    }
  
    void virt_check_svm(fwts_framework *fw)
  
  ---
  
  The equivalent code for Intel VMX might have a problem, too:
  
  Bit 2 of MSR 0x3a controls if VMXON outside SMX operation causes a
  general protection exception. It does not control if VMX may be used.
  
  It is unclear why this bit is checked in vt_locked_by_bios(). See
  
  Intel® 64 and IA-32 Architectures
  Software Developer’s Manual
  Volume 3C:
  System Programming Guide, Part 3
  
https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-3c-part-3-manual.pdf
  23.7 ENABLING AND ENTERING VMX OPERATION
  
  Best regards
  
  Heinrich
+ --- 
+ ProblemType: Bug
+ ApportVersion: 2.31.0-0ubuntu5
+ Architecture: amd64
+ CasperMD5CheckResult: pass
+ CurrentDesktop: KDE
+ DistroRelease: Ubuntu 25.04
+ InstallationDate: Installed on 2021-07-01 (1324 days ago)
+ InstallationMedia: Kubuntu 21.04 "Hirsute Hippo" - Release amd64 (20210420)
+ NonfreeKernelModules: zfs
+ Package: fwts 25.01.00-0ubuntu1
+ PackageArchitecture: amd64
+ ProcVersionSignature: Ubuntu 6.12.0-12.12-generic 6.12.4
+ SnapChanges: no changes found
+ Tags: plucky third-party-packages
+ Uname: Linux 6.12.0-12-generic x86_64
+ UpgradeStatus: Upgraded to plucky on 2024-11-10 (96 days ago)
+ UserGroups: N/A
+ _MarkForUpload: True

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2098458

Title:
  Incorrect virt test results

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/fwts/+bug/2098458/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to