mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
tpm: Return QMP error when TPM is disabled in build
When the management layer queries a binary built using --disable-tpm for TPM devices, it gets confused by getting empty responses: { "execute": "query-tpm" } { "return": [ ] } { "execute": "query-tpm-types" } { "return": [ ] } { "execute": "query-tpm-models" } { "return": [ ] } To make it clearer by returning an error: - Make the TPM QAPI schema conditional All of tpm.json is now 'if': 'defined(CONFIG_TPM)'. - Adapt the HMP command - Remove stubs which became unnecessary The management layer now gets a 'CommandNotFound' error: { "execute": "query-tpm" } { "error": { "class": "CommandNotFound", "desc": "The command query-tpm has not been found" } } Suggested-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
e542b71805
commit
caff255a54
5 changed files with 23 additions and 36 deletions
|
@ -901,6 +901,7 @@ void hmp_info_pci(Monitor *mon, const QDict *qdict)
|
|||
|
||||
void hmp_info_tpm(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
#ifdef CONFIG_TPM
|
||||
TPMInfoList *info_list, *info;
|
||||
Error *err = NULL;
|
||||
unsigned int c = 0;
|
||||
|
@ -946,6 +947,9 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict)
|
|||
c++;
|
||||
}
|
||||
qapi_free_TPMInfoList(info_list);
|
||||
#else
|
||||
monitor_printf(mon, "TPM device not supported\n");
|
||||
#endif /* CONFIG_TPM */
|
||||
}
|
||||
|
||||
void hmp_quit(Monitor *mon, const QDict *qdict)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue