Skip to content

Commit

Permalink
KVM: x86: Remove redundant vcpu->arch.cr0 assignments
Browse files Browse the repository at this point in the history
Drop the vcpu->arch.cr0 assignment after static_call(kvm_x86_set_cr0).
CR0 was already set by {vmx,svm}_set_cr0().

Signed-off-by: Michal Luczaj <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sean Christopherson <[email protected]>
  • Loading branch information
mmhal authored and sean-jc committed Sep 27, 2023
1 parent 5804c19 commit 9dbb029
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 2 deletions.
1 change: 0 additions & 1 deletion arch/x86/kvm/smm.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ void enter_smm(struct kvm_vcpu *vcpu)

cr0 = vcpu->arch.cr0 & ~(X86_CR0_PE | X86_CR0_EM | X86_CR0_TS | X86_CR0_PG);
static_call(kvm_x86_set_cr0)(vcpu, cr0);
vcpu->arch.cr0 = cr0;

static_call(kvm_x86_set_cr4)(vcpu, 0);

Expand Down
1 change: 0 additions & 1 deletion arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -11521,7 +11521,6 @@ static int __set_sregs_common(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs,

*mmu_reset_needed |= kvm_read_cr0(vcpu) != sregs->cr0;
static_call(kvm_x86_set_cr0)(vcpu, sregs->cr0);
vcpu->arch.cr0 = sregs->cr0;

*mmu_reset_needed |= kvm_read_cr4(vcpu) != sregs->cr4;
static_call(kvm_x86_set_cr4)(vcpu, sregs->cr4);
Expand Down

0 comments on commit 9dbb029

Please sign in to comment.