From nobody Mon Feb 9 06:05:20 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1768820698; cv=none; d=zohomail.com; s=zohoarc; b=cFdJqve5ooYlyRiFCy+yaoTCf5cKzpD7wtVUJJlj6+yN2eye4qoOa46LLfmLzHaK4mZpAPfuQJtG3915qPT0lLo9TicZPnZ3SkrmfwnHbxmdMSZY3ymMNEGl7b03SfheO3mNaKUkSMTcxB5GZI0SiCZ0CrY5S9GL2x329X1itog= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768820698; 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=XbQjc8ZYqWORXyizHA7cHB2eAOXerMSR4t/7ALRc1wY=; b=l6RHoLhuda7G714Sv3EwAnh5OdDQtOkYGh/suX2Ue1fAYBjTwKrXFbmdyy7+pjYM+R+GX4hpQhgPiYj7v/yXD5wBLKNfzHI3o66suOmg05YBQdDbP/M6MFThJFZe9PH+A/bQi+zaLfPZ13dmfhFP8Q5dRY5ghWWP5pn+AP2Cbe0= 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 1768820698205606.3163350329238; Mon, 19 Jan 2026 03:04:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vhn3O-0006P6-D9; Mon, 19 Jan 2026 06:04:14 -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 1vhn3M-0006AR-DB for qemu-devel@nongnu.org; Mon, 19 Jan 2026 06:04:12 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vhn3K-0006Vw-Rj for qemu-devel@nongnu.org; Mon, 19 Jan 2026 06:04:12 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-47ee0291921so27080015e9.3 for ; Mon, 19 Jan 2026 03:04:10 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47f4b267661sm245742745e9.13.2026.01.19.03.04.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 19 Jan 2026 03:04:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1768820649; x=1769425449; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XbQjc8ZYqWORXyizHA7cHB2eAOXerMSR4t/7ALRc1wY=; b=CHSBINrkzFAqdfJYxOC/tzkhKW8yRjGStoTU2uTiVCMt3Na/T5eVoIe1QlxzlpuTt4 kpipMSSvtOl02flwJe9/XmKVqUjHQeYV9dRSKC6E3yB263UliHJp1mAgfsoO8QTSuDGb L3yW0gnVrYDJvicWhweZ0+5LxJHQQIsy/vgKkiI+1CFHh+ChOb0QQ9R4yBGDYaBFjOyn BgvqtL/FKwPWivsOdIzwoKPdII5Joei0/3450ZHqB/NymyQEOlcyFp7+SI2jA3PLz2lQ 3K4owoF2cJnI5xMXWhVYmlj4M8xzrmik8vvkgLeNweGv9xhLxj28sPV+L6Z3b0dyt+rE xPZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768820649; x=1769425449; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=XbQjc8ZYqWORXyizHA7cHB2eAOXerMSR4t/7ALRc1wY=; b=EgUzQQWIiaTnYJYyuqJA8uC/eDJpn0PDkjCtqjfjL3ZZ+ljfI8gdG6lqq0b8q3uWZO PyMTwP/zfhcLufehTnOf5b30vEKBt7T9WS4tDo22VqMTzCpfVdru22C+9DFIzpXJTS58 jvsRB9RJuA0v0exsrR8+I6SZKGAR90id2M1arHWoSadTfue9ldMlEqQlDtd+qKR+kXbW F2jeQapBeW0/u7/qUw/X6r+4NLd3420Ti68xmASdF+gPnGcBb/WUFrQTa9tWjouI75+T t41XT/tJWVN4uLrdimXzXBFDFWyUPmt9SOamJYZ6fAQa4ctgZMMvktAshh5zxA9bNRxi K/yA== X-Gm-Message-State: AOJu0YwqAfIgvPMMXUL7NN+r/VkUPAjy5fwJgloGWipi5XzCTNLnSR2n etBqu74weKeZwdpgRgTwWEePZlgO4+hAbYbO1vydr/yUnO/zA0wcSxbwUsyacVj4A4sG43ken4c RClNEWGk= X-Gm-Gg: AY/fxX7UAXWk0gB2lev+8MwdrUYKOX29VQPtjl90B02G3bHFlVa+CUMtL89X6D/ol7c OCLkAZ1ONVq9CpRxBe32P1pdgFvTLaI/rIQKduAi9rTU3judAsDA92JGBrnWZp8hQABCb8ns6xN 5k040eAj4zaRhrFV5BnftdLxj5DTObk6q5hapUG7IhF8V/LPPr8Y7CgE7UcE/1eYOtHfhOewlkE wkLYjN8reNN1FV/GTBv2e4IFFMtsFcENaUn4/J1mle7oxXYqmWrMv1qtfI8jAhtS35m9a2uD2bx mcz+oD9/wuS1iRhAIcsL+AWITCFKPRGiuFUKqafNQ3y8wo7rrqps9F1SxmeklI37zTvEPjxNMTF zq6YfzrSk6Os+6nCgmM0cxlVe/KanbjQSaPicX3dQ+x4O/HCxPMf6FN2STpG6MekiRlWuAeTkGW 0LgR+nwGJOE00jw/yGMZuAA6X1WxmZvOYLbzqKPbfJLahHq+O2ocm/xRayqCSb X-Received: by 2002:a05:600c:c16b:b0:47e:e78a:c831 with SMTP id 5b1f17b1804b1-4801eb14ff0mr118218625e9.36.1768820648670; Mon, 19 Jan 2026 03:04:08 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , Pierrick Bouvier , "Dr. David Alan Gilbert" , Paolo Bonzini , Richard Henderson Subject: [PATCH v3 1/8] target/i386: Include missing 'svm.h' header in 'sev.h' Date: Mon, 19 Jan 2026 12:03:51 +0100 Message-ID: <20260119110358.66821-2-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260119110358.66821-1-philmd@linaro.org> References: <20260119110358.66821-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 (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=2a00:1450:4864:20::32b; 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, 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 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 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 @linaro.org) X-ZM-MESSAGEID: 1768820699688158501 "target/i386/sev.h" uses the vmcb_seg structure type, which is defined in "target/i386/svm.h". Current builds succeed because the files including "target/i386/sev.h" also include "monitor/hmp-target.h", itself including "cpu.h" and finally "target/i386/svm.h". Include the latter, otherwise removing "cpu.h" from "monitor/hmp-target.h" triggers: ../target/i386/sev.h:62:21: error: field has incomplete type 'struct vmcb= _seg' 62 | struct vmcb_seg es; | ^ Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Zhao Liu --- target/i386/sev.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/i386/sev.h b/target/i386/sev.h index 9db1a802f6b..4358df40e48 100644 --- a/target/i386/sev.h +++ b/target/i386/sev.h @@ -14,6 +14,8 @@ #ifndef I386_SEV_H #define I386_SEV_H =20 +#include "target/i386/svm.h" + #ifndef CONFIG_USER_ONLY #include CONFIG_DEVICES /* CONFIG_SEV */ #endif --=20 2.52.0 From nobody Mon Feb 9 06:05:20 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1768820698; cv=none; d=zohomail.com; s=zohoarc; b=W35CflJxbd6aUNprjMyuDtTmlSLoqVeOcmwiG0ve/sfoijUiYzelX/JpBtBcviObN+wmTffrtPcUCGKtQuL4ckdF4U0KimkW67uGmGC/Sj8EbpzFCaQw1mMp6JttNv5ksz8xEzYRrurZrW3d4Tl1jGaBK5f3Pa2TuuX6C5Th7b8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768820698; 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=2/5ri0x0HKOQ4AevWnY2CiNFX91P9a3QRDv363s7aV8=; b=lJ1s3QK8Hysnz9JgH+IdUXR72dCvuEeulWJS787oFp8ZT0HHKWffS+TyZ67bU3Um1GlVMc+8CKyhs3kO14/pYO3YtD0CDiSXd568PAoDEnFl/ufQFr6uPZR4IihKoIotAupj1ta1ASBSQD555bwrhEXNbKDNl+5nENFu6hyHYW0= 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 1768820698182749.0731962978825; Mon, 19 Jan 2026 03:04:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vhn3U-0006xw-SU; Mon, 19 Jan 2026 06:04:20 -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 1vhn3T-0006rG-NC for qemu-devel@nongnu.org; Mon, 19 Jan 2026 06:04:19 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vhn3S-0006YD-32 for qemu-devel@nongnu.org; Mon, 19 Jan 2026 06:04:19 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-47ff94b46afso26958795e9.1 for ; Mon, 19 Jan 2026 03:04:17 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4801fe74987sm82032795e9.8.2026.01.19.03.04.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 19 Jan 2026 03:04:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1768820656; x=1769425456; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2/5ri0x0HKOQ4AevWnY2CiNFX91P9a3QRDv363s7aV8=; b=XfNHp/TrPO1lkJtC/QCvoRAOP8HvOwXhAeUDnP2Ke9d2kzKHL0+IW/cGJ3H6ecfZhk azMeHSstJSRpy14opES4lLwIDXhu7jo5kAukj5qbssE7/bo2tPxwlYc5A7v+RVtJCSNE dAHklFGs6KpZY6ve1pefOh7VXddpTE1H8q8+mXBI9RbKGRhWyineba+Y19y3zz7KgsVP 5VBa5C9WuB5Ut+gxTBo0m3VqJAo1X7pu//dzADL3pnQoP3rvZ4O8jYc9BhqWu03L/o0T 8440RqAJata7Ob7BIK6RLeps8UAfJUbSj7V6QUjLUiT3/lSZWG/XJdr4iR6J3pRMdthr FhGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768820656; x=1769425456; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=2/5ri0x0HKOQ4AevWnY2CiNFX91P9a3QRDv363s7aV8=; b=u8siMuZ16ajasJXCZjPuJz0HAwoL7cg2aVABO0TvDWwFtp/wT90o6mAyRw/4KwP114 hkJgPqZtyDyEjViiraubgOd2wE+BUCrSxycBkZzS6c3q41IAAJpo3erBfL9zh1QzCPBa uVN/tkrYp2WbLvOQupYvsPbO70wajUPo/FL5p+Fg4sR7ysHbXgP1lYJJ28/A2xV1oeyn pMf2IjNv74UIWKtLGP58zTyxSekE68YNhnmsPy4EW9m7+bV4G3yQ2bK3um0vr89muX8n 7sSSh0q91RSBWu8wwplGwMUm+ATdrvH1AeOLrpagEk7oRb8Vx4jnbhvQzroxiL25ElGm g5eQ== X-Gm-Message-State: AOJu0YygCt/yOzUm62ZUdxfo+Nrw+OivUsfXFpNRZdENyj3m8n4yAv/m FKKvDbTz3RYrBnKb18naNnteJRUy4GPki3RdYqSp1d6iIlltDtJqiY2fsXapqoaelB+NXHdVfA6 kq/0lB3I= X-Gm-Gg: AY/fxX7SjIoUHozQo769+Y64QgSjJK1xhy7uhK3OT/g0c1xHs+fur4J+aT40DcSct3v Jh5exjZa3elgyg7vSTqKttOzQDp7uVuFA4uSIwO9Dod3GXj3qNwh8H8O4FDQ+n5uqZngwowXjGp pBSJDHaIJNRqgcR87ls29nDnotMND2sXkdzU72ZY3TB5fLZqeldDASkOwIf3YLT2QgW5pdK9f79 tGv4i84dEWdLHtxXEMq0Ae+hxzdCZboQ/Vg+OqUAmcqQaZ0v5lTNXc9yRc/URNahdxiBGKZzs4c 0pDK3S0bJ3sqve3l5Rm1OqluUmvxzesujG3TR00oXSCpT7LVnl7mmz4fqtrPuk9Swy7Gsb71cML /WTscmkc0vCRV+GdGXW+C566ebBmnSDS4Pf08jmbwZg1Y4rcx48CMXp0v2ILx+Ad6MsWFPK2o1d HB5cFZp64v1Q/LP5W6LF2jxbgzS6IYxWN3ENxnNfMm5uTDbxouScO1VhEuSNEkVrD3MH8m/Xw= X-Received: by 2002:a05:600c:8184:b0:475:d9de:952e with SMTP id 5b1f17b1804b1-4801e530d08mr129131105e9.1.1768820655782; Mon, 19 Jan 2026 03:04:15 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , Pierrick Bouvier , "Dr. David Alan Gilbert" , Paolo Bonzini , Richard Henderson Subject: [PATCH v3 2/8] monitor: Add hmp_cmds_for_target() helper Date: Mon, 19 Jan 2026 12:03:52 +0100 Message-ID: <20260119110358.66821-3-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260119110358.66821-1-philmd@linaro.org> References: <20260119110358.66821-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 (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=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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, 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 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 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 @linaro.org) X-ZM-MESSAGEID: 1768820699688158500 HMPCommand arrays are filled with target-specific commands, so defined in a target-specific unit. Introduce the hmp_cmds_for_target() to allow target-agnostic code to access the arrays. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Dr. David Alan Gilbert --- monitor/monitor-internal.h | 9 +++++++-- monitor/hmp-target.c | 13 ++++++++----- monitor/hmp.c | 8 +++++--- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index 7735c731083..feca111ae31 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -169,8 +169,6 @@ extern QmpCommandList qmp_commands, qmp_cap_negotiation= _commands; extern QemuMutex monitor_lock; extern MonitorList mon_list; =20 -extern HMPCommand hmp_cmds[]; - void monitor_data_init(Monitor *mon, bool is_qmp, bool skip_flush, bool use_io_thread); void monitor_data_destroy(Monitor *mon); @@ -187,4 +185,11 @@ int get_monitor_def(Monitor *mon, int64_t *pval, const= char *name); void handle_hmp_command(MonitorHMP *mon, const char *cmdline); int hmp_compare_cmd(const char *name, const char *list); =20 +/* + * hmp_cmds_for_target: Return array of HMPCommand entries + * + * If @info_command is true, return the particular 'info foo' commands arr= ay. + */ +HMPCommand *hmp_cmds_for_target(bool info_command); + #endif diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c index 37dfd7fd4c6..59c60d13b52 100644 --- a/monitor/hmp-target.c +++ b/monitor/hmp-target.c @@ -44,8 +44,6 @@ /* Make devices configuration available for use in hmp-commands*.hx templa= tes */ #include CONFIG_DEVICES =20 -static HMPCommand hmp_info_cmds[]; - /** * Is @name in the '|' separated list of names @list? */ @@ -76,11 +74,16 @@ static HMPCommand hmp_info_cmds[] =3D { }; =20 /* hmp_cmds and hmp_info_cmds would be sorted at runtime */ -HMPCommand hmp_cmds[] =3D { +static HMPCommand hmp_cmds[] =3D { #include "hmp-commands.h" { NULL, NULL, }, }; =20 +HMPCommand *hmp_cmds_for_target(bool info_command) +{ + return info_command ? hmp_info_cmds : hmp_cmds; +} + /* * Set @pval to the value in the register identified by @name. * return 0 if OK, -1 if not found @@ -148,7 +151,7 @@ static void __attribute__((__constructor__)) sortcmdlis= t(void) void monitor_register_hmp(const char *name, bool info, void (*cmd)(Monitor *mon, const QDict *qdict)) { - HMPCommand *table =3D info ? hmp_info_cmds : hmp_cmds; + HMPCommand *table =3D hmp_cmds_for_target(info); =20 while (table->name !=3D NULL) { if (strcmp(table->name, name) =3D=3D 0) { @@ -164,7 +167,7 @@ void monitor_register_hmp(const char *name, bool info, void monitor_register_hmp_info_hrt(const char *name, HumanReadableText *(*handler)(Error **e= rrp)) { - HMPCommand *table =3D hmp_info_cmds; + HMPCommand *table =3D hmp_cmds_for_target(true); =20 while (table->name !=3D NULL) { if (strcmp(table->name, name) =3D=3D 0) { diff --git a/monitor/hmp.c b/monitor/hmp.c index 4caafbc7146..17e5756986f 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -301,7 +301,7 @@ void hmp_help_cmd(Monitor *mon, const char *name) } =20 /* 2. dump the contents according to parsed args */ - help_cmd_dump(mon, hmp_cmds, args, nb_args, 0); + help_cmd_dump(mon, hmp_cmds_for_target(false), args, nb_args, 0); =20 free_cmdline_args(args, nb_args); } @@ -1131,7 +1131,8 @@ void handle_hmp_command(MonitorHMP *mon, const char *= cmdline) =20 trace_handle_hmp_command(mon, cmdline); =20 - cmd =3D monitor_parse_command(mon, cmdline, &cmdline, hmp_cmds); + cmd =3D monitor_parse_command(mon, cmdline, &cmdline, + hmp_cmds_for_target(false)); if (!cmd) { return; } @@ -1375,7 +1376,8 @@ static void monitor_find_completion(void *opaque, } =20 /* 2. auto complete according to args */ - monitor_find_completion_by_table(mon, hmp_cmds, args, nb_args); + monitor_find_completion_by_table(mon, hmp_cmds_for_target(false), + args, nb_args); =20 cleanup: free_cmdline_args(args, nb_args); --=20 2.52.0 From nobody Mon Feb 9 06:05:20 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1768820698; cv=none; d=zohomail.com; s=zohoarc; b=EcWcJDOiHIGTRww8PIqWZKJ+yasFdgJewMY9IosRsuxZjI1X4x3WQJi8qApyvEywZITG27piypPyRiMjzFHtpBQ15xAEZf19h9nV3oRDwUMC+MTT74YRWu4cm3QK3IsAzEHUCAbVyVFhd/pYVeaeufjQdyN6JU7dh3kJA4Z9gSw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768820698; 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=apOZMf0tEn3rJJPrSfMcVgYQ3RZZMtDVtwPqX5t6dIc=; b=bB4kPUecEYrSTbPTU/7a7Q0yn7v0m7utUNo/Dpl4Z3nSGRU0U+aHgIUoc8BSpUhXe8c+3dNqJEQPVsOWJrgKo1+mvbzp+zY8qrgt7HbbX1ToRH/f00EZrYOJJ3RGLXiwWnIY7SnnZ8UAe5hHFArzV4tmSOPVVwSqLIRi5qymASM= 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 17688206981199.993566299808663; Mon, 19 Jan 2026 03:04:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vhn3c-0007IP-IV; Mon, 19 Jan 2026 06:04:28 -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 1vhn3a-0007Dj-Eo for qemu-devel@nongnu.org; Mon, 19 Jan 2026 06:04:26 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vhn3Y-0006ZP-Io for qemu-devel@nongnu.org; Mon, 19 Jan 2026 06:04:26 -0500 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-42fbbc3df8fso2120784f8f.2 for ; Mon, 19 Jan 2026 03:04:24 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43569921da2sm22462140f8f.1.2026.01.19.03.04.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 19 Jan 2026 03:04:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1768820663; x=1769425463; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=apOZMf0tEn3rJJPrSfMcVgYQ3RZZMtDVtwPqX5t6dIc=; b=RsOBiFDk77TNCR35oaHkp0D4TwL96cEQaEMwTcqeRj95xO1humRsQ8hFzXnyyadSTl yF/TDE4TcZ8b9wTnWCfkgM0JgoBvRD6BMpCn38IQTdjnzX4eIfBsW0/zlrgGwxjoK5Wg W1ScjY2DQTfpE5IXRJiHzXuRfeE368+0jMcQVKXvzamnABxmcGzU6DIGnxN2hOVt64Z2 JXZrQlxxOiq1xFyzr74YVQTL2ZD9Hq61c3/j5dvQtq72Yx8m1V+xoh5Q+CPoWF21q9Md sHNuK5BGEM9uMXoXdnNv2Tn40FBNmrqG8LK/Gs0SWhBPG5EIk6zD8yiukA5kRHfB9uWO uWQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768820663; x=1769425463; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=apOZMf0tEn3rJJPrSfMcVgYQ3RZZMtDVtwPqX5t6dIc=; b=vayzZf9IPZ3+mdwHhUKnXz/apR5sl7zrjmaIFjB6W42ymDJhjd2GXb3+k48i7GBCXa EYNJYQS4BJAZ+z44w/qINqjm2jHR3sQ6VjOMZVsKf1snMwRlQCvQZeS8PprWXszW2DUI KY9/g2uOp1VsGZaD3k8XaplNyPwcJbK5Uef0g9gQwE71f2orZhjTjzzD+1rmS97G7TkR WT+b9W05ckSeE2dkAHvhufGIRGLSDp2jzR04W4JcgGyXnkBSyyKBFnY9C2OOJ8MHnrqs KfrkrPNQHjWdqMuvZHxsPeuiMrb3qI5Gmaex1Ie8UXnFud/IC0NmJdkMenrFrDE6+AFa jbgw== X-Gm-Message-State: AOJu0YzLrfenZjYYwnE0/IxOf8/7EFt3KRA7quOKzFzP9mnPF6fKTznZ kesqD9WjiuJeYq1BkT+frWadFSeJ9Bu9Ox2r+yzvpSyqld6XT28SRIYWvlvzD3+IlkfF7RXm//x NQLD/anU= X-Gm-Gg: AZuq6aLsgKFkaCjVLVbnMM6G5EPtewxIQ3fqsUyLuggCBYlwn/o3N9yE4lR/BotdBHv Pmf9xdndvHybJeEQ1p4dRG56FDBGv1gj164Iq2mKrffGl7IUjnNExF1QgKWx3fvpmGbAb3m+iZk yGLerlWRRaW8yhlRDkItIYOkE1EkM11tfQPy93KxoYwrdIFTKC9edANoEOZ142b+8mWQLHHtp/p 4bgu70Uly4Fctor7pDAipJvjyXF9tjeLwyx+x1R6XNqTrbUxA0IitLyhOX1UMaRVmwx+nGPK10B HmWqoGIQVKEEAqM2u3i7j91T9irM4JFBd+OUUKJhHRO3DSeJ619Pwv1mfQfhc+UlDUYM/Sx6BF6 kaqHLxB22/+vE8gQ8qvOEWLLoy4MNnp1u6Usw6XIK8UYrAH/Tg8POTZIzLV2ZDQp3iSZPCRr04r RqdM/DjXiEYyyRYnjyiV0wsnBSMjUp6F8r8FTR0pdJtDAdha6qJ0HSd/E8ut/I X-Received: by 2002:a05:6000:2988:10b0:431:808:2d32 with SMTP id ffacd0b85a97d-43569972f16mr9422436f8f.7.1768820662670; Mon, 19 Jan 2026 03:04:22 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , Pierrick Bouvier , "Dr. David Alan Gilbert" , Paolo Bonzini , Richard Henderson Subject: [PATCH v3 3/8] monitor: Reduce target-specific methods Date: Mon, 19 Jan 2026 12:03:53 +0100 Message-ID: <20260119110358.66821-4-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260119110358.66821-1-philmd@linaro.org> References: <20260119110358.66821-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 (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=2a00:1450:4864:20::436; envelope-from=philmd@linaro.org; helo=mail-wr1-x436.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, 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 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 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 @linaro.org) X-ZM-MESSAGEID: 1768820699700158500 The following methods don't use target-specific code anymore: - hmp_compare_cmd() - monitor_register_hmp() - monitor_register_hmp_info_hrt() Move them to hmp.c which is target-agnostic, being built once. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Dr. David Alan Gilbert --- monitor/hmp-target.c | 57 -------------------------------------------- monitor/hmp.c | 55 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 57 deletions(-) diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c index 59c60d13b52..420969bd6eb 100644 --- a/monitor/hmp-target.c +++ b/monitor/hmp-target.c @@ -33,8 +33,6 @@ #include "qapi/qapi-commands-control.h" #include "qapi/qapi-commands-misc.h" #include "qapi/qapi-commands-machine.h" -#include "qapi/error.h" -#include "qemu/cutils.h" =20 #if defined(TARGET_S390X) #include "hw/s390x/storage-keys.h" @@ -44,29 +42,6 @@ /* Make devices configuration available for use in hmp-commands*.hx templa= tes */ #include CONFIG_DEVICES =20 -/** - * Is @name in the '|' separated list of names @list? - */ -int hmp_compare_cmd(const char *name, const char *list) -{ - const char *p, *pstart; - int len; - len =3D strlen(name); - p =3D list; - for (;;) { - pstart =3D p; - p =3D qemu_strchrnul(p, '|'); - if ((p - pstart) =3D=3D len && !memcmp(pstart, name, len)) { - return 1; - } - if (*p =3D=3D '\0') { - break; - } - p++; - } - return 0; -} - /* Please update hmp-commands.hx when adding or changing commands */ static HMPCommand hmp_info_cmds[] =3D { #include "hmp-commands-info.h" @@ -147,35 +122,3 @@ static void __attribute__((__constructor__)) sortcmdli= st(void) sizeof(*hmp_info_cmds), compare_mon_cmd); } - -void monitor_register_hmp(const char *name, bool info, - void (*cmd)(Monitor *mon, const QDict *qdict)) -{ - HMPCommand *table =3D hmp_cmds_for_target(info); - - while (table->name !=3D NULL) { - if (strcmp(table->name, name) =3D=3D 0) { - g_assert(table->cmd =3D=3D NULL && table->cmd_info_hrt =3D=3D = NULL); - table->cmd =3D cmd; - return; - } - table++; - } - g_assert_not_reached(); -} - -void monitor_register_hmp_info_hrt(const char *name, - HumanReadableText *(*handler)(Error **e= rrp)) -{ - HMPCommand *table =3D hmp_cmds_for_target(true); - - while (table->name !=3D NULL) { - if (strcmp(table->name, name) =3D=3D 0) { - g_assert(table->cmd =3D=3D NULL && table->cmd_info_hrt =3D=3D = NULL); - table->cmd_info_hrt =3D handler; - return; - } - table++; - } - g_assert_not_reached(); -} diff --git a/monitor/hmp.c b/monitor/hmp.c index 17e5756986f..0a5bbf82197 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -1497,3 +1497,58 @@ void monitor_init_hmp(Chardev *chr, bool use_readlin= e, Error **errp) monitor_event, NULL, &mon->common, NULL, true= ); monitor_list_append(&mon->common); } + +/** + * Is @name in the '|' separated list of names @list? + */ +int hmp_compare_cmd(const char *name, const char *list) +{ + const char *p, *pstart; + int len; + len =3D strlen(name); + p =3D list; + for (;;) { + pstart =3D p; + p =3D qemu_strchrnul(p, '|'); + if ((p - pstart) =3D=3D len && !memcmp(pstart, name, len)) { + return 1; + } + if (*p =3D=3D '\0') { + break; + } + p++; + } + return 0; +} + +void monitor_register_hmp(const char *name, bool info, + void (*cmd)(Monitor *mon, const QDict *qdict)) +{ + HMPCommand *table =3D hmp_cmds_for_target(info); + + while (table->name !=3D NULL) { + if (strcmp(table->name, name) =3D=3D 0) { + g_assert(table->cmd =3D=3D NULL && table->cmd_info_hrt =3D=3D = NULL); + table->cmd =3D cmd; + return; + } + table++; + } + g_assert_not_reached(); +} + +void monitor_register_hmp_info_hrt(const char *name, + HumanReadableText *(*handler)(Error **e= rrp)) +{ + HMPCommand *table =3D hmp_cmds_for_target(true); + + while (table->name !=3D NULL) { + if (strcmp(table->name, name) =3D=3D 0) { + g_assert(table->cmd =3D=3D NULL && table->cmd_info_hrt =3D=3D = NULL); + table->cmd_info_hrt =3D handler; + return; + } + table++; + } + g_assert_not_reached(); +} --=20 2.52.0 From nobody Mon Feb 9 06:05:20 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1768820697; cv=none; d=zohomail.com; s=zohoarc; b=niaUXkh78g+em5dV+r/ucOvoJ18mXhj5XguJDE56s5vCrqRLQeeQ6nQD/Yj0L9sw6u0/PrQCr8hxZTYXxDtwSYxvGHuMgA4mIAHSpOXmV9/pIpRLyzCp1Ah9iHGues3JpeyocqIxqM6gR92k0tahwSn0R35v39nTNGnlaI+t6e8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768820697; 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=wqdwi0ogZGHQTIcbpvNIqRSWev4Ubi5NdR0L7mmSkME=; b=OfX5KIOBYnJAoyo9hb9Mcv+G0V77VatK40qTdOS1Ex/bx8WKl2V/JkEH3kFgbMNskMGYFuY65Q09RWxYRzAR33PXHDQ5fr1HjrIrOakZF0APaqr0qC8kEkVtclSwCikdaTD68yPpBYYYc8nHJBqKHNbHsD7N47s8lPUXSeulP+E= 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 176882069777318.123038383776134; Mon, 19 Jan 2026 03:04:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vhn3k-0007X6-1K; Mon, 19 Jan 2026 06:04:36 -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 1vhn3i-0007Sr-82 for qemu-devel@nongnu.org; Mon, 19 Jan 2026 06:04:34 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vhn3g-0006ah-2N for qemu-devel@nongnu.org; Mon, 19 Jan 2026 06:04:33 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4801d7c72a5so19666485e9.0 for ; Mon, 19 Jan 2026 03:04:31 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47f4289b789sm245297805e9.1.2026.01.19.03.04.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 19 Jan 2026 03:04:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1768820670; x=1769425470; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wqdwi0ogZGHQTIcbpvNIqRSWev4Ubi5NdR0L7mmSkME=; b=b9f+IyAu0tXpxa0oc4UUkdWjTeGdy6UykDadfF6QXsGSbwUL8aLyjREf2owgbuzG/6 V/Rs1qcA9F52t4ft81lTnO6zK3lZHnEf/mOJuYqas6/EfQkBE/tES1lpGq4Q9WkoFe0/ sCIqarmYYdyL/r7Q0cIGiLA/2p+PsdRGRZpRoFSRJHb/HNfvOxvAI7bSTcD+7VfD2iKP +38js2aTIydm1gOdIoHQuA9b8voC32x96YisWi/KBAqHP/ltymz2gmeK9cT/C1hfJFZZ veKvenXFpBDw1T25GWJuuTUIJSwSPMKKlhVlgEMUXxwOT1aGdfawIZtkYKhoYk63LwCZ Q4PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768820670; x=1769425470; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=wqdwi0ogZGHQTIcbpvNIqRSWev4Ubi5NdR0L7mmSkME=; b=Fco9gWaU2XKn7ZesHCObYw73IX7xHv06I/MkIZasoM2nyNbgtwg4zpNFEma+Nhxl8E 7w40VLw0jtDo1Lx+GkuVMPhdWu7n1568qYKQsW8e/ULw+7rRGRLgIOne3RTMjhBhJ5f/ 2U3Us7cTcCEVG0xwmkNQrC7sML2EmYdYPIJVM8j+j7MCwshK4yeJxomqGtEVDiUGuDQW rS9nWmy92dHRuCsCm0gRJqJOw4vFt4viHxBHhkoUw/8H7k/cVons58bPeY1DCQ5vXWsH oYTJdxs5XkAbvZDQEUVPuKqvad4XjZospsWraC2MA0NUIw4AXTf5oGOd9jr7+UNYvWdw 2yHw== X-Gm-Message-State: AOJu0YyN4ofT4UbrnRerGcCrajcUymawpvSRKjFWY4H1lBpaeVzP7Rpd /GAeZ5AUuuDWpVpu/vDbwzb0gBcuYtAg4Hk4XYXozDHGd8Ct8sgsbsAwmKnHl1ceRPVPsiuKJ7j MJzWd2xw= X-Gm-Gg: AY/fxX7SD43lNfn71X+LxO9hyBvmQof2ynr7Hk7Y9dX67q1u7AX5Le8LM5WOCfFmCk9 RwhIRNIzP7cRxWi0XyHP5EZ9zmR01ZIV7/j94a/VqUTblQT+Nf2+VdJXkr54Wxx2ByJgb1vY19y Lj+nY8leQVsGmXAvaa1bDdbVA3IF1vZajC6ncPtCdhJeW+J2ipxvExBNRLjaQbmZPMD4nGpESSE h0l43IKLqYzj8CgVYDq215sIFDYW2sg3oRJlYutwNcf7h6zhcuSkZkNjP8mLfCOWb6eaxF8RMmW BWY/LNeKxcSqNWUReIgkidxS4JNSSeqq24iXAJFh+04Bsx7ZsuZifGjvhSC5tUrv38jLGEegDc/ MooDmoc/aOlhSIuRBZBRQcjb9SqMpyTeqMSoQNVOnrlV0qNEX4Pfb2UZ2Cxvn6i15dEwREsxC48 4vwgu5nDyuvv8VzHAtbQaKpTUSA27DxHL6QjSlHFQS7aaBOMxJPWAatS1U2PBi X-Received: by 2002:a05:600c:8b64:b0:47a:8cce:2940 with SMTP id 5b1f17b1804b1-4801eac0f22mr123135515e9.14.1768820669849; Mon, 19 Jan 2026 03:04:29 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , Pierrick Bouvier , "Dr. David Alan Gilbert" , Paolo Bonzini , Richard Henderson Subject: [PATCH v3 4/8] monitor: Have MonitorDef::get_value() return an unsigned type Date: Mon, 19 Jan 2026 12:03:54 +0100 Message-ID: <20260119110358.66821-5-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260119110358.66821-1-philmd@linaro.org> References: <20260119110358.66821-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 (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=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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, 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 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 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 @linaro.org) X-ZM-MESSAGEID: 1768820699771158500 All implementations of the get_value() handler return an unsigned type: - target/i386/monitor.c monitor_get_pc() -> target_ulong eip; - target/ppc/ppc-qmp-cmds.c monitor_get_ccr() -> uint64_t ppc_get_cr(const CPUPPCState *env); monitor_get_xer() -> target_ulong cpu_read_xer(const CPUPPCState *env); monitor_get_decr() -> target_ulong cpu_ppc_load_decr(CPUPPCState *env); monitor_get_tbu() -> uint32_t cpu_ppc_load_tbu(CPUPPCState *env); monitor_get_tbl() -> uint64_t cpu_ppc_load_tbl(CPUPPCState *env); - target/sparc/monitor.c monitor_get_psr() -> target_ulong cpu_get_psr(CPUSPARCState *env1); monitor_get_reg() -> target_ulong *regwptr; Convert the MonitorDef::get_value() handler to return unsigned. Rename the MD_I32/MD_TLONG definitions mechanically doing: $ sed -i -e s/MD_I32/MD_U32/g $(git grep -lw MD_I32) $ sed -i -e s/MD_TLONG/MD_TULONG/g $(git grep -lw MD_TLONG) Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Dr. David Alan Gilbert --- include/monitor/hmp-target.h | 7 ++--- monitor/hmp-target.c | 12 ++++---- target/i386/monitor.c | 8 ++--- target/m68k/monitor.c | 60 ++++++++++++++++++------------------ target/ppc/ppc-qmp-cmds.c | 25 +++++++-------- target/sparc/monitor.c | 10 +++--- 6 files changed, 59 insertions(+), 63 deletions(-) diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h index b679aaebbff..97d99f1c747 100644 --- a/include/monitor/hmp-target.h +++ b/include/monitor/hmp-target.h @@ -32,14 +32,13 @@ typedef struct MonitorDef MonitorDef; struct MonitorDef { const char *name; int offset; - target_long (*get_value)(Monitor *mon, const struct MonitorDef *md, - int val); + uint64_t (*get_value)(Monitor *mon, const struct MonitorDef *md, int v= al); int type; }; #endif =20 -#define MD_TLONG 0 -#define MD_I32 1 +#define MD_TULONG 0 +#define MD_U32 1 =20 const MonitorDef *target_monitor_defs(void); int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval); diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c index 420969bd6eb..1600666ee92 100644 --- a/monitor/hmp-target.c +++ b/monitor/hmp-target.c @@ -67,7 +67,6 @@ int get_monitor_def(Monitor *mon, int64_t *pval, const ch= ar *name) { const MonitorDef *md =3D target_monitor_defs(); CPUState *cs =3D mon_get_cpu(mon); - void *ptr; uint64_t tmp =3D 0; int ret; =20 @@ -81,13 +80,14 @@ int get_monitor_def(Monitor *mon, int64_t *pval, const = char *name) *pval =3D md->get_value(mon, md, md->offset); } else { CPUArchState *env =3D mon_get_cpu_env(mon); - ptr =3D (uint8_t *)env + md->offset; + void *ptr =3D (uint8_t *)env + md->offset; + switch(md->type) { - case MD_I32: - *pval =3D *(int32_t *)ptr; + case MD_U32: + *pval =3D *(uint32_t *)ptr; break; - case MD_TLONG: - *pval =3D *(target_long *)ptr; + case MD_TULONG: + *pval =3D *(target_ulong *)ptr; break; default: *pval =3D 0; diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 99b32cb7b0f..427f1990399 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -593,8 +593,8 @@ void hmp_mce(Monitor *mon, const QDict *qdict) } } =20 -static target_long monitor_get_pc(Monitor *mon, const struct MonitorDef *m= d, - int val) +static uint64_t monitor_get_pc(Monitor *mon, const struct MonitorDef *md, + int val) { CPUArchState *env =3D mon_get_cpu_env(mon); return env->eip + env->segs[R_CS].base; @@ -602,9 +602,9 @@ static target_long monitor_get_pc(Monitor *mon, const s= truct MonitorDef *md, =20 const MonitorDef monitor_defs[] =3D { #define SEG(name, seg) \ - { name, offsetof(CPUX86State, segs[seg].selector), NULL, MD_I32 },\ + { name, offsetof(CPUX86State, segs[seg].selector), NULL, MD_U32 },\ { name ".base", offsetof(CPUX86State, segs[seg].base) },\ - { name ".limit", offsetof(CPUX86State, segs[seg].limit), NULL, MD_I32 = }, + { name ".limit", offsetof(CPUX86State, segs[seg].limit), NULL, MD_U32 = }, =20 { "eax", offsetof(CPUX86State, regs[0]) }, { "ecx", offsetof(CPUX86State, regs[1]) }, diff --git a/target/m68k/monitor.c b/target/m68k/monitor.c index 161f41853ec..fe289f6d5de 100644 --- a/target/m68k/monitor.c +++ b/target/m68k/monitor.c @@ -23,36 +23,36 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict) } =20 static const MonitorDef monitor_defs[] =3D { - { "d0", offsetof(CPUM68KState, dregs[0]), NULL, MD_I32 }, - { "d1", offsetof(CPUM68KState, dregs[1]), NULL, MD_I32 }, - { "d2", offsetof(CPUM68KState, dregs[2]), NULL, MD_I32 }, - { "d3", offsetof(CPUM68KState, dregs[3]), NULL, MD_I32 }, - { "d4", offsetof(CPUM68KState, dregs[4]), NULL, MD_I32 }, - { "d5", offsetof(CPUM68KState, dregs[5]), NULL, MD_I32 }, - { "d6", offsetof(CPUM68KState, dregs[6]), NULL, MD_I32 }, - { "d7", offsetof(CPUM68KState, dregs[7]), NULL, MD_I32 }, - { "a0", offsetof(CPUM68KState, aregs[0]), NULL, MD_I32 }, - { "a1", offsetof(CPUM68KState, aregs[1]), NULL, MD_I32 }, - { "a2", offsetof(CPUM68KState, aregs[2]), NULL, MD_I32 }, - { "a3", offsetof(CPUM68KState, aregs[3]), NULL, MD_I32 }, - { "a4", offsetof(CPUM68KState, aregs[4]), NULL, MD_I32 }, - { "a5", offsetof(CPUM68KState, aregs[5]), NULL, MD_I32 }, - { "a6", offsetof(CPUM68KState, aregs[6]), NULL, MD_I32 }, - { "a7", offsetof(CPUM68KState, aregs[7]), NULL, MD_I32 }, - { "pc", offsetof(CPUM68KState, pc), NULL, MD_I32 }, - { "sr", offsetof(CPUM68KState, sr), NULL, MD_I32 }, - { "ssp", offsetof(CPUM68KState, sp[0]), NULL, MD_I32 }, - { "usp", offsetof(CPUM68KState, sp[1]), NULL, MD_I32 }, - { "isp", offsetof(CPUM68KState, sp[2]), NULL, MD_I32 }, - { "sfc", offsetof(CPUM68KState, sfc), NULL, MD_I32 }, - { "dfc", offsetof(CPUM68KState, dfc), NULL, MD_I32 }, - { "urp", offsetof(CPUM68KState, mmu.urp), NULL, MD_I32 }, - { "srp", offsetof(CPUM68KState, mmu.srp), NULL, MD_I32 }, - { "dttr0", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR0]), NULL, MD_I32 }, - { "dttr1", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR1]), NULL, MD_I32 }, - { "ittr0", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR0]), NULL, MD_I32 }, - { "ittr1", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR1]), NULL, MD_I32 }, - { "mmusr", offsetof(CPUM68KState, mmu.mmusr), NULL, MD_I32 }, + { "d0", offsetof(CPUM68KState, dregs[0]), NULL, MD_U32 }, + { "d1", offsetof(CPUM68KState, dregs[1]), NULL, MD_U32 }, + { "d2", offsetof(CPUM68KState, dregs[2]), NULL, MD_U32 }, + { "d3", offsetof(CPUM68KState, dregs[3]), NULL, MD_U32 }, + { "d4", offsetof(CPUM68KState, dregs[4]), NULL, MD_U32 }, + { "d5", offsetof(CPUM68KState, dregs[5]), NULL, MD_U32 }, + { "d6", offsetof(CPUM68KState, dregs[6]), NULL, MD_U32 }, + { "d7", offsetof(CPUM68KState, dregs[7]), NULL, MD_U32 }, + { "a0", offsetof(CPUM68KState, aregs[0]), NULL, MD_U32 }, + { "a1", offsetof(CPUM68KState, aregs[1]), NULL, MD_U32 }, + { "a2", offsetof(CPUM68KState, aregs[2]), NULL, MD_U32 }, + { "a3", offsetof(CPUM68KState, aregs[3]), NULL, MD_U32 }, + { "a4", offsetof(CPUM68KState, aregs[4]), NULL, MD_U32 }, + { "a5", offsetof(CPUM68KState, aregs[5]), NULL, MD_U32 }, + { "a6", offsetof(CPUM68KState, aregs[6]), NULL, MD_U32 }, + { "a7", offsetof(CPUM68KState, aregs[7]), NULL, MD_U32 }, + { "pc", offsetof(CPUM68KState, pc), NULL, MD_U32 }, + { "sr", offsetof(CPUM68KState, sr), NULL, MD_U32 }, + { "ssp", offsetof(CPUM68KState, sp[0]), NULL, MD_U32 }, + { "usp", offsetof(CPUM68KState, sp[1]), NULL, MD_U32 }, + { "isp", offsetof(CPUM68KState, sp[2]), NULL, MD_U32 }, + { "sfc", offsetof(CPUM68KState, sfc), NULL, MD_U32 }, + { "dfc", offsetof(CPUM68KState, dfc), NULL, MD_U32 }, + { "urp", offsetof(CPUM68KState, mmu.urp), NULL, MD_U32 }, + { "srp", offsetof(CPUM68KState, mmu.srp), NULL, MD_U32 }, + { "dttr0", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR0]), NULL, MD_U32 }, + { "dttr1", offsetof(CPUM68KState, mmu.ttr[M68K_DTTR1]), NULL, MD_U32 }, + { "ittr0", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR0]), NULL, MD_U32 }, + { "ittr1", offsetof(CPUM68KState, mmu.ttr[M68K_ITTR1]), NULL, MD_U32 }, + { "mmusr", offsetof(CPUM68KState, mmu.mmusr), NULL, MD_U32 }, { NULL }, }; =20 diff --git a/target/ppc/ppc-qmp-cmds.c b/target/ppc/ppc-qmp-cmds.c index 7022564604f..07938abb15f 100644 --- a/target/ppc/ppc-qmp-cmds.c +++ b/target/ppc/ppc-qmp-cmds.c @@ -33,26 +33,23 @@ #include "cpu-models.h" #include "cpu-qom.h" =20 -static target_long monitor_get_ccr(Monitor *mon, const struct MonitorDef *= md, - int val) +static uint64_t monitor_get_ccr(Monitor *mon, const struct MonitorDef *md, + int val) { CPUArchState *env =3D mon_get_cpu_env(mon); - unsigned int u; =20 - u =3D ppc_get_cr(env); - - return u; + return ppc_get_cr(env); } =20 -static target_long monitor_get_xer(Monitor *mon, const struct MonitorDef *= md, - int val) +static uint64_t monitor_get_xer(Monitor *mon, const struct MonitorDef *md, + int val) { CPUArchState *env =3D mon_get_cpu_env(mon); return cpu_read_xer(env); } =20 -static target_long monitor_get_decr(Monitor *mon, const struct MonitorDef = *md, - int val) +static uint64_t monitor_get_decr(Monitor *mon, const struct MonitorDef *md, + int val) { CPUArchState *env =3D mon_get_cpu_env(mon); if (!env->tb_env) { @@ -61,8 +58,8 @@ static target_long monitor_get_decr(Monitor *mon, const s= truct MonitorDef *md, return cpu_ppc_load_decr(env); } =20 -static target_long monitor_get_tbu(Monitor *mon, const struct MonitorDef *= md, - int val) +static uint64_t monitor_get_tbu(Monitor *mon, const struct MonitorDef *md, + int val) { CPUArchState *env =3D mon_get_cpu_env(mon); if (!env->tb_env) { @@ -71,8 +68,8 @@ static target_long monitor_get_tbu(Monitor *mon, const st= ruct MonitorDef *md, return cpu_ppc_load_tbu(env); } =20 -static target_long monitor_get_tbl(Monitor *mon, const struct MonitorDef *= md, - int val) +static uint64_t monitor_get_tbl(Monitor *mon, const struct MonitorDef *md, + int val) { CPUArchState *env =3D mon_get_cpu_env(mon); if (!env->tb_env) { diff --git a/target/sparc/monitor.c b/target/sparc/monitor.c index 73f15aa272d..378967f8164 100644 --- a/target/sparc/monitor.c +++ b/target/sparc/monitor.c @@ -40,8 +40,8 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict) } =20 #ifndef TARGET_SPARC64 -static target_long monitor_get_psr(Monitor *mon, const struct MonitorDef *= md, - int val) +static uint64_t monitor_get_psr(Monitor *mon, const struct MonitorDef *md, + int val) { CPUArchState *env =3D mon_get_cpu_env(mon); =20 @@ -49,8 +49,8 @@ static target_long monitor_get_psr(Monitor *mon, const st= ruct MonitorDef *md, } #endif =20 -static target_long monitor_get_reg(Monitor *mon, const struct MonitorDef *= md, - int val) +static uint64_t monitor_get_reg(Monitor *mon, const struct MonitorDef *md, + int val) { CPUArchState *env =3D mon_get_cpu_env(mon); return env->regwptr[val]; @@ -154,7 +154,7 @@ const MonitorDef monitor_defs[] =3D { { "otherwin", offsetof(CPUSPARCState, otherwin) }, { "wstate", offsetof(CPUSPARCState, wstate) }, { "cleanwin", offsetof(CPUSPARCState, cleanwin) }, - { "fprs", offsetof(CPUSPARCState, fprs), NULL, MD_I32 }, + { "fprs", offsetof(CPUSPARCState, fprs), NULL, MD_U32 }, #endif { NULL }, }; --=20 2.52.0 From nobody Mon Feb 9 06:05:20 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1768820713; cv=none; d=zohomail.com; s=zohoarc; b=kwZkKtdYSID0FDJKYLLjpY5jRJCo8Nb7q2ewa7C4gqLmdXINphop7usvYbYAYz6HEmDsGmS358c0NfYHCnnL9t4IHSFSNTkzx4TUCiyAKKEvj16UpFyTHSmS5ggSf0VU6hcW4Ss2ouBzgeMXfuQ3LPWy+I6QBifnP0goQAP5VTI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768820713; 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=31vcExfhyxITyDpAatH4IsbdJjBgBKYHjZYCzAjc2Rk=; b=C2nAHVx1eD9WdBHQrIQJfVjpc+z3VeMhQk7AEkn9PhUci6Z4Plc2g0axReXJXXa8HQKU26bYGRoiVOQMao5uoahlndKAVM6YlBHCATn1RhjhXLBfTKZR/jhNXdjUg8lBxbirgmQP1DNVRwmbXkgtGPZFJcbNjZRW4QwOF6DsQAk= 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 1768820713518695.5697766498241; Mon, 19 Jan 2026 03:05:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vhn3r-00080b-O2; Mon, 19 Jan 2026 06:04:43 -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 1vhn3q-0007v3-60 for qemu-devel@nongnu.org; Mon, 19 Jan 2026 06:04:42 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vhn3o-0006ca-Dx for qemu-devel@nongnu.org; Mon, 19 Jan 2026 06:04:41 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-47ee4338e01so16752195e9.2 for ; Mon, 19 Jan 2026 03:04:40 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4801fe3b01csm82111835e9.5.2026.01.19.03.04.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 19 Jan 2026 03:04:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1768820678; x=1769425478; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=31vcExfhyxITyDpAatH4IsbdJjBgBKYHjZYCzAjc2Rk=; b=reWORSN56g0T0sRIIYYu/8tyV7tCxnz0RnTUm+2RVe4alT/fbT+dqc2AFNkydWam/G MOk/u1CWrwMEYOYWBBL0l0K3sWvqyRM+8m4aGZ83hD3rmtaB72RCDK1siSchpjtiDkTO cDarKtSzFBhllQLl+EIifeZguVu33W828ZuK3xZyWcDw8FoBAOgCMHDkrwzAvziffh3y Rb4T+EN1m0W0Oe9pbopGkbbekPBCO6uTc9jfP1/jpJArpMuAQ+HRnTjm3TOmoWEsnI23 xho8CdFRUWXnWbqlGeU3E9iZP0vPVGVSt8daHfq1F6j3kV9w6Y/PddZ5AHqykRqez9HH nuUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768820678; x=1769425478; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=31vcExfhyxITyDpAatH4IsbdJjBgBKYHjZYCzAjc2Rk=; b=cdrMeMqHXv5Yy6iRZRiZSviHleAHySrVeigHxP2yq4IB7+FlGGS628WBisiFnvAvhp Rlek11IjJGuJgd7nUdbhWa8k1lJRD98mPsPdHk6Mkrq3bA6qnwnUbFIcMLFhzo70G55N 6PY/3WRHpD+7xg+W+5aAW8z0YGiWbxosixerdMEYHf7y+BGZ1k85OZnZY3hwHStysm3A 0WwhrcaCZwOpXZkA/O900OpUcuTvGUBVr2CHjioD/3tfwUG+eK3ATjrVOcvVwFjvaME2 YbdLh0xe8f2YFD4MvYSjqdxloYV+nb1YOxX4qItnEUY7DhRZbYC+NW0/G0C7iVxenVI6 p7Jg== X-Gm-Message-State: AOJu0Yx4UNLsHuFJhLTJ9EzmhXrZ2MNvnRQnEXtxn+MYFUjGTOCkatr4 AxxqVNClQZgV2ETsusgcPPYVFgPA15ZwORNEdpFfiy86lM86TBJndXEG+xwoaZ9vEEIfh+66dqe NvsW4mXM= X-Gm-Gg: AY/fxX4vk7TYl/Cx3TgxnendZdOlw8ubS2gWhUioki6mYN6wKNWNxiR34kxPsYwZV9L cLO2SBE2wAqnFdXO3296nqoGQTgYdpsHZG6NP+J7jG0LfMXjkAxEFuP660RKSTjhhsLo6GAlD0N x0QHhjo2IrFSmzmKVpdI1c+Wq5ODn6Ii7RmQHB8jo7SignpKUrKMTtMtInr3IWILtn0VFbd57kX rrJGvGaVCRk98/d/m1RF9w6yaYZRjo/YFfWssGWKOdY9YD3lM2hAe1gesF13H6LDaiKHj4jfIso k2mvzofq38vGMugmCwfeJOiKq5gqfPhOlytduk5wz+fPPWJDcc3hfeCwPe6zk/55UgcqJIOGEF7 hx6Oq+OfNIHd7Q4pR39oCp1k0iNakj49GrgprpucO1UuKYLk0wtdg17Cdp8KHOqxKPzBIgIEvv4 LP+ryIQQdOzlE3abiTaYOxgnibJoVJmpwSc9UiSSjIt0cW1xxb4K6i1XhURlMg X-Received: by 2002:a05:600c:4448:b0:477:b0b9:312a with SMTP id 5b1f17b1804b1-4801eab9db5mr122218155e9.7.1768820678212; Mon, 19 Jan 2026 03:04:38 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , Pierrick Bouvier , "Dr. David Alan Gilbert" , Paolo Bonzini , Richard Henderson Subject: [PATCH v3 5/8] monitor: Have *get_monitor_def() fill an unsigned value Date: Mon, 19 Jan 2026 12:03:55 +0100 Message-ID: <20260119110358.66821-6-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260119110358.66821-1-philmd@linaro.org> References: <20260119110358.66821-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 (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=2a00:1450:4864:20::32d; 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, 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 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 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 @linaro.org) X-ZM-MESSAGEID: 1768820715430158500 target_get_monitor_def() fills an unsigned value. Have get_monitor_def() fill an unsigned value too. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Dr. David Alan Gilbert --- monitor/monitor-internal.h | 2 +- monitor/hmp-target.c | 4 ++-- monitor/hmp.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index feca111ae31..8dc88963630 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -181,7 +181,7 @@ void monitor_data_destroy_qmp(MonitorQMP *mon); void coroutine_fn monitor_qmp_dispatcher_co(void *data); void qmp_dispatcher_co_wake(void); =20 -int get_monitor_def(Monitor *mon, int64_t *pval, const char *name); +int get_monitor_def(Monitor *mon, uint64_t *pval, const char *name); void handle_hmp_command(MonitorHMP *mon, const char *cmdline); int hmp_compare_cmd(const char *name, const char *list); =20 diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c index 1600666ee92..5738b47bb03 100644 --- a/monitor/hmp-target.c +++ b/monitor/hmp-target.c @@ -63,7 +63,7 @@ HMPCommand *hmp_cmds_for_target(bool info_command) * Set @pval to the value in the register identified by @name. * return 0 if OK, -1 if not found */ -int get_monitor_def(Monitor *mon, int64_t *pval, const char *name) +int get_monitor_def(Monitor *mon, uint64_t *pval, const char *name) { const MonitorDef *md =3D target_monitor_defs(); CPUState *cs =3D mon_get_cpu(mon); @@ -100,7 +100,7 @@ int get_monitor_def(Monitor *mon, int64_t *pval, const = char *name) =20 ret =3D target_get_monitor_def(cs, name, &tmp); if (!ret) { - *pval =3D (target_long) tmp; + *pval =3D (target_ulong)tmp; } =20 return ret; diff --git a/monitor/hmp.c b/monitor/hmp.c index 0a5bbf82197..eee8b7e964e 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -376,7 +376,7 @@ static int64_t expr_unary(Monitor *mon) case '$': { char buf[128], *q; - int64_t reg =3D 0; + uint64_t reg =3D 0; =20 pch++; q =3D buf; --=20 2.52.0 From nobody Mon Feb 9 06:05:20 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1768820747; cv=none; d=zohomail.com; s=zohoarc; b=igFlYItl95/I/Mxsp59bPGL/sVDCIb1HB8g0p7URZr4WEtyMZVXGd4gl04S47R1PImWUshYHqMYlg66v+VECOarKCfTQZPiS+rb6h8ZqSWzvc++hxVXUDbtMvII+cqVfeF+/E4O/RYy6WZEvNUG82FJmdFlqZc5YV0WNsRxORT4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768820747; 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=8fVwrVnP/PWITMvtJ7WHDio1LGq6lJqRNDjS4fFYTXc=; b=TSy1Dc/V+42ih+GvLwP7Jjjh10pwZS3u7u9DysYRwn+x7SburrpPxNFC4GbHuAKHmFs+xeKEu1t1c3WFekcQAlCN2ww+SOKmiVLAlCVf/V0jXw9TOlWFDLQZIzucpIClRE1hEH7pn+UHqq8sHZtp4QkM47fLQh7mc6jMZyEseSI= 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 1768820746993629.3018966238035; Mon, 19 Jan 2026 03:05:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vhn3y-00086r-6r; Mon, 19 Jan 2026 06:04:50 -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 1vhn3w-00085B-Vp for qemu-devel@nongnu.org; Mon, 19 Jan 2026 06:04:49 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vhn3v-0006dg-Hs for qemu-devel@nongnu.org; Mon, 19 Jan 2026 06:04:48 -0500 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-42fb0fc5aa9so2284611f8f.1 for ; Mon, 19 Jan 2026 03:04:47 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4356996cf42sm22578583f8f.20.2026.01.19.03.04.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 19 Jan 2026 03:04:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1768820685; x=1769425485; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8fVwrVnP/PWITMvtJ7WHDio1LGq6lJqRNDjS4fFYTXc=; b=Vv+nj2FsYSCas08POv68c5ImuNSNsV1WGu/1i9f6X/c/Wv8pcGgMyX5Ahu/B5gmF2r 0UEIYZ3pZiQWGpiOZvAS3EmA2gtRqXk3Rsufaj76B9Glx5e2d7dhMb6z2didCKDavn64 WxhJ071Idqm+x5fMWUrKQjekqWMIiiBNsmza3a3ftfHtzfh7bvtMNFyN0guOi4+7w10O QqwHsAiRM0ThfegHc4mBc5Qcm+hjmnNX3taAWr3Xv2hc8/5ZobMqY9hW/BxOF57K4bsM 83zv2oqU5VN1sJ7BePNXlcgREXVyBehY9Qi+Fbe7hau67wmKzECuAGETcO/vFWVU/M30 S4+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768820685; x=1769425485; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=8fVwrVnP/PWITMvtJ7WHDio1LGq6lJqRNDjS4fFYTXc=; b=JIOxG+i0K9wVpJ4tVgzlrLcqNbnbgjr2mgln0KLIVmt/+4zllTW1fmaDTDvBl17oV3 1udlTNxsQ5YOwptdyYnd3xVzxS103KrRdVGjlftSZnwxUiCMJ+fUkr2JE0jBfSKBnnu+ GRJZCwRjN7l7Yi40nFsuLaxUL9GkibrIxstB8xeVPLxnm+P8p6yUVZddKmXVTNCFJgDF reYlHvY2tM2AZzxOt9GOyY1HzLgYLinPnYc1XNrvmOzYpCtC8sFkBT0xaUw3nMJ8BgjA Z2dMs09z+MTWl/hj15C0zYsg8LqHhbkJGe5HAICXMmzaF4QpQ6HEcEdxTn8ku/rvFdPe pnjQ== X-Gm-Message-State: AOJu0YwXiT9jgpzw5Ydfl3DGMGPF+yzF/1m9XNDTWh+OcfDfXj0UO6u1 z+HQSWYe/r7nfXptZ2I6vOt+PCI7HZyj17U35KJRRQyxzsD5AEMzHQVAyESKvi55LH3qKTc9Dmm ufAv56ek= X-Gm-Gg: AZuq6aJPuc5Hc4uK9dNWhBDYEPKK1FqGDvn7KUrlwdA3LdmDoyi/omTckWlgt9Cl1bZ iVmxE3YvwnTNF3GvGirVA+cyqNk/WkC12XE9Mc34fmswjDnpFthtS3a+bgl9gNBzWAAvxUWUHl1 c4xlfhRDvc5pz+4iSe1H3iFLJANnIikfpZGhgqMcEFWnlhQABHmISP2AQeKf6lQs2q5bvVV3uM/ W6ELJ8/NUKwa8cbZEII344+0AP3pfiIqETK2ApsYSYjVee//EX6Zl6QsaC4ClyJd1FOC6/6S1qH vjS052HXo8DwHFztiVP9t4Q/jkq7XngydznBLZTQT6abfU9HGv6jsw3xm93Y5fiHkziW4PB01jL kfmWvlbVgrNdP3RKwok3Sx6W8wbCLUcMaDVTLPVMhPzvXtSidVfvufvite3WbbSZVDkIXRygBli q9GaTnWPIVpDJLrj+Vjw2h37KTn/BosZcua/5H5d0F+cxep4llIOu04T8Cc6cX X-Received: by 2002:adf:f983:0:b0:435:6c8d:d017 with SMTP id ffacd0b85a97d-4356c8dd0d7mr11585446f8f.32.1768820685525; Mon, 19 Jan 2026 03:04:45 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , Pierrick Bouvier , "Dr. David Alan Gilbert" , Paolo Bonzini , Richard Henderson Subject: [PATCH v3 6/8] monitor: Truncate target register using ldn_he_p() API Date: Mon, 19 Jan 2026 12:03:56 +0100 Message-ID: <20260119110358.66821-7-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260119110358.66821-1-philmd@linaro.org> References: <20260119110358.66821-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 (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=2a00:1450:4864:20::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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, 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 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 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 @linaro.org) X-ZM-MESSAGEID: 1768820747702158500 Rather than truncating with a target_long cast, use the unaligned load/store API. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/monitor/hmp-target.h | 3 --- monitor/hmp-target.c | 8 +++++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h index 97d99f1c747..c56f8df505c 100644 --- a/include/monitor/hmp-target.h +++ b/include/monitor/hmp-target.h @@ -27,15 +27,12 @@ =20 typedef struct MonitorDef MonitorDef; =20 -#ifdef COMPILING_PER_TARGET -#include "cpu.h" struct MonitorDef { const char *name; int offset; uint64_t (*get_value)(Monitor *mon, const struct MonitorDef *md, int v= al); int type; }; -#endif =20 #define MD_TULONG 0 #define MD_U32 1 diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c index 5738b47bb03..257605a1c96 100644 --- a/monitor/hmp-target.c +++ b/monitor/hmp-target.c @@ -23,6 +23,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/bswap.h" #include "monitor-internal.h" #include "monitor/qdev.h" #include "net/slirp.h" @@ -65,6 +66,7 @@ HMPCommand *hmp_cmds_for_target(bool info_command) */ int get_monitor_def(Monitor *mon, uint64_t *pval, const char *name) { + const unsigned length =3D target_long_bits() / 8; const MonitorDef *md =3D target_monitor_defs(); CPUState *cs =3D mon_get_cpu(mon); uint64_t tmp =3D 0; @@ -83,11 +85,11 @@ int get_monitor_def(Monitor *mon, uint64_t *pval, const= char *name) void *ptr =3D (uint8_t *)env + md->offset; =20 switch(md->type) { - case MD_U32: + case MD_I32: *pval =3D *(uint32_t *)ptr; break; case MD_TULONG: - *pval =3D *(target_ulong *)ptr; + *pval =3D ldn_he_p(ptr, length); break; default: *pval =3D 0; @@ -100,7 +102,7 @@ int get_monitor_def(Monitor *mon, uint64_t *pval, const= char *name) =20 ret =3D target_get_monitor_def(cs, name, &tmp); if (!ret) { - *pval =3D (target_ulong)tmp; + *pval =3D ldn_he_p(&tmp, length); } =20 return ret; --=20 2.52.0 From nobody Mon Feb 9 06:05:20 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1768820744; cv=none; d=zohomail.com; s=zohoarc; b=mMV6SjdbhjUIv2cdEF/g+8r5fKg4ntNFPiBYYRCwsUL0QqrzNVVB5+AUolHrjH3ONHZLx1T9iV8cT7sG6UXcRVHZMviogtXeMp3ra42CySZ8ArHq52aRoYFOMxNmFC3X72DJ/nl0wsz3lqqQdZKoCCf31ttI8IXZn2RiHqeaLeM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768820744; 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=3VIB+OpBInAaNY2pTDrwIlQ5aTfArsqavUF/QiPi1mg=; b=C2WTnN/e3RRoo6FRAKHUwVzagNVcDqNmvviIerzS1jPI9sIQF61+xXIEz/RTCfiTy5dvSLJN6adcHDEYz6G57FhffdaS0sq/yruHsixGRlIB3dNAwkMjcuayE1Le1v9fQkff82B+mYE/+B5tjXQge5oP2mEKohNXqqNzyimgANA= 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 1768820744465754.8515994816248; Mon, 19 Jan 2026 03:05:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vhn4U-0000KU-6R; Mon, 19 Jan 2026 06:05:24 -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 1vhn4B-0008Qy-7R for qemu-devel@nongnu.org; Mon, 19 Jan 2026 06:05:06 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vhn49-0006fT-1E for qemu-devel@nongnu.org; Mon, 19 Jan 2026 06:05:02 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-47d63594f7eso28251585e9.0 for ; Mon, 19 Jan 2026 03:05:00 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4356999824csm22360981f8f.39.2026.01.19.03.04.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 19 Jan 2026 03:04:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1768820699; x=1769425499; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3VIB+OpBInAaNY2pTDrwIlQ5aTfArsqavUF/QiPi1mg=; b=XrXWFq9u867jCH2ItBg5gipTWmBvYiVwqomfioEBFh4NzqjBrm3kC5EBF4i5npS57J yhOyheKS1IEatFtLlrWmZYb77+qX9o9/lp6brGhANojwLTO76iIOEOhSE7AkFGZCm6N5 V1ElP1UJ9uFeNUaT96XkStQreemKy5ZTp0Zd/m/UGnnIeNFwBnrIe43Mo5b+JDsgsHiF QLHlU+zxjwXn0cgmJQQOfhEUPlKyU2PfRM9DHMI8GbGeSN94lBATyt2YcooElysk3ax4 zM0XMOE92qTNOQlqwl7oaKom3cjh8riGdJMXPROFa7D+2ud0tCa415PMrvZ/u+AK8E2l F4RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768820699; x=1769425499; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=3VIB+OpBInAaNY2pTDrwIlQ5aTfArsqavUF/QiPi1mg=; b=RedSelD9+75bNpJ7J7bQ3A5/0s0183let6B9st9TTk2Sr4b9m4r9OUQucufgyWTrKQ P9hyniHU1HXK9clUHCElpJsJBpu1d6ce4DpOn1qgIeIoWbYMH6OeUpjChk/Bknw3RAHf HMx+l2sjfgKHMKS1dSeSRiCFG5dVxzh1ZbYp+anACRPnEiFG+cClnaTh8QXewE8ez73A X9uqsAEF4STjllyHOEtm/5xHLVm71gUT4IzmYlx0srYABnXQ72C2agrmSOrYsEIeO4lx sZVqZQtQZI7AQTswh3jz4WxK8z/NxS/WCPZr4CtohfONOrlpfx502pCnbN/FCTgPSbGx OMlw== X-Gm-Message-State: AOJu0YzUDMctS/YOo14RkxP1rEk+R5XteRqDukudZ1PvuqOHE/m2OX64 IYFxW9SVNVMh0XHWLotxCRYQRjROFMXD9MxqVsZtiyBjUiwF5ZGcqnW/aDGd0uLsKs023MyOoib FhgxObng= X-Gm-Gg: AY/fxX6DrbT6XnZTX1gbq8RfiOcVttrIbrKUkOnbt9xISHGRefAUWRp4cYF+HwyFnLP 5Oieu0ZCtBvQWx2+6Kj+nf7BEs3e+3s1ZNjYZWdaOdjtxQiEeErOMoLOMUodUKB37Z35nMv5tLi mgCPrzt3jVEfNxJQfHxbhGShg5fh7G912YRmt4BKphvX7115WJmLY0a1WeXY5qAqLkR/bqP+Ndj 0XuJGz6ACYX/zts4KZDLF+Z5vJTYXtn+6wbjaORzhRylECIsm6zIaHrCeXURPE4teuVS3Jd7J9i oQVTqCgGEp5cxu+J84z+k8neq5LR+7LnazZY3AYDOxD9ETOqNU6DDIIsiwDFEwJnejuq3T2yR3g EoaA0HzsLO3BS1wsMRKcxoJK2Xvb7eszjTTu1eEpw7EHxXpQ00w0kL5kWX11V/VkHplW3qG+w+M AFgeV1EbTXlSEz7d3ye9o8hhbtBJViNa16uEYvaRBiksUyvyCy+evwjEpQUvig X-Received: by 2002:a05:600c:4e4e:b0:477:7725:c16a with SMTP id 5b1f17b1804b1-4801e30b74emr142538355e9.10.1768820692550; Mon, 19 Jan 2026 03:04:52 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , Pierrick Bouvier , "Dr. David Alan Gilbert" , Paolo Bonzini , Richard Henderson Subject: [PATCH v3 7/8] monitor: Reduce target-specific methods further Date: Mon, 19 Jan 2026 12:03:57 +0100 Message-ID: <20260119110358.66821-8-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260119110358.66821-1-philmd@linaro.org> References: <20260119110358.66821-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 (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=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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, 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 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 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 @linaro.org) X-ZM-MESSAGEID: 1768820745652158500 get_monitor_def() doesn't use any target-specific declaration anymore, move it to hmp.c to compile it once. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Dr. David Alan Gilbert --- monitor/monitor-internal.h | 1 - monitor/hmp-target.c | 49 ----------------------------------- monitor/hmp.c | 52 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 50 deletions(-) diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index 8dc88963630..3ecd394ecf6 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -181,7 +181,6 @@ void monitor_data_destroy_qmp(MonitorQMP *mon); void coroutine_fn monitor_qmp_dispatcher_co(void *data); void qmp_dispatcher_co_wake(void); =20 -int get_monitor_def(Monitor *mon, uint64_t *pval, const char *name); void handle_hmp_command(MonitorHMP *mon, const char *cmdline); int hmp_compare_cmd(const char *name, const char *list); =20 diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c index 257605a1c96..a3306b69c93 100644 --- a/monitor/hmp-target.c +++ b/monitor/hmp-target.c @@ -23,7 +23,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu/bswap.h" #include "monitor-internal.h" #include "monitor/qdev.h" #include "net/slirp.h" @@ -60,54 +59,6 @@ HMPCommand *hmp_cmds_for_target(bool info_command) return info_command ? hmp_info_cmds : hmp_cmds; } =20 -/* - * Set @pval to the value in the register identified by @name. - * return 0 if OK, -1 if not found - */ -int get_monitor_def(Monitor *mon, uint64_t *pval, const char *name) -{ - const unsigned length =3D target_long_bits() / 8; - const MonitorDef *md =3D target_monitor_defs(); - CPUState *cs =3D mon_get_cpu(mon); - uint64_t tmp =3D 0; - int ret; - - if (cs =3D=3D NULL || md =3D=3D NULL) { - return -1; - } - - for(; md->name !=3D NULL; md++) { - if (hmp_compare_cmd(name, md->name)) { - if (md->get_value) { - *pval =3D md->get_value(mon, md, md->offset); - } else { - CPUArchState *env =3D mon_get_cpu_env(mon); - void *ptr =3D (uint8_t *)env + md->offset; - - switch(md->type) { - case MD_I32: - *pval =3D *(uint32_t *)ptr; - break; - case MD_TULONG: - *pval =3D ldn_he_p(ptr, length); - break; - default: - *pval =3D 0; - break; - } - } - return 0; - } - } - - ret =3D target_get_monitor_def(cs, name, &tmp); - if (!ret) { - *pval =3D ldn_he_p(&tmp, length); - } - - return ret; -} - static int compare_mon_cmd(const void *a, const void *b) { diff --git a/monitor/hmp.c b/monitor/hmp.c index eee8b7e964e..36e58c54670 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -27,8 +27,10 @@ #include "hw/core/qdev.h" #include "monitor-internal.h" #include "monitor/hmp.h" +#include "monitor/hmp-target.h" #include "qobject/qdict.h" #include "qobject/qnum.h" +#include "qemu/bswap.h" #include "qemu/config-file.h" #include "qemu/ctype.h" #include "qemu/cutils.h" @@ -311,6 +313,8 @@ void hmp_help_cmd(Monitor *mon, const char *name) static const char *pch; static sigjmp_buf expr_env; =20 +static int get_monitor_def(Monitor *mon, uint64_t *pval, const char *name); + static G_NORETURN G_GNUC_PRINTF(2, 3) void expr_error(Monitor *mon, const char *fmt, ...) { @@ -1552,3 +1556,51 @@ void monitor_register_hmp_info_hrt(const char *name, } g_assert_not_reached(); } + +/* + * Set @pval to the value in the register identified by @name. + * return 0 if OK, -1 if not found + */ +static int get_monitor_def(Monitor *mon, uint64_t *pval, const char *name) +{ + const unsigned length =3D target_long_bits() / 8; + const MonitorDef *md =3D target_monitor_defs(); + CPUState *cs =3D mon_get_cpu(mon); + uint64_t tmp =3D 0; + int ret; + + if (cs =3D=3D NULL || md =3D=3D NULL) { + return -1; + } + + for(; md->name !=3D NULL; md++) { + if (hmp_compare_cmd(name, md->name)) { + if (md->get_value) { + *pval =3D md->get_value(mon, md, md->offset); + } else { + CPUArchState *env =3D mon_get_cpu_env(mon); + void *ptr =3D (uint8_t *)env + md->offset; + + switch(md->type) { + case MD_U32: + *pval =3D *(uint32_t *)ptr; + break; + case MD_TULONG: + *pval =3D ldn_he_p(ptr, length); + break; + default: + *pval =3D 0; + break; + } + } + return 0; + } + } + + ret =3D target_get_monitor_def(cs, name, &tmp); + if (!ret) { + *pval =3D ldn_he_p(&tmp, length); + } + + return ret; +} --=20 2.52.0 From nobody Mon Feb 9 06:05:20 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1768820737; cv=none; d=zohomail.com; s=zohoarc; b=eBuAKv83SYrK/FKI6CVvZObV/+R8ylkCFeeDrw8Xd8oDsc9tN56jDXGO88ioCeuEqCAqxY0bwzvhfdz60YLpgTKxOV3EFI5a/OnPnwayUoqiGqr/uYcoztAKl878DfhTZclEQjCCLcsP7/LgmDi8+VMviUqy/CpS3csu668LYL8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768820737; 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=+9fQffFhl/PW1gRIx+W9VUGAErfX3oCqnx4WCN0VxsM=; b=MSvHwXDNiDP2Rn2VNgCEfAZPuUNP2kp5TpledH37Ov5YkGHgzE1c/5ZNb6augbu7ZuLLjMH6xHgVeVoRFmmQDAbmptoHgWn/scCVIvou3N7FNbhYN/rYK3KDHg3R4Yl7kXgix2Qg4y1ToQVsVR5TwjMoRvAQ5DjbMo5aZuT756w= 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 1768820737031644.4287377573638; Mon, 19 Jan 2026 03:05:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vhn4a-0000XQ-8l; Mon, 19 Jan 2026 06:05:30 -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 1vhn4K-00008g-Fi for qemu-devel@nongnu.org; Mon, 19 Jan 2026 06:05:15 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vhn4F-0006s3-O5 for qemu-devel@nongnu.org; Mon, 19 Jan 2026 06:05:11 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-4327790c4e9so2501974f8f.2 for ; Mon, 19 Jan 2026 03:05:07 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4356996dadbsm22348387f8f.21.2026.01.19.03.05.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 19 Jan 2026 03:05:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1768820706; x=1769425506; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+9fQffFhl/PW1gRIx+W9VUGAErfX3oCqnx4WCN0VxsM=; b=VwQUVPp8GsGzKREjKOD87F3rYJAzhPjAJXpGP9rZxzwD+haDHFVwJE6ZfIT+msH8pC 1BeEHCidYWMm3w9BbCQOBSKS8VwwJw72lCw9SJo4EmNjqYuhFb4pcfev0/shfUafeHKy CF+fDCWnsiC6KpebC+YOQKlqkFAntaYiTCnkhoFQwq/THrsxPabRxeYlGiADlVHDLz/G QOqqWT9v6q/H4km0DNOJ5fUl/2V9R0Akx59QqcjZVRBHZFd7Gt3CIP+IIfiVMIkg/vaj CKfUhf7yhBX+LhvAfCoZ38p0BNcRZ6CoM8s9d1Sk6uwqpLmB8SiGEuv7cN97mF+ngq8y JnPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768820706; x=1769425506; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=+9fQffFhl/PW1gRIx+W9VUGAErfX3oCqnx4WCN0VxsM=; b=WwNE2TR77QJM9qSWUeKeC8cpIQBpBsHrKrX5+jHtMaWbcl2XIIfzOEygX8GYOQYMbI naCFesfTwbyg7/mgBAZl3i95XkuIaYrv6HoFP2W2UtHGw824rTeFw6oVu2ZjrWmmOw/s sXAOUqVpX8UUxyg4HkKC9L2tAFNqyb+tMAilAjJHDZ8CtcAwhUuLi0x1eQJLEWCWtRzj TPO5aXXpRyQTZDg58+QuFK42QXi5nwp92SKM0qzSk45i2n/O1EiUpcYCGPZ5+Qtc/jrD WzHPdU1CIUBpPfEnI2u/7ftfCA///B8DQgsBV/2pwe3NqootptIK91FA67fqs2Ho/gdC e5EQ== X-Gm-Message-State: AOJu0YwsVgw1q1WZH2cqcBniUt4x54kwnk30PGFcmLMA+Me+X/K+dJwe fJrJtqTR0xRnWGSXaHbjAKpnWP6wfYI7E9CIuxmdg5wSEbN2HoqfhV3yU5edTv1ubsPunL25LEv cE9AAcOk= X-Gm-Gg: AZuq6aLhG3dQDd5cbl4WyvHT9FFksslqKuCqx08lmgAHCt1pEkkeSMa0AJkFW6LLgoZ LSmMfkvR7m7c5Pm+V9rTMOc+aI2cdOPzYtVbzxE2iYDwyk1JtTINQ3cxe/DsZ7bkyMf4OgAdepj kN4I0D6p6N9XibR4QV3FVCChC7ukfro0S5zY/UJoqu2pMMQ5pU/PSrZIhxjCkwraJcW0u9rHa09 Hqa1AmdFv4I2cl9XxNiSkXzILuDuqTSoTeifi6fh1rYAngZbCCUi2pp0DcjQ+2Vryr1J7uOfh7l ifR7Y+A5yH1PBluUhj4Zk7kxJc4Bsb8+KRSJ/PnKl5O/0SO3zuPa5iN7OUgryYwW+lrbR6PNSvA 9fUgBpPO1liCIgRbhJGbUzOjekeD8fIuVyRdcmINiKew7IXRZ0W8oUuscL3TIxLVmRBYdo8FUu1 iHNglOB6/YXqXnTZI/Zo/iLQZIGxnlWeuBylVFCejSt6j3ekgEsCeBASmewCCUba9wlL9SQsY= X-Received: by 2002:a05:6000:1ac5:b0:432:a9db:f99b with SMTP id ffacd0b85a97d-43569919a6bmr11825492f8f.0.1768820705581; Mon, 19 Jan 2026 03:05:05 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , Pierrick Bouvier , "Dr. David Alan Gilbert" , Paolo Bonzini , Richard Henderson Subject: [PATCH v3 8/8] monitor: Remove 'monitor/hmp-target.h' header Date: Mon, 19 Jan 2026 12:03:58 +0100 Message-ID: <20260119110358.66821-9-philmd@linaro.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260119110358.66821-1-philmd@linaro.org> References: <20260119110358.66821-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 (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=2a00:1450:4864:20::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.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, 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 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 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 @linaro.org) X-ZM-MESSAGEID: 1768820737736158500 The "monitor/hmp-target.h" header doesn't contain any target-specific declarations anymore. Merge it with "monitor/hmp.h", its target-agnostic counterpart. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Dr. David Alan Gilbert --- MAINTAINERS | 2 +- include/monitor/hmp-target.h | 60 ----------------------------------- include/monitor/hmp.h | 31 ++++++++++++++++++ hw/i386/sgx-stub.c | 2 +- hw/i386/sgx.c | 1 - monitor/hmp-cmds.c | 1 - monitor/hmp-target.c | 1 - monitor/hmp.c | 1 - stubs/target-monitor-defs.c | 2 +- target/i386/cpu-apic.c | 2 +- target/i386/monitor.c | 1 - target/i386/sev-system-stub.c | 2 +- target/i386/sev.c | 1 - target/m68k/monitor.c | 2 +- target/ppc/ppc-qmp-cmds.c | 1 - target/riscv/monitor.c | 2 +- target/riscv/riscv-qmp-cmds.c | 1 - target/sh4/monitor.c | 1 - target/sparc/monitor.c | 1 - target/xtensa/monitor.c | 1 - 20 files changed, 38 insertions(+), 78 deletions(-) delete mode 100644 include/monitor/hmp-target.h diff --git a/MAINTAINERS b/MAINTAINERS index de8246c3ffd..1e0d71c7bb8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3377,7 +3377,7 @@ F: monitor/monitor.c F: monitor/hmp* F: hmp.h F: hmp-commands*.hx -F: include/monitor/hmp-target.h +F: include/monitor/hmp.h F: tests/qtest/test-hmp.c F: include/qemu/qemu-print.h F: util/qemu-print.c diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h deleted file mode 100644 index c56f8df505c..00000000000 --- a/include/monitor/hmp-target.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * QEMU monitor - * - * Copyright (c) 2003-2004 Fabrice Bellard - * - * Permission is hereby granted, free of charge, to any person obtaining a= copy - * of this software and associated documentation files (the "Software"), t= o deal - * in the Software without restriction, including without limitation the r= ights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included= in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN - * THE SOFTWARE. - */ - -#ifndef MONITOR_HMP_TARGET_H -#define MONITOR_HMP_TARGET_H - -typedef struct MonitorDef MonitorDef; - -struct MonitorDef { - const char *name; - int offset; - uint64_t (*get_value)(Monitor *mon, const struct MonitorDef *md, int v= al); - int type; -}; - -#define MD_TULONG 0 -#define MD_U32 1 - -const MonitorDef *target_monitor_defs(void); -int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval); - -CPUArchState *mon_get_cpu_env(Monitor *mon); -CPUState *mon_get_cpu(Monitor *mon); - -void hmp_info_mem(Monitor *mon, const QDict *qdict); -void hmp_info_tlb(Monitor *mon, const QDict *qdict); -void hmp_mce(Monitor *mon, const QDict *qdict); -void hmp_info_local_apic(Monitor *mon, const QDict *qdict); -void hmp_info_sev(Monitor *mon, const QDict *qdict); -void hmp_info_sgx(Monitor *mon, const QDict *qdict); -void hmp_info_via(Monitor *mon, const QDict *qdict); -void hmp_memory_dump(Monitor *mon, const QDict *qdict); -void hmp_physical_memory_dump(Monitor *mon, const QDict *qdict); -void hmp_info_registers(Monitor *mon, const QDict *qdict); -void hmp_gva2gpa(Monitor *mon, const QDict *qdict); -void hmp_gpa2hva(Monitor *mon, const QDict *qdict); -void hmp_gpa2hpa(Monitor *mon, const QDict *qdict); - -#endif /* MONITOR_HMP_TARGET_H */ diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index 83721b5ffc6..9d70a7b78ad 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -17,6 +17,37 @@ #include "qemu/readline.h" #include "qapi/qapi-types-common.h" =20 +typedef struct MonitorDef { + const char *name; + int offset; + uint64_t (*get_value)(Monitor *mon, const struct MonitorDef *md, int v= al); + int type; +} MonitorDef; + +#define MD_TULONG 0 +#define MD_U32 1 + +const MonitorDef *target_monitor_defs(void); + +int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval); + +CPUArchState *mon_get_cpu_env(Monitor *mon); +CPUState *mon_get_cpu(Monitor *mon); + +void hmp_info_mem(Monitor *mon, const QDict *qdict); +void hmp_info_tlb(Monitor *mon, const QDict *qdict); +void hmp_mce(Monitor *mon, const QDict *qdict); +void hmp_info_local_apic(Monitor *mon, const QDict *qdict); +void hmp_info_sev(Monitor *mon, const QDict *qdict); +void hmp_info_sgx(Monitor *mon, const QDict *qdict); +void hmp_info_via(Monitor *mon, const QDict *qdict); +void hmp_memory_dump(Monitor *mon, const QDict *qdict); +void hmp_physical_memory_dump(Monitor *mon, const QDict *qdict); +void hmp_info_registers(Monitor *mon, const QDict *qdict); +void hmp_gva2gpa(Monitor *mon, const QDict *qdict); +void hmp_gpa2hva(Monitor *mon, const QDict *qdict); +void hmp_gpa2hpa(Monitor *mon, const QDict *qdict); + bool hmp_handle_error(Monitor *mon, Error *err); void hmp_help_cmd(Monitor *mon, const char *name); strList *hmp_split_at_comma(const char *str); diff --git a/hw/i386/sgx-stub.c b/hw/i386/sgx-stub.c index d295e54d239..6e82773a86d 100644 --- a/hw/i386/sgx-stub.c +++ b/hw/i386/sgx-stub.c @@ -1,6 +1,6 @@ #include "qemu/osdep.h" #include "monitor/monitor.h" -#include "monitor/hmp-target.h" +#include "monitor/hmp.h" #include "hw/i386/pc.h" #include "hw/i386/sgx-epc.h" #include "qapi/qapi-commands-misc-i386.h" diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c index e2801546ad6..54d2cae36d8 100644 --- a/hw/i386/sgx.c +++ b/hw/i386/sgx.c @@ -16,7 +16,6 @@ #include "hw/mem/memory-device.h" #include "monitor/qdev.h" #include "monitor/monitor.h" -#include "monitor/hmp-target.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "qapi/qapi-commands-misc-i386.h" diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 5a673cddb2a..7c2b69dfa5b 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -21,7 +21,6 @@ #include "gdbstub/enums.h" #include "monitor/hmp.h" #include "qemu/help_option.h" -#include "monitor/hmp-target.h" #include "monitor/monitor-internal.h" #include "qapi/error.h" #include "qapi/qapi-commands-control.h" diff --git a/monitor/hmp-target.c b/monitor/hmp-target.c index a3306b69c93..2574c5d8b4b 100644 --- a/monitor/hmp-target.c +++ b/monitor/hmp-target.c @@ -27,7 +27,6 @@ #include "monitor/qdev.h" #include "net/slirp.h" #include "system/device_tree.h" -#include "monitor/hmp-target.h" #include "monitor/hmp.h" #include "block/block-hmp-cmds.h" #include "qapi/qapi-commands-control.h" diff --git a/monitor/hmp.c b/monitor/hmp.c index 36e58c54670..2d9f870df26 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -27,7 +27,6 @@ #include "hw/core/qdev.h" #include "monitor-internal.h" #include "monitor/hmp.h" -#include "monitor/hmp-target.h" #include "qobject/qdict.h" #include "qobject/qnum.h" #include "qemu/bswap.h" diff --git a/stubs/target-monitor-defs.c b/stubs/target-monitor-defs.c index 35a0a342772..0dd4cdb34f6 100644 --- a/stubs/target-monitor-defs.c +++ b/stubs/target-monitor-defs.c @@ -1,5 +1,5 @@ #include "qemu/osdep.h" -#include "monitor/hmp-target.h" +#include "monitor/hmp.h" =20 const MonitorDef *target_monitor_defs(void) { diff --git a/target/i386/cpu-apic.c b/target/i386/cpu-apic.c index eeee62b52a2..3b73a04597f 100644 --- a/target/i386/cpu-apic.c +++ b/target/i386/cpu-apic.c @@ -10,7 +10,7 @@ #include "qobject/qdict.h" #include "qapi/error.h" #include "monitor/monitor.h" -#include "monitor/hmp-target.h" +#include "monitor/hmp.h" #include "system/hw_accel.h" #include "system/kvm.h" #include "system/xen.h" diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 427f1990399..1d04978c43b 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -25,7 +25,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "monitor/monitor.h" -#include "monitor/hmp-target.h" #include "monitor/hmp.h" #include "qobject/qdict.h" #include "qapi/error.h" diff --git a/target/i386/sev-system-stub.c b/target/i386/sev-system-stub.c index 7c5c02a5657..f799a338d60 100644 --- a/target/i386/sev-system-stub.c +++ b/target/i386/sev-system-stub.c @@ -13,7 +13,7 @@ =20 #include "qemu/osdep.h" #include "monitor/monitor.h" -#include "monitor/hmp-target.h" +#include "monitor/hmp.h" #include "qapi/error.h" #include "sev.h" =20 diff --git a/target/i386/sev.c b/target/i386/sev.c index 1d70f96ec1f..31dbabe4b51 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -36,7 +36,6 @@ #include "migration/blocker.h" #include "qom/object.h" #include "monitor/monitor.h" -#include "monitor/hmp-target.h" #include "qapi/qapi-commands-misc-i386.h" #include "confidential-guest.h" #include "hw/i386/pc.h" diff --git a/target/m68k/monitor.c b/target/m68k/monitor.c index fe289f6d5de..c148926d827 100644 --- a/target/m68k/monitor.c +++ b/target/m68k/monitor.c @@ -7,7 +7,7 @@ =20 #include "qemu/osdep.h" #include "cpu.h" -#include "monitor/hmp-target.h" +#include "monitor/hmp.h" #include "monitor/monitor.h" =20 void hmp_info_tlb(Monitor *mon, const QDict *qdict) diff --git a/target/ppc/ppc-qmp-cmds.c b/target/ppc/ppc-qmp-cmds.c index 07938abb15f..08314e3c1cd 100644 --- a/target/ppc/ppc-qmp-cmds.c +++ b/target/ppc/ppc-qmp-cmds.c @@ -26,7 +26,6 @@ #include "cpu.h" #include "monitor/monitor.h" #include "qemu/ctype.h" -#include "monitor/hmp-target.h" #include "monitor/hmp.h" #include "qapi/error.h" #include "qapi/qapi-commands-machine.h" diff --git a/target/riscv/monitor.c b/target/riscv/monitor.c index 8a77476db93..bc176dd8771 100644 --- a/target/riscv/monitor.c +++ b/target/riscv/monitor.c @@ -22,7 +22,7 @@ #include "cpu.h" #include "cpu_bits.h" #include "monitor/monitor.h" -#include "monitor/hmp-target.h" +#include "monitor/hmp.h" #include "system/memory.h" =20 #ifdef TARGET_RISCV64 diff --git a/target/riscv/riscv-qmp-cmds.c b/target/riscv/riscv-qmp-cmds.c index d5e9bec0f86..79232d34005 100644 --- a/target/riscv/riscv-qmp-cmds.c +++ b/target/riscv/riscv-qmp-cmds.c @@ -34,7 +34,6 @@ #include "qemu/ctype.h" #include "qemu/qemu-print.h" #include "monitor/hmp.h" -#include "monitor/hmp-target.h" #include "system/kvm.h" #include "system/tcg.h" #include "cpu-qom.h" diff --git a/target/sh4/monitor.c b/target/sh4/monitor.c index 2da6a5426eb..50324d3600c 100644 --- a/target/sh4/monitor.c +++ b/target/sh4/monitor.c @@ -24,7 +24,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "monitor/monitor.h" -#include "monitor/hmp-target.h" #include "monitor/hmp.h" =20 static void print_tlb(Monitor *mon, int idx, tlb_t *tlb) diff --git a/target/sparc/monitor.c b/target/sparc/monitor.c index 378967f8164..83257a18717 100644 --- a/target/sparc/monitor.c +++ b/target/sparc/monitor.c @@ -24,7 +24,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "monitor/monitor.h" -#include "monitor/hmp-target.h" #include "monitor/hmp.h" =20 =20 diff --git a/target/xtensa/monitor.c b/target/xtensa/monitor.c index fbf60d55530..2af84934f83 100644 --- a/target/xtensa/monitor.c +++ b/target/xtensa/monitor.c @@ -24,7 +24,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "monitor/monitor.h" -#include "monitor/hmp-target.h" #include "monitor/hmp.h" =20 void hmp_info_tlb(Monitor *mon, const QDict *qdict) --=20 2.52.0