xen: fix MSI setup and teardown for PV on HVM guests
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Wed, 1 Dec 2010 14:51:44 +0000 (14:51 +0000)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Thu, 2 Dec 2010 14:34:25 +0000 (14:34 +0000)
commitaf42b8d12f8adec6711cb824549a0edac6a4ae8f
treee922110d01d85688a03f9ae5d7e31c9f73f2b001
parente5fc7345412d5e4758fcef55a74354c5cbefd61e
xen: fix MSI setup and teardown for PV on HVM guests

When remapping MSIs into pirqs for PV on HVM guests, qemu is responsible
for doing the actual mapping and unmapping.
We only give qemu the desired pirq number when we ask to do the mapping
the first time, after that we should be reading back the pirq number
from qemu every time we want to re-enable the MSI.

This fixes a bug in xen_hvm_setup_msi_irqs that manifests itself when
trying to enable the same MSI for the second time: the old MSI to pirq
mapping is still valid at this point but xen_hvm_setup_msi_irqs would
try to assign a new pirq anyway.
A simple way to reproduce this bug is to assign an MSI capable network
card to a PV on HVM guest, if the user brings down the corresponding
ethernet interface and up again, Linux would fail to enable MSIs on the
device.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
arch/x86/pci/xen.c
drivers/xen/events.c
include/xen/events.h