From: Keir Fraser Date: Mon, 9 Aug 2010 15:32:45 +0000 (+0100) Subject: vt-d: Fix ioapic write order in io_apic_write_remap_rte X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~11651^2~13 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1cb3c0f2288ef1043eb7d1a318a226a1ebc3be1b;p=xen.git vt-d: Fix ioapic write order in io_apic_write_remap_rte At the end of io_apic_write_remap_rte, it writes new entry (remapped interrupt) to ioapic. But it writes low 32 bits before high 32 bits, it unmasks interrupt before writing high 32 bits if 'mask' bit in low 32 bits is cleared. Thus it may result in issues. This patch fixes this issue by writing high 32 bits before low 32 bits. Signed-off-by: Jiang, Yunhong Signed-off-by: Weidong Han --- diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c index 828aeb043a..1f9ca0e54c 100644 --- a/xen/drivers/passthrough/vtd/intremap.c +++ b/xen/drivers/passthrough/vtd/intremap.c @@ -444,10 +444,10 @@ void io_apic_write_remap_rte( } /* write new entry to ioapic */ - *IO_APIC_BASE(apic) = reg; - *(IO_APIC_BASE(apic)+4) = *(((u32 *)&old_rte)+0); *IO_APIC_BASE(apic) = reg + 1; *(IO_APIC_BASE(apic)+4) = *(((u32 *)&old_rte)+1); + *IO_APIC_BASE(apic) = reg; + *(IO_APIC_BASE(apic)+4) = *(((u32 *)&old_rte)+0); } #if defined(__i386__) || defined(__x86_64__)