summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/i8259.c
diff options
context:
space:
mode:
authorJinliang Zheng <alexjlzheng@tencent.com>2023-04-19 04:19:25 +0200
committerSean Christopherson <seanjc@google.com>2023-06-01 22:44:13 +0200
commit0d42522bdee70b9197be63dd76c9f6297cd1e832 (patch)
treed5a57b6e605c2722ada4060cf9c27a35840ac48c /arch/x86/kvm/i8259.c
parentKVM: x86: Move common handling of PAT MSR writes to kvm_set_msr_common() (diff)
downloadlinux-0d42522bdee70b9197be63dd76c9f6297cd1e832.tar.xz
linux-0d42522bdee70b9197be63dd76c9f6297cd1e832.zip
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>
Diffstat (limited to 'arch/x86/kvm/i8259.c')
-rw-r--r--arch/x86/kvm/i8259.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
index 4756bcb5724f..8dec646e764b 100644
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -411,7 +411,10 @@ static u32 pic_poll_read(struct kvm_kpic_state *s, u32 addr1)
pic_clear_isr(s, ret);
if (addr1 >> 7 || ret != 2)
pic_update_irq(s->pics_state);
+ /* Bit 7 is 1, means there's an interrupt */
+ ret |= 0x80;
} else {
+ /* Bit 7 is 0, means there's no interrupt */
ret = 0x07;
pic_update_irq(s->pics_state);
}