From nobody Sun Feb 8 19:24:57 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623252364; cv=none; d=zohomail.com; s=zohoarc; b=ayZU7G8aueg7K2Gxan5gg/SuS1weYrZRg7Xg0h4BlE39/qrNIoVSjxGAbst5nKNOudijkJCIoUMWBlByybUfaD5FEBdOFi/kKhiJfrLn5djGwrrb4u5uXZV/dIedVdFkJ0J2GJCCij6f7nz1wS+5EMNxS3NbshDi9U6huwWPMuA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623252364; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=3JDtiVRlS21ENBVVxMxOKQP3uYIs/1iCx9UWETEac04=; b=mgwEREzTDmM/ZpmtK9ZJcRPFzmne1BX9Iu5eA4WFs3X0RT5qJZaF0EoiQKLZH8emziAGLrldf4BWG3cQNLP+/uUFsfB4HsWatd0FzAYWGF6hLmkLnx0lQDyWtuXAdRYuyLoJezt7m3Oo0vCpTciQyeIzepp2lZVgfZGaB/LC9VI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1623252364825729.946392807103; Wed, 9 Jun 2021 08:26:04 -0700 (PDT) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-338-IzqYYlSnNHiqc2tsj0-FJg-1; Wed, 09 Jun 2021 11:26:02 -0400 Received: by mail-wr1-f71.google.com with SMTP id q15-20020adfc50f0000b0290111f48b865cso10911416wrf.4 for ; Wed, 09 Jun 2021 08:26:01 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (235.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.235]) by smtp.gmail.com with ESMTPSA id e27sm280297wra.50.2021.06.09.08.26.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Jun 2021 08:26:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623252363; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3JDtiVRlS21ENBVVxMxOKQP3uYIs/1iCx9UWETEac04=; b=bhhr1bn1YP2RV4LJipQvS3qCtEqpnrZzPYJvsd6b9zMZyHkduxW50e9SHqkrfZ92K+cnnI tphbNBKq81U1wAg5A5wT1uL8A0RgAWqxWCzzeCUkzEy3lwJF40BZT46ASyVqJwF/z2Bum2 lHxMG8QQbo1EHaykcL2AvL91FXb1feA= X-MC-Unique: IzqYYlSnNHiqc2tsj0-FJg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3JDtiVRlS21ENBVVxMxOKQP3uYIs/1iCx9UWETEac04=; b=shJ6Fr1lhW95/NYmRk6bY4LgmC2vKrKsYoDXk5yI35eDnAcEd0Mjgm1ljClX+mb5d2 V4w3yLt78gyaV+Lvp+o3y4O+MSPoOdqiUojpkNHHlORwkUJ9Fxp+An2fM67K5HyCnlCp 4KU48CqZjicTjtPWFaw5wDdpvAN8YN4sD2RAIMFT/hfMUR25PzZXoDyTL1YQGubw/arQ 0n1EBPBpGrTLKS9vqIBbMplva/8fDTgArRBL3bXApuXj6br4oRkBjcVFJQRGiLVk8FTo +Tu1uOlLum0Ml09tszjMR73B6HYpr8xNQSZEJThEXuDFxmPwrxNJPJUummhy04hln97d 09og== X-Gm-Message-State: AOAM530SHBuyrCd+/ZU9o4QrBQNz/V/Iqz7GLrRfnOAUXcaKcQMDyNB5 DzG9ggOkqx1IhgZiRRDFFoiYKBGZJ3LNY8mb6tx57r7W39lggijxh31LwXh3Xo1sIX37auG//ER C5G0r2PuW9C+bXg== X-Received: by 2002:a05:600c:4f8f:: with SMTP id n15mr398930wmq.116.1623252360763; Wed, 09 Jun 2021 08:26:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8l3dwW/n0M1oO5dsF/VhS7WP4rqzDzLw4NDsjUbfyjerme5n+FyjVdEKHfcZBXNo9cLaq5A== X-Received: by 2002:a05:600c:4f8f:: with SMTP id n15mr398914wmq.116.1623252360660; Wed, 09 Jun 2021 08:26:00 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Stefan Berger , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH] tpm: Return QMP error when TPM is disabled in build Date: Wed, 9 Jun 2021 17:25:59 +0200 Message-Id: <20210609152559.1088596-1-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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": [ ] } Make it clearer by returning an error, mentioning the feature is disabled: { "execute": "query-tpm" } { "error": { "class": "GenericError", "desc": "this feature or command is not currently supported" } } Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- stubs/tpm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stubs/tpm.c b/stubs/tpm.c index 9bded191d9d..8c904215b39 100644 --- a/stubs/tpm.c +++ b/stubs/tpm.c @@ -7,6 +7,8 @@ =20 #include "qemu/osdep.h" #include "qapi/qapi-commands-tpm.h" +#include "qapi/qmp/qerror.h" +#include "qapi/error.h" #include "sysemu/tpm.h" #include "hw/acpi/tpm.h" =20 @@ -21,16 +23,19 @@ void tpm_cleanup(void) =20 TPMInfoList *qmp_query_tpm(Error **errp) { + error_setg(errp, QERR_UNSUPPORTED); return NULL; } =20 TpmTypeList *qmp_query_tpm_types(Error **errp) { + error_setg(errp, QERR_UNSUPPORTED); return NULL; } =20 TpmModelList *qmp_query_tpm_models(Error **errp) { + error_setg(errp, QERR_UNSUPPORTED); return NULL; } =20 --=20 2.31.1