Skip to content

Commit 0d42522

Browse files
fatherMatrixsean-jc
authored andcommitted
KVM: x86: Fix poll command
According to the hardware manual, when the Poll command is issued, the byte returned by the I/O read is 1 in Bit 7 when there is an interrupt, and the highest priority binary code in Bits 2:0. The current pic simulation code is not implemented strictly according to the above expression. Fix the implementation of pic_poll_read(), set Bit 7 when there is an interrupt. Signed-off-by: Jinliang Zheng <alexjlzheng@tencent.com> Link: https://lore.kernel.org/r/20230419021924.1342184-1-alexjlzheng@tencent.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent dee3219 commit 0d42522

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

arch/x86/kvm/i8259.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,10 @@ static u32 pic_poll_read(struct kvm_kpic_state *s, u32 addr1)
411411
pic_clear_isr(s, ret);
412412
if (addr1 >> 7 || ret != 2)
413413
pic_update_irq(s->pics_state);
414+
/* Bit 7 is 1, means there's an interrupt */
415+
ret |= 0x80;
414416
} else {
417+
/* Bit 7 is 0, means there's no interrupt */
415418
ret = 0x07;
416419
pic_update_irq(s->pics_state);
417420
}

0 commit comments

Comments
 (0)