[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 04/23] target/i386/monitor: Return QMP error when SEV is disab
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 04/23] target/i386/monitor: Return QMP error when SEV is disabled in build |
Date: |
Wed, 16 Jun 2021 22:43:09 +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 119211f0b06..c83cca80dc2 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"
@@ -742,6 +743,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 v2 00/23] target/i386/sev: Housekeeping (OVMF + SEV-disabled binaries), Philippe Mathieu-Daudé, 2021/06/16
- [PATCH v2 02/23] qapi/misc-target: Wrap long 'SEV Attestation Report' long lines, Philippe Mathieu-Daudé, 2021/06/16
- [PATCH v2 01/23] MAINTAINERS: Add Connor Kuehl as reviewer for AMD SEV, Philippe Mathieu-Daudé, 2021/06/16
- [PATCH v2 03/23] qapi/misc-target: Group SEV QAPI definitions, Philippe Mathieu-Daudé, 2021/06/16
- [PATCH v2 05/23] target/i386/cpu: Add missing 'qapi/error.h' header, Philippe Mathieu-Daudé, 2021/06/16
- [PATCH v2 04/23] target/i386/monitor: Return QMP error when SEV is disabled in build,
Philippe Mathieu-Daudé <=
- [PATCH v2 06/23] target/i386/sev_i386.h: Remove unused headers, Philippe Mathieu-Daudé, 2021/06/16
- [PATCH v2 07/23] target/i386/sev: Remove sev_get_me_mask(), Philippe Mathieu-Daudé, 2021/06/16
- [PATCH v2 08/23] target/i386/sev: Mark unreachable code with g_assert_not_reached(), Philippe Mathieu-Daudé, 2021/06/16
- [PATCH v2 09/23] target/i386/sev: sev_get_attestation_report use g_autofree, Philippe Mathieu-Daudé, 2021/06/16
- [PATCH v2 10/23] target/i386/sev: Restrict SEV to system emulation, Philippe Mathieu-Daudé, 2021/06/16
- [PATCH v2 11/23] target/i386/sev: Move qmp_query_sev_attestation_report() to sev.c, Philippe Mathieu-Daudé, 2021/06/16
- [PATCH v2 12/23] target/i386/sev: Move qmp_sev_inject_launch_secret() to sev.c, Philippe Mathieu-Daudé, 2021/06/16
- [PATCH v2 13/23] target/i386/sev: Move qmp_query_sev_capabilities() to sev.c, Philippe Mathieu-Daudé, 2021/06/16
- [PATCH v2 14/23] target/i386/sev: Move qmp_query_sev_launch_measure() to sev.c, Philippe Mathieu-Daudé, 2021/06/16
- [PATCH v2 15/23] target/i386/sev: Move qmp_query_sev() & hmp_info_sev() to sev.c, Philippe Mathieu-Daudé, 2021/06/16