[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 05/22] target/i386/monitor: Return QMP error when SEV is disab
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v3 05/22] target/i386/monitor: Return QMP error when SEV is disabled in build |
Date: |
Sat, 2 Oct 2021 14:53:00 +0200 |
If the management layer tries to inject a secret, it gets an empty
response in case the binary built without SEV:
{ "execute": "sev-inject-launch-secret",
"arguments": { "packet-header": "mypkt", "secret": "mypass", "gpa":
4294959104 }
}
{
"return": {
}
}
Make it clearer by returning an error, mentioning the feature is
disabled:
{ "execute": "sev-inject-launch-secret",
"arguments": { "packet-header": "mypkt", "secret": "mypass", "gpa":
4294959104 }
}
{
"error": {
"class": "GenericError",
"desc": "this feature or command is not currently supported"
}
}
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Connor Kuehl <ckuehl@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
target/i386/monitor.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/target/i386/monitor.c b/target/i386/monitor.c
index 196c1c9e77f..a9f85acd473 100644
--- a/target/i386/monitor.c
+++ b/target/i386/monitor.c
@@ -28,6 +28,7 @@
#include "monitor/hmp-target.h"
#include "monitor/hmp.h"
#include "qapi/qmp/qdict.h"
+#include "qapi/qmp/qerror.h"
#include "sysemu/kvm.h"
#include "sysemu/sev.h"
#include "qapi/error.h"
@@ -743,6 +744,10 @@ void qmp_sev_inject_launch_secret(const char *packet_hdr,
bool has_gpa, uint64_t gpa,
Error **errp)
{
+ if (!sev_enabled()) {
+ error_setg(errp, QERR_UNSUPPORTED);
+ return;
+ }
if (!has_gpa) {
uint8_t *data;
struct sev_secret_area *area;
--
2.31.1
- [PATCH v3 00/22] target/i386/sev: Housekeeping SEV + measured Linux SEV guest, Philippe Mathieu-Daudé, 2021/10/02
- [PATCH v3 06/22] target/i386/cpu: Add missing 'qapi/error.h' header, Philippe Mathieu-Daudé, 2021/10/02
- [PATCH v3 07/22] target/i386/sev_i386.h: Remove unused headers, Philippe Mathieu-Daudé, 2021/10/02
- [PATCH v3 09/22] target/i386/sev: Mark unreachable code with g_assert_not_reached(), Philippe Mathieu-Daudé, 2021/10/02
- [PATCH v3 08/22] target/i386/sev: Remove sev_get_me_mask(), Philippe Mathieu-Daudé, 2021/10/02