{"id":2222176,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2222176/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-ppc/patch/20260410195323.17937-22-philmd@linaro.org/","project":{"id":69,"url":"http://patchwork.ozlabs.org/api/1.1/projects/69/?format=json","name":"QEMU powerpc development","link_name":"qemu-ppc","list_id":"qemu-ppc.nongnu.org","list_email":"qemu-ppc@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260410195323.17937-22-philmd@linaro.org>","date":"2026-04-10T19:53:15","name":"[v2,21/27] monitor: Do not check TARGET_S390X to build s390x commands","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"26da9081ae11d297696058f5b62e4f24f9a4d9c6","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-ppc/patch/20260410195323.17937-22-philmd@linaro.org/mbox/","series":[{"id":499497,"url":"http://patchwork.ozlabs.org/api/1.1/series/499497/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-ppc/list/?series=499497","date":"2026-04-10T19:52:55","name":"monitor: Remove need of per-target handlers","version":2,"mbox":"http://patchwork.ozlabs.org/series/499497/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2222176/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2222176/checks/","tags":{},"headers":{"Return-Path":"<qemu-ppc-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=N8tYr4dn;\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-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.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 4fsndj3gmWz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 11 Apr 2026 05:57:29 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-ppc-bounces@nongnu.org>)\n\tid 1wBHxR-0006X4-FP; Fri, 10 Apr 2026 15:56:01 -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 1wBHxQ-0006WG-En\n for qemu-ppc@nongnu.org; Fri, 10 Apr 2026 15:56:00 -0400","from mail-wm1-x335.google.com ([2a00:1450:4864:20::335])\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 1wBHxO-0003aq-9E\n for qemu-ppc@nongnu.org; Fri, 10 Apr 2026 15:56:00 -0400","by mail-wm1-x335.google.com with SMTP id\n 5b1f17b1804b1-488c2690057so23823135e9.0\n for <qemu-ppc@nongnu.org>; Fri, 10 Apr 2026 12:55:57 -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-488d5888c12sm109936675e9.3.2026.04.10.12.55.55\n (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);\n Fri, 10 Apr 2026 12:55:56 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1775850957; x=1776455757; 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=Ns/VNhECUVMMVKjm49BzmvODa90VglcciVurHoSA27A=;\n b=N8tYr4dnvRwEFXBVQ1UIzZnyXtt/F5Bo4hZFdAmWl8HxWaS8OLhvdnYf3h884MQ4Sy\n hauLUX7ehGcsTUp6nKL0DN9Lpk6ZH0v64N+0JLmQ0KLXbnBINiSwaJ+xS0L+TMklSO0W\n 8kHmLldVMaeDcmECM1DZ2bZqyJpZUGJH7YfVNPEe58JQqRMwrtTtj7oBT0yKej5Odb7Q\n gEgsxD/t0KLwwjzzG4lJ8xQajkz0/vYiO32zfQWNYAMtDgmJbg6D2yp46Zk6BU+pIsVw\n /gLPDO69y3pDEV+l/zeQLPvRkRoWnDE2FDu370PPg/fvDYgZiqDUiZMRwlALwJtRRsLk\n 54eQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775850957; x=1776455757;\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=Ns/VNhECUVMMVKjm49BzmvODa90VglcciVurHoSA27A=;\n b=jDXWgfTJDy6n/6LFEGmp1EOes9d8SCfp39cmVxJ2TLKcWTrYLZPQwIRH1DwjKYes1A\n TAXvQN2l4OxMzo8m3ayEW78/pEebRCKMisddyk3pecg9m1ieNnovhlNsDZg/wKQCkvcr\n zdKvqAqQ4uPvYAZjtYIkMTtZkr1a7iklAm2118JQtmk7FdvIjJKWkaBWKdf+V0+NBkb1\n kmEBmRqx5dn7HAMTcyVHuMvRDOOuwh+UonavOQKds38UQiuQcWoCoo16KcEfntZt+zMa\n zvKmX9bngy/n1jaVsVTORqnHDWf/j2dgyvxpJghCT5wtvtLHQT0z9u0CS3OF5dVk7vhM\n fjiQ==","X-Forwarded-Encrypted":"i=1;\n AJvYcCUpbrZ9gLM2n1fGuI18Y10s4AKx3WfSpaJg4WcgIWrmfM7qSSYoDRLYnm5lrXV+/5maU9iETh3adA==@nongnu.org","X-Gm-Message-State":"AOJu0YxQdfX6cg1x4sRaIW1kFvt6KW2AzCxrBd7I3OqzE8ih6dji1jl/\n AfWCjLE4MA3D3RGc8XW/Nuvob01tFynuN8RrMWUFHhq1L8aSFakL8jpWCwOqeEwFyvE=","X-Gm-Gg":"AeBDiev/TXQoPCP/VohAIBK9jv7xwV0wqLcjBOEG8eRJSLZyYe/vJQtgC2unj8BxYmt\n 412bwL42wJKn/DlIrIYf4lv1yMTUCYDBI0m64PEClu/4lFJm8DzJBbr19+6iqJhoDxNOkJ5pN9R\n 9mfuD3ByvkGkOAXLJPvXgIGNM0FtoSt7WMH79gRQRTBhKW08TVgW9WEt9IVBB68QuIIzRzYNz2J\n Zk3bGADnVwMW9glHvQn5kJnz9qtZPkZlJDbg2Vgx0fxnRJkZURZTL/VxtNOnX9nr81mEXCXkA4m\n 3qGenQW+qpQeDhloEsCm+cVd93XnLCicV8zcEdVF/ykXZnPePXFDaP8VvfDIl83R9uYNdEcx2kh\n k1iJsrC9l8FvsKSxPL+tukogNUZ4lD2XSTIfk0llxwe6RlmQdtdrTDZuidZPXN2BRkelit4l1lX\n s9wfbq1ear8zXlqKztuYhsG6PwqZyYGB0rKv2sFAcmzzxSH1beomFzzukEn2DERjkIFp3oY6Vh","X-Received":"by 2002:a05:600c:64c4:b0:486:fbd1:9dc0 with SMTP id\n 5b1f17b1804b1-488d68c2c56mr54818125e9.22.1775850956615;\n Fri, 10 Apr 2026 12:55:56 -0700 (PDT)","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>","To":"qemu-devel@nongnu.org","Cc":"Richard Henderson <richard.henderson@linaro.org>,\n \"Dr. David Alan Gilbert\" <dave@treblig.org>,\n Pierrick Bouvier <pierrick.bouvier@linaro.org>, qemu-riscv@nongnu.org,\n Markus Armbruster <armbru@redhat.com>, qemu-s390x@nongnu.org,\n kvm@vger.kernel.org, qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud?=\n\t=?utf-8?q?=C3=A9?= <philmd@linaro.org>, Cornelia Huck <cohuck@redhat.com>,\n Eric Farman <farman@linux.ibm.com>, Matthew Rosato <mjrosato@linux.ibm.com>,\n Paolo Bonzini <pbonzini@redhat.com>","Subject":"[PATCH v2 21/27] monitor: Do not check TARGET_S390X to build s390x\n commands","Date":"Fri, 10 Apr 2026 21:53:15 +0200","Message-ID":"<20260410195323.17937-22-philmd@linaro.org>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260410195323.17937-1-philmd@linaro.org>","References":"<20260410195323.17937-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::335;\n envelope-from=philmd@linaro.org; helo=mail-wm1-x335.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-ppc@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<qemu-ppc.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-ppc>,\n <mailto:qemu-ppc-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-ppc>","List-Post":"<mailto:qemu-ppc@nongnu.org>","List-Help":"<mailto:qemu-ppc-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-ppc>,\n <mailto:qemu-ppc-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"These commands are filtered at build-time for s390x binary.\nBy using the recently introduced HMPCommand::arch_bitmask flag\nwe can filter them at runtime, making it possible to compile\nhmp-commands[-info].hx files once.\n\nSince the methods are used inconditionally within hw/s390x/,\ndefine them in the same stub file.\n\nSigned-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>\n---\n MAINTAINERS               |  1 +\n include/monitor/hmp.h     |  7 +++++++\n monitor/hmp-target.c      |  5 -----\n stubs/hmp-cmds-hw-s390x.c | 15 +++++++++++++++\n hmp-commands-info.hx      |  6 ++----\n hmp-commands.hx           |  6 ++----\n stubs/meson.build         |  1 +\n 7 files changed, 28 insertions(+), 13 deletions(-)\n create mode 100644 stubs/hmp-cmds-hw-s390x.c","diff":"diff --git a/MAINTAINERS b/MAINTAINERS\nindex 1810625eb1e..e53158143a8 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -122,6 +122,7 @@ F: include/hw/watchdog/wdt_diag288.h\n F: pc-bios/s390-ccw/\n F: pc-bios/s390-ccw.img\n F: stubs/qmp-cpu-s390x.c\n+F: stubs/hmp-cmds-hw-s390x.c\n F: target/s390x/\n F: docs/system/target-s390x.rst\n F: docs/system/s390x/\ndiff --git a/include/monitor/hmp.h b/include/monitor/hmp.h\nindex a0a063db8e4..c8ce8579424 100644\n--- a/include/monitor/hmp.h\n+++ b/include/monitor/hmp.h\n@@ -16,6 +16,13 @@\n \n #include \"qemu/readline.h\"\n #include \"qapi/qapi-types-common.h\"\n+#include \"monitor/monitor.h\"\n+\n+#define HMP_STUB(cmd) \\\n+    void hmp_##cmd(Monitor *mon, const QDict *qdict) \\\n+    { \\\n+        g_assert_not_reached(); \\\n+    }\n \n struct MonitorDef {\n     const char *name;\ndiff --git a/monitor/hmp-target.c b/monitor/hmp-target.c\nindex 9d8dcb8835a..4968d511101 100644\n--- a/monitor/hmp-target.c\n+++ b/monitor/hmp-target.c\n@@ -35,11 +35,6 @@\n #include \"qapi/qapi-commands-misc.h\"\n #include \"qapi/qapi-commands-machine.h\"\n \n-#if defined(TARGET_S390X)\n-#include \"hw/s390x/storage-keys.h\"\n-#include \"hw/s390x/storage-attributes.h\"\n-#endif\n-\n /* Make devices configuration available for use in hmp-commands*.hx templates */\n #include CONFIG_DEVICES\n \ndiff --git a/stubs/hmp-cmds-hw-s390x.c b/stubs/hmp-cmds-hw-s390x.c\nnew file mode 100644\nindex 00000000000..2b4f4cac79f\n--- /dev/null\n+++ b/stubs/hmp-cmds-hw-s390x.c\n@@ -0,0 +1,15 @@\n+/*\n+ * Human Monitor hw/s390x stubs\n+ *\n+ * Copyright (c) Linaro\n+ *\n+ * SPDX-License-Identifier: GPL-2.0-or-later\n+ */\n+\n+#include \"qemu/osdep.h\"\n+#include \"monitor/hmp.h\"\n+\n+HMP_STUB(dump_skeys)\n+HMP_STUB(info_cmma)\n+HMP_STUB(info_skeys)\n+HMP_STUB(migrationmode)\ndiff --git a/hmp-commands-info.hx b/hmp-commands-info.hx\nindex 463038c302a..28dec25642d 100644\n--- a/hmp-commands-info.hx\n+++ b/hmp-commands-info.hx\n@@ -717,30 +717,28 @@ SRST\n     Show rocker OF-DPA groups.\n ERST\n \n-#if defined(TARGET_S390X)\n     {\n         .name       = \"skeys\",\n         .args_type  = \"addr:l\",\n         .params     = \"address\",\n         .help       = \"Display the value of a storage key\",\n         .cmd        = hmp_info_skeys,\n+        .arch_bitmask = QEMU_ARCH_S390X,\n     },\n-#endif\n \n SRST\n   ``info skeys`` *address*\n     Display the value of a storage key (s390 only)\n ERST\n \n-#if defined(TARGET_S390X)\n     {\n         .name       = \"cmma\",\n         .args_type  = \"addr:l,count:l?\",\n         .params     = \"address [count]\",\n         .help       = \"Display the values of the CMMA storage attributes for a range of pages\",\n         .cmd        = hmp_info_cmma,\n+        .arch_bitmask = QEMU_ARCH_S390X,\n     },\n-#endif\n \n SRST\n   ``info cmma`` *address*\ndiff --git a/hmp-commands.hx b/hmp-commands.hx\nindex 06d7b17bf25..ff65b39b454 100644\n--- a/hmp-commands.hx\n+++ b/hmp-commands.hx\n@@ -1125,30 +1125,28 @@ SRST\n \n ERST\n \n-#if defined(TARGET_S390X)\n     {\n         .name       = \"dump-skeys\",\n         .args_type  = \"filename:F\",\n         .params     = \"\",\n         .help       = \"Save guest storage keys into file 'filename'.\\n\",\n         .cmd        = hmp_dump_skeys,\n+        .arch_bitmask = QEMU_ARCH_S390X,\n     },\n-#endif\n \n SRST\n ``dump-skeys`` *filename*\n   Save guest storage keys to a file.\n ERST\n \n-#if defined(TARGET_S390X)\n     {\n         .name       = \"migration_mode\",\n         .args_type  = \"mode:i\",\n         .params     = \"mode\",\n         .help       = \"Enables or disables migration mode\\n\",\n         .cmd        = hmp_migrationmode,\n+        .arch_bitmask = QEMU_ARCH_S390X,\n     },\n-#endif\n \n SRST\n ``migration_mode`` *mode*\ndiff --git a/stubs/meson.build b/stubs/meson.build\nindex 356d7800760..d4a6bc0dde4 100644\n--- a/stubs/meson.build\n+++ b/stubs/meson.build\n@@ -84,6 +84,7 @@ if have_system\n   stub_ss.add(files('qmp-cpu.c'))\n   stub_ss.add(files('qmp-cpu-s390x.c'))\n   stub_ss.add(files('qmp-cpu-s390x-kvm.c'))\n+  stub_ss.add(files('hmp-cmds-hw-s390x.c'))\n endif\n \n if have_system or have_user\n","prefixes":["v2","21/27"]}