The command can be used by libvirt to retrieve the measurement of SEV guest. This measurement is a signature of the memory contents that was encrypted through the LAUNCH_UPDATE_DATA. Cc: "Daniel P. Berrangé" <berrange@xxxxxxxxxx> Cc: "Dr. David Alan Gilbert" <dgilbert@xxxxxxxxxx> Cc: Markus Armbruster <armbru@xxxxxxxxxx> Signed-off-by: Brijesh Singh <brijesh.singh@xxxxxxx> --- qapi-schema.json | 30 ++++++++++++++++++++++++++++++ qmp.c | 14 ++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/qapi-schema.json b/qapi-schema.json index 447ebb15266e..19331bff8883 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3236,3 +3236,33 @@ # ## { 'command': 'query-sev', 'returns': 'SevInfo' } + +## +# @SevLaunchMeasureInfo: +# +# SEV Guest Launch measurement information +# +# @data: the measurement value encoded in base64 +# +# Since: 2.12 +# +# Notes: If measurement is not available then a null measurement is returned. +## +{ 'struct': 'SevLaunchMeasureInfo', 'data': {'data': 'str'} } + +## +# @query-sev-launch-measure: +# +# Query the SEV guest launch information. +# +# Returns: The @SevLaunchMeasureInfo for the guest +# +# Since: 2.12 +# +# Example: +# +# -> { "execute": "query-sev-launch-measure" } +# <- { "return": { "data": "4l8LXeNlSPUDlXPJG5966/8%YZ" } } +# +## +{ 'command': 'query-sev-launch-measure', 'returns': 'SevLaunchMeasureInfo' } diff --git a/qmp.c b/qmp.c index 1a5cfad09dd0..5fb19b9d0db3 100644 --- a/qmp.c +++ b/qmp.c @@ -733,3 +733,17 @@ SevInfo *qmp_query_sev(Error **errp) return info; } + +SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) +{ + SevLaunchMeasureInfo *info = NULL; + + if (sev_enabled()) { + info = g_malloc0(sizeof(*info)); + info->data = sev_get_launch_measurement(); + } else { + error_setg(errp, "SEV is not enabled"); + } + + return info; +} -- 2.14.3