[libvirt] [PATCH 32/36] cputest: Add support for MSR features to cpu-parse.sh

Jiri Denemark jdenemar at redhat.com
Mon Apr 8 08:42:36 UTC 2019


The script just parses whatever cpu-gather.sh printed out.

Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 tests/cputestdata/cpu-parse.sh                        | 9 ++++++---
 tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268.xml | 1 +
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/tests/cputestdata/cpu-parse.sh b/tests/cputestdata/cpu-parse.sh
index a001647549..7501c57cba 100755
--- a/tests/cputestdata/cpu-parse.sh
+++ b/tests/cputestdata/cpu-parse.sh
@@ -23,12 +23,15 @@ fname="x86_64-cpuid-$fname"
 xml()
 {
     hex='\(0x[0-9a-f]\+\)'
-    match="$hex $hex: eax=$hex ebx=$hex ecx=$hex edx=$hex"
-    subst="<cpuid eax_in='\\1' ecx_in='\\2' eax='\\3' ebx='\\4' ecx='\\5' edx='\\6'\\/>"
+    matchCPUID="$hex $hex: eax=$hex ebx=$hex ecx=$hex edx=$hex"
+    substCPUID="<cpuid eax_in='\\1' ecx_in='\\2' eax='\\3' ebx='\\4' ecx='\\5' edx='\\6'\\/>"
+
+    matchMSR="$hex: $hex\(.......[0-9a-f]\)"
+    substMSR="<msr index='\\1' edx='\\2' eax='0x\\3'\\/>"
 
     echo "<!-- $model -->"
     echo "<cpudata arch='x86'>"
-    sed -ne "s/^ *$match$/  $subst/p"
+    sed -ne "s/^ *$matchCPUID$/  $substCPUID/p; s/^ *$matchMSR$/  $substMSR/p"
     echo "</cpudata>"
 }
 
diff --git a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268.xml b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268.xml
index 75472d44fe..f1261da891 100644
--- a/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268.xml
+++ b/tests/cputestdata/x86_64-cpuid-Xeon-Platinum-8268.xml
@@ -51,4 +51,5 @@
   <cpuid eax_in='0x80000008' ecx_in='0x00' eax='0x0000302e' ebx='0x00000000' ecx='0x00000000' edx='0x00000000'/>
   <cpuid eax_in='0x80860000' ecx_in='0x00' eax='0x00000b54' ebx='0x00000f3c' ecx='0x00000064' edx='0x00000000'/>
   <cpuid eax_in='0xc0000000' ecx_in='0x00' eax='0x00000b54' ebx='0x00000f3c' ecx='0x00000064' edx='0x00000000'/>
+  <msr index='0x10a' edx='0x00000000' eax='0x0000002b'/>
 </cpudata>
-- 
2.21.0




More information about the libvir-list mailing list