{"id":2215955,"url":"http://patchwork.ozlabs.org/api/patches/2215955/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260325151728.45378-6-philmd@linaro.org/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260325151728.45378-6-philmd@linaro.org>","list_archive_url":null,"date":"2026-03-25T15:17:27","name":"[PATCH-for-11.0?,5/6] qom: Restrict compat properties API to system emulation","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"1a166f3d74b1ccea34173d602f9f899b4d98a5d0","submitter":{"id":85046,"url":"http://patchwork.ozlabs.org/api/people/85046/?format=json","name":"Philippe Mathieu-Daudé","email":"philmd@linaro.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260325151728.45378-6-philmd@linaro.org/mbox/","series":[{"id":497463,"url":"http://patchwork.ozlabs.org/api/series/497463/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=497463","date":"2026-03-25T15:17:22","name":"qom: Restrict compat properties API to system emulation","version":1,"mbox":"http://patchwork.ozlabs.org/series/497463/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2215955/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2215955/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=An+Vzzv5;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fgrCG31wxz1xy3\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 02:18:34 +1100 (AEDT)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1w5Pzt-00055e-JT; Wed, 25 Mar 2026 11:18:17 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1w5Pzo-0004vJ-Cl\n for qemu-devel@nongnu.org; Wed, 25 Mar 2026 11:18:12 -0400","from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1w5Pzm-0000Gd-Ej\n for qemu-devel@nongnu.org; Wed, 25 Mar 2026 11:18:12 -0400","by mail-wm1-x32b.google.com with SMTP id\n 5b1f17b1804b1-486fc4725f0so10702905e9.1\n for <qemu-devel@nongnu.org>; Wed, 25 Mar 2026 08:18:10 -0700 (PDT)","from localhost.localdomain (88-187-86-199.subs.proxad.net.\n [88.187.86.199]) by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-4871174f2cesm139339185e9.10.2026.03.25.08.18.07\n (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);\n Wed, 25 Mar 2026 08:18:08 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1774451889; x=1775056689; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=jek66EmZwh90Q0GbeJB2FKCf8mZ1pqgxf9FHcRMVDAM=;\n b=An+Vzzv5JYxqrmfKsXRY942e61w+UibF/N83A3HPn8vNZ06rGeE7OoZoONLjq6jAxZ\n UQP2JnHEjWDBrAydbvpRryA3e7VXu3vvF2TmlWSM9a+EWt6FcNvQMBrHH2l45UPvBzrs\n jGm+0XneZ6mSn6gVfAIxsbsj+QJq6yQZaM8GiQnYvkQGR1UsjtcHS6jhS2nRrUubDVce\n cn/51HlJNsv31fJmK0w/Pt4OSO1mp0zymM5ihUlpjd/52s5+Hs29CUP9x0j5FFH8PG+e\n Zf8Xsk/INKexB/JMwdcRbwFi7DLAfXcoNkW6WZj0W9UHKFij3ziRsOgqXlGHbKXi9f9Q\n 7jqg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774451889; x=1775056689;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=jek66EmZwh90Q0GbeJB2FKCf8mZ1pqgxf9FHcRMVDAM=;\n b=eEMho61lkW/4nMOwPpPcd6e9q1I4/khRRYQWhx0Yr9Aq9eYoBVv+/Eh2Y6X8kAJ/Df\n TA1pd7ybuS0Wl/PyfclkUP2zNfGmYG/J0W6mIrq8BSR/7a37XAMDzuyltn0Hq/qZHYBS\n XnJN1FZGiXoNxjtfaR6KOKyGOOH0V67swqxYWMbq6HmTsHDvIlOpOst2DGNMU4L35+Y4\n knk2fteKFzsee0uPNg9kz7YS0DYvgi3cVJHR1VS4M17L467vuO1vZ1KELEh2Pnu+xyKw\n tVcXD/wGkmx+1cQHFlSvf8lElWfTFGxmGO+GLg8RhWSRvuFjH+mLgHMBJZxUKeHfmBXT\n 6v7g==","X-Forwarded-Encrypted":"i=1;\n AJvYcCU5i45xyh94bCO+yBrQvYPVidNNMqqFeJcmxfrGACxr7S2myh7wk/u0e9FqHVSl+KYLaoIgb18BqN+Q@nongnu.org","X-Gm-Message-State":"AOJu0YycXfnLVov0pYukgYJQxYErpKZxBxb6Bq5cRQ2aOdgBfCBwDgpf\n bDQgxnp/4TvtjfL8qTT7zLO48hZYZ1l+7K+Na2K645dV3K+X9M0nR7jETy/Br2nMrcmaG4I3rTn\n tJ69zMho=","X-Gm-Gg":"ATEYQzxuSz3xURh8aDqwkH9umVWO0rTams6X5CI0WZauYi1i/q4vbneC+3wFelRtBxe\n MGLyE8Zj2n/9m0LSWYo2RD35EpTezV1/n2TnHiwjhbxTUYXYn1ulZMj0E/zvGylDAjfAZhQTfBy\n Lu/qWCGI1anTcWps48PPMCNmdl7uAdY9NQu2W+91eTFtIqj5UOwPd8j2duqGLZ+SWxejiJkyHxC\n O8lFIfFD+uOLgUhezSurX1fc9U+yhxPNjyHVwlVhMqFz1tLVisp4h8HTt77UCO3i0G1TZb1gd3J\n +ffqCSsAIDMm6104d73hsXAdyjVfks4xmJ71wbmg1nkokbfogYrY2zt08hVQ8js6xoU8sPNE4IF\n 6FHRs5zwOqlQ6E5qIADRZp7K58yPvr416bH5DfI1034BIm2mHAZxLbbuBwlWZSdcUG6L9w+GxeL\n ykg0SJF4+kOD9VXt93wiCve0Z+ET/wdResa9XTpnL4eOBv+c0Op12ujgIkOmLN+JRsQCWLyc8Z","X-Received":"by 2002:a05:600c:6814:b0:485:3c11:de84 with SMTP id\n 5b1f17b1804b1-487160a2589mr53284815e9.14.1774451888875;\n Wed, 25 Mar 2026 08:18:08 -0700 (PDT)","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>","To":"Michael Tokarev <mjt@tls.msk.ru>,\n\tqemu-devel@nongnu.org","Cc":"=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>,\n Richard Henderson <richard.henderson@linaro.org>, =?utf-8?q?Philippe_Mathie?=\n\t=?utf-8?q?u-Daud=C3=A9?= <philmd@linaro.org>, =?utf-8?q?Daniel_P=2E_Berrang?=\n\t=?utf-8?q?=C3=A9?= <berrange@redhat.com>,\n Paolo Bonzini <pbonzini@redhat.com>,\n =?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org>, kvm@vger.kernel.org","Subject":"[PATCH-for-11.0? 5/6] qom: Restrict compat properties API to system\n emulation","Date":"Wed, 25 Mar 2026 16:17:27 +0100","Message-ID":"<20260325151728.45378-6-philmd@linaro.org>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260325151728.45378-1-philmd@linaro.org>","References":"<20260325151728.45378-1-philmd@linaro.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=2a00:1450:4864:20::32b;\n envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.google.com","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,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n 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":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"Move compat properties API definitions to their own file\nunit, compile it only when system emulation is configured.\n\nSigned-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>\n---\n qom/compat-properties.c | 116 ++++++++++++++++++++++++++++++++++++++++\n qom/object.c            | 100 ----------------------------------\n qom/meson.build         |   3 ++\n 3 files changed, 119 insertions(+), 100 deletions(-)\n create mode 100644 qom/compat-properties.c","diff":"diff --git a/qom/compat-properties.c b/qom/compat-properties.c\nnew file mode 100644\nindex 00000000000..f8d9b0036ae\n--- /dev/null\n+++ b/qom/compat-properties.c\n@@ -0,0 +1,116 @@\n+/*\n+ * QEMU Object Model\n+ *\n+ * Copyright IBM, Corp. 2011\n+ *\n+ * Authors:\n+ *  Anthony Liguori   <aliguori@us.ibm.com>\n+ *\n+ * SPDX-License-Identifier: GPL-2.0-or-later\n+ */\n+\n+#include \"qemu/osdep.h\"\n+#include \"qapi/error.h\"\n+#include \"qom/compat-properties.h\"\n+#include \"qom/qom-qobject.h\"\n+#include \"hw/core/qdev.h\"\n+\n+bool object_apply_global_props(Object *obj, const GPtrArray *props,\n+                               Error **errp)\n+{\n+    int i;\n+\n+    if (!props) {\n+        return true;\n+    }\n+\n+    for (i = 0; i < props->len; i++) {\n+        GlobalProperty *p = g_ptr_array_index(props, i);\n+        Error *err = NULL;\n+\n+        if (object_dynamic_cast(obj, p->driver) == NULL) {\n+            continue;\n+        }\n+        if (p->optional && !object_property_find(obj, p->property)) {\n+            continue;\n+        }\n+        p->used = true;\n+        if (!object_property_parse(obj, p->property, p->value, &err)) {\n+            error_prepend(&err, \"can't apply global %s.%s=%s: \",\n+                          p->driver, p->property, p->value);\n+            /*\n+             * If errp != NULL, propagate error and return.\n+             * If errp == NULL, report a warning, but keep going\n+             * with the remaining globals.\n+             */\n+            if (errp) {\n+                error_propagate(errp, err);\n+                return false;\n+            } else {\n+                warn_report_err(err);\n+            }\n+        }\n+    }\n+\n+    return true;\n+}\n+\n+/*\n+ * Global property defaults\n+ * Slot 0: accelerator's global property defaults\n+ * Slot 1: machine's global property defaults\n+ * Slot 2: global properties from legacy command line option\n+ * Each is a GPtrArray of GlobalProperty.\n+ * Applied in order, later entries override earlier ones.\n+ */\n+static GPtrArray *object_compat_props[3];\n+\n+/*\n+ * Retrieve @GPtrArray for global property defined with options\n+ * other than \"-global\".  These are generally used for syntactic\n+ * sugar and legacy command line options.\n+ */\n+void object_register_sugar_prop(const char *driver, const char *prop,\n+                                const char *value, bool optional)\n+{\n+    GlobalProperty *g;\n+    if (!object_compat_props[2]) {\n+        object_compat_props[2] = g_ptr_array_new();\n+    }\n+    g = g_new0(GlobalProperty, 1);\n+    g->driver = g_strdup(driver);\n+    g->property = g_strdup(prop);\n+    g->value = g_strdup(value);\n+    g->optional = optional;\n+    g_ptr_array_add(object_compat_props[2], g);\n+}\n+\n+/*\n+ * Set machine's global property defaults to @compat_props.\n+ * May be called at most once.\n+ */\n+void object_set_machine_compat_props(GPtrArray *compat_props)\n+{\n+    assert(!object_compat_props[1]);\n+    object_compat_props[1] = compat_props;\n+}\n+\n+/*\n+ * Set accelerator's global property defaults to @compat_props.\n+ * May be called at most once.\n+ */\n+void object_set_accelerator_compat_props(GPtrArray *compat_props)\n+{\n+    assert(!object_compat_props[0]);\n+    object_compat_props[0] = compat_props;\n+}\n+\n+void object_apply_compat_props(Object *obj)\n+{\n+    int i;\n+\n+    for (i = 0; i < ARRAY_SIZE(object_compat_props); i++) {\n+        object_apply_global_props(obj, object_compat_props[i],\n+                                  i == 2 ? &error_fatal : &error_abort);\n+    }\n+}\ndiff --git a/qom/object.c b/qom/object.c\nindex 838b1d2b225..f00d659ef0f 100644\n--- a/qom/object.c\n+++ b/qom/object.c\n@@ -440,106 +440,6 @@ static void object_post_init_with_type(Object *obj, TypeImpl *ti)\n     }\n }\n \n-bool object_apply_global_props(Object *obj, const GPtrArray *props,\n-                               Error **errp)\n-{\n-    int i;\n-\n-    if (!props) {\n-        return true;\n-    }\n-\n-    for (i = 0; i < props->len; i++) {\n-        GlobalProperty *p = g_ptr_array_index(props, i);\n-        Error *err = NULL;\n-\n-        if (object_dynamic_cast(obj, p->driver) == NULL) {\n-            continue;\n-        }\n-        if (p->optional && !object_property_find(obj, p->property)) {\n-            continue;\n-        }\n-        p->used = true;\n-        if (!object_property_parse(obj, p->property, p->value, &err)) {\n-            error_prepend(&err, \"can't apply global %s.%s=%s: \",\n-                          p->driver, p->property, p->value);\n-            /*\n-             * If errp != NULL, propagate error and return.\n-             * If errp == NULL, report a warning, but keep going\n-             * with the remaining globals.\n-             */\n-            if (errp) {\n-                error_propagate(errp, err);\n-                return false;\n-            } else {\n-                warn_report_err(err);\n-            }\n-        }\n-    }\n-\n-    return true;\n-}\n-\n-/*\n- * Global property defaults\n- * Slot 0: accelerator's global property defaults\n- * Slot 1: machine's global property defaults\n- * Slot 2: global properties from legacy command line option\n- * Each is a GPtrArray of GlobalProperty.\n- * Applied in order, later entries override earlier ones.\n- */\n-static GPtrArray *object_compat_props[3];\n-\n-/*\n- * Retrieve @GPtrArray for global property defined with options\n- * other than \"-global\".  These are generally used for syntactic\n- * sugar and legacy command line options.\n- */\n-void object_register_sugar_prop(const char *driver, const char *prop,\n-                                const char *value, bool optional)\n-{\n-    GlobalProperty *g;\n-    if (!object_compat_props[2]) {\n-        object_compat_props[2] = g_ptr_array_new();\n-    }\n-    g = g_new0(GlobalProperty, 1);\n-    g->driver = g_strdup(driver);\n-    g->property = g_strdup(prop);\n-    g->value = g_strdup(value);\n-    g->optional = optional;\n-    g_ptr_array_add(object_compat_props[2], g);\n-}\n-\n-/*\n- * Set machine's global property defaults to @compat_props.\n- * May be called at most once.\n- */\n-void object_set_machine_compat_props(GPtrArray *compat_props)\n-{\n-    assert(!object_compat_props[1]);\n-    object_compat_props[1] = compat_props;\n-}\n-\n-/*\n- * Set accelerator's global property defaults to @compat_props.\n- * May be called at most once.\n- */\n-void object_set_accelerator_compat_props(GPtrArray *compat_props)\n-{\n-    assert(!object_compat_props[0]);\n-    object_compat_props[0] = compat_props;\n-}\n-\n-void object_apply_compat_props(Object *obj)\n-{\n-    int i;\n-\n-    for (i = 0; i < ARRAY_SIZE(object_compat_props); i++) {\n-        object_apply_global_props(obj, object_compat_props[i],\n-                                  i == 2 ? &error_fatal : &error_abort);\n-    }\n-}\n-\n static void object_class_property_init_all(Object *obj)\n {\n     ObjectPropertyIterator iter;\ndiff --git a/qom/meson.build b/qom/meson.build\nindex 81922434309..bd6f4aadd78 100644\n--- a/qom/meson.build\n+++ b/qom/meson.build\n@@ -5,6 +5,9 @@ qom_ss.add(files(\n   'object_interfaces.c',\n   'qom-qobject.c',\n ))\n+if have_system\n+  qom_ss.add(files('compat-properties.c'))\n+endif\n \n qmp_ss.add(files('qom-qmp-cmds.c'))\n system_ss.add(files('qom-hmp-cmds.c'))\n","prefixes":["PATCH-for-11.0?","5/6"]}