From nobody Sat Apr 11 23:07:24 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=1772744008; cv=none; d=zohomail.com; s=zohoarc; b=P9TMy++LRFXZGz5dRHzVIlkwBY2/3NSWV5Sg5Buemy6XpshvNLuwM8RR5QSb7fmVbZP9+kiomp8RTLM+OK50X0cDdX/GVKUbWYuOjLv3udh9GLkzc1LNoGuQW71DyIQRLEV7t4ds/Z9PpNqGEZHZ5k7/syATSnkZtk1WFSUB5EI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772744008; 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=jhU2H5Lji7UkbAGIzyPPNScbnVNC1zzUf1PUJSajVNo=; b=lhmTXiCUGDLqt7c4+6SL62nk4t4H7yrO42X8SdGyPYgW5MpwBdRSvMrctdbosLVQUwaWaEQNak2ccyAODR8X9sSY244iE/O/W4qvUmhC+duCWGn7Rz3pOrLOekO0NDgzaNgZWkgHV+nvNfuH40HfduU6Ss/Aa1LTLBNWuPeCGps= 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 1772744008075652.5994508829589; Thu, 5 Mar 2026 12:53:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vyFgB-0006c8-EN; Thu, 05 Mar 2026 15:52:19 -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 1vyFg7-0006Zk-EY for qemu-devel@nongnu.org; Thu, 05 Mar 2026 15:52:16 -0500 Received: from mail-qv1-xf33.google.com ([2607:f8b0:4864:20::f33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vyFg4-00066l-D5 for qemu-devel@nongnu.org; Thu, 05 Mar 2026 15:52:15 -0500 Received: by mail-qv1-xf33.google.com with SMTP id 6a1803df08f44-89a06bc2f1bso70189586d6.1 for ; Thu, 05 Mar 2026 12:52:11 -0800 (PST) Received: from pc.taild8403c.ts.net (216-71-219-44.dyn.novuscom.net. [216.71.219.44]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-89a0e31b035sm65559396d6.17.2026.03.05.12.52.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2026 12:52:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772743930; x=1773348730; 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=jhU2H5Lji7UkbAGIzyPPNScbnVNC1zzUf1PUJSajVNo=; b=XXzIEbis/XwGnCGnAXhQ4UMePfq6E+Afq104B2FajxotlgbBPzZSjfeB37+cK0RVdv s0TWyKDq0TD4HWDcAhMfp9SpKPr15JDTjd7EfKwkBLmtZ5SIFISCIRtH47YZ09gt7pIR PbvYqSWM3Yxjm0dwXR8B+dH3H4o02ces+HHVFTd98aKHtkqtPix4/8rbJrFFaki2hTnK UdjF1LlJZy/7QS4i2G+vihf7/uotFSXC0ncZHJAwtbv7Cd4zsAWyMqf2CJsvt0xBi0WF k26+RK5JEmv4bIfBnNNIhmJRq42oulhWpvFb3Lc0i8m0SeY6M9iKf28QEzyVv6HNBRvz Jwfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772743930; x=1773348730; 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=jhU2H5Lji7UkbAGIzyPPNScbnVNC1zzUf1PUJSajVNo=; b=XqQ+sF5uDWmshlPkE3wpX/tXkKeT2DHTEyoHycGwfMkoi13pjTLfpQ5aLwDVno6U3Z ig6ZtAbLqYrw+1OfOB9pox3Ej0zsFfPfTq/0pqokOvBXiwwW6y/JrZb4JVuYRSwxPl7F d1EqFl9ll8L+VAw9qk0yedSZcbKg8T/PV9QB4WuQjsVRHQAWy/5lCfKTMiMKLjbDFzWW G+VlmJ+IJtrGkdiP4NCOnUicMKE6EhsiRjxOrv33nhZL1ViiZMee2EjW5dD8SbOTZY7a BtM4BB6g4QLpbWzQAbb9eAvADoDToLoPr59aC34vTcneknHX/lqa1jf+WqtPdgzL8vDu IAsw== X-Gm-Message-State: AOJu0Yz9UNMmOLSq94AxwcDrZt5OTR5mPLTWR7n/W71RzxALCAM9UGLv oIFsK0zrdnyqQidlp8XVTda5IinDeRvGsSuwR4OJBgiHENWiibPts5mC4r6Y0sIRvh+yKmBiRQu 5L969 X-Gm-Gg: ATEYQzyQkM2HQbJU57ohEUUmWtfoGOMFtXMV9BlDIPgVbRRoweKN6bEuAZnhpm5AZUq Kj1xoTVit4vERMsBU1PxbJkpsuTwrU88XlJqzUqo96mumFnvYGqc2yhGTJO8kWkrAeyFyWrAK+R 53sW/WV8BxfQ40vEQ9MimUOcXiXFGqYoEQ2GqzmK4qiEfZy+0KqPdF25nu+6wN1q5bcf8SSu88y YQkQsMOfOBlJEgOhexFmfvz5w44N6lWAV5lx9NPiSqlC9+TiOjDBh+WTrnvTrTkCE/RtGewysgT CNZvrGaLmG9yveWncXueLz5+2V1PHfr9huRo5wsWKU9yWBz20zd/YFusC5s2CYxq4kPWFeCV0Rw nrVAqs0yBQNi2BozEty/jNLlAMoGD83h9DEAZauyFhFhoi0vFey5rK2GZwgqWdakCZnuBocsO/X uAJtKlGWyif1cZsEmYmKYgHWZEzDkhjrGjPpBC4ntruyP0JYDsaXE+Z8TQIXHmHwqs/Gs1cUAVx Tbk X-Received: by 2002:a05:6214:2585:b0:899:eba1:3c0b with SMTP id 6a1803df08f44-89a19af3ac2mr104706976d6.33.1772743930182; Thu, 05 Mar 2026 12:52:10 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org, peter.maydell@linaro.org, richard.henderson@linaro.org, pbonzini@redhat.com, stefanha@redhat.com Cc: pierrick.bouvier@linaro.org Subject: [PULL 06/12] plugins: add read-only property for registers Date: Thu, 5 Mar 2026 12:51:46 -0800 Message-ID: <20260305205152.2121854-7-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260305205152.2121854-1-pierrick.bouvier@linaro.org> References: <20260305205152.2121854-1-pierrick.bouvier@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 client-ip=2607:f8b0:4864:20::f33; envelope-from=pierrick.bouvier@linaro.org; helo=mail-qv1-xf33.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: 1772744009618158500 From: Florian Hofhammer Some registers should be marked as read-only from a plugin API perspective, as writing to them via qemu_plugin_write_register has no effect. This includes the program counter, and we expose this fact to the plugins with this patch. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Pierrick Bouvier Signed-off-by: Florian Hofhammer Link: https://lore.kernel.org/qemu-devel/20260305-setpc-v5-v7-6-4c3adba5240= 3@epfl.ch Signed-off-by: Pierrick Bouvier --- include/plugins/qemu-plugin.h | 3 +++ plugins/api.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/plugins/qemu-plugin.h b/include/plugins/qemu-plugin.h index 7b9cd6a9717..fceb8194eb8 100644 --- a/include/plugins/qemu-plugin.h +++ b/include/plugins/qemu-plugin.h @@ -979,11 +979,14 @@ struct qemu_plugin_register; * writing value with qemu_plugin_write_register * @name: register name * @feature: optional feature descriptor, can be NULL + * @is_readonly: true if the register cannot be written via + * qemu_plugin_write_register */ typedef struct { struct qemu_plugin_register *handle; const char *name; const char *feature; + bool is_readonly; } qemu_plugin_reg_descriptor; =20 /** diff --git a/plugins/api.c b/plugins/api.c index 23c291f6444..85b34949cbb 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -410,6 +410,12 @@ bool qemu_plugin_bool_parse(const char *name, const ch= ar *value, bool *ret) * ancillary data the plugin might find useful. */ =20 +static const char pc_str[] =3D "pc"; /* generic name for program counter */ +static const char eip_str[] =3D "eip"; /* x86-specific name for PC */ +static const char rip_str[] =3D "rip"; /* x86_64-specific name for PC */ +static const char pswa_str[] =3D "pswa"; /* s390x-specific name for PC */ +static const char iaoq_str[] =3D "iaoq"; /* HP/PA-specific name for PC */ +static const char rpc_str[] =3D "rpc"; /* microblaze-specific name for PC = */ static GArray *create_register_handles(GArray *gdbstub_regs) { GArray *find_data =3D g_array_new(true, true, @@ -427,6 +433,16 @@ static GArray *create_register_handles(GArray *gdbstub= _regs) /* Create a record for the plugin */ desc.handle =3D GINT_TO_POINTER(grd->gdb_reg + 1); desc.name =3D g_intern_string(grd->name); + desc.is_readonly =3D false; + if (g_strcmp0(desc.name, pc_str) =3D=3D 0 + || g_strcmp0(desc.name, eip_str) =3D=3D 0 + || g_strcmp0(desc.name, rip_str) =3D=3D 0 + || g_strcmp0(desc.name, pswa_str) =3D=3D 0 + || g_strcmp0(desc.name, iaoq_str) =3D=3D 0 + || g_strcmp0(desc.name, rpc_str) =3D=3D 0 + ) { + desc.is_readonly =3D true; + } desc.feature =3D g_intern_string(grd->feature_name); g_array_append_val(find_data, desc); } --=20 2.47.3