From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 293A0C54EED for ; Tue, 24 Jan 2023 22:41:09 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKRxU-0004x4-Py; Tue, 24 Jan 2023 17:40:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKRxR-0004vm-F8; Tue, 24 Jan 2023 17:40:02 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKRxO-0003xp-Nf; Tue, 24 Jan 2023 17:40:01 -0500 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30OL0e2t004293; Tue, 24 Jan 2023 22:39:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=RD/9cAwAUjUItwYVSSrfC5lSykBjAbxVHWhng1e4lLU=; b=rKt0IsWnYSrB1vILeLen4gsATxX21eOoDj/GoUi9LzekB0NX/ubLmkNUx320WbrSRsOI NcYWYAJbc1PmR36unhThjSCBJplB5zHhZYnK16yWwucd5OoDFlTcVTYqoUYPeVNBFnt1 Ed2Jaw5yh9DmgTYj3nhf8UImuubzyFJ380mxeFL44MZSUKyawckNGyZDiPwOrttJFeMT vk8X7WXRFqSmlv/zICUpCnxoGsdv07/FASErYSuckQH6s50nr3QDW5ndlBkyAGTw9oCi S4ceOj320xKs/dW4/ito5ZRRDW201UUKX2Uk3lJEN3frBR9iKoeqCSWzrUPkvKIJ+Fs3 pQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3na838qy0d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Jan 2023 22:39:46 +0000 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 30OMHiQr003601; Tue, 24 Jan 2023 22:39:45 GMT Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3na838qxyx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Jan 2023 22:39:45 +0000 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 30OMCRh3007935; Tue, 24 Jan 2023 22:39:43 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([9.208.129.118]) by ppma05wdc.us.ibm.com (PPS) with ESMTPS id 3n87p6vqtq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Jan 2023 22:39:43 +0000 Received: from smtpav06.wdc07v.mail.ibm.com (smtpav06.wdc07v.mail.ibm.com [10.39.53.233]) by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 30OMdg3x4522632 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Jan 2023 22:39:42 GMT Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4359658060; Tue, 24 Jan 2023 22:39:42 +0000 (GMT) Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 19CD25803F; Tue, 24 Jan 2023 22:39:40 +0000 (GMT) Received: from [9.47.158.152] (unknown [9.47.158.152]) by smtpav06.wdc07v.mail.ibm.com (Postfix) with ESMTP; Tue, 24 Jan 2023 22:39:39 +0000 (GMT) Message-ID: Date: Tue, 24 Jan 2023 17:39:39 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH 20/32] tpm: Move HMP commands from monitor/ to softmmu/ Content-Language: en-US To: Markus Armbruster , qemu-devel@nongnu.org Cc: pbonzini@redhat.com, kraxel@redhat.com, kwolf@redhat.com, hreitz@redhat.com, marcandre.lureau@redhat.com, dgilbert@redhat.com, mst@redhat.com, imammedo@redhat.com, ani@anisinha.ca, eduardo@habkost.net, marcel.apfelbaum@gmail.com, philmd@linaro.org, wangyanan55@huawei.com, jasowang@redhat.com, jiri@resnulli.us, berrange@redhat.com, thuth@redhat.com, quintela@redhat.com, stefanb@linux.vnet.ibm.com, stefanha@redhat.com, kvm@vger.kernel.org, qemu-block@nongnu.org References: <20230124121946.1139465-1-armbru@redhat.com> <20230124121946.1139465-21-armbru@redhat.com> From: Stefan Berger In-Reply-To: <20230124121946.1139465-21-armbru@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 56MjQsw_OH10w9uLqTE6h1c9bMMpruZF X-Proofpoint-ORIG-GUID: vlcnXK2Awnf2kuMmucV2Xku1Cj-KV6AM Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-24_16,2023-01-24_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 spamscore=0 mlxlogscore=999 adultscore=0 lowpriorityscore=0 bulkscore=0 clxscore=1011 malwarescore=0 mlxscore=0 priorityscore=1501 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301240209 Received-SPF: pass client-ip=148.163.156.1; envelope-from=stefanb@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-1.148, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On 1/24/23 07:19, Markus Armbruster wrote: > This moves these commands from MAINTAINERS section "Human > Monitor (HMP)" to "TPM". > > Signed-off-by: Markus Armbruster Reviewed-by: Stefan Berger > --- > MAINTAINERS | 2 +- > monitor/hmp-cmds.c | 54 ----------------------------------- > softmmu/tpm-hmp-cmds.c | 65 ++++++++++++++++++++++++++++++++++++++++++ > softmmu/meson.build | 1 + > 4 files changed, 67 insertions(+), 55 deletions(-) > create mode 100644 softmmu/tpm-hmp-cmds.c > > diff --git a/MAINTAINERS b/MAINTAINERS > index 3bd4d101d3..dab4def753 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -3067,7 +3067,7 @@ T: git https://github.com/stefanha/qemu.git tracing > TPM > M: Stefan Berger > S: Maintained > -F: softmmu/tpm.c > +F: softmmu/tpm* > F: hw/tpm/* > F: include/hw/acpi/tpm.h > F: include/sysemu/tpm* > diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c > index 6b1d5358f7..81f63fa8ec 100644 > --- a/monitor/hmp-cmds.c > +++ b/monitor/hmp-cmds.c > @@ -22,7 +22,6 @@ > #include "qapi/qapi-commands-misc.h" > #include "qapi/qapi-commands-run-state.h" > #include "qapi/qapi-commands-stats.h" > -#include "qapi/qapi-commands-tpm.h" > #include "qapi/qmp/qdict.h" > #include "qapi/qmp/qerror.h" > #include "qemu/cutils.h" > @@ -126,59 +125,6 @@ void hmp_info_pic(Monitor *mon, const QDict *qdict) > hmp_info_pic_foreach, mon); > } > > -void hmp_info_tpm(Monitor *mon, const QDict *qdict) > -{ > -#ifdef CONFIG_TPM > - TPMInfoList *info_list, *info; > - Error *err = NULL; > - unsigned int c = 0; > - TPMPassthroughOptions *tpo; > - TPMEmulatorOptions *teo; > - > - info_list = qmp_query_tpm(&err); > - if (err) { > - monitor_printf(mon, "TPM device not supported\n"); > - error_free(err); > - return; > - } > - > - if (info_list) { > - monitor_printf(mon, "TPM device:\n"); > - } > - > - for (info = info_list; info; info = info->next) { > - TPMInfo *ti = info->value; > - monitor_printf(mon, " tpm%d: model=%s\n", > - c, TpmModel_str(ti->model)); > - > - monitor_printf(mon, " \\ %s: type=%s", > - ti->id, TpmType_str(ti->options->type)); > - > - switch (ti->options->type) { > - case TPM_TYPE_PASSTHROUGH: > - tpo = ti->options->u.passthrough.data; > - monitor_printf(mon, "%s%s%s%s", > - tpo->path ? ",path=" : "", > - tpo->path ?: "", > - tpo->cancel_path ? ",cancel-path=" : "", > - tpo->cancel_path ?: ""); > - break; > - case TPM_TYPE_EMULATOR: > - teo = ti->options->u.emulator.data; > - monitor_printf(mon, ",chardev=%s", teo->chardev); > - break; > - case TPM_TYPE__MAX: > - break; > - } > - monitor_printf(mon, "\n"); > - 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) > { > monitor_suspend(mon); > diff --git a/softmmu/tpm-hmp-cmds.c b/softmmu/tpm-hmp-cmds.c > new file mode 100644 > index 0000000000..9ed6ad6c4d > --- /dev/null > +++ b/softmmu/tpm-hmp-cmds.c > @@ -0,0 +1,65 @@ > +/* > + * HMP commands related to TPM > + * > + * This work is licensed under the terms of the GNU GPL, version 2 or > + * (at your option) any later version. > + */ > + > +#include "qemu/osdep.h" > +#include "qapi/qapi-commands-tpm.h" > +#include "monitor/monitor.h" > +#include "monitor/hmp.h" > +#include "qapi/error.h" > + > +void hmp_info_tpm(Monitor *mon, const QDict *qdict) > +{ > +#ifdef CONFIG_TPM > + TPMInfoList *info_list, *info; > + Error *err = NULL; > + unsigned int c = 0; > + TPMPassthroughOptions *tpo; > + TPMEmulatorOptions *teo; > + > + info_list = qmp_query_tpm(&err); > + if (err) { > + monitor_printf(mon, "TPM device not supported\n"); > + error_free(err); > + return; > + } > + > + if (info_list) { > + monitor_printf(mon, "TPM device:\n"); > + } > + > + for (info = info_list; info; info = info->next) { > + TPMInfo *ti = info->value; > + monitor_printf(mon, " tpm%d: model=%s\n", > + c, TpmModel_str(ti->model)); > + > + monitor_printf(mon, " \\ %s: type=%s", > + ti->id, TpmType_str(ti->options->type)); > + > + switch (ti->options->type) { > + case TPM_TYPE_PASSTHROUGH: > + tpo = ti->options->u.passthrough.data; > + monitor_printf(mon, "%s%s%s%s", > + tpo->path ? ",path=" : "", > + tpo->path ?: "", > + tpo->cancel_path ? ",cancel-path=" : "", > + tpo->cancel_path ?: ""); > + break; > + case TPM_TYPE_EMULATOR: > + teo = ti->options->u.emulator.data; > + monitor_printf(mon, ",chardev=%s", teo->chardev); > + break; > + case TPM_TYPE__MAX: > + break; > + } > + monitor_printf(mon, "\n"); > + c++; > + } > + qapi_free_TPMInfoList(info_list); > +#else > + monitor_printf(mon, "TPM device not supported\n"); > +#endif /* CONFIG_TPM */ > +} > diff --git a/softmmu/meson.build b/softmmu/meson.build > index 3272af1f31..efbf4ec029 100644 > --- a/softmmu/meson.build > +++ b/softmmu/meson.build > @@ -25,6 +25,7 @@ softmmu_ss.add(files( > 'rtc.c', > 'runstate-action.c', > 'runstate.c', > + 'tpm-hmp-cmds.c', > 'vl.c', > ), sdl, libpmem, libdaxctl) >