From caff255a546d12530cf7c28e60690cd0e65851fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 15 Jun 2021 16:21:21 +0200 Subject: tpm: Return QMP error when TPM is disabled in build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Stefan Berger --- stubs/meson.build | 1 - stubs/tpm.c | 25 ------------------------- 2 files changed, 26 deletions(-) delete mode 100644 stubs/tpm.c (limited to 'stubs') diff --git a/stubs/meson.build b/stubs/meson.build index 65c22c0568..d4e9549dc9 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -38,7 +38,6 @@ stub_ss.add(files('runstate-check.c')) stub_ss.add(files('sysbus.c')) stub_ss.add(files('target-get-monitor-def.c')) stub_ss.add(files('target-monitor-defs.c')) -stub_ss.add(files('tpm.c')) stub_ss.add(files('trace-control.c')) stub_ss.add(files('uuid.c')) stub_ss.add(files('vmgenid.c')) diff --git a/stubs/tpm.c b/stubs/tpm.c deleted file mode 100644 index e79bd2a6c2..0000000000 --- a/stubs/tpm.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * TPM stubs - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#include "qemu/osdep.h" -#include "qapi/qapi-commands-tpm.h" -#include "hw/acpi/tpm.h" - -TPMInfoList *qmp_query_tpm(Error **errp) -{ - return NULL; -} - -TpmTypeList *qmp_query_tpm_types(Error **errp) -{ - return NULL; -} - -TpmModelList *qmp_query_tpm_models(Error **errp) -{ - return NULL; -} -- cgit v1.2.3