From nobody Sat Oct 25 20:03:17 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520851050490165.2865138957502; Mon, 12 Mar 2018 03:37:30 -0700 (PDT) Received: from localhost ([::1]:57621 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evKpd-00007A-NG for importer@patchew.org; Mon, 12 Mar 2018 06:37:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39028) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evKkK-0004Nk-5V for qemu-devel@nongnu.org; Mon, 12 Mar 2018 06:32:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evKkI-0003fS-RL for qemu-devel@nongnu.org; Mon, 12 Mar 2018 06:32:00 -0400 Received: from smtp1.lauterbach.com ([62.154.241.196]:39696) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1evKkI-0003Bb-FW for qemu-devel@nongnu.org; Mon, 12 Mar 2018 06:31:58 -0400 Received: (qmail 13483 invoked by uid 484); 12 Mar 2018 10:31:41 -0000 Received: from unknown (HELO localhost.localdomain) (Authenticated_SSL:abouassida@[41.224.44.126]) (envelope-sender ) by smtp1.lauterbach.com (qmail-ldap-1.03) with ECDHE-RSA-AES256-SHA encrypted SMTP for ; 12 Mar 2018 10:31:40 -0000 X-Qmail-Scanner-Diagnostics: from 41.224.44.126 by smtp1.lauterbach.com (envelope-from , uid 484) with qmail-scanner-2.11 (mhr: 1.0. clamdscan: 0.99/21437. spamassassin: 3.4.0. Clear:RC:1(41.224.44.126):. Processed in 0.131647 secs); 12 Mar 2018 10:31:41 -0000 From: Abdallah Bouassida To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Mon, 12 Mar 2018 11:31:30 +0100 Message-Id: <1520850690-23245-5-git-send-email-abdallah.bouassida@lauterbach.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520850690-23245-1-git-send-email-abdallah.bouassida@lauterbach.com> References: <1520850690-23245-1-git-send-email-abdallah.bouassida@lauterbach.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 62.154.241.196 Subject: [Qemu-devel] [PATCH v4 4/4] target/arm: Add arm_gdb_set_sysreg() callback X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: khaled.jmal@lauterbach.com, qemu-arm@nongnu.org, Abdallah Bouassida Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 This is a callback to set the cp-regs registered by the dynamic XML. Signed-off-by: Abdallah Bouassida --- >> Adding to that our customers may need this write access, our tool TRACE3= 2=C2=AE >> needs this also in some particular cases. For example: temporary disabli= ng MMU >> to do a physical memory access. > By clearing the SCTLR bit? That's a good example of a case that > won't work reliably. If you clear the SCTLR.M bit via raw_write > this will not perform the tlb_flush() that it needs to, which > means that if anything does a memory access via the QEMU TLB > it may get the wrong cached results. If you always clear the > bit, do one gdb memory access then set the bit then it will > probably not run into problems but you're walking on thin ice. Does adding tlb_flush() before or after write_raw_cp_reg() could solve the reliability issue for other particular cases? Or is there any improvement that could be done for this write callback in order to get more reliable results for other particular cases? target/arm/helper.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/target/arm/helper.c b/target/arm/helper.c index 5929e0b..bb5a97c 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -239,6 +239,20 @@ static int arm_gdb_get_sysreg(CPUARMState *env, uint8_= t *buf, int reg) =20 static int arm_gdb_set_sysreg(CPUARMState *env, uint8_t *buf, int reg) { + ARMCPU *cpu =3D arm_env_get_cpu(env); + const ARMCPRegInfo *ri; + uint32_t key; + uint32_t tmp; + + tmp =3D ldl_p(buf); + key =3D cpu->dyn_xml.cpregs_keys[reg]; + ri =3D get_arm_cp_reginfo(arm_env_get_cpu(env)->cp_regs, key); + if (ri) { + if (!(ri->type & ARM_CP_CONST)) { + write_raw_cp_reg(env, ri, tmp); + return cpreg_field_is_64bit(ri) ? 8 : 4; + } + } return 0; } =20 --=20 2.7.4