{"id":2222908,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2222908/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260414003001.97571-28-philmd@linaro.org/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.1/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":""},"msgid":"<20260414003001.97571-28-philmd@linaro.org>","date":"2026-04-14T00:29:59","name":"[v3,27/27] monitor: Merge hmp-target.c code within hmp-cmds.c","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"dfcf6fc5dbca145f80c8ca9a68b0e57b61e0c3f5","submitter":{"id":85046,"url":"http://patchwork.ozlabs.org/api/1.1/people/85046/?format=json","name":"Philippe Mathieu-Daudé","email":"philmd@linaro.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260414003001.97571-28-philmd@linaro.org/mbox/","series":[{"id":499762,"url":"http://patchwork.ozlabs.org/api/1.1/series/499762/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=499762","date":"2026-04-14T00:29:32","name":"monitor: Remove need of per-target handlers","version":3,"mbox":"http://patchwork.ozlabs.org/series/499762/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2222908/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2222908/checks/","tags":{},"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=dLB1Mi3L;\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=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.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 4fvld34HGLz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 14 Apr 2026 10:33:43 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wCRie-0001WV-4N; Mon, 13 Apr 2026 20:33:32 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1wCRiX-0001TF-5d\n for qemu-devel@nongnu.org; Mon, 13 Apr 2026 20:33:26 -0400","from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d])\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 1wCRiV-0003fv-9N\n for qemu-devel@nongnu.org; Mon, 13 Apr 2026 20:33:24 -0400","by mail-wm1-x32d.google.com with SMTP id\n 5b1f17b1804b1-483487335c2so54767705e9.2\n for <qemu-devel@nongnu.org>; Mon, 13 Apr 2026 17:33:22 -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-488ee038752sm5826945e9.9.2026.04.13.17.33.20\n (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);\n Mon, 13 Apr 2026 17:33:20 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1776126801; x=1776731601; 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=ODwnfJVouK+JUVlbOBy8KRV4Th4vkJEO+Xt0lwwIQP8=;\n b=dLB1Mi3LosnyTRuIlMQmSZshoWtfrlNSa5MDtEuOgZnAGZxpsk7pePs/HQtFarPPwG\n CsxaMsPS2z9m4VAQRks2pBg3A0yJEfvyymEj4NARpz6r7SORXqLA4sqk+XisdppBZL9D\n 3CuqYujfAlTvaY3MGmBQD+GQymWeafVz/1/HrLTIllLMRWdkrZpXMjPjx5EGTJXVl9G6\n J6GL2U4yM2X0/LlFJqDu0xymNBAEPRPLbLlQEAIg8PH5egR28dxRlR1MeMvdwQb1fohu\n 78WW2Z7m8fdnDuWl4wu68WvpiFiQ+J2sTTz11X0G8VfCngHxgezR0FD9fEoCAzDT3r9t\n U+jw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776126801; x=1776731601;\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=ODwnfJVouK+JUVlbOBy8KRV4Th4vkJEO+Xt0lwwIQP8=;\n b=ZUoIw3jtaofoNntzptkrcZ2OLvex5QaErTRfexEmSxZrQCPh8RxlJDvliuLMUx0gx+\n J/dhIGbeJRXIIhy/iH0NccgvUqasRymKyH6r97bSsssAF9285D4/wsnoBVYz7ffLRGGU\n qmSeRhLme0uYRpHWehQfh7x73QeKtM+8PnU2U40iRf6bCyK1ByKW/wgmMibGRuk+TYgl\n RJEewUUEGztCwY3yVijX+qzd8I5JcJ6RT6lAH2i15x67gJegL4DFCgitWPTyobYlHthb\n Nha34Xsd/c5+g4Ex+BwjhNI3fc+F2xCz094sG2JYvhWt/Mc2lwnHMvyqW6YcIIfEuP5N\n qZ0g==","X-Gm-Message-State":"AOJu0YzMCtokQrWLpI3fWUEUEND2DLYlCd6/tF8pomdCjalCYtK5kJo+\n ALosixP0ZC+suDh0TzdCRcFtXWDpjXV6c3kvmDJVUrR1G7h2wgALhyVP7578aozQRTiZt8g7aIZ\n tCStAF7U=","X-Gm-Gg":"AeBDiesZnz4dHWQ8mgxliP1zWhrkb3/sWYCB8+Bi/2geX8WWXBYP1p42aENTJ6cxjo7\n EkC+RxZMS8aUPQBqwfq7GG9uYcnDoFPKcfLob0LNWy5aPOvih3LNpCxqcqPEouGlsAYCujVO79+\n nqtq/KXyokmBKqmPG3sLqua+nb+/v1s7AZrO80KQSw7UMIvuikEZ7XojhkPHKx51t2UVgz73VdA\n IyDmH3EsDHjtkxoew/RSn8Tw++13uB8FNueR6gTY7Huaepj5LuTI467uIlNn1ZvPJ3w4bjSVUlZ\n G7nDTjUIP/cEnv4+YluKLs5zaFZVyCGeyqJ1EeOW/M22qEpd16nVPEtn77JWaDdeagTFUO5zIq1\n 4fZGkg/ms0VJORJW1hwAXMSJ3NvhqTKaQT1bfb3ONJwWBVuBBBwtIkmiUcZtDEy3nmKlXaT3lgB\n I2p+yS4LL7i6IsW+YWJLdNptAjVTBq7BkrS+xj4Wccb7kPCAAZDzpG1xNnF7ImtIDt47n2Q1SZ","X-Received":"by 2002:a05:600d:d:b0:485:2a85:e5ec with SMTP id\n 5b1f17b1804b1-488d67b8db8mr160288015e9.2.1776126801487;\n Mon, 13 Apr 2026 17:33:21 -0700 (PDT)","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>","To":"qemu-devel@nongnu.org","Cc":"Pierrick Bouvier <pierrick.bouvier@linaro.org>,\n Markus Armbruster <armbru@redhat.com>,\n Richard Henderson <richard.henderson@linaro.org>,\n \"Dr. David Alan Gilbert\" <dave@treblig.org>,\n Paolo Bonzini <pbonzini@redhat.com>,\n =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>","Subject":"[PATCH v3 27/27] monitor: Merge hmp-target.c code within hmp-cmds.c","Date":"Tue, 14 Apr 2026 02:29:59 +0200","Message-ID":"<20260414003001.97571-28-philmd@linaro.org>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260414003001.97571-1-philmd@linaro.org>","References":"<20260414003001.97571-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::32d;\n envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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":"hmp-target.c doesn't contain any target-specific code anymore.\nMerge it within hmp-cmds.c (which is already built once).\n\nSigned-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>\nReviewed-by: Richard Henderson <richard.henderson@linaro.org>\n---\n MAINTAINERS          |  1 -\n monitor/hmp-cmds.c   | 40 ++++++++++++++++++++++++\n monitor/hmp-target.c | 74 --------------------------------------------\n monitor/meson.build  |  3 --\n 4 files changed, 40 insertions(+), 78 deletions(-)\n delete mode 100644 monitor/hmp-target.c","diff":"diff --git a/MAINTAINERS b/MAINTAINERS\nindex 5dcd24a8a89..d184e25ddd4 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -3414,7 +3414,6 @@ Human Monitor (HMP)\n M: Dr. David Alan Gilbert <dave@treblig.org>\n S: Maintained\n F: monitor/monitor-internal.h\n-F: monitor/hmp-target.c\n F: monitor/monitor.c\n F: monitor/hmp*\n F: hmp.h\ndiff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c\nindex e81632f5551..409a1a9c701 100644\n--- a/monitor/hmp-cmds.c\n+++ b/monitor/hmp-cmds.c\n@@ -14,6 +14,7 @@\n  */\n \n #include \"qemu/osdep.h\"\n+#include \"qemu/base-arch-defs.h\"\n #include \"system/address-spaces.h\"\n #include \"system/ioport.h\"\n #include \"exec/gdbstub.h\"\n@@ -22,19 +23,58 @@\n #include \"monitor/hmp.h\"\n #include \"qemu/help_option.h\"\n #include \"monitor/hmp.h\"\n+#include \"monitor/hmp-completion.h\"\n #include \"monitor/monitor-internal.h\"\n+#include \"monitor/qdev.h\"\n #include \"qapi/error.h\"\n #include \"qapi/qapi-commands-control.h\"\n #include \"qapi/qapi-commands-machine.h\"\n #include \"qapi/qapi-commands-misc.h\"\n+#include \"block/block-hmp-cmds.h\"\n #include \"qobject/qdict.h\"\n #include \"qemu/cutils.h\"\n #include \"qemu/log.h\"\n+#include \"net/slirp.h\"\n+#include \"system/device_tree.h\"\n #include \"system/hw_accel.h\"\n #include \"system/memory.h\"\n #include \"system/system.h\"\n #include \"disas/disas.h\"\n \n+/* Please update hmp-commands.hx when adding or changing commands */\n+static HMPCommand hmp_info_cmds[] = {\n+#include \"hmp-commands-info.h\"\n+    { NULL, NULL, },\n+};\n+\n+/* hmp_cmds and hmp_info_cmds would be sorted at runtime */\n+static HMPCommand hmp_cmds[] = {\n+#include \"hmp-commands.h\"\n+    { NULL, NULL, },\n+};\n+\n+HMPCommand *hmp_cmds_for_target(bool info_command)\n+{\n+    return info_command ? hmp_info_cmds : hmp_cmds;\n+}\n+\n+static int\n+compare_mon_cmd(const void *a, const void *b)\n+{\n+    return strcmp(((const HMPCommand *)a)->name,\n+            ((const HMPCommand *)b)->name);\n+}\n+\n+static void __attribute__((__constructor__)) sortcmdlist(void)\n+{\n+    qsort(hmp_cmds, ARRAY_SIZE(hmp_cmds) - 1,\n+          sizeof(*hmp_cmds),\n+          compare_mon_cmd);\n+    qsort(hmp_info_cmds, ARRAY_SIZE(hmp_info_cmds) - 1,\n+          sizeof(*hmp_info_cmds),\n+          compare_mon_cmd);\n+}\n+\n bool hmp_handle_error(Monitor *mon, Error *err)\n {\n     if (err) {\ndiff --git a/monitor/hmp-target.c b/monitor/hmp-target.c\ndeleted file mode 100644\nindex 2739383607d..00000000000\n--- a/monitor/hmp-target.c\n+++ /dev/null\n@@ -1,74 +0,0 @@\n-/*\n- * QEMU monitor, target-dependent part\n- *\n- * Copyright (c) 2003-2004 Fabrice Bellard\n- *\n- * Permission is hereby granted, free of charge, to any person obtaining a copy\n- * of this software and associated documentation files (the \"Software\"), to deal\n- * in the Software without restriction, including without limitation the rights\n- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n- * copies of the Software, and to permit persons to whom the Software is\n- * furnished to do so, subject to the following conditions:\n- *\n- * The above copyright notice and this permission notice shall be included in\n- * all copies or substantial portions of the Software.\n- *\n- * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n- * THE SOFTWARE.\n- */\n-\n-#include \"qemu/osdep.h\"\n-#include \"qemu/base-arch-defs.h\"\n-#include \"monitor-internal.h\"\n-#include \"monitor/qdev.h\"\n-#include \"net/slirp.h\"\n-#include \"system/device_tree.h\"\n-#include \"monitor/hmp.h\"\n-#include \"monitor/hmp-completion.h\"\n-#include \"block/block-hmp-cmds.h\"\n-#include \"qapi/qapi-commands-control.h\"\n-#include \"qapi/qapi-commands-misc.h\"\n-#include \"qapi/qapi-commands-machine.h\"\n-#include \"hw/core/sysemu-cpu-ops.h\"\n-\n-/* Make devices configuration available for use in hmp-commands*.hx templates */\n-#include CONFIG_DEVICES\n-\n-/* Please update hmp-commands.hx when adding or changing commands */\n-static HMPCommand hmp_info_cmds[] = {\n-#include \"hmp-commands-info.h\"\n-    { NULL, NULL, },\n-};\n-\n-/* hmp_cmds and hmp_info_cmds would be sorted at runtime */\n-static HMPCommand hmp_cmds[] = {\n-#include \"hmp-commands.h\"\n-    { NULL, NULL, },\n-};\n-\n-HMPCommand *hmp_cmds_for_target(bool info_command)\n-{\n-    return info_command ? hmp_info_cmds : hmp_cmds;\n-}\n-\n-static int\n-compare_mon_cmd(const void *a, const void *b)\n-{\n-    return strcmp(((const HMPCommand *)a)->name,\n-            ((const HMPCommand *)b)->name);\n-}\n-\n-static void __attribute__((__constructor__)) sortcmdlist(void)\n-{\n-    qsort(hmp_cmds, ARRAY_SIZE(hmp_cmds) - 1,\n-          sizeof(*hmp_cmds),\n-          compare_mon_cmd);\n-    qsort(hmp_info_cmds, ARRAY_SIZE(hmp_info_cmds) - 1,\n-          sizeof(*hmp_info_cmds),\n-          compare_mon_cmd);\n-}\ndiff --git a/monitor/meson.build b/monitor/meson.build\nindex 585251804e4..4c58dd148c0 100644\n--- a/monitor/meson.build\n+++ b/monitor/meson.build\n@@ -7,6 +7,3 @@ system_ss.add(files(\n   'qemu-config-qmp.c',\n   'qmp-cmds.c',\n ))\n-\n-specific_ss.add(when: 'CONFIG_SYSTEM_ONLY',\n-                if_true: [files('hmp-target.c')])\n","prefixes":["v3","27/27"]}