Commit 77e1eb75 authored by Nikita Leshenko's avatar Nikita Leshenko Committed by Greg Kroah-Hartman

KVM: x86: ioapic: Preserve read-only values in the redirection table


[ Upstream commit b200dded ]

According to 82093AA (IOAPIC) manual, Remote IRR and Delivery Status are
read-only. QEMU implements the bits as RO in commit 479c2a1cb7fb
("ioapic: keep RO bits for IOAPIC entry").
Signed-off-by: default avatarNikita Leshenko <nikita.leshchenko@oracle.com>
Reviewed-by: default avatarLiran Alon <liran.alon@oracle.com>
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: default avatarWanpeng Li <wanpeng.li@hotmail.com>
Reviewed-by: default avatarSteve Rutherford <srutherford@google.com>
Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3ee7ae2b
...@@ -268,6 +268,7 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val) ...@@ -268,6 +268,7 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val)
{ {
unsigned index; unsigned index;
bool mask_before, mask_after; bool mask_before, mask_after;
int old_remote_irr, old_delivery_status;
union kvm_ioapic_redirect_entry *e; union kvm_ioapic_redirect_entry *e;
switch (ioapic->ioregsel) { switch (ioapic->ioregsel) {
...@@ -290,6 +291,9 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val) ...@@ -290,6 +291,9 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val)
return; return;
e = &ioapic->redirtbl[index]; e = &ioapic->redirtbl[index];
mask_before = e->fields.mask; mask_before = e->fields.mask;
/* Preserve read-only fields */
old_remote_irr = e->fields.remote_irr;
old_delivery_status = e->fields.delivery_status;
if (ioapic->ioregsel & 1) { if (ioapic->ioregsel & 1) {
e->bits &= 0xffffffff; e->bits &= 0xffffffff;
e->bits |= (u64) val << 32; e->bits |= (u64) val << 32;
...@@ -297,6 +301,8 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val) ...@@ -297,6 +301,8 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val)
e->bits &= ~0xffffffffULL; e->bits &= ~0xffffffffULL;
e->bits |= (u32) val; e->bits |= (u32) val;
} }
e->fields.remote_irr = old_remote_irr;
e->fields.delivery_status = old_delivery_status;
/* /*
* Some OSes (Linux, Xen) assume that Remote IRR bit will * Some OSes (Linux, Xen) assume that Remote IRR bit will
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment