Package: cpu-checker / 0.7-1.1

arm Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Author: dann frazier <dann.frazier@canonical.com>
Description: Add support ARM Cortex-A15 systems
Bug: https://launchpad.net/bugs/1194632
Bug-Ubuntu: https://launchpad.net/bugs/1194632
Forwarded: https://code.launchpad.net/~dannf/cpu-checker/arm-cortex-a15/+merge/171667
Last-Update: 2013-09-13

--- a/kvm-ok
+++ b/kvm-ok
@@ -39,10 +39,20 @@
 	fi
 }
 
+ARM_CPU_PART_CORTEX_A15="0xc0f" # <asm/cputype.h>
+
 # check cpu flags for capability
-virt=$(egrep -m1 -w '^flags[[:blank:]]*:' /proc/cpuinfo | egrep -wo '(vmx|svm)') || true
-[ "$virt" = "vmx" ] && brand="intel"
-[ "$virt" = "svm" ] && brand="amd"
+if [ "$(uname -m)" = "armv7l" ]; then
+    if egrep -m1 -w '^CPU part[[:blank:]]*:' /proc/cpuinfo | \
+	egrep -wq "$ARM_CPU_PART_CORTEX_A15"; then
+	virt="ARM"
+	kvm_mod="kvm"
+    fi
+else
+    virt=$(egrep -m1 -w '^flags[[:blank:]]*:' /proc/cpuinfo | egrep -wo '(vmx|svm)') || true
+    [ "$virt" = "vmx" ] && kvm_mod="kvm_intel"
+    [ "$virt" = "svm" ] && kvm_mod="kvm_amd"
+fi
 
 if [ -z "$virt" ]; then
 	echo "INFO: Your CPU does not support KVM extensions"
@@ -56,7 +66,7 @@
 	verdict 0
 else
 	echo "INFO: /dev/kvm does not exist"
-	echo "HINT:   sudo modprobe kvm_$brand"
+	echo "HINT:   sudo modprobe $kvm_mod"
 fi
 
 assert_root
@@ -66,7 +76,7 @@
 if [ ! -r "$msr" ]; then
 	modprobe msr
 fi
-if [ ! -r "$msr" ]; then
+if [ -e "$msr" -a ! -r "$msr" ]; then
 	echo "You must be root to run this check." >&2
 	exit 2
 fi
@@ -90,6 +100,9 @@
         if [ "$BIT" = "1" ]; then
 		disabled=1
         fi
+elif [ "$virt" = "ARM" ]; then
+    # Should also test that we booted in HYP mode, if detectable
+    :
 else
 	echo "FAIL: Unknown virtualization extension: $virt"
 	verdict 1