check if VT-x is activated without having to reboo

2020-02-17 01:52发布

I have a laptop with Intel Core i5 M 450 @ 2.40GHz which apparently has VT-x but not VT-d. I have Ubuntu 12.04 32bit but would like to have a virtual 64bit terminal-based Linux running on it. How do I know if the BIOS has this VT-x feature activated without having to reboot?

8条回答
Viruses.
2楼-- · 2020-02-17 02:33

You can use rdmsr from msr-tools to read register IA32_FEATURE_CONTROL (address 0x3a). The kernel module msr has to be loaded for this.

On most Linux systems:

sudo modprobe msr
sudo rdmsr 0x3a

Values 3 and 5 mean it's activated.

查看更多
Evening l夕情丶
3楼-- · 2020-02-17 02:33

you can use:

sudo apt-get update
sudo apt-get install cpu-checker
kvm-ok
查看更多
一夜七次
4楼-- · 2020-02-17 02:36

I found that scai's answer doesn't work on my AMD Ryzen systems.

This however works really well for me, even on Intel:

if systool -m kvm_amd -v &> /dev/null || systool -m kvm_intel -v &> /dev/null ; then
    echo "AMD-V / VT-X is enabled in the BIOS/UEFI."
else
    echo "AMD-V / VT-X is not enabled in the BIOS/UEFI"
fi

(systool is found in the sysfsutils package on most distros.)

For Intel's VT-D / AMD's IOMMU, I came up with this solution:

if compgen -G "/sys/kernel/iommu_groups/*/devices/*" > /dev/null; then
    echo "AMD's IOMMU / Intel's VT-D is enabled in the BIOS/UEFI."
else
    echo "AMD's IOMMU / Intel's VT-D is not enabled in the BIOS/UEFI"
fi

(It even worked for me if the iommu kernel parameters are not set.)

查看更多
走好不送
5楼-- · 2020-02-17 02:40
systool -m kvm_intel -v | grep nested
systool -m kvm_amd -v | grep nested

One of these should output:

nested              = "1"

Which indicates it is enabled.

查看更多
叛逆
6楼-- · 2020-02-17 02:42

A simple approach to confirm that Vt-D is enabled in the BIOS is through the Linux system. If the VT-D is enable in the BIOS and Iommu=on in the grub.cfg then the below folder structure is created automatically to hold the Virtual devices.

/sys/kernel/iommu_groups/0/devices/0000:00:00.0

Whereas if either one of the options VT-D or Iommu is not configured/enabled then the above mentioned folder structure is not created. This behavior is confirmed in CentOS 7.4 and Ubuntu. Hopefully this behavior is similar for other operating systems as well but this would need to be confirmed.

查看更多
孤傲高冷的网名
7楼-- · 2020-02-17 02:49

In linux you can check cpuinfo:

cat /proc/cpuinfo| egrep "vmx|svm"
查看更多
登录 后发表回答