diff options
author | Paolo Bonzini | 2021-12-21 10:12:53 +0100 |
---|---|---|
committer | Paolo Bonzini | 2022-01-12 14:09:06 +0100 |
commit | 1520f8bb671ce3c1b8a3b5ed3bbdfe1a06aa8691 (patch) | |
tree | d237216643c2ff04a0bd0461d6f71e18e9f69924 /target/i386 | |
parent | KVM: use KVM_{GET|SET}_SREGS2 when supported. (diff) | |
download | qemu-1520f8bb671ce3c1b8a3b5ed3bbdfe1a06aa8691.tar.gz qemu-1520f8bb671ce3c1b8a3b5ed3bbdfe1a06aa8691.tar.xz qemu-1520f8bb671ce3c1b8a3b5ed3bbdfe1a06aa8691.zip |
KVM: x86: ignore interrupt_bitmap field of KVM_GET/SET_SREGS
This is unnecessary, because the interrupt would be retrieved and queued
anyway by KVM_GET_VCPU_EVENTS and KVM_SET_VCPU_EVENTS respectively,
and it makes the flow more similar to the one for KVM_GET/SET_SREGS2.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target/i386')
-rw-r--r-- | target/i386/kvm/kvm.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index d81745620b..2c8feb4a6f 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -2607,11 +2607,11 @@ static int kvm_put_sregs(X86CPU *cpu) CPUX86State *env = &cpu->env; struct kvm_sregs sregs; + /* + * The interrupt_bitmap is ignored because KVM_SET_SREGS is + * always followed by KVM_SET_VCPU_EVENTS. + */ memset(sregs.interrupt_bitmap, 0, sizeof(sregs.interrupt_bitmap)); - if (env->interrupt_injected >= 0) { - sregs.interrupt_bitmap[env->interrupt_injected / 64] |= - (uint64_t)1 << (env->interrupt_injected % 64); - } if ((env->eflags & VM_MASK)) { set_v8086_seg(&sregs.cs, &env->segs[R_CS]); @@ -3341,23 +3341,17 @@ static int kvm_get_sregs(X86CPU *cpu) { CPUX86State *env = &cpu->env; struct kvm_sregs sregs; - int bit, i, ret; + int ret; ret = kvm_vcpu_ioctl(CPU(cpu), KVM_GET_SREGS, &sregs); if (ret < 0) { return ret; } - /* There can only be one pending IRQ set in the bitmap at a time, so try - to find it and save its number instead (-1 for none). */ - env->interrupt_injected = -1; - for (i = 0; i < ARRAY_SIZE(sregs.interrupt_bitmap); i++) { - if (sregs.interrupt_bitmap[i]) { - bit = ctz64(sregs.interrupt_bitmap[i]); - env->interrupt_injected = i * 64 + bit; - break; - } - } + /* + * The interrupt_bitmap is ignored because KVM_GET_SREGS is + * always preceded by KVM_GET_VCPU_EVENTS. + */ get_seg(&env->segs[R_CS], &sregs.cs); get_seg(&env->segs[R_DS], &sregs.ds); |