[PATCH] cpu_map: Add EPYC-Rome model

Markus Schade posted 1 patch 3 years, 6 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
[PATCH] cpu_map: Add EPYC-Rome model
Posted by Markus Schade 3 years, 6 months ago
Hi everyone,

I'd like to add support for the EPYC-Rome CPU model from qemu.

The following patch adds the model to cpu_map. While this allows to use
the model, I am aware that some tests are required as well.

However I am not certain what exactly is needed. I am happy to provide
CPU flags or any required information from an EPYC 7502 system


Signed-off-by: Markus Schade <markus.schade@hetzner.com>

diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml
index 1486a29c65..fec01f324c 100644
--- a/src/cpu_map/index.xml
+++ b/src/cpu_map/index.xml
@@ -66,6 +66,7 @@
     <include filename="x86_Opteron_G5.xml"/>
     <include filename="x86_EPYC.xml"/>
     <include filename="x86_EPYC-IBPB.xml"/>
+    <include filename="x86_EPYC-Rome.xml"/>

     <!-- Hygon CPU models -->
     <include filename="x86_Dhyana.xml"/>
diff --git a/src/cpu_map/meson.build b/src/cpu_map/meson.build
index 19daa7157b..b86612b6e0 100644
--- a/src/cpu_map/meson.build
+++ b/src/cpu_map/meson.build
@@ -32,6 +32,7 @@ cpumap_data = [
   'x86_Dhyana.xml',
   'x86_EPYC-IBPB.xml',
   'x86_EPYC.xml',
+  'x86_EPYC-Rome.xml',
   'x86_features.xml',
   'x86_Haswell-IBRS.xml',
   'x86_Haswell-noTSX-IBRS.xml',
diff --git a/src/cpu_map/x86_EPYC-Rome.xml b/src/cpu_map/x86_EPYC-Rome.xml
new file mode 100644
index 0000000000..41d4123917
--- /dev/null
+++ b/src/cpu_map/x86_EPYC-Rome.xml
@@ -0,0 +1,81 @@
+<cpus>
+  <model name='EPYC-Rome'>
+    <decode host='on' guest='on'/>
+    <signature family='23' model='49'/>
+    <vendor name='AMD'/>
+    <feature name='3dnowprefetch'/>
+    <feature name='abm'/>
+    <feature name='adx'/>
+    <feature name='aes'/>
+    <feature name='amd-stibp'/>
+    <feature name='apic'/>
+    <feature name='arat'/>
+    <feature name='avx'/>
+    <feature name='avx2'/>
+    <feature name='bmi1'/>
+    <feature name='bmi2'/>
+    <feature name='clflush'/>
+    <feature name='clflushopt'/>
+    <feature name='clwb'/>
+    <feature name='clzero'/>
+    <feature name='cmov'/>
+    <feature name='cr8legacy'/>
+    <feature name='cx16'/>
+    <feature name='cx8'/>
+    <feature name='de'/>
+    <feature name='f16c'/>
+    <feature name='fma'/>
+    <feature name='fpu'/>
+    <feature name='fsgsbase'/>
+    <feature name='fxsr'/>
+    <feature name='fxsr_opt'/>
+    <feature name='ibpb'/>
+    <feature name='lahf_lm'/>
+    <feature name='lm'/>
+    <feature name='mca'/>
+    <feature name='mce'/>
+    <feature name='misalignsse'/>
+    <feature name='mmx'/>
+    <feature name='mmxext'/>
+    <feature name='monitor'/>
+    <feature name='movbe'/>
+    <feature name='msr'/>
+    <feature name='mtrr'/>
+    <feature name='nx'/>
+    <feature name='osvw'/>
+    <feature name='pae'/>
+    <feature name='pat'/>
+    <feature name='pclmuldq'/>
+    <feature name='pdpe1gb'/>
+    <feature name='perfctr_core'/>
+    <feature name='pge'/>
+    <feature name='pni'/>
+    <feature name='popcnt'/>
+    <feature name='pse'/>
+    <feature name='pse36'/>
+    <feature name='rdpid'/>
+    <feature name='rdrand'/>
+    <feature name='rdseed'/>
+    <feature name='rdtscp'/>
+    <feature name='sep'/>
+    <feature name='sha-ni'/>
+    <feature name='smap'/>
+    <feature name='smep'/>
+    <feature name='sse'/>
+    <feature name='sse2'/>
+    <feature name='sse4.1'/>
+    <feature name='sse4.2'/>
+    <feature name='sse4a'/>
+    <feature name='ssse3'/>
+    <feature name='svm'/>
+    <feature name='syscall'/>
+    <feature name='tsc'/>
+    <feature name='vme'/>
+    <feature name='wbnoinvd'/>
+    <feature name='xgetbv1'/>
+    <feature name='xsave'/>
+    <feature name='xsavec'/>
+    <feature name='xsaveerptr'/>
+    <feature name='xsaveopt'/>
+  </model>
+</cpus>


Re: [PATCH] cpu_map: Add EPYC-Rome model
Posted by Jiri Denemark 3 years, 6 months ago
On Thu, Sep 24, 2020 at 12:25:23 +0200, Markus Schade wrote:
> Hi everyone,
> 
> I'd like to add support for the EPYC-Rome CPU model from qemu.
> 
> The following patch adds the model to cpu_map. While this allows to use
> the model, I am aware that some tests are required as well.
> 
> However I am not certain what exactly is needed. I am happy to provide
> CPU flags or any required information from an EPYC 7502 system

Great. First, make sure you have cpuid and current qemu installed. Then
go to tests/cputestdata and run ./cpu-gather.sh script there. It should
print CPUID dump followed by a lot of JSON from QEMU. If that works, you
can pipe it to another script:

    ./cpu-gather.sh | ./cpu-parse.sh

This will create new data files for cputest. They will be called
x86_64-cpuid-*{.xml,.json,-disabled.xml,-enabled.xml}. Got back to the
top source directory, edit tests/cputest.c and add a new test case:

    DO_TEST_CPUID(VIR_ARCH_X86_64, <NAME>, JSON_MODELS);

where <NAME> is the part between "x86_64-cpuid-" and ".json" from the
new data file. If you rebuild libvirt and run tests now, cputest should
fail complaining about missing files. Run

    VIR_TEST_REGENERATE_OUTPUT=1 tests/cputest

from the build directory to create those files. Running "meson test"
should succeed now. If it does, you can just add all the new files and
tests/cputest changes to git and send it for review.

Jirka