66 lines
2.6 KiB
Diff
66 lines
2.6 KiB
Diff
From a9530c89225fce9e381929c4cd8e372068827acf Mon Sep 17 00:00:00 2001
|
|
From: Michal Privoznik <mprivozn@redhat.com>
|
|
Date: Mon, 24 Jun 2024 10:52:49 +0200
|
|
Subject: [PATCH 089/100] i386/sev: Fallback to the default SEV device if none
|
|
provided in sev_get_capabilities()
|
|
|
|
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
|
|
RH-MergeRequest: 245: SEV-SNP support
|
|
RH-Jira: RHEL-39544
|
|
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
RH-Acked-by: Bandan Das <bdas@redhat.com>
|
|
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
|
RH-Commit: [89/91] 22318c20d7102815f754cec0efaf383e05ef79c1 (bonzini/rhel-qemu-kvm)
|
|
|
|
When management tools (e.g. libvirt) query QEMU capabilities,
|
|
they start QEMU with a minimalistic configuration and issue
|
|
various commands on monitor. One of the command issued is/might
|
|
be "query-sev-capabilities" to learn values like cbitpos or
|
|
reduced-phys-bits. But as of v9.0.0-1145-g16dcf200dc the monitor
|
|
command returns an error instead.
|
|
|
|
This creates a chicken-egg problem because in order to query
|
|
those aforementioned values QEMU needs to be started with a
|
|
'sev-guest' object. But to start QEMU with the values must be
|
|
known.
|
|
|
|
I think it's safe to assume that the default path ("/dev/sev")
|
|
provides the same data as user provided one. So fall back to it.
|
|
|
|
Fixes: 16dcf200dc951c1cde3e5b442457db5f690b8cf0
|
|
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
Link: https://lore.kernel.org/r/157f93712c23818be193ce785f648f0060b33dee.1719218926.git.mprivozn@redhat.com
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
(cherry picked from commit 3fb24530b2bb1346a44e17becefc9865b40a2257)
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
---
|
|
target/i386/sev.c | 10 +++++-----
|
|
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/target/i386/sev.c b/target/i386/sev.c
|
|
index 53b7f7315b..491fab74fd 100644
|
|
--- a/target/i386/sev.c
|
|
+++ b/target/i386/sev.c
|
|
@@ -585,13 +585,13 @@ static SevCapability *sev_get_capabilities(Error **errp)
|
|
}
|
|
|
|
sev_common = SEV_COMMON(MACHINE(qdev_get_machine())->cgs);
|
|
- if (!sev_common) {
|
|
- error_setg(errp, "SEV is not configured");
|
|
- return NULL;
|
|
+ if (sev_common) {
|
|
+ sev_device = object_property_get_str(OBJECT(sev_common), "sev-device",
|
|
+ &error_abort);
|
|
+ } else {
|
|
+ sev_device = g_strdup(DEFAULT_SEV_DEVICE);
|
|
}
|
|
|
|
- sev_device = object_property_get_str(OBJECT(sev_common), "sev-device",
|
|
- &error_abort);
|
|
fd = open(sev_device, O_RDWR);
|
|
if (fd < 0) {
|
|
error_setg_errno(errp, errno, "SEV: Failed to open %s",
|
|
--
|
|
2.39.3
|
|
|