Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/ehabkost/tags/x86-next-for-5.1-…
Browse files Browse the repository at this point in the history
…pull-request' into staging

x86 bug fix for -rc2

A fix from Vitaly Kuznetsov for a CPU reset bug
reported by Jan Kiszka.

# gpg: Signature made Thu 23 Jul 2020 20:10:40 BST
# gpg:                using RSA key 5A322FD5ABC4D3DBACCFD1AA2807936F984DC5A6
# gpg:                issuer "ehabkost@redhat.com"
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full]
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/x86-next-for-5.1-pull-request:
  KVM: fix CPU reset wrt HF2_GIF_MASK

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Jul 24, 2020
2 parents 09e0cd7 + 0baa4b4 commit 7adfbea
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions target/i386/kvm.c
Expand Up @@ -3877,7 +3877,9 @@ static int kvm_put_nested_state(X86CPU *cpu)
} else {
env->nested_state->flags &= ~KVM_STATE_NESTED_GUEST_MODE;
}
if (env->hflags2 & HF2_GIF_MASK) {

/* Don't set KVM_STATE_NESTED_GIF_SET on VMX as it is illegal */
if (cpu_has_svm(env) && (env->hflags2 & HF2_GIF_MASK)) {
env->nested_state->flags |= KVM_STATE_NESTED_GIF_SET;
} else {
env->nested_state->flags &= ~KVM_STATE_NESTED_GIF_SET;
Expand Down Expand Up @@ -3919,10 +3921,14 @@ static int kvm_get_nested_state(X86CPU *cpu)
} else {
env->hflags &= ~HF_GUEST_MASK;
}
if (env->nested_state->flags & KVM_STATE_NESTED_GIF_SET) {
env->hflags2 |= HF2_GIF_MASK;
} else {
env->hflags2 &= ~HF2_GIF_MASK;

/* Keep HF2_GIF_MASK set on !SVM as x86_cpu_pending_interrupt() needs it */
if (cpu_has_svm(env)) {
if (env->nested_state->flags & KVM_STATE_NESTED_GIF_SET) {
env->hflags2 |= HF2_GIF_MASK;
} else {
env->hflags2 &= ~HF2_GIF_MASK;
}
}

return ret;
Expand Down

0 comments on commit 7adfbea

Please sign in to comment.