{"id":2228661,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2228661/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260427080738.77138-4-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":"<20260427080738.77138-4-philmd@linaro.org>","date":"2026-04-27T08:07:09","name":"[v4,03/32] monitor: Remove MonitorDef::type field and MD_TLONG / MD_I32","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"7bd9da19205ae2c2af60f11dca01220a17ad409f","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/20260427080738.77138-4-philmd@linaro.org/mbox/","series":[{"id":501599,"url":"http://patchwork.ozlabs.org/api/1.1/series/501599/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=501599","date":"2026-04-27T08:07:06","name":"monitor: Remove need of per-target handlers","version":4,"mbox":"http://patchwork.ozlabs.org/series/501599/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2228661/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2228661/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=rWALb7mw;\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 4g3x5q5HMFz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 18:08:31 +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 1wHH0h-0000az-Ac; Mon, 27 Apr 2026 04:08:07 -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 1wHH0f-0000an-PD\n for qemu-devel@nongnu.org; Mon, 27 Apr 2026 04:08:05 -0400","from mail-wm1-x332.google.com ([2a00:1450:4864:20::332])\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 1wHH0e-0001LH-69\n for qemu-devel@nongnu.org; Mon, 27 Apr 2026 04:08:05 -0400","by mail-wm1-x332.google.com with SMTP id\n 5b1f17b1804b1-4890d945eb4so49147635e9.0\n for <qemu-devel@nongnu.org>; Mon, 27 Apr 2026 01:08:03 -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-48a575ad67asm391204825e9.2.2026.04.27.01.08.01\n (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);\n Mon, 27 Apr 2026 01:08:01 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1777277283; x=1777882083; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:to:from:from:to:cc:subject:date:message-id\n :reply-to; bh=cBuj8J+8c77rLL4d5hAULRShpRlZCQscvo/9rmO1W0M=;\n b=rWALb7mwTDx4gEQzdA0NarRnVNW/sXb4kqjQwgrb01BKZTs6NTpIMhJvWOKAdoiydz\n 8LL7vhaWJi9F/p9ALYzvQghEKQVbpPIp2j/YK1zNWygrBXv57iau5Ugp0yAyaWTuJojT\n 12hKageMklIjod+8SQBqCLFLyCjXXUFKMzwjt7DeKd/WRMnescnMpHNb+xrQYWDdirDo\n PYx6AGVChrscOf/2K4hEHAKmZbeCsJr6ExXV13/q95CgYVG0OhDsq9VVdkz/MgfO7/AI\n 7iVr3awyH5we87Vt6TF3DGXvXEiIYCo6VKETS+99OUhTUGQpYsgQh5v7+2WSrFq2KKXr\n jPDA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777277283; x=1777882083;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to\n :cc:subject:date:message-id:reply-to;\n bh=cBuj8J+8c77rLL4d5hAULRShpRlZCQscvo/9rmO1W0M=;\n b=hGt9esblfi8i5jIcEiph72dZpzY1WuBmq7/WGyCMrO9/l2WiE46dwZtn1wi6xpWn2y\n nJOoA53gCtpkZnbqK9OScm+zvzdDcovY3xE9U+ij4DiAjcgkfYtvfpOAZN/6PggTnmTd\n C59mFTECsk6h3mfw9IS/qPTFqPq9o1Y4qPhNxZAPyU+yQuFVqc0HMfn4jKwsbApL9t4D\n 7xLjxd3CWrAuHeTmnI1nDjH8LMmBPreQOL53Jag/tVCkrZ1T5NoAQfzKl9ixj847kyuJ\n if6+uWWbtmirAIb85dol2m1+W5sGiqroYwFdTeS8jBW8nEdNllJf3tbb6ii2UnRwtET7\n EWmg==","X-Forwarded-Encrypted":"i=1;\n AFNElJ/gaoL/Y9zOW6BcRB3I8kcldonPuYH713TC6yrFu/+1mTs3midhW3IlZPz4RV4D4LN1HhIiwTkV3nRK@nongnu.org","X-Gm-Message-State":"AOJu0Yzv2a4EhIPKrvML8IaI23yIl+s6+xz2LHw1nLTl/tWGgswOGBaN\n +vQjvu2BYfmJUTAzkAswKSqN/JRDt4xegbbNSvd6aQdO6X35vkcm0e7rZtIVha9vk2XtJv9I2li\n L16PSsv0=","X-Gm-Gg":"AeBDietKlWedA4eHKnLO+jrIcnim3ACgi5k/zjXJc1fHbv2dAxq4XisGL4qTPKSwSdb\n KW0BeeL6QXPA11Yo2E0ziEMTsvCEIhB/BNhmjyHnlwvDyJAZF2N5YSeCrpdT3VHQtyV0txaxJ4J\n DCit2vEnGRQE+nSBnLcIcMp0BXfbvO5WH7xQH4A1VMlqHq5w1Mv90DNyzdP804oRPVKMgJyVj1g\n 9qoGep6YsJ+v77voeY2jofzKx4I8lXXQ/upABCGJbrwgTcRQYckZCs8JQd2omLOT8FZvvKvkOH/\n erL8h+hKNyAaybFomdKzqOOwv3eeuwkHhi+pf0tLxJ7VZjc1Pr6Y4jp+9j2XFEhF35MkJ5/ePYd\n hye12VU5xKdZqFTAeMfkB2ZAN6uXujCSxdJjKbMSNvRhL+A2vXm/ZzQ4j2x121bdw16xe/9ZPWO\n H6Jrhik7rQrW9bkXnoKUeQLeP1bvY6wwqTrnvyi0aObpONKuMu3x4G01dpNV3KOrJxXV/JfiVwR\n /oV9MBnnUY=","X-Received":"by 2002:a05:600c:33a4:b0:489:1abb:5559 with SMTP id\n 5b1f17b1804b1-4891abb574amr245058715e9.5.1777277282572;\n Mon, 27 Apr 2026 01:08:02 -0700 (PDT)","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>","To":"Markus Armbruster <armbru@redhat.com>,\n\tqemu-devel@nongnu.org","Subject":"[PATCH v4 03/32] monitor: Remove MonitorDef::type field and MD_TLONG\n / MD_I32","Date":"Mon, 27 Apr 2026 10:07:09 +0200","Message-ID":"<20260427080738.77138-4-philmd@linaro.org>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260427080738.77138-1-philmd@linaro.org>","References":"<20260427080738.77138-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::332;\n envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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":"None of the few targets still using MonitorDef use MD_TLONG,\nthey either use MD_I32 or the %get_value handler. Remove the\nMonitorDef::type and its definitions altogether: simply check\nfor the %get_value handler, if NULL then consider 32-bit.\n\nSigned-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>\nReviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>\n---\n include/monitor/hmp-target.h |  4 ----\n monitor/hmp-target.c         | 12 +-----------\n target/i386/monitor.c        |  2 +-\n target/m68k/monitor.c        | 24 ++++++++++++------------\n target/sparc/monitor.c       | 14 +++++++-------\n 5 files changed, 21 insertions(+), 35 deletions(-)","diff":"diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h\nindex 898473b3ed0..ce0bb1983cc 100644\n--- a/include/monitor/hmp-target.h\n+++ b/include/monitor/hmp-target.h\n@@ -34,13 +34,9 @@ struct MonitorDef {\n     int offset;\n     target_long (*get_value)(Monitor *mon, const struct MonitorDef *md,\n                              int val);\n-    int type;\n };\n #endif\n \n-#define MD_TLONG 0\n-#define MD_I32   1\n-\n const MonitorDef *target_monitor_defs(void);\n int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval);\n \ndiff --git a/monitor/hmp-target.c b/monitor/hmp-target.c\nindex 420969bd6eb..3f019ae2a28 100644\n--- a/monitor/hmp-target.c\n+++ b/monitor/hmp-target.c\n@@ -82,17 +82,7 @@ int get_monitor_def(Monitor *mon, int64_t *pval, const char *name)\n             } else {\n                 CPUArchState *env = mon_get_cpu_env(mon);\n                 ptr = (uint8_t *)env + md->offset;\n-                switch(md->type) {\n-                case MD_I32:\n-                    *pval = *(int32_t *)ptr;\n-                    break;\n-                case MD_TLONG:\n-                    *pval = *(target_long *)ptr;\n-                    break;\n-                default:\n-                    *pval = 0;\n-                    break;\n-                }\n+                *pval = *(int32_t *)ptr;\n             }\n             return 0;\n         }\ndiff --git a/target/i386/monitor.c b/target/i386/monitor.c\nindex 446428602ef..977f65fe16c 100644\n--- a/target/i386/monitor.c\n+++ b/target/i386/monitor.c\n@@ -602,7 +602,7 @@ static target_long monitor_get_pc(Monitor *mon, const struct MonitorDef *md,\n \n const MonitorDef monitor_defs[] = {\n #define SEG(name, seg) \\\n-    { name \".limit\", offsetof(CPUX86State, segs[seg].limit), NULL, MD_I32 },\n+    { name \".limit\", offsetof(CPUX86State, segs[seg].limit) },\n     SEG(\"cs\", R_CS)\n     SEG(\"ds\", R_DS)\n     SEG(\"es\", R_ES)\ndiff --git a/target/m68k/monitor.c b/target/m68k/monitor.c\nindex 08ced037b47..94bb12833af 100644\n--- a/target/m68k/monitor.c\n+++ b/target/m68k/monitor.c\n@@ -24,18 +24,18 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)\n }\n \n static const MonitorDef monitor_defs[] = {\n-    { \"ssp\", offsetof(CPUM68KState, sp[0]), NULL, MD_I32 },\n-    { \"usp\", offsetof(CPUM68KState, sp[1]), NULL, MD_I32 },\n-    { \"isp\", offsetof(CPUM68KState, sp[2]), NULL, MD_I32 },\n-    { \"sfc\", offsetof(CPUM68KState, sfc), NULL, MD_I32 },\n-    { \"dfc\", offsetof(CPUM68KState, dfc), NULL, MD_I32 },\n-    { \"urp\", offsetof(CPUM68KState, mmu.urp), NULL, MD_I32 },\n-    { \"srp\", offsetof(CPUM68KState, mmu.srp), NULL, MD_I32 },\n-    { \"dttr0\", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR0]), NULL, MD_I32 },\n-    { \"dttr1\", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR1]), NULL, MD_I32 },\n-    { \"ittr0\", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR0]), NULL, MD_I32 },\n-    { \"ittr1\", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR1]), NULL, MD_I32 },\n-    { \"mmusr\", offsetof(CPUM68KState, mmu.mmusr), NULL, MD_I32 },\n+    { \"ssp\", offsetof(CPUM68KState, sp[0]) },\n+    { \"usp\", offsetof(CPUM68KState, sp[1]) },\n+    { \"isp\", offsetof(CPUM68KState, sp[2]) },\n+    { \"sfc\", offsetof(CPUM68KState, sfc) },\n+    { \"dfc\", offsetof(CPUM68KState, dfc) },\n+    { \"urp\", offsetof(CPUM68KState, mmu.urp) },\n+    { \"srp\", offsetof(CPUM68KState, mmu.srp) },\n+    { \"dttr0\", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR0]) },\n+    { \"dttr1\", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR1]) },\n+    { \"ittr0\", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR0]) },\n+    { \"ittr1\", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR1]) },\n+    { \"mmusr\", offsetof(CPUM68KState, mmu.mmusr) },\n     { NULL },\n };\n \ndiff --git a/target/sparc/monitor.c b/target/sparc/monitor.c\nindex e9300ded4ad..a60671a60a4 100644\n--- a/target/sparc/monitor.c\n+++ b/target/sparc/monitor.c\n@@ -41,13 +41,13 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)\n \n const MonitorDef monitor_defs[] = {\n #ifdef TARGET_SPARC64\n-    { \"asi\", offsetof(CPUSPARCState, asi), NULL, MD_I32 },\n-    { \"pstate\", offsetof(CPUSPARCState, pstate), NULL, MD_I32 },\n-    { \"cansave\", offsetof(CPUSPARCState, cansave), NULL, MD_I32 },\n-    { \"canrestore\", offsetof(CPUSPARCState, canrestore), NULL, MD_I32 },\n-    { \"otherwin\", offsetof(CPUSPARCState, otherwin), NULL, MD_I32 },\n-    { \"wstate\", offsetof(CPUSPARCState, wstate), NULL, MD_I32 },\n-    { \"cleanwin\", offsetof(CPUSPARCState, cleanwin), NULL, MD_I32 },\n+    { \"asi\", offsetof(CPUSPARCState, asi) },\n+    { \"pstate\", offsetof(CPUSPARCState, pstate) },\n+    { \"cansave\", offsetof(CPUSPARCState, cansave) },\n+    { \"canrestore\", offsetof(CPUSPARCState, canrestore) },\n+    { \"otherwin\", offsetof(CPUSPARCState, otherwin) },\n+    { \"wstate\", offsetof(CPUSPARCState, wstate) },\n+    { \"cleanwin\", offsetof(CPUSPARCState, cleanwin) },\n #endif\n     { NULL },\n };\n","prefixes":["v4","03/32"]}