Messages in this thread | | | From | Thomas Gleixner <> | Subject | Re: [PATCH v2 08/23] x86/fpu: Provide fpu_update_guest_perm_features() for guest | Date | Fri, 17 Dec 2021 19:50:24 +0100 |
| |
eviewed-by: Thomas Gleixner <tglx@linutronix.de> On Fri, Dec 17 2021 at 07:29, Jing Liu wrote: > +/* > + * fpu_update_guest_perm_features - Enable xfeatures according to guest perm > + * @guest_fpu: Pointer to the guest FPU container > + * > + * Enable all dynamic xfeatures according to guest perm. 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 > + */ > +int fpu_update_guest_perm_features(struct fpu_guest *guest_fpu) > +{ > + u64 expand; > + > + lockdep_assert_preemption_enabled(); > + > + if (!IS_ENABLED(CONFIG_X86_64)) > + return 0; > + > + expand = guest_fpu->perm & ~guest_fpu->xfeatures; > + if (!expand) > + return 0; > + > + return __xfd_enable_feature(expand, guest_fpu); > +} > +EXPORT_SYMBOL_GPL(fpu_update_guest_perm_features);
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
| |