Skip to content

Commit a445fc4

Browse files
Wanpeng Libonzini
authored andcommitted
KVM: LAPIC: Set the TDCR settable bits
It is a little different between Intel and AMD, Intel's bit 2 is 0 and AMD is reserved. On bare-metal, Intel will refuse to set APIC_TDCR once bits except 0, 1, 3 are setting, however, AMD will accept bits 0, 1, 3 and ignore other bits setting as patch does. Before the patch, we can get back anything what we set to the APIC_TDCR, this patch improves it. Signed-off-by: Wanpeng Li <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 8301305 commit a445fc4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kvm/lapic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2066,7 +2066,7 @@ int kvm_lapic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val)
20662066
case APIC_TDCR: {
20672067
uint32_t old_divisor = apic->divide_count;
20682068

2069-
kvm_lapic_set_reg(apic, APIC_TDCR, val);
2069+
kvm_lapic_set_reg(apic, APIC_TDCR, val & 0xb);
20702070
update_divide_count(apic);
20712071
if (apic->divide_count != old_divisor &&
20722072
apic->lapic_timer.period) {

0 commit comments

Comments
 (0)