Commit Graph

8 Commits

Author SHA1 Message Date
Jiri Denemark
2784a83907 domain_capabilities: Add vendor attribute for CPU models
Even though several CPU models from various vendors are reported as
usable on a given host, user may still want to use only those that match
the host vendor. Currently the only place where users can check the
vendor of each CPU model is our CPU map, which is considered internal
and users should not really be using it directly. So to allow for such
filtering we now advertise the vendor of each CPU model in domain
capabilities.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-10 14:31:42 +02:00
Michal Privoznik
1445f62fce testutilsqemu: Fake TPM versions
Because of v8.5.0-rc1~25 we are already faking TPM support for
domaincaps. Might as well fake supported TPM versions.
The swtpm binary supports both TPM versions since its first
release, but pretend it isn't the case. For QEMU-5.2 and older
pretend only TPM-1.2 is available, QEMU-6.* has both TPM-1.2 and
TPM-2.0 and QEMU-7.0 and newer has only TPM-2.0 available.
This way, domaincaps are more dispersed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2022-08-04 08:13:55 +02:00
Jiri Denemark
48341b025a cpu_x86: Penalize disabled features when computing CPU model
For finding the best matching CPU model for a given set of features
while we don't know the CPU signature (i.e., when computing a baseline
CPU model) we've been using a "shortest list of features" heuristics.
This works well if new CPU models are supersets of older models, but
that's not always the case. As a result it may actually select a new CPU
model as a baseline while removing some features from it to make it
compatible with older models. This is in general worse than using an old
CPU model with a bunch of added features as a guest OS or apps may crash
when using features that were disabled.

On the other hand we don't want to end up with a very old model which
would guarantee no disabled features as it could stop a guest OS or apps
from using some features provided by the CPU because they would not
expect them on such an old CPU.

This patch changes the heuristics to something in between. Enabled and
disabled features are counted separately so that a CPU model requiring
some features to be disabled looks worse than a model with fewer
disabled features even if its complete list of features is longer. The
penalty given for each additional disabled feature gets bigger to make
longer list of disabled features look even worse.

https://bugzilla.redhat.com/show_bug.cgi?id=1851227

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-05-06 17:33:47 +02:00
Daniel P. Berrangé
6e1baedd2f qemu: mock swtpm initialization in tests
The domain capabilities won't report TPM support unless SWTPM can be
initialized. To avoid relying on the swtpm install in the host, mock
the entire initialization method, since all it needs todo is return
a non-error value.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-12-01 12:14:03 +00:00
Daniel P. Berrangé
6f7fc0b54a qemu: fill in domain capabilities for TPMs
This reports what TPM features QEMU supports, provided that swtpm is
installed in the host.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-12-01 12:14:03 +00:00
Peter Krempa
b04e1fddf7 qemu: capabilities: Enable detection of QEMU_CAPS_BLOCKDEV_REOPEN
Base it on the presence of the "blockdev-reopen" QMP command.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-07-26 20:25:23 +02:00
Kristina Hanicova
133d05a15e qemu: capabilities: fill in domcaps <memoryBacking>
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-07-15 15:13:04 +02:00
Peter Krempa
d53afa1e66 tests: qemucapabilities: Add test-data for the qemu-6.1 cycle
Add test data based on qemu commit v6.0.0-540-g6005ee07c3.

Notable changes are the removal of 'sheepdog' disk storage protocol.

Additionally the cpu model reported when probing seems to have changed
from:

"model-id": "AMD Ryzen 9 3900X 12-Core Processor            "

to:

"model-id": "QEMU TCG CPU version 2.5+"

despite building on the same machine. This probably also results in the
2 test changes in the CPU definition which popped up in this update.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-05-19 10:21:32 +02:00