mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
target/i386: Add HMP and QMP interfaces for SGX
The QMP and HMP interfaces can be used by monitor or QMP tools to retrieve the SGX information from VM side when SGX is enabled on Intel platform. Signed-off-by: Yang Zhong <yang.zhong@intel.com> Message-Id: <20210910102258.46648-2-yang.zhong@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
c5348c6a16
commit
57d874c4c7
8 changed files with 136 additions and 0 deletions
|
@ -35,6 +35,7 @@
|
|||
#include "qapi/qapi-commands-misc-target.h"
|
||||
#include "qapi/qapi-commands-misc.h"
|
||||
#include "hw/i386/pc.h"
|
||||
#include "hw/i386/sgx.h"
|
||||
|
||||
/* Perform linear address sign extension */
|
||||
static hwaddr addr_canonical(CPUArchState *env, hwaddr addr)
|
||||
|
@ -763,3 +764,29 @@ qmp_query_sev_attestation_report(const char *mnonce, Error **errp)
|
|||
{
|
||||
return sev_get_attestation_report(mnonce, errp);
|
||||
}
|
||||
|
||||
SGXInfo *qmp_query_sgx(Error **errp)
|
||||
{
|
||||
return sgx_get_info(errp);
|
||||
}
|
||||
|
||||
void hmp_info_sgx(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
Error *err = NULL;
|
||||
g_autoptr(SGXInfo) info = qmp_query_sgx(&err);
|
||||
|
||||
if (err) {
|
||||
error_report_err(err);
|
||||
return;
|
||||
}
|
||||
monitor_printf(mon, "SGX support: %s\n",
|
||||
info->sgx ? "enabled" : "disabled");
|
||||
monitor_printf(mon, "SGX1 support: %s\n",
|
||||
info->sgx1 ? "enabled" : "disabled");
|
||||
monitor_printf(mon, "SGX2 support: %s\n",
|
||||
info->sgx2 ? "enabled" : "disabled");
|
||||
monitor_printf(mon, "FLC support: %s\n",
|
||||
info->flc ? "enabled" : "disabled");
|
||||
monitor_printf(mon, "size: %" PRIu64 "\n",
|
||||
info->section_size);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue