lkml.org 
[lkml]   [2022]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH v5 07/21] x86/fpu: Provide fpu_enable_guest_xfd_features() for KVM
    From
    On 1/5/22 13:35, Yang Zhong wrote:
    > +int fpu_enable_guest_xfd_features(struct fpu_guest *guest_fpu, u64 xfeatures)
    > +{
    > + lockdep_assert_preemption_enabled();
    > +

    The old fpu_update_guest_perm_features(guest_fpu) is equivalent to

    fpu_enable_guest_xfd_features(guest_fpu, guest_fpu->perm);

    Missing doc comment:

    /*
    * fpu_enable_guest_xfd_features - Enable xfeatures according to guest perm
    * @guest_fpu: Pointer to the guest FPU container
    * @xfeatures: Features requested by guest CPUID
    *
    * Enable all dynamic xfeatures according to guest perm and requested CPUID.
    * Invoked if the caller wants to conservatively expand fpstate buffer instead
    * of waiting until XCR0 or XFD MSR is written.
    *
    * Return: 0 on success, error code otherwise
    */

    Also, the check for 32-bit is slightly imprecise:

    /* Dynamic xfeatures are not supported with 32-bit kernels. */
    if (!IS_ENABLED(CONFIG_X86_64))
    - return 0;
    + return -EINVAL;

    since we only get here with xfeatures != 0 (if it compiles, just removing
    the IS_ENABLED check altogether would be even better). With these changes,

    Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

    Thanks,

    Paolo

    \
     
     \ /
      Last update: 2022-01-05 14:07    [W:4.061 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site