All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roman Bolshakov <r.bolshakov@yadro.com>
To: Hill Ma <maahiuzeon@gmail.com>
Cc: richard.henderson@linaro.org, qemu-devel@nongnu.org, dirty@apple.com
Subject: Re: [PATCH v2] hvf: guard xgetbv call.
Date: Tue, 12 Jan 2021 10:46:16 +0300	[thread overview]
Message-ID: <X/1TyPrA1LeEqS6d@SPB-NB-133.local> (raw)
In-Reply-To: <CABpQrUMmmo1RECW0qpROfZmFdPSFwG2HFwKiZiqkWxU+hqCvZw@mail.gmail.com>

On Mon, Jan 11, 2021 at 09:44:40PM -0800, Hill Ma wrote:
> On Sun, Jan 10, 2021 at 8:38 PM Roman Bolshakov <r.bolshakov@yadro.com> wrote:
> > I'm not sure if eax should be modified with mask because the mask has no
> > value per se. I.e. eax &= supp_xcr0 from below should be placed inside
> > the if. It'd express clearly that eax is not modified unless xgetbv is
> > supported.
> 
> Like this?
> 
> -            uint64_t host_xcr0 = xgetbv(0);
> -            uint64_t supp_xcr0 = host_xcr0 & (XSTATE_FP_MASK |
> XSTATE_SSE_MASK |
> +            uint64_t host_xcr0;
> +            if (xgetbv(ecx, 0, &host_xcr0)) {
> +                uint64_t supp_xcr0 = host_xcr0 & (XSTATE_FP_MASK |
> XSTATE_SSE_MASK |
>                                    XSTATE_YMM_MASK | XSTATE_BNDREGS_MASK |
>                                    XSTATE_BNDCSR_MASK | XSTATE_OPMASK_MASK |
>                                    XSTATE_ZMM_Hi256_MASK |
> XSTATE_Hi16_ZMM_MASK);
> -            eax &= supp_xcr0;
> +                eax &= supp_xcr0;
> +            }

Yes.

Thanks,
Roman


      reply	other threads:[~2021-01-12  7:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-10 21:08 [PATCH v2] hvf: guard xgetbv call Hill Ma
2021-01-11  4:38 ` Roman Bolshakov
2021-01-12  5:44   ` Hill Ma
2021-01-12  7:46     ` Roman Bolshakov [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=X/1TyPrA1LeEqS6d@SPB-NB-133.local \
    --to=r.bolshakov@yadro.com \
    --cc=dirty@apple.com \
    --cc=maahiuzeon@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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.