diff options
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r-- | arch/x86/kvm/emulate.c | 9 | ||||
-rw-r--r-- | arch/x86/kvm/lapic.c | 9 |
2 files changed, 13 insertions, 5 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 8db0010ed150..5953dcea752d 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -1240,9 +1240,12 @@ static int decode_modrm(struct x86_emulate_ctxt *ctxt, | |||
1240 | ctxt->modrm_seg = VCPU_SREG_DS; | 1240 | ctxt->modrm_seg = VCPU_SREG_DS; |
1241 | 1241 | ||
1242 | if (ctxt->modrm_mod == 3) { | 1242 | if (ctxt->modrm_mod == 3) { |
1243 | int highbyte_regs = ctxt->rex_prefix == 0; | ||
1244 | |||
1243 | op->type = OP_REG; | 1245 | op->type = OP_REG; |
1244 | op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes; | 1246 | op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes; |
1245 | op->addr.reg = decode_register(ctxt, ctxt->modrm_rm, ctxt->d & ByteOp); | 1247 | op->addr.reg = decode_register(ctxt, ctxt->modrm_rm, |
1248 | highbyte_regs && (ctxt->d & ByteOp)); | ||
1246 | if (ctxt->d & Sse) { | 1249 | if (ctxt->d & Sse) { |
1247 | op->type = OP_XMM; | 1250 | op->type = OP_XMM; |
1248 | op->bytes = 16; | 1251 | op->bytes = 16; |
@@ -3997,7 +4000,8 @@ static const struct opcode twobyte_table[256] = { | |||
3997 | DI(ImplicitOps | Priv, invd), DI(ImplicitOps | Priv, wbinvd), N, N, | 4000 | DI(ImplicitOps | Priv, invd), DI(ImplicitOps | Priv, wbinvd), N, N, |
3998 | N, D(ImplicitOps | ModRM), N, N, | 4001 | N, D(ImplicitOps | ModRM), N, N, |
3999 | /* 0x10 - 0x1F */ | 4002 | /* 0x10 - 0x1F */ |
4000 | N, N, N, N, N, N, N, N, D(ImplicitOps | ModRM), N, N, N, N, N, N, N, | 4003 | N, N, N, N, N, N, N, N, |
4004 | D(ImplicitOps | ModRM), N, N, N, N, N, N, D(ImplicitOps | ModRM), | ||
4001 | /* 0x20 - 0x2F */ | 4005 | /* 0x20 - 0x2F */ |
4002 | DIP(ModRM | DstMem | Priv | Op3264, cr_read, check_cr_read), | 4006 | DIP(ModRM | DstMem | Priv | Op3264, cr_read, check_cr_read), |
4003 | DIP(ModRM | DstMem | Priv | Op3264, dr_read, check_dr_read), | 4007 | DIP(ModRM | DstMem | Priv | Op3264, dr_read, check_dr_read), |
@@ -4836,6 +4840,7 @@ twobyte_insn: | |||
4836 | case 0x08: /* invd */ | 4840 | case 0x08: /* invd */ |
4837 | case 0x0d: /* GrpP (prefetch) */ | 4841 | case 0x0d: /* GrpP (prefetch) */ |
4838 | case 0x18: /* Grp16 (prefetch/nop) */ | 4842 | case 0x18: /* Grp16 (prefetch/nop) */ |
4843 | case 0x1f: /* nop */ | ||
4839 | break; | 4844 | break; |
4840 | case 0x20: /* mov cr, reg */ | 4845 | case 0x20: /* mov cr, reg */ |
4841 | ctxt->dst.val = ops->get_cr(ctxt, ctxt->modrm_reg); | 4846 | ctxt->dst.val = ops->get_cr(ctxt, ctxt->modrm_reg); |
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index e1adbb4aca75..0eee2c8b64d1 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
@@ -1861,11 +1861,14 @@ void kvm_apic_accept_events(struct kvm_vcpu *vcpu) | |||
1861 | { | 1861 | { |
1862 | struct kvm_lapic *apic = vcpu->arch.apic; | 1862 | struct kvm_lapic *apic = vcpu->arch.apic; |
1863 | unsigned int sipi_vector; | 1863 | unsigned int sipi_vector; |
1864 | unsigned long pe; | ||
1864 | 1865 | ||
1865 | if (!kvm_vcpu_has_lapic(vcpu)) | 1866 | if (!kvm_vcpu_has_lapic(vcpu) || !apic->pending_events) |
1866 | return; | 1867 | return; |
1867 | 1868 | ||
1868 | if (test_and_clear_bit(KVM_APIC_INIT, &apic->pending_events)) { | 1869 | pe = xchg(&apic->pending_events, 0); |
1870 | |||
1871 | if (test_bit(KVM_APIC_INIT, &pe)) { | ||
1869 | kvm_lapic_reset(vcpu); | 1872 | kvm_lapic_reset(vcpu); |
1870 | kvm_vcpu_reset(vcpu); | 1873 | kvm_vcpu_reset(vcpu); |
1871 | if (kvm_vcpu_is_bsp(apic->vcpu)) | 1874 | if (kvm_vcpu_is_bsp(apic->vcpu)) |
@@ -1873,7 +1876,7 @@ void kvm_apic_accept_events(struct kvm_vcpu *vcpu) | |||
1873 | else | 1876 | else |
1874 | vcpu->arch.mp_state = KVM_MP_STATE_INIT_RECEIVED; | 1877 | vcpu->arch.mp_state = KVM_MP_STATE_INIT_RECEIVED; |
1875 | } | 1878 | } |
1876 | if (test_and_clear_bit(KVM_APIC_SIPI, &apic->pending_events) && | 1879 | if (test_bit(KVM_APIC_SIPI, &pe) && |
1877 | vcpu->arch.mp_state == KVM_MP_STATE_INIT_RECEIVED) { | 1880 | vcpu->arch.mp_state == KVM_MP_STATE_INIT_RECEIVED) { |
1878 | /* evaluate pending_events before reading the vector */ | 1881 | /* evaluate pending_events before reading the vector */ |
1879 | smp_rmb(); | 1882 | smp_rmb(); |