From: "Chang S. Bae" <chang.seok.bae@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>, <qemu-devel@nongnu.org>
Subject: Re: [PATCH 05/20] target/i386/tcg: add APX support to XSAVE/XRSTOR
Date: Mon, 7 Sep 2026 19:10:15 -0700 [thread overview]
Message-ID: <ccfbd5d4-e00f-4de5-890f-2a88ee5620c5@intel.com> (raw)
In-Reply-To: <20260825122921.431739-6-pbonzini@redhat.com>
On 8/25/2026 5:29 AM, Paolo Bonzini wrote:
> With it, add a new hidden flag that will be used to enable the REX2 prefix
> and EVEX map4.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> target/i386/cpu.h | 3 ++
> target/i386/tcg/tcg-cpu.h | 16 +++++++---
> target/i386/helper.c | 11 +++++++
> target/i386/tcg/fpu_helper.c | 59 +++++++++++++++++++++++++++++++++---
> target/i386/tcg/tcg-cpu.c | 5 +--
> 5 files changed, 83 insertions(+), 11 deletions(-)
...
>
> - /* MPX State: */
> - XSaveBNDREG bndreg_state;
> - XSaveBNDCSR bndcsr_state;
> + /* Overlapping MPX and APX States: */
> + union {
> + struct {
> + XSaveBNDREG bndreg;
> + XSaveBNDCSR bndcsr;
> + } mpx_state;
> + XSaveAPX apx_state;
> + };
> +
Nit:
Along with this, I was curios if something like this would be
worthwhile, or too much:
#define XSAVE_APX_OFFSET XSAVE_BNDREG_OFFSET
>
> +void cpu_sync_apx_hflag(CPUX86State *env)
> +{
> + if ((env->cr[4] & CR4_OSXSAVE_MASK)
> + && (env->xcr0 & XSTATE_APX_MASK) == XSTATE_APX_MASK) {
> + env->hflags |= HF_APX_EN_MASK;
> + } else{
> + env->hflags &= ~HF_APX_EN_MASK;
> + }
> +}
This check could be simply (xcr0 & XSTATE_APX_MASK) since testing one
bit here unlike the AVX check below.
> +
> void cpu_sync_avx_hflag(CPUX86State *env)
> {
> if ((env->cr[4] & CR4_OSXSAVE_MASK)
> @@ -250,6 +260,7 @@ void cpu_x86_update_cr4(CPUX86State *env, uint32_t new_cr4)
Overall, the change looks fine from my perspective. If allowed,
Reviewed-by: Chang S. Bae <chang.seok.bae@intel.com>
next prev parent reply other threads:[~2026-09-08 2:11 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 12:29 [PATCH 00/20] target/i386/tcg: implement APX Paolo Bonzini
2026-08-25 12:29 ` [PATCH 01/20] target/i386/tcg: do not reuse cc_srcT Paolo Bonzini
2026-08-25 23:09 ` Richard Henderson
2026-08-25 12:29 ` [PATCH 02/20] target/i386/tcg: inline gen_ext_tl Paolo Bonzini
2026-08-25 23:09 ` Richard Henderson
2026-08-25 12:29 ` [PATCH 03/20] target/i386/tcg: simplify return value of gen_prepare_cc Paolo Bonzini
2026-08-25 12:29 ` [PATCH 04/20] target/i386/tcg: move check bits out of validate_vex Paolo Bonzini
2026-08-25 12:29 ` [PATCH 05/20] target/i386/tcg: add APX support to XSAVE/XRSTOR Paolo Bonzini
2026-09-08 2:10 ` Chang S. Bae [this message]
2026-08-25 12:29 ` [PATCH 06/20] target/i386/tcg: treat VEX as disabling high-byte registers Paolo Bonzini
2026-08-25 12:29 ` [PATCH 07/20] target/i386/tcg: add definition for REX2 prefix Paolo Bonzini
2026-09-08 2:10 ` Chang S. Bae
2026-08-25 12:29 ` [PATCH 08/20] target/i386/tcg: mark XSAVE* as not allowing REX2 Paolo Bonzini
2026-09-08 2:10 ` Chang S. Bae
2026-08-25 12:29 ` [PATCH 09/20] target/i386/tcg: decode REX2 prefix Paolo Bonzini
2026-09-08 2:10 ` Chang S. Bae
2026-08-25 12:29 ` [PATCH 10/20] target/i386/tcg: implement JMPABS instruction Paolo Bonzini
2026-08-26 14:30 ` Zhao Liu
2026-08-27 6:33 ` Paolo Bonzini
2026-08-25 12:29 ` [PATCH 11/20] target/i386/tcg: fetch modrm early Paolo Bonzini
2026-08-25 12:29 ` [PATCH 12/20] target/i386/tcg: move VEX validation early Paolo Bonzini
2026-08-28 8:32 ` Zhao Liu
2026-08-25 12:29 ` [PATCH 13/20] target/i386/tcg: extend VEX.vvvv parsing for APX Paolo Bonzini
2026-08-25 12:29 ` [PATCH 14/20] target/i386/tcg: decode EVEX prefix Paolo Bonzini
2026-08-28 9:10 ` Zhao Liu
2026-08-25 12:29 ` [PATCH 15/20] target/i386/tcg: add ZU writeback Paolo Bonzini
2026-08-25 12:29 ` [PATCH 16/20] target/i386/tcg: add decode functionality for APX Paolo Bonzini
2026-09-01 14:56 ` Zhao Liu
2026-09-02 6:55 ` Zhao Liu
2026-08-25 12:29 ` [PATCH 17/20] target/i386/tcg: implement CCMP/CTEST Paolo Bonzini
2026-09-02 6:06 ` Zhao Liu
2026-08-25 12:29 ` [PATCH 18/20] target/i386/tcg: decode APX instructions Paolo Bonzini
2026-09-02 7:27 ` Zhao Liu
2026-08-25 12:29 ` [PATCH 19/20] target/i386/tcg: mark APX as supported Paolo Bonzini
2026-09-02 9:15 ` Zhao Liu
2026-08-25 12:29 ` [PATCH 20/20] target/i386/tcg: optimize CCMP Paolo Bonzini
2026-09-02 9:29 ` Zhao Liu
2026-09-08 2:10 ` [PATCH 00/20] target/i386/tcg: implement APX Chang S. Bae
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=ccfbd5d4-e00f-4de5-890f-2a88ee5620c5@intel.com \
--to=chang.seok.bae@intel.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.