qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Vacha Bhavsar <vacha.bhavsar@oss.qualcomm.com>, qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	qemu-arm@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: [PATCH 2/2] target/arm: Fix big-endian handling of SVE gdb remote debugging
Date: Tue, 22 Jul 2025 08:09:02 +0200	[thread overview]
Message-ID: <3aa0c603-7acd-4802-9a32-80e183ef01eb@linaro.org> (raw)
In-Reply-To: <20250721211952.2239714-3-vacha.bhavsar@oss.qualcomm.com>

On 21/7/25 23:19, Vacha Bhavsar wrote:
> This patch adds big endian support for SVE GDB remote
> debugging. It replaces the use of pointer dereferencing with the use of
> ldq_p() as explained in the first part of this patch series. Additionally,
> the order in which the buffer content is loaded into the CPU struct is
> switched depending on target endianness to ensure the most significant bits
> are always in second element.
> 
> Signed-off-by: Vacha Bhavsar <vacha.bhavsar@oss.qualcomm.com>
> ---
>   target/arm/gdbstub64.c | 18 +++++++++++++-----
>   1 file changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/target/arm/gdbstub64.c b/target/arm/gdbstub64.c
> index 8b7f15b920..cd61d946bb 100644
> --- a/target/arm/gdbstub64.c
> +++ b/target/arm/gdbstub64.c
> @@ -200,10 +200,18 @@ int aarch64_gdb_set_sve_reg(CPUState *cs, uint8_t *buf, int reg)

Alex,

Why is there a disconnection with gdb_register_coprocessor() and
"gdbstub/helpers.h" APIs? The former is older? Should we unify
using the latter API with GByteArray?

>       case 0 ... 31:
>       {
>           int vq, len = 0;
> -        uint64_t *p = (uint64_t *) buf;
>           for (vq = 0; vq < cpu->sve_max_vq; vq++) {
> -            env->vfp.zregs[reg].d[vq * 2 + 1] = *p++;
> -            env->vfp.zregs[reg].d[vq * 2] = *p++;
> +            if (target_big_endian()){
> +                env->vfp.zregs[reg].d[vq * 2 + 1] = ldq_p(buf);
> +                buf += 8;
> +                env->vfp.zregs[reg].d[vq * 2] = ldq_p(buf);
> +            }
> +            else{
> +                env->vfp.zregs[reg].d[vq * 2] = ldq_p(buf);
> +                buf += 8;
> +                env->vfp.zregs[reg].d[vq * 2 + 1] = ldq_p(buf);
> +            }
> +            buf += 8;
>               len += 16;
>           }
>           return len;
> @@ -218,9 +226,9 @@ int aarch64_gdb_set_sve_reg(CPUState *cs, uint8_t *buf, int reg)
>       {
>           int preg = reg - 34;
>           int vq, len = 0;
> -        uint64_t *p = (uint64_t *) buf;
>           for (vq = 0; vq < cpu->sve_max_vq; vq = vq + 4) {
> -            env->vfp.pregs[preg].p[vq / 4] = *p++;
> +            env->vfp.pregs[preg].p[vq/4] = ldq_p(buf);
> +            buf += 8;
>               len += 8;
>           }
>           return len;



      reply	other threads:[~2025-07-22  6:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-21 21:19 [PATCH 0/2] target/arm: Fix big-endian handling for NEON and SVE gdb remote debugging Vacha Bhavsar
2025-07-21 21:19 ` [PATCH 1/2] target/arm: Fix big-endian handling of NEON " Vacha Bhavsar
2025-07-22  6:05   ` Philippe Mathieu-Daudé
2025-07-22 17:37     ` Vacha Bhavsar
2025-07-21 21:19 ` [PATCH 2/2] target/arm: Fix big-endian handling of SVE " Vacha Bhavsar
2025-07-22  6:09   ` Philippe Mathieu-Daudé [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3aa0c603-7acd-4802-9a32-80e183ef01eb@linaro.org \
    --to=philmd@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vacha.bhavsar@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).