All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Mingwei Zhang <mizhang@google.com>
Cc: Aaron Lewis <aaronlewis@google.com>,
	kvm@vger.kernel.org, pbonzini@redhat.com, jmattson@google.com
Subject: Re: [PATCH v3 2/8] KVM: x86: Clear all supported MPX xfeatures if they are not all set
Date: Thu, 23 Mar 2023 14:29:18 -0700	[thread overview]
Message-ID: <ZBzErkhkXQ7j+zKS@google.com> (raw)
In-Reply-To: <CAL715WKX6FXugfCYLqyoT4UKCYha7g_izvy2Djvg5zPkxa7JwQ@mail.gmail.com>

On Thu, Mar 23, 2023, Mingwei Zhang wrote:
> > --- a/arch/x86/kvm/x86.h
> > +++ b/arch/x86/kvm/x86.h
> > @@ -3,6 +3,7 @@
> >  #define ARCH_X86_KVM_X86_H
> >
> >  #include <linux/kvm_host.h>
> > +#include <asm/fpu/xstate.h>
> >  #include <asm/mce.h>
> >  #include <asm/pvclock.h>
> >  #include "kvm_cache_regs.h"
> > @@ -325,7 +326,22 @@ extern bool enable_pmu;
> >   */
> >  static inline u64 kvm_get_filtered_xcr0(void)
> >  {
> > -       return kvm_caps.supported_xcr0 & xstate_get_guest_group_perm();
> > +       u64 supported_xcr0 = kvm_caps.supported_xcr0;
> > +
> > +       BUILD_BUG_ON(XFEATURE_MASK_USER_DYNAMIC != XFEATURE_MASK_XTILE_DATA);
> > +
> > +       if (supported_xcr0 & XFEATURE_MASK_USER_DYNAMIC) {
> > +               supported_xcr0 &= xstate_get_guest_group_perm();
> > +
> > +               /*
> > +                * Treat XTILE_CFG as unsupported if the current process isn't
> > +                * allowed to use XTILE_DATA, as attempting to set XTILE_CFG in
> > +                * XCR0 without setting XTILE_DATA is architecturally illegal.
> > +                */
> > +               if (!(supported_xcr0 & XFEATURE_MASK_XTILE_DATA))
> > +                       supported_xcr0 &= XFEATURE_MASK_XTILE_CFG;
> 
> should be this? supported_xcr0 &= ~XFEATURE_MASK_XTILE_CFG;

Doh, yes.

  parent reply	other threads:[~2023-03-23 21:29 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24 22:35 [PATCH v3 0/8] Clean up the supported xfeatures Aaron Lewis
2023-02-24 22:36 ` [PATCH v3 1/8] KVM: x86: Add kvm_permitted_xcr0() Aaron Lewis
2023-03-03 21:13   ` Mingwei Zhang
2023-02-24 22:36 ` [PATCH v3 2/8] KVM: x86: Clear all supported MPX xfeatures if they are not all set Aaron Lewis
2023-03-03 21:23   ` Mingwei Zhang
2023-03-03 22:23     ` Aaron Lewis
2023-03-07 16:32       ` Mingwei Zhang
2023-03-23 20:29   ` Sean Christopherson
2023-03-23 21:10     ` Mingwei Zhang
2023-03-23 21:16       ` Mingwei Zhang
2023-03-23 21:30         ` Sean Christopherson
2023-03-23 21:29       ` Sean Christopherson [this message]
2023-02-24 22:36 ` [PATCH v3 3/8] KVM: x86: Clear all supported AVX-512 " Aaron Lewis
2023-02-24 22:36 ` [PATCH v3 4/8] KVM: x86: Clear AVX-512 xfeatures if SSE or AVX is clear Aaron Lewis
2023-02-24 22:36 ` [PATCH v3 5/8] KVM: x86: Clear all supported AMX xfeatures if they are not all set Aaron Lewis
2023-03-03 21:12   ` Mingwei Zhang
2023-02-24 22:36 ` [PATCH v3 6/8] KVM: selftests: Hoist XGETBV and XSETBV to make them more accessible Aaron Lewis
2023-03-03 21:24   ` Mingwei Zhang
2023-02-24 22:36 ` [PATCH v3 7/8] KVM: selftests: Add XFEATURE masks to common code Aaron Lewis
2023-03-03 21:16   ` Mingwei Zhang
2023-03-03 22:25     ` Aaron Lewis
2023-03-07 16:33       ` Mingwei Zhang
2023-02-24 22:36 ` [PATCH v3 8/8] KVM: selftests: Add XCR0 Test Aaron Lewis
2023-03-02 20:34   ` Mingwei Zhang
2023-03-02 22:50     ` Aaron Lewis
2023-03-03 21:11       ` Mingwei Zhang
2023-03-23 21:46   ` Sean Christopherson
2023-03-20 15:45 ` [PATCH v3 0/8] Clean up the supported xfeatures Mingwei Zhang
2023-03-23 21:47 ` Sean Christopherson

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=ZBzErkhkXQ7j+zKS@google.com \
    --to=seanjc@google.com \
    --cc=aaronlewis@google.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=mizhang@google.com \
    --cc=pbonzini@redhat.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 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.