mirror of
https://github.com/torvalds/linux.git
synced 2026-11-24 23:47:06 +00:00
x86/fpu: Add uabi_size to guest_fpu
Userspace needs to inquire KVM about the buffer size to work with the new KVM_SET_XSAVE and KVM_GET_XSAVE2. Add the size info to guest_fpu for KVM to access. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Wei Wang <[email protected]> Signed-off-by: Jing Liu <[email protected]> Signed-off-by: Yang Zhong <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
This commit is contained in:
committed by
Paolo Bonzini
parent
690a757d61
commit
c60427dd50
@@ -522,6 +522,11 @@ struct fpu_guest {
|
||||
*/
|
||||
u64 xfd_err;
|
||||
|
||||
/*
|
||||
* @uabi_size: Size required for save/restore
|
||||
*/
|
||||
unsigned int uabi_size;
|
||||
|
||||
/*
|
||||
* @fpstate: Pointer to the allocated guest fpstate
|
||||
*/
|
||||
|
||||
@@ -240,6 +240,7 @@ bool fpu_alloc_guest_fpstate(struct fpu_guest *gfpu)
|
||||
gfpu->fpstate = fpstate;
|
||||
gfpu->xfeatures = fpu_user_cfg.default_features;
|
||||
gfpu->perm = fpu_user_cfg.default_features;
|
||||
gfpu->uabi_size = fpu_user_cfg.default_size;
|
||||
fpu_init_guest_permissions(gfpu);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1545,6 +1545,7 @@ static int fpstate_realloc(u64 xfeatures, unsigned int ksize,
|
||||
newfps->is_confidential = curfps->is_confidential;
|
||||
newfps->in_use = curfps->in_use;
|
||||
guest_fpu->xfeatures |= xfeatures;
|
||||
guest_fpu->uabi_size = usize;
|
||||
}
|
||||
|
||||
fpregs_lock();
|
||||
|
||||
Reference in New Issue
Block a user