[PATCH 2/2] KVM: x86: Adjust return value of pic_poll_read()

From: alexjlzheng
Date: Tue Apr 18 2023 - 06:49:53 EST


From: Jinliang Zheng <alexjlzheng@xxxxxxxxxxx>

Returning 0x07 raises ambiguity when no interrupt is in pic_poll_read().
Although it will not cause a functional exception (Bit 7 is 0 means no
interrupt), it will easily make developers mistakenly think that a
spurious interrupt (IRQ 7) has been returned.

Return 0x00 instread of 0x07.

Signed-off-by: Jinliang Zheng <alexjlzheng@xxxxxxxxxxx>
---
arch/x86/kvm/i8259.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
index 861872e2641a..57978ad8311c 100644
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -414,7 +414,8 @@ static u32 pic_poll_read(struct kvm_kpic_state *s, u32 addr1)
/* Bit 7 is 1, means there's an interrupt */
ret |= 0x80;
} else {
- ret = 0x07;
+ /* Bit 7 is 0, means there's no interrupt */
+ ret = 0x00;
pic_update_irq(s->pics_state);
}

--
2.31.1