From patchwork Mon Mar 17 14:28:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 874164 Delivered-To: patch@linaro.org Received: by 2002:a5d:4308:0:b0:38f:210b:807b with SMTP id h8csp2022849wrq; Mon, 17 Mar 2025 07:31:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXA/drvKl3wjZwem6kCVhXL3UT+/ceCRVwwb49bW9sFCt8+mGZIYyqWTnSUoTFUozhRIOncJA==@linaro.org X-Google-Smtp-Source: AGHT+IE6iPNtqGIG8vYbF1HH4dJxfG+D3oobsTl972H2rOY7BwRnYtWeQFaFaMp7YN5CIHnSp42V X-Received: by 2002:a05:6122:91c:b0:520:5185:1c77 with SMTP id 71dfb90a1353d-524499d574amr6865783e0c.7.1742221875986; Mon, 17 Mar 2025 07:31:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742221875; cv=none; d=google.com; s=arc-20240605; b=CqNNl9/pjSUDeyu7QtENjT/VnB+mnicBWmNYrZpsCDVBKosaozrH57EyhuyUlXxAfk shJ98uTLrrAONO5EgAZDWWJpV42bOc5xU0rgBt1pmpA3NezOzZQR3QPIDaG7Iw+jB53v cUzIvkrkPDU4ZF8dMjy2oXql90kkn8ELepLXA1vrcwYe8PjWvTOx5B3X4ZCPU6349ZNC BG/AsbWAq1br8ZjCrR273NY+ZxjO6A6fvIR6801ey1OJnkWFrvVN1baRVjIaRe+bP+sh dDwFLL3vYzFfwPiamazTgRlIDnOpRPkmzKOpRcqN1GyhsXfSAeZb6Kk6Q6LDVDOickJE jHYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=NaCPyDdxmRmZpYCr7DKDsJe3bk+lLzZjopyFV4R3vdM=; fh=TmGgNLjlfRC0Ue1rs/SIwCxxcMibXQAkrkLhl3z5JKk=; b=dkoHuykT8SMWjtWu2hSq7Hk0dBOCPW8DO1zQYtzI03OjJtkKEu0DIxjYwX/fkSRMbq jOV7naUwrNcYwDcW2HKpuuRTJqoZQ5Dx2iFyVIIRQa66qXNpH4rexsxFaQ/tu9CGaMMi y4JroeQvBTPgFHOCIp/iup59aY/c3BCrFBApEXvJC/EWI1MtMLYjuBbSpH7BTgBjRjml 9WaeoxnhIwU/k7Y50dBfFCRlB3ydSCcVQ52lvWWnanUlyH2b53iOfILUHOOEIKV02sSs /Q7FmETnmm9Auif5NebUu0cdnlB7ntK/ncZnYkGsFMDy53R5HjBNalXUnvGektNfvQZA CBcQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Vk+WsdMn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-5243a6c872esi2921325e0c.114.2025.03.17.07.31.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Mar 2025 07:31:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Vk+WsdMn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuBSK-0000hJ-1r; Mon, 17 Mar 2025 10:28:40 -0400 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 1tuBS8-0000Zk-NV for qemu-devel@nongnu.org; Mon, 17 Mar 2025 10:28:29 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tuBS6-000196-0y for qemu-devel@nongnu.org; Mon, 17 Mar 2025 10:28:28 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-43d2d952eb1so10334855e9.1 for ; Mon, 17 Mar 2025 07:28:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742221704; x=1742826504; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=NaCPyDdxmRmZpYCr7DKDsJe3bk+lLzZjopyFV4R3vdM=; b=Vk+WsdMnu4yb7RZcok/WPH5AOa9COQOol5i1a/EwttGcA3LsnOOyl4af/3J89Ai4sv B7rt9i34RtD9mkpl0J2T0M60jhhuysLM5r2vOWrLT6LQ+d/Ee8t4Rv7DIC/TMbk3+j65 sRCf3jOO9L5mrqRmMSy4laEzlpOinjE7xpZ3lsAeSq+9m5I/5Us1mKPTYz09lU/iQSTx /6hSWWBX7zN5+2Eepv1pTKOw5tpCYQsbWqSGeyu+6m1yZJ5NIwcSP9uIGhsS61NAhjW7 3My6FMcb/j9ZAmrM7vRxpcvY8oAKTRZFGbCuwA/E89EeBlcFMWRPiooCRIOrhz8X5KYC FfUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742221704; x=1742826504; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NaCPyDdxmRmZpYCr7DKDsJe3bk+lLzZjopyFV4R3vdM=; b=L7TZ3/lBc0JLi9eZVcP/OnjTw6T/Awh1c90bUC3JM/kL3lNMI99Xb4C7m9Oxvt391F QD+IjEdkjL06jn2oWVtb9YAIexK1huFORXwJaDLGukijEBuo4bJzYDV99YPbAoJWGhci 7YqMF8jbDzU/ODSJGZ7qzLWF2v6kZRGVdK/MxUjXcOatwRccdWMB16dBTUVHG1nx73cU 1jHD5WIIZGShojgzaZGyiBbBcMBBbbTtuVlX6BVtERDeZlFvmS8J/SgqSvBrZfT+OyCo m4ENI26uNnTPd7jqcipxNX1XmVIh+1y+mBfziblj30iVBmwp6/xbcizxWNAg12v8RCtf ZBxA== X-Forwarded-Encrypted: i=1; AJvYcCWUnA2xnf0BYTjZVP+Nm2+kWRTQ0O2saxIOQGvljsSwbkD7xmF6x67MELvBnmw8577Hqn8yCv8tqe4O@nongnu.org X-Gm-Message-State: AOJu0YwnDMArBfyPKzOpAJPjHXEMc6oHlU5c3W//QHewAs9OdDnES3VL fsOTvWRDPvBCZrEuUzWMacpuE2P6ATrRR2FK/vSwH+h6RtqejHD3p23mQWHlWK0= X-Gm-Gg: ASbGncuohIbtpQ/tqGBeoMAtSjWQ6tyNrzeaH9+Jc9o4ewx346vwqpwpcSpANWR/jxN vd4gGXWo7EmuLk8z/yJlta5HvVPLqTXd7FpqSij2Yy8QKBmnLPiCpcUjol72R87YgeE6G0YPqRX Na5bQGuFP3HG03nf9d3XVKmoSX+0Wusp1nDTfrsGyeTzFqP+KEl22Io0fL4jHq5CV4DCA97lfUV Q0/AdUIfhP/spNjbFVIxrTR8R9ceIhE7j0vvc/ggZFnMLdnnSHYWpsCpMakqXqimoxn0YA8A4gS fUu4VcSU5/UkjRdwLSVa48YVFZm4/9+ICRTBpNFUQXKbGUGlXTQ= X-Received: by 2002:a05:600c:46ca:b0:43c:ee62:33f5 with SMTP id 5b1f17b1804b1-43d389ae727mr261045e9.27.1742221704183; Mon, 17 Mar 2025 07:28:24 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43d1fe60ad4sm107914985e9.29.2025.03.17.07.28.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Mar 2025 07:28:23 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH for-10.1 3/9] target/arm: Handle AArch64 in TYPE_ARM_CPU gdb_arch_name Date: Mon, 17 Mar 2025 14:28:13 +0000 Message-ID: <20250317142819.900029-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250317142819.900029-1-peter.maydell@linaro.org> References: <20250317142819.900029-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, 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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Instead of having the TYPE_AARCH64_CPU subclass set CPUClass::gdb_arch_name to a different function, make the TYPE_ARM_CPU implementation of the method handle AArch64. For the moment we make the "is this AArch64?" function test "is the CPU of TYPE_AARCH64_CPU?", so that this produces no behavioural change. When we've moved all the gdbstub related methods across to the base class, we will be able to change this to be "does the CPU have the ARM_FEATURE_AARCH64 feature?". Signed-off-by: Peter Maydell Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé --- target/arm/internals.h | 6 ++++++ target/arm/cpu.c | 3 +++ target/arm/cpu64.c | 6 ------ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index bb962389192..a14c269fa5a 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1691,6 +1691,12 @@ void aarch64_add_sve_properties(Object *obj); void aarch64_add_sme_properties(Object *obj); #endif +/* Return true if the gdbstub is presenting an AArch64 CPU */ +static inline bool arm_gdbstub_is_aarch64(ARMCPU *cpu) +{ + return object_dynamic_cast(OBJECT(cpu), TYPE_AARCH64_CPU); +} + /* Read the CONTROL register as the MRS instruction would. */ uint32_t arm_v7m_mrs_control(CPUARMState *env, uint32_t secure); diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 01786ac7879..d69403fda90 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2647,6 +2647,9 @@ static const gchar *arm_gdb_arch_name(CPUState *cs) ARMCPU *cpu = ARM_CPU(cs); CPUARMState *env = &cpu->env; + if (arm_gdbstub_is_aarch64(cpu)) { + return "aarch64"; + } if (arm_feature(env, ARM_FEATURE_IWMMXT)) { return "iwmmxt"; } diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 8188ede5cc8..020b32f21e9 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -813,11 +813,6 @@ static void aarch64_cpu_finalizefn(Object *obj) { } -static const gchar *aarch64_gdb_arch_name(CPUState *cs) -{ - return "aarch64"; -} - static void aarch64_cpu_class_init(ObjectClass *oc, void *data) { CPUClass *cc = CPU_CLASS(oc); @@ -825,7 +820,6 @@ static void aarch64_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_read_register = aarch64_cpu_gdb_read_register; cc->gdb_write_register = aarch64_cpu_gdb_write_register; cc->gdb_core_xml_file = "aarch64-core.xml"; - cc->gdb_arch_name = aarch64_gdb_arch_name; object_class_property_add_bool(oc, "aarch64", aarch64_cpu_get_aarch64, aarch64_cpu_set_aarch64);