Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
[platform/kernel/linux-rpi.git] / arch / x86 / kernel / fpu / xstate.h
index e0c9264..d22ace0 100644 (file)
@@ -20,10 +20,19 @@ static inline void xstate_init_xcomp_bv(struct xregs_state *xsave, u64 mask)
                xsave->header.xcomp_bv = mask | XCOMP_BV_COMPACTED_FORMAT;
 }
 
-static inline u64 xstate_get_host_group_perm(void)
+static inline u64 xstate_get_group_perm(bool guest)
 {
+       struct fpu *fpu = &current->group_leader->thread.fpu;
+       struct fpu_state_perm *perm;
+
        /* Pairs with WRITE_ONCE() in xstate_request_perm() */
-       return READ_ONCE(current->group_leader->thread.fpu.perm.__state_perm);
+       perm = guest ? &fpu->guest_perm : &fpu->perm;
+       return READ_ONCE(perm->__state_perm);
+}
+
+static inline u64 xstate_get_host_group_perm(void)
+{
+       return xstate_get_group_perm(false);
 }
 
 enum xstate_copy_mode {
@@ -145,8 +154,14 @@ static inline void xfd_update_state(struct fpstate *fpstate)
                }
        }
 }
+
+extern int __xfd_enable_feature(u64 which, struct fpu_guest *guest_fpu);
 #else
 static inline void xfd_update_state(struct fpstate *fpstate) { }
+
+static inline int __xfd_enable_feature(u64 which, struct fpu_guest *guest_fpu) {
+       return -EPERM;
+}
 #endif
 
 /*