/* Walk the list of active TPM backends and collect information about them following the schema description in qapi-schema.json.  */
TPMInfoList* qmp_query_tpm(Error **errp)
/* Walk the list of active TPM backends and collect information about them following the schema description in qapi-schema.json.  */
TPMInfoList* qmp_query_tpm(Error **errp)
{
    TPMBackend *drv;
    TPMInfoList *info, *head = NULL, *cur_item = NULL;
    QLIST_FOREACH(drv, &tpm_backends, list) {
        if (!tpm_model_is_registered(drv->fe_model)) {
            continue;
        }
        info = g_new0(TPMInfoList, 1);
        info->value = qmp_query_tpm_inst(drv);
        if (!cur_item) {
            head = cur_item = info;
        } else {
            cur_item->next = info;
            cur_item = info;
        }
    }
    return head;
}