mirror of
https://github.com/torvalds/linux.git
synced 2026-09-28 12:02:03 +02:00
KVM: x86: Extract REGS and SREGS runtime sync code to helpers
Extract the REGS and SREGS portions of {store,sync}_regs() into separate
helpers in anticipation of moving the register specific code out of x86.c
and into regs.c.
No functional change intended.
Cc: Yosry Ahmed <yosry@kernel.org>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Kai Huang <kai.huang@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@linux.intel.com>
Message-ID: <20260613000329.732085-2-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
098e32cba3
commit
6a8a98aa9c
|
|
@ -12685,7 +12685,7 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void store_regs(struct kvm_vcpu *vcpu)
|
||||
static void kvm_run_sync_regs_to_user(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
BUILD_BUG_ON(sizeof(struct kvm_sync_regs) > SYNC_REGS_SIZE_BYTES);
|
||||
|
||||
|
|
@ -12694,13 +12694,18 @@ static void store_regs(struct kvm_vcpu *vcpu)
|
|||
|
||||
if (vcpu->run->kvm_valid_regs & KVM_SYNC_X86_SREGS)
|
||||
__get_sregs(vcpu, &vcpu->run->s.regs.sregs);
|
||||
}
|
||||
|
||||
static void store_regs(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
kvm_run_sync_regs_to_user(vcpu);
|
||||
|
||||
if (vcpu->run->kvm_valid_regs & KVM_SYNC_X86_EVENTS)
|
||||
kvm_vcpu_ioctl_x86_get_vcpu_events(
|
||||
vcpu, &vcpu->run->s.regs.events);
|
||||
}
|
||||
|
||||
static int sync_regs(struct kvm_vcpu *vcpu)
|
||||
static int kvm_run_sync_regs_from_user(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
if (vcpu->run->kvm_dirty_regs & KVM_SYNC_X86_REGS) {
|
||||
__set_regs(vcpu, &vcpu->run->s.regs.regs);
|
||||
|
|
@ -12716,6 +12721,14 @@ static int sync_regs(struct kvm_vcpu *vcpu)
|
|||
vcpu->run->kvm_dirty_regs &= ~KVM_SYNC_X86_SREGS;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sync_regs(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
if (kvm_run_sync_regs_from_user(vcpu))
|
||||
return -EINVAL;
|
||||
|
||||
if (vcpu->run->kvm_dirty_regs & KVM_SYNC_X86_EVENTS) {
|
||||
struct kvm_vcpu_events events = vcpu->run->s.regs.events;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user