From nobody Tue Nov 26 06:40:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1709560368; cv=none; d=zohomail.com; s=zohoarc; b=LppylKlVfbZJMMYwwcsr6BY9ZVJlUfv8AqKlZY2TsTthXJ9c3TKyRJhQSntz8lUp3moRZ9CpFiTG6ukFMiKGxXBvf1Op7fpuBnE5GreW3uqYct7MU0krm/M+grLtGXOMuEsTioiyLOPjqqCMwcdy07r5HseQDODwNUl4LaP74l0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709560368; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=c/i+NYjvQsES+/AHWFB9e2egh23dZ1ktAi8EXPofTlg=; b=U4oyO7Co4KrgBqPg8n3sZvBZm5lQn5GOcs1Ejg4ko9/SVTkCEjZE1IZXEr2MWhl8cSfgnIXEtgNa5eY5yqyIda6QkNZS5sh5kA2AbY7gP0LsattOYLRrZHZL14C8TC8mDxJXqM/C2ZbolhRTWeVH9VNkhmqyTd1QMiq+F0Z+tC0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1709560368314185.94127909498548; Mon, 4 Mar 2024 05:52:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rh8js-0006Ja-5d; Mon, 04 Mar 2024 08:52:21 -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 1rh8jp-0006J2-4e for qemu-devel@nongnu.org; Mon, 04 Mar 2024 08:52:17 -0500 Received: from forwardcorp1c.mail.yandex.net ([178.154.239.200]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rh8jk-0002JU-Lo for qemu-devel@nongnu.org; Mon, 04 Mar 2024 08:52:16 -0500 Received: from mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net [IPv6:2a02:6b8:c14:750a:0:640:e46:0]) by forwardcorp1c.mail.yandex.net (Yandex) with ESMTPS id 0B3536095C; Mon, 4 Mar 2024 16:52:07 +0300 (MSK) Received: from davydov-max-nux.yandex-team.ru (unknown [2a02:6b8:b081:b709::1:23]) by mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id jpeXWn4Id0U0-6DC7ZeqA; Mon, 04 Mar 2024 16:52:06 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1709560326; bh=c/i+NYjvQsES+/AHWFB9e2egh23dZ1ktAi8EXPofTlg=; h=Cc:Message-Id:References:Date:In-Reply-To:Subject:To:From; b=qq3fzFAQtyKlzBlvnd3nYnLjrJzBvHHAe0cioWbsoynUUPQB8cTy+PcockkcrmhU0 EBxmGQ+oDi7tQtVK2/QuaFXqQT4AMlL+ckq0PkBGbHKB1X1nfodmYe+8JpN71epijG JVlmZj+U6uaK3RRvUqJCrdfLzNN239raJ0EmbGtk= Authentication-Results: mail-nwsmtp-smtp-corp-main-34.sas.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Maksim Davydov To: qemu-devel@nongnu.org Cc: davydov-max@yandex-team.ru, vsementsov@yandex-team.ru, peter.maydell@linaro.org, jsnow@redhat.com, philmd@linaro.org, armbru@redhat.com Subject: [PULL 2/4] qmp: add dump machine type compatibility properties Date: Mon, 4 Mar 2024 16:51:43 +0300 Message-Id: <20240304135145.154860-3-davydov-max@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240304135145.154860-1-davydov-max@yandex-team.ru> References: <20240304135145.154860-1-davydov-max@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.200; envelope-from=davydov-max@yandex-team.ru; helo=forwardcorp1c.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1709560370431100005 Content-Type: text/plain; charset="utf-8" To control that creating new machine type doesn't affect the previous types (their compat_props) and to check complex compat_props inheritance we need qmp command to print machine type compatibility properties. This patch adds the ability to get list of all the compat_props of the corresponding supported machines for their comparison via new optional argument of "query-machines" command. Since information on compatibility properties can increase the command output by a factor of 40, add an argument to enable it, default off. Signed-off-by: Maksim Davydov Reviewed-by: Vladimir Sementsov-Ogievskiy Acked-by: Markus Armbruster --- hw/core/machine-qmp-cmds.c | 23 ++++++++++++- qapi/machine.json | 69 +++++++++++++++++++++++++++++++++++-- tests/qtest/fuzz/qos_fuzz.c | 2 +- 3 files changed, 89 insertions(+), 5 deletions(-) diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index 3860a50c3b..4e908e12d3 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -66,7 +66,8 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp) return head; } =20 -MachineInfoList *qmp_query_machines(Error **errp) +MachineInfoList *qmp_query_machines(bool has_compat_props, bool compat_pro= ps, + Error **errp) { GSList *el, *machines =3D object_class_get_list(TYPE_MACHINE, false); MachineInfoList *mach_list =3D NULL; @@ -98,6 +99,26 @@ MachineInfoList *qmp_query_machines(Error **errp) info->default_ram_id =3D g_strdup(mc->default_ram_id); } =20 + if (compat_props && mc->compat_props) { + int i; + info->compat_props =3D NULL; + CompatPropertyList **tail =3D &(info->compat_props); + info->has_compat_props =3D true; + + for (i =3D 0; i < mc->compat_props->len; i++) { + GlobalProperty *mt_prop =3D g_ptr_array_index(mc->compat_p= rops, + i); + CompatProperty *prop; + + prop =3D g_malloc0(sizeof(*prop)); + prop->qom_type =3D g_strdup(mt_prop->driver); + prop->property =3D g_strdup(mt_prop->property); + prop->value =3D g_strdup(mt_prop->value); + + QAPI_LIST_APPEND(tail, prop); + } + } + QAPI_LIST_PREPEND(mach_list, info); } =20 diff --git a/qapi/machine.json b/qapi/machine.json index 93b4677286..4850ef212e 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -135,6 +135,26 @@ ## { 'command': 'query-cpus-fast', 'returns': [ 'CpuInfoFast' ] } =20 +## +# @CompatProperty: +# +# Property default values specific to a machine type, for use by +# scripts/compare-machine-types. +# +# @qom-type: name of the QOM type to which the default applies +# +# @property: name of its property to which the default applies +# +# @value: the default value (machine-specific default can overwrite +# the "default" default, to avoid this use -machine none) +# +# Since: 9.0 +## +{ 'struct': 'CompatProperty', + 'data': { 'qom-type': 'str', + 'property': 'str', + 'value': 'str' } } + ## # @MachineInfo: # @@ -166,6 +186,14 @@ # # @acpi: machine type supports ACPI (since 8.0) # +# @compat-props: The machine type's compatibility properties. Only +# present when query-machines argument @compat-props is true. +# (since 9.0) +# +# Features: +# +# @unstable: Member @compat-props is experimental. +# # Since: 1.2 ## { 'struct': 'MachineInfo', @@ -173,18 +201,53 @@ '*is-default': 'bool', 'cpu-max': 'int', 'hotpluggable-cpus': 'bool', 'numa-mem-supported': 'bool', 'deprecated': 'bool', '*default-cpu-type': 'str', - '*default-ram-id': 'str', 'acpi': 'bool' } } + '*default-ram-id': 'str', 'acpi': 'bool', + '*compat-props': { 'type': ['CompatProperty'], + 'features': ['unstable'] } } } =20 ## # @query-machines: # # Return a list of supported machines # +# @compat-props: if true, also return compatibility properties. +# (default: false) (since 9.0) +# +# Features: +# +# @unstable: Argument @compat-props is experimental. +# # Returns: a list of MachineInfo # # Since: 1.2 -## -{ 'command': 'query-machines', 'returns': ['MachineInfo'] } +# +# Example: +# +# -> { "execute": "query-machines", "arguments": { "compat-props": true } } +# <- { "return": [ +# { +# "hotpluggable-cpus": true, +# "name": "pc-q35-6.2", +# "compat-props": [ +# { +# "qom-type": "virtio-mem", +# "property": "unplugged-inaccessible", +# "value": "off" +# } +# ], +# "numa-mem-supported": false, +# "default-cpu-type": "qemu64-x86_64-cpu", +# "cpu-max": 288, +# "deprecated": false, +# "default-ram-id": "pc.ram" +# }, +# ... +# } +## +{ 'command': 'query-machines', + 'data': { '*compat-props': { 'type': 'bool', + 'features': [ 'unstable' ] } }, + 'returns': ['MachineInfo'] } =20 ## # @CurrentMachineParams: diff --git a/tests/qtest/fuzz/qos_fuzz.c b/tests/qtest/fuzz/qos_fuzz.c index e403d373a0..b71e945c5f 100644 --- a/tests/qtest/fuzz/qos_fuzz.c +++ b/tests/qtest/fuzz/qos_fuzz.c @@ -46,7 +46,7 @@ static void qos_set_machines_devices_available(void) MachineInfoList *mach_info; ObjectTypeInfoList *type_info; =20 - mach_info =3D qmp_query_machines(&error_abort); + mach_info =3D qmp_query_machines(false, false, &error_abort); machines_apply_to_node(mach_info); qapi_free_MachineInfoList(mach_info); =20 --=20 2.34.1