From patchwork Tue Nov 2 18:25:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516697 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp4870280iml; Tue, 2 Nov 2021 11:35:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6L836SehCqp9LfUzWK73KTB0ifyvkoEZJetq6TCmnMyTWAosgd+pT/kiRXO4h26hRsrnv X-Received: by 2002:a05:6830:43aa:: with SMTP id s42mr10413415otv.13.1635878099909; Tue, 02 Nov 2021 11:34:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635878099; cv=none; d=google.com; s=arc-20160816; b=KSPyHaPXHwdl5qPlsi/uAIoMt/Hs2pOeBo8eNdVi0rYRA+b8K8rh3HExzdN/audG0E 79MpoV8Lfx8g8Gb2EFNikDf/Xzf3sYS8og70MHDFDn3hF4htN9BoHen30YzOB7QMBCmd E618rm2SWTg8KW1mGgynZP16CzxGyKazqY5McGhtx0jLpjfTRdI/4Hd7mqnJ3iyuL98s RHJJ10TKRrUEwZFcij4GfKdESD8FPZmq28aq+Ed9/iJobCVO4+JbNfMillxVVbGELaJ1 aDV+vnHkL26IBjDy1CLKbqkphij4UCLEfutWh5sNdRiBGLMhZYKj/pea83acz7NhwF0+ 7ijA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=4iN+wCNn39PyCmqyIu9fXyF1t2chc7mKLTiK8TWZaXs=; b=ZggA5vnxWTF06WJUw84seDAk6a6kg5Fg9qEb9ZxD3EQykHyIFyVV4S2fo/R8V72DF3 s1e98JuK4zoJfsRorm/IHVRRA55Z17cgB2NEHflkw4LozT7wW75+F4pjme0+4KF2+syn sjdHdBqdqyXhCh0Wgook+J56RdwZjA4Ht3dc2V2JP6RDpIP4BAuTBmqRvzEWTymZ6kU+ qJ8jdFMq/FFV6PiFIz3UlH8FHdH5YLFyIgmpWQY1GfCVLLs/B0VEA6Y5YdzY9FcosoXx VIeNREIOFSWdizHivDzT5vfHBEG1XWCTYE47zLyFt8Jgtac1zdOaGnmlmQo4dU/PC0p4 Btlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JoPCVBn9; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v4si5060061oth.276.2021.11.02.11.34.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Nov 2021 11:34:59 -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=JoPCVBn9; 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 Received: from localhost ([::1]:60088 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhycd-0005vR-Bt for patch@linaro.org; Tue, 02 Nov 2021 14:34:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhyTO-0005gE-Se for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:26 -0400 Received: from mail-qv1-xf33.google.com ([2607:f8b0:4864:20::f33]:35508) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhyTM-0004Dc-Tc for qemu-devel@nongnu.org; Tue, 02 Nov 2021 14:25:26 -0400 Received: by mail-qv1-xf33.google.com with SMTP id u25so13891786qve.2 for ; Tue, 02 Nov 2021 11:25:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4iN+wCNn39PyCmqyIu9fXyF1t2chc7mKLTiK8TWZaXs=; b=JoPCVBn9L1Ue22zkRBO/EyAKTn1xiZ8Z9+zAHemM/cg31+nW5NR+EEMoag89yIU4Vu 6cp4Ds2SdZ1FdONyDtr487fadvrTZel39kfy1pj7y3P6fCvwvzocpdeFy6vBE5fUjBlb 8PynOc2HDPFrq6lHMddP7xzxAPkVATYFqW+9uMxNdQN6331of0sppX6/e0doNLwhFM66 1E7sJpiwz/Rdpu0Y2fNQ74bCR1qPI4WHkyrxIDYHqW9lSJOIL5rXoS6aujVUijKJyUD5 RbPQ1Tu0PhpmuOPhgpZOpQo13R3tBsJah7qT8bB/hyJ/INCopvCBbQm5e30YUT0m+zsY tl+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4iN+wCNn39PyCmqyIu9fXyF1t2chc7mKLTiK8TWZaXs=; b=n6p2Ut+kagCn2o0q34AHoUrsO9fUpRELv6V1SQeMkMzl27bu4NFic9CX030PENWExR lFJbn1dau/WM4meV4nabQSKKSB6bcdHRQaD5FJHBJ+0xhAsJ9qi1Eg2TQFxBShSkzJeF Z/d8NvPPnBzfZKJ4YPnbyZzGlo8mo11cMexNG56uztfFumg2mdUCi2BrHyI3p+vkjr8j UWwqKU8hY/fVWPXksBWGnCUultvEefFrBRqkLjaF6jhKxNDtVHh5ct3SnDMoBI9MxQS1 tJbFIx2F2N1kyOBhWoKWBQMjK8AAIWna9vCu8xNhT4wWodSLRp1pfYfFWF04EQc8ZdQ4 s38Q== X-Gm-Message-State: AOAM532sWQGdE1Yxyri3Rl5vLzrEUPfTolwNLJmfajkFh/tQslbJKWnX CfxKmwh33Sxz2B6mAG8u7fNzMjwbfhB/vg== X-Received: by 2002:a0c:edb0:: with SMTP id h16mr27487471qvr.17.1635877523902; Tue, 02 Nov 2021 11:25:23 -0700 (PDT) Received: from localhost.localdomain (rrcs-172-254-253-57.nyc.biz.rr.com. [172.254.253.57]) by smtp.gmail.com with ESMTPSA id y9sm13701081qko.74.2021.11.02.11.25.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Nov 2021 11:25:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v2 05/12] target/arm: Advertise MVE to gdb when present Date: Tue, 2 Nov 2021 14:25:12 -0400 Message-Id: <20211102182519.320319-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211102182519.320319-1-richard.henderson@linaro.org> References: <20211102182519.320319-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f33; envelope-from=richard.henderson@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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?b?YXVkw6k=?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Cortex-M CPUs with MVE should advertise this fact to gdb, using the org.gnu.gdb.arm.m-profile-mve XML feature, which defines the VPR register. Presence of this feature also tells gdb to create pseudo-registers Q0..Q7, so we do not need to tell gdb about them separately. Note that unless you have a very recent GDB that includes this fix: http://patches-tcwg.linaro.org/patch/58133/ gdb will mis-print the individual fields of the VPR register as zero (but showing the whole thing as hex, eg with "print /x $vpr" will give the correct value). Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20211101160814.5103-1-peter.maydell@linaro.org> Signed-off-by: Richard Henderson --- configs/targets/aarch64-softmmu.mak | 2 +- configs/targets/arm-linux-user.mak | 2 +- configs/targets/arm-softmmu.mak | 2 +- configs/targets/armeb-linux-user.mak | 2 +- target/arm/gdbstub.c | 25 +++++++++++++++++++++++++ gdb-xml/arm-m-profile-mve.xml | 19 +++++++++++++++++++ 6 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 gdb-xml/arm-m-profile-mve.xml -- 2.25.1 diff --git a/configs/targets/aarch64-softmmu.mak b/configs/targets/aarch64-softmmu.mak index 13d40b55e6..d489e6da83 100644 --- a/configs/targets/aarch64-softmmu.mak +++ b/configs/targets/aarch64-softmmu.mak @@ -1,5 +1,5 @@ TARGET_ARCH=aarch64 TARGET_BASE_ARCH=arm TARGET_SUPPORTS_MTTCG=y -TARGET_XML_FILES= gdb-xml/aarch64-core.xml gdb-xml/aarch64-fpu.xml gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml +TARGET_XML_FILES= gdb-xml/aarch64-core.xml gdb-xml/aarch64-fpu.xml gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml gdb-xml/arm-m-profile-mve.xml TARGET_NEED_FDT=y diff --git a/configs/targets/arm-linux-user.mak b/configs/targets/arm-linux-user.mak index acecc339e3..3e10d6b15d 100644 --- a/configs/targets/arm-linux-user.mak +++ b/configs/targets/arm-linux-user.mak @@ -1,6 +1,6 @@ TARGET_ARCH=arm TARGET_SYSTBL_ABI=common,oabi TARGET_SYSTBL=syscall.tbl -TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml +TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml gdb-xml/arm-m-profile-mve.xml TARGET_HAS_BFLT=y CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y diff --git a/configs/targets/arm-softmmu.mak b/configs/targets/arm-softmmu.mak index f6c95ba07a..92c8349b96 100644 --- a/configs/targets/arm-softmmu.mak +++ b/configs/targets/arm-softmmu.mak @@ -1,4 +1,4 @@ TARGET_ARCH=arm TARGET_SUPPORTS_MTTCG=y -TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml +TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml gdb-xml/arm-m-profile-mve.xml TARGET_NEED_FDT=y diff --git a/configs/targets/armeb-linux-user.mak b/configs/targets/armeb-linux-user.mak index 662c73d8fb..f81e5bf1fe 100644 --- a/configs/targets/armeb-linux-user.mak +++ b/configs/targets/armeb-linux-user.mak @@ -2,6 +2,6 @@ TARGET_ARCH=arm TARGET_SYSTBL_ABI=common,oabi TARGET_SYSTBL=syscall.tbl TARGET_WORDS_BIGENDIAN=y -TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml +TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml gdb-xml/arm-m-profile-mve.xml TARGET_HAS_BFLT=y CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c index e0dcb33e32..134da0d0ae 100644 --- a/target/arm/gdbstub.c +++ b/target/arm/gdbstub.c @@ -199,6 +199,27 @@ static int vfp_gdb_set_sysreg(CPUARMState *env, uint8_t *buf, int reg) return 0; } +static int mve_gdb_get_reg(CPUARMState *env, GByteArray *buf, int reg) +{ + switch (reg) { + case 0: + return gdb_get_reg32(buf, env->v7m.vpr); + default: + return 0; + } +} + +static int mve_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg) +{ + switch (reg) { + case 0: + env->v7m.vpr = ldl_p(buf); + return 4; + default: + return 0; + } +} + /** * arm_get/set_gdb_*: get/set a gdb register * @env: the CPU state @@ -468,6 +489,10 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu) 2, "arm-vfp-sysregs.xml", 0); } } + if (cpu_isar_feature(aa32_mve, cpu)) { + gdb_register_coprocessor(cs, mve_gdb_get_reg, mve_gdb_set_reg, + 1, "arm-m-profile-mve.xml", 0); + } gdb_register_coprocessor(cs, arm_gdb_get_sysreg, arm_gdb_set_sysreg, arm_gen_dynamic_sysreg_xml(cs, cs->gdb_num_regs), "system-registers.xml", 0); diff --git a/gdb-xml/arm-m-profile-mve.xml b/gdb-xml/arm-m-profile-mve.xml new file mode 100644 index 0000000000..cba664c4c5 --- /dev/null +++ b/gdb-xml/arm-m-profile-mve.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + +