aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-07-24 10:52:20 +0100
committerPeter Maydell <peter.maydell@linaro.org>2020-07-24 10:52:20 +0100
commit7adfbea8fd1efce36019a0c2f198ca73be9d3f18 (patch)
tree7496c3d6ab73cd38e0d2b7fcdd1855ed86ef551c
parent09e0cd773723219d21655587954da2769f64ba01 (diff)
parent0baa4b445e28f37243e5dc72e7efe32f0c9d7801 (diff)
Merge remote-tracking branch 'remotes/ehabkost/tags/x86-next-for-5.1-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>
-rw-r--r--target/i386/kvm.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index b8455c89ed..6f18d940a5 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -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;
@@ -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;