]>
git.proxmox.com Git - mirror_qemu.git/blob - tests/acceptance/x86_cpu_model_versions.py
b85d6f860445d3eefa32fa2d1870f9069c0f6f41
3 # Basic validation of x86 versioned CPU models and CPU model aliases
5 # Copyright (c) 2019 Red Hat Inc
8 # Eduardo Habkost <ehabkost@redhat.com>
10 # This library is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU Lesser General Public
12 # License as published by the Free Software Foundation; either
13 # version 2 of the License, or (at your option) any later version.
15 # This library is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # Lesser General Public License for more details.
20 # You should have received a copy of the GNU Lesser General Public
21 # License along with this library; if not, see <http://www.gnu.org/licenses/>.
28 class X86CPUModelAliases(avocado_qemu
.Test
):
30 Validation of PC CPU model versions and CPU model aliases
32 :avocado: tags=arch:x86_64
34 def validate_aliases(self
, cpus
):
35 for c
in cpus
.values():
37 # all aliases must point to a valid CPU model name:
38 self
.assertIn(c
['alias-of'], cpus
,
39 '%s.alias-of (%s) is not a valid CPU model name' % (c
['name'], c
['alias-of']))
40 # aliases must not point to aliases
41 self
.assertNotIn('alias-of', cpus
[c
['alias-of']],
42 '%s.alias-of (%s) points to another alias' % (c
['name'], c
['alias-of']))
44 # aliases must not be static
45 self
.assertFalse(c
['static'])
47 def validate_variant_aliases(self
, cpus
):
48 # -noTSX, -IBRS and -IBPB variants of CPU models are special:
49 # they shouldn't have their own versions:
50 self
.assertNotIn("Haswell-noTSX-v1", cpus
,
51 "Haswell-noTSX shouldn't be versioned")
52 self
.assertNotIn("Broadwell-noTSX-v1", cpus
,
53 "Broadwell-noTSX shouldn't be versioned")
54 self
.assertNotIn("Nehalem-IBRS-v1", cpus
,
55 "Nehalem-IBRS shouldn't be versioned")
56 self
.assertNotIn("Westmere-IBRS-v1", cpus
,
57 "Westmere-IBRS shouldn't be versioned")
58 self
.assertNotIn("SandyBridge-IBRS-v1", cpus
,
59 "SandyBridge-IBRS shouldn't be versioned")
60 self
.assertNotIn("IvyBridge-IBRS-v1", cpus
,
61 "IvyBridge-IBRS shouldn't be versioned")
62 self
.assertNotIn("Haswell-noTSX-IBRS-v1", cpus
,
63 "Haswell-noTSX-IBRS shouldn't be versioned")
64 self
.assertNotIn("Haswell-IBRS-v1", cpus
,
65 "Haswell-IBRS shouldn't be versioned")
66 self
.assertNotIn("Broadwell-noTSX-IBRS-v1", cpus
,
67 "Broadwell-noTSX-IBRS shouldn't be versioned")
68 self
.assertNotIn("Broadwell-IBRS-v1", cpus
,
69 "Broadwell-IBRS shouldn't be versioned")
70 self
.assertNotIn("Skylake-Client-IBRS-v1", cpus
,
71 "Skylake-Client-IBRS shouldn't be versioned")
72 self
.assertNotIn("Skylake-Server-IBRS-v1", cpus
,
73 "Skylake-Server-IBRS shouldn't be versioned")
74 self
.assertNotIn("EPYC-IBPB-v1", cpus
,
75 "EPYC-IBPB shouldn't be versioned")
77 def test_4_0_alias_compatibility(self
):
78 """Check if pc-*-4.0 unversioned CPU model won't be reported as aliases"""
79 # pc-*-4.0 won't expose non-versioned CPU models as aliases
80 # We do this to help management software to keep compatibility
81 # with older QEMU versions that didn't have the versioned CPU model
82 self
.vm
.add_args('-S')
83 self
.vm
.set_machine('pc-i440fx-4.0')
85 cpus
= dict((m
['name'], m
) for m
in self
.vm
.command('query-cpu-definitions'))
87 self
.assertFalse(cpus
['Cascadelake-Server']['static'],
88 'unversioned Cascadelake-Server CPU model must not be static')
89 self
.assertNotIn('alias-of', cpus
['Cascadelake-Server'],
90 'Cascadelake-Server must not be an alias')
91 self
.assertNotIn('alias-of', cpus
['Cascadelake-Server-v1'],
92 'Cascadelake-Server-v1 must not be an alias')
94 self
.assertFalse(cpus
['qemu64']['static'],
95 'unversioned qemu64 CPU model must not be static')
96 self
.assertNotIn('alias-of', cpus
['qemu64'],
97 'qemu64 must not be an alias')
98 self
.assertNotIn('alias-of', cpus
['qemu64-v1'],
99 'qemu64-v1 must not be an alias')
101 self
.validate_variant_aliases(cpus
)
103 # On pc-*-4.0, no CPU model should be reported as an alias:
104 for name
,c
in cpus
.items():
105 self
.assertNotIn('alias-of', c
, "%s shouldn't be an alias" % (name
))