qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Robert Hoo <robert.hu@linux.intel.com>,
	pbonzini@redhat.com, ehabkost@redhat.com
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH] i386/cpu_dump: support AVX512 ZMM regs dump
Date: Tue, 23 Mar 2021 06:14:56 -0600	[thread overview]
Message-ID: <5b016ffe-8e55-df3d-e2f9-fef9452a7e5c@linaro.org> (raw)
In-Reply-To: <705f02a0903fc40d7328b506ebe8517f007a5d9d.camel@linux.intel.com>

On 3/23/21 1:00 AM, Robert Hoo wrote:
> On Mon, 2021-03-22 at 15:06 -0600, Richard Henderson wrote:
>> On 3/22/21 4:59 AM, Robert Hoo wrote:
>>> Since commit fa4518741e (target-i386: Rename struct XMMReg to
>>> ZMMReg),
>>> CPUX86State.xmm_regs[] has already been extended to 512bit to
>>> support
>>> AVX512.
>>> Also, other qemu level supports for AVX512 registers are there for
>>> years.
>>> But in x86_cpu_dump_state(), still only dump XMM registers.
>>> This patch is just to complement this part, let it dump ZMM of
>>> 512bits.
>>
>> I think you should examine the state of the cpu to determine what of
>> SSE, AVX
>> or AVX512 is currently enabled, then dump that.
> 
> Thanks Richard for review.
> 
> Uh, looks like the existing code doesn't have this logic yet.
> OK, I'm to add this logic.

Correct.


>>> -        if (env->hflags & HF_CS64_MASK)
>>> -            nb = 16;
>>> -        else
>>> -            nb = 8;
>>> -        for(i=0;i<nb;i++) {
>>> -            qemu_fprintf(f, "XMM%02d=%08x%08x%08x%08x",
>>> +
>>> +        nb = sizeof(env->xmm_regs) / sizeof(env->xmm_regs[0]);
>>
>> E.g., you're dumping all of the registers in 32-bit mode, which is
>> restricted
>> to 8 registers, not 32.
> 
> In typedef struct CPUX86State {
> ...
> ZMMReg xmm_regs[CPU_NB_REGS == 8 ? 8 : 32];
> ...
> }
> 
> where in cpu.h
> 
> #define CPU_NB_REGS64 16
> #define CPU_NB_REGS32 8
> 
> #ifdef TARGET_X86_64
> #define CPU_NB_REGS CPU_NB_REGS64
> #else
> #define CPU_NB_REGS CPU_NB_REGS32
> #endif
> 
> so the register number is 8 in 32-bit mode and 32 in 64-bit mode.

The array size is the maximum.  But of course a 64-bit cpu can be put into 
32-bit mode.  You removed the exact check for that, using HF_CS64_MASK, quoted 
above.


r~


      reply	other threads:[~2021-03-23 12:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 10:59 [PATCH] i386/cpu_dump: support AVX512 ZMM regs dump Robert Hoo
2021-03-22 21:06 ` Richard Henderson
2021-03-23  7:00   ` Robert Hoo
2021-03-23 12:14     ` Richard Henderson [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=5b016ffe-8e55-df3d-e2f9-fef9452a7e5c@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=robert.hu@linux.intel.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).