diff options
Diffstat (limited to 'hw')
47 files changed, 91 insertions, 9 deletions
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c index b0ca81cea3..02c8caa191 100644 --- a/hw/arm/allwinner-a10.c +++ b/hw/arm/allwinner-a10.c @@ -15,6 +15,7 @@ * for more details. */ +#include "qemu/osdep.h" #include "hw/sysbus.h" #include "hw/devices.h" #include "hw/arm/allwinner-a10.h" diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c index a80d2ad29c..f3973f721a 100644 --- a/hw/arm/armv7m.c +++ b/hw/arm/armv7m.c @@ -7,6 +7,7 @@ * This code is licensed under the GPL. */ +#include "qemu/osdep.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "hw/loader.h" diff --git a/hw/arm/boot.c b/hw/arm/boot.c index 75f69bfe01..7742dd3cb6 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -7,7 +7,7 @@ * This code is licensed under the GPL. */ -#include "config.h" +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/arm/arm.h" #include "hw/arm/linux-boot-if.h" diff --git a/hw/arm/collie.c b/hw/arm/collie.c index 9991c0c4a0..8bb308a42e 100644 --- a/hw/arm/collie.c +++ b/hw/arm/collie.c @@ -8,6 +8,7 @@ * Contributions after 2012-01-13 are licensed under the terms of the * GNU GPL, version 2 or (at your option) any later version. */ +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/sysbus.h" #include "hw/boards.h" diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c index a71e43cf5f..2382c59158 100644 --- a/hw/arm/cubieboard.c +++ b/hw/arm/cubieboard.c @@ -15,6 +15,7 @@ * for more details. */ +#include "qemu/osdep.h" #include "hw/sysbus.h" #include "hw/devices.h" #include "hw/boards.h" diff --git a/hw/arm/digic.c b/hw/arm/digic.c index 90f8190c48..82087bacb8 100644 --- a/hw/arm/digic.c +++ b/hw/arm/digic.c @@ -20,6 +20,7 @@ * */ +#include "qemu/osdep.h" #include "hw/arm/digic.h" #define DIGIC4_TIMER_BASE(n) (0xc0210000 + (n) * 0x100) diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c index dfaed257f5..e5308f47ab 100644 --- a/hw/arm/digic_boards.c +++ b/hw/arm/digic_boards.c @@ -23,6 +23,7 @@ * */ +#include "qemu/osdep.h" #include "hw/boards.h" #include "exec/address-spaces.h" #include "qemu/error-report.h" diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 79b7c5ab3d..6a8f0b54ce 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -21,6 +21,7 @@ * */ +#include "qemu/osdep.h" #include "hw/boards.h" #include "sysemu/sysemu.h" #include "hw/sysbus.h" diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c index da82b27bad..42faa8c48d 100644 --- a/hw/arm/exynos4_boards.c +++ b/hw/arm/exynos4_boards.c @@ -21,6 +21,7 @@ * */ +#include "qemu/osdep.h" #include "sysemu/sysemu.h" #include "sysemu/qtest.h" #include "hw/sysbus.h" diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c index 36818ee025..fb743bfbd0 100644 --- a/hw/arm/fsl-imx25.c +++ b/hw/arm/fsl-imx25.c @@ -22,6 +22,7 @@ * with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "qemu/osdep.h" #include "hw/arm/fsl-imx25.h" #include "sysemu/sysemu.h" #include "exec/address-spaces.h" diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c index abdea0683a..f2c2ce56f6 100644 --- a/hw/arm/fsl-imx31.c +++ b/hw/arm/fsl-imx31.c @@ -19,6 +19,7 @@ * with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "qemu/osdep.h" #include "hw/arm/fsl-imx31.h" #include "sysemu/sysemu.h" #include "exec/address-spaces.h" diff --git a/hw/arm/gumstix.c b/hw/arm/gumstix.c index 32ad041b20..626d338373 100644 --- a/hw/arm/gumstix.c +++ b/hw/arm/gumstix.c @@ -34,6 +34,7 @@ * # qemu-system-arm -M verdex -pflash flash -monitor null -nographic -m 289 */ +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/arm/pxa.h" #include "net/net.h" diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index cb9926e50f..620b52631a 100644 --- a/hw/arm/highbank.c +++ b/hw/arm/highbank.c @@ -17,6 +17,7 @@ * */ +#include "qemu/osdep.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "hw/devices.h" diff --git a/hw/arm/imx25_pdk.c b/hw/arm/imx25_pdk.c index 039f0ebdb8..b167e19f5a 100644 --- a/hw/arm/imx25_pdk.c +++ b/hw/arm/imx25_pdk.c @@ -23,6 +23,7 @@ * with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "qemu/osdep.h" #include "hw/arm/fsl-imx25.h" #include "hw/boards.h" #include "qemu/error-report.h" diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c index 96dedce906..c6656a817c 100644 --- a/hw/arm/integratorcp.c +++ b/hw/arm/integratorcp.c @@ -7,6 +7,7 @@ * This code is licensed under the GPL */ +#include "qemu/osdep.h" #include "hw/sysbus.h" #include "hw/devices.h" #include "hw/boards.h" diff --git a/hw/arm/kzm.c b/hw/arm/kzm.c index f4b463aa1e..55fb36021c 100644 --- a/hw/arm/kzm.c +++ b/hw/arm/kzm.c @@ -13,6 +13,7 @@ * i.MX31 SoC */ +#include "qemu/osdep.h" #include "hw/arm/fsl-imx31.h" #include "hw/boards.h" #include "qemu/error-report.h" diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c index e434cb6ab0..98a892ff62 100644 --- a/hw/arm/mainstone.c +++ b/hw/arm/mainstone.c @@ -11,6 +11,7 @@ * Contributions after 2012-01-13 are licensed under the terms of the * GNU GPL, version 2 or (at your option) any later version. */ +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/arm/pxa.h" #include "hw/arm/arm.h" diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index b534bb9041..54548f38bb 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -9,6 +9,7 @@ * GNU GPL, version 2 or (at your option) any later version. */ +#include "qemu/osdep.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "hw/devices.h" diff --git a/hw/arm/netduino2.c b/hw/arm/netduino2.c index 3ab83a1acd..86065d360a 100644 --- a/hw/arm/netduino2.c +++ b/hw/arm/netduino2.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" #include "hw/boards.h" #include "qemu/error-report.h" #include "hw/arm/stm32f205_soc.h" diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c index 57170aea8b..d9e61f7779 100644 --- a/hw/arm/nseries.c +++ b/hw/arm/nseries.c @@ -18,6 +18,7 @@ * with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "qemu/osdep.h" #include "qemu-common.h" #include "sysemu/sysemu.h" #include "hw/arm/omap.h" diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c index 6b1c076598..6f68130419 100644 --- a/hw/arm/omap1.c +++ b/hw/arm/omap1.c @@ -17,6 +17,7 @@ * with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "qemu/osdep.h" #include "hw/boards.h" #include "hw/hw.h" #include "hw/arm/arm.h" diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c index 98ee19f861..d11224e81e 100644 --- a/hw/arm/omap2.c +++ b/hw/arm/omap2.c @@ -18,6 +18,7 @@ * with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "qemu/osdep.h" #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "hw/boards.h" diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c index 8eaf8f3315..68236a39b2 100644 --- a/hw/arm/omap_sx1.c +++ b/hw/arm/omap_sx1.c @@ -25,6 +25,7 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "qemu/osdep.h" #include "hw/hw.h" #include "ui/console.h" #include "hw/arm/omap.h" diff --git a/hw/arm/palm.c b/hw/arm/palm.c index 82ec99d936..cae0a46561 100644 --- a/hw/arm/palm.c +++ b/hw/arm/palm.c @@ -16,6 +16,7 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "qemu/osdep.h" #include "hw/hw.h" #include "audio/audio.h" #include "sysemu/sysemu.h" diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c index 79d22d91e5..db58781e01 100644 --- a/hw/arm/pxa2xx.c +++ b/hw/arm/pxa2xx.c @@ -7,6 +7,7 @@ * This code is licensed under the GPL. */ +#include "qemu/osdep.h" #include "hw/sysbus.h" #include "hw/arm/pxa.h" #include "sysemu/sysemu.h" diff --git a/hw/arm/pxa2xx_gpio.c b/hw/arm/pxa2xx_gpio.c index c89c8045c3..67e7e70943 100644 --- a/hw/arm/pxa2xx_gpio.c +++ b/hw/arm/pxa2xx_gpio.c @@ -7,6 +7,7 @@ * This code is licensed under the GPL. */ +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/sysbus.h" #include "hw/arm/pxa.h" diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c index d41ac93416..8a39b1caca 100644 --- a/hw/arm/pxa2xx_pic.c +++ b/hw/arm/pxa2xx_pic.c @@ -8,6 +8,7 @@ * This code is licensed under the GPL. */ +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/arm/pxa.h" #include "hw/sysbus.h" diff --git a/hw/arm/realview.c b/hw/arm/realview.c index 2d6952c393..90429fc456 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -7,6 +7,7 @@ * This code is licensed under the GPL. */ +#include "qemu/osdep.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "hw/arm/primecell.h" diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c index 8d3cc0b6b2..317ade1202 100644 --- a/hw/arm/spitz.c +++ b/hw/arm/spitz.c @@ -10,6 +10,7 @@ * GNU GPL, version 2 or (at your option) any later version. */ +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/arm/pxa.h" #include "hw/arm/arm.h" diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index 0114e0a7f8..3eb7d3cb77 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -7,6 +7,7 @@ * This code is licensed under the GPL. */ +#include "qemu/osdep.h" #include "hw/sysbus.h" #include "hw/ssi.h" #include "hw/arm/arm.h" diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c index 3f993406dd..79bfe6d10f 100644 --- a/hw/arm/stm32f205_soc.c +++ b/hw/arm/stm32f205_soc.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" #include "hw/arm/arm.h" #include "exec/address-spaces.h" #include "hw/arm/stm32f205_soc.h" diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c index 9624ecb586..d9f2f5b3aa 100644 --- a/hw/arm/strongarm.c +++ b/hw/arm/strongarm.c @@ -27,6 +27,7 @@ * GNU GPL, version 2 or (at your option) any later version. */ +#include "qemu/osdep.h" #include "hw/boards.h" #include "hw/sysbus.h" #include "strongarm.h" diff --git a/hw/arm/sysbus-fdt.c b/hw/arm/sysbus-fdt.c index 9d28797c87..68a3de5cf8 100644 --- a/hw/arm/sysbus-fdt.c +++ b/hw/arm/sysbus-fdt.c @@ -21,6 +21,7 @@ * */ +#include "qemu/osdep.h" #include "hw/arm/sysbus-fdt.h" #include "qemu/error-report.h" #include "sysemu/device_tree.h" diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c index 02814d7aba..c387950fb0 100644 --- a/hw/arm/tosa.c +++ b/hw/arm/tosa.c @@ -11,6 +11,7 @@ * GNU GPL, version 2 or (at your option) any later version. */ +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/arm/pxa.h" #include "hw/arm/arm.h" diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c index 70eefe9987..d061f0fd07 100644 --- a/hw/arm/versatilepb.c +++ b/hw/arm/versatilepb.c @@ -7,6 +7,7 @@ * This code is licensed under the GPL. */ +#include "qemu/osdep.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "hw/devices.h" diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index ea9a9840d0..3154aeaa95 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -21,6 +21,7 @@ * GNU GPL, version 2 or (at your option) any later version. */ +#include "qemu/osdep.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "hw/arm/primecell.h" diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 0d5c635cc8..87fbe7c97d 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -26,6 +26,7 @@ * with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "qemu/osdep.h" #include "qemu-common.h" #include "hw/arm/virt-acpi-build.h" #include "qemu/bitmap.h" diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 92dcd02119..05f9087cca 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -28,6 +28,7 @@ * This is essentially the same approach kvmtool uses. */ +#include "qemu/osdep.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "hw/arm/primecell.h" diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c index 65e92e1824..40b476172a 100644 --- a/hw/arm/xilinx_zynq.c +++ b/hw/arm/xilinx_zynq.c @@ -15,6 +15,7 @@ * with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "qemu/osdep.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "net/net.h" diff --git a/hw/arm/xlnx-ep108.c b/hw/arm/xlnx-ep108.c index 9099025a79..c9414e6a25 100644 --- a/hw/arm/xlnx-ep108.c +++ b/hw/arm/xlnx-ep108.c @@ -15,6 +15,7 @@ * for more details. */ +#include "qemu/osdep.h" #include "hw/arm/xlnx-zynqmp.h" #include "hw/boards.h" #include "qemu/error-report.h" diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c index f26efd802a..57e926d524 100644 --- a/hw/arm/xlnx-zynqmp.c +++ b/hw/arm/xlnx-zynqmp.c @@ -15,6 +15,7 @@ * for more details. */ +#include "qemu/osdep.h" #include "hw/arm/xlnx-zynqmp.h" #include "hw/intc/arm_gic_common.h" #include "exec/address-spaces.h" diff --git a/hw/arm/z2.c b/hw/arm/z2.c index b44eb76fcc..aecb24a8e9 100644 --- a/hw/arm/z2.c +++ b/hw/arm/z2.c @@ -11,6 +11,7 @@ * GNU GPL, version 2 or (at your option) any later version. */ +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/arm/pxa.h" #include "hw/arm/arm.h" diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 2c7101d91d..44bf790b01 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -1206,7 +1206,6 @@ static void device_finalize(Object *obj) NamedGPIOList *ngl, *next; DeviceState *dev = DEVICE(obj); - qemu_opts_del(dev->opts); QLIST_FOREACH_SAFE(ngl, &dev->gpios, node, next) { QLIST_REMOVE(ngl, node); @@ -1254,6 +1253,9 @@ static void device_unparent(Object *obj) qapi_event_send_device_deleted(!!dev->id, dev->id, path, &error_abort); g_free(path); } + + qemu_opts_del(dev->opts); + dev->opts = NULL; } static void device_class_init(ObjectClass *class, void *data) diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index 4fb86a68c4..dccb908c31 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -684,7 +684,7 @@ int spapr_drc_populate_dt(void *fdt, int fdt_offset, Object *owner, { Object *root_container; ObjectProperty *prop; - ObjectPropertyIterator *iter; + ObjectPropertyIterator iter; uint32_t drc_count = 0; GArray *drc_indexes, *drc_power_domains; GString *drc_names, *drc_types; @@ -708,8 +708,8 @@ int spapr_drc_populate_dt(void *fdt, int fdt_offset, Object *owner, */ root_container = container_get(object_get_root(), DRC_CONTAINER_PATH); - iter = object_property_iter_init(root_container); - while ((prop = object_property_iter_next(iter))) { + object_property_iter_init(&iter, root_container); + while ((prop = object_property_iter_next(&iter))) { Object *obj; sPAPRDRConnector *drc; sPAPRDRConnectorClass *drck; @@ -750,7 +750,6 @@ int spapr_drc_populate_dt(void *fdt, int fdt_offset, Object *owner, spapr_drc_get_type_str(drc->type)); drc_types = g_string_insert_len(drc_types, -1, "\0", 1); } - object_property_iter_free(iter); /* now write the drc count into the space we reserved at the * beginning of the arrays previously diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index 30c68a1e2b..e117c41fbe 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -328,7 +328,7 @@ static void vfio_probe_ati_bar4_quirk(VFIOPCIDevice *vdev, int nr) window->data_offset = 4; window->nr_matches = 1; window->matches[0].match = 0x4000; - window->matches[0].mask = PCIE_CONFIG_SPACE_SIZE - 1; + window->matches[0].mask = vdev->config_size - 1; window->bar = nr; window->addr_mem = &quirk->mem[0]; window->data_mem = &quirk->mem[1]; @@ -674,7 +674,7 @@ static void vfio_probe_nvidia_bar5_quirk(VFIOPCIDevice *vdev, int nr) window->matches[0].match = 0x1800; window->matches[0].mask = PCI_CONFIG_SPACE_SIZE - 1; window->matches[1].match = 0x88000; - window->matches[1].mask = PCIE_CONFIG_SPACE_SIZE - 1; + window->matches[1].mask = vdev->config_size - 1; window->bar = nr; window->addr_mem = bar5->addr_mem = &quirk->mem[0]; window->data_mem = bar5->data_mem = &quirk->mem[1]; @@ -765,7 +765,7 @@ static void vfio_probe_nvidia_bar0_quirk(VFIOPCIDevice *vdev, int nr) memory_region_init_io(mirror->mem, OBJECT(vdev), &vfio_nvidia_mirror_quirk, mirror, "vfio-nvidia-bar0-88000-mirror-quirk", - PCIE_CONFIG_SPACE_SIZE); + vdev->config_size); memory_region_add_subregion_overlap(&vdev->bars[nr].region.mem, mirror->offset, mirror->mem, 1); diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 1fb868c244..e66c47ff6a 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -356,6 +356,13 @@ static void vfio_msi_interrupt(void *opaque) if (vdev->interrupt == VFIO_INT_MSIX) { get_msg = msix_get_message; notify = msix_notify; + + /* A masked vector firing needs to use the PBA, enable it */ + if (msix_is_masked(&vdev->pdev, nr)) { + set_bit(nr, vdev->msix->pending); + memory_region_set_enabled(&vdev->pdev.msix_pba_mmio, true); + trace_vfio_msix_pba_enable(vdev->vbasedev.name); + } } else if (vdev->interrupt == VFIO_INT_MSI) { get_msg = msi_get_message; notify = msi_notify; @@ -535,6 +542,14 @@ static int vfio_msix_vector_do_use(PCIDevice *pdev, unsigned int nr, } } + /* Disable PBA emulation when nothing more is pending. */ + clear_bit(nr, vdev->msix->pending); + if (find_first_bit(vdev->msix->pending, + vdev->nr_vectors) == vdev->nr_vectors) { + memory_region_set_enabled(&vdev->pdev.msix_pba_mmio, false); + trace_vfio_msix_pba_disable(vdev->vbasedev.name); + } + return 0; } @@ -738,6 +753,9 @@ static void vfio_msix_disable(VFIOPCIDevice *vdev) vfio_msi_disable_common(vdev); + memset(vdev->msix->pending, 0, + BITS_TO_LONGS(vdev->msix->entries) * sizeof(unsigned long)); + trace_vfio_msix_disable(vdev->vbasedev.name); } @@ -1251,6 +1269,8 @@ static int vfio_msix_setup(VFIOPCIDevice *vdev, int pos) { int ret; + vdev->msix->pending = g_malloc0(BITS_TO_LONGS(vdev->msix->entries) * + sizeof(unsigned long)); ret = msix_init(&vdev->pdev, vdev->msix->entries, &vdev->bars[vdev->msix->table_bar].region.mem, vdev->msix->table_bar, vdev->msix->table_offset, @@ -1264,6 +1284,24 @@ static int vfio_msix_setup(VFIOPCIDevice *vdev, int pos) return ret; } + /* + * The PCI spec suggests that devices provide additional alignment for + * MSI-X structures and avoid overlapping non-MSI-X related registers. + * For an assigned device, this hopefully means that emulation of MSI-X + * structures does not affect the performance of the device. If devices + * fail to provide that alignment, a significant performance penalty may + * result, for instance Mellanox MT27500 VFs: + * http://www.spinics.net/lists/kvm/msg125881.html + * + * The PBA is simply not that important for such a serious regression and + * most drivers do not appear to look at it. The solution for this is to + * disable the PBA MemoryRegion unless it's being used. We disable it + * here and only enable it if a masked vector fires through QEMU. As the + * vector-use notifier is called, which occurs on unmask, we test whether + * PBA emulation is needed and again disable if not. + */ + memory_region_set_enabled(&vdev->pdev.msix_pba_mmio, false); + return 0; } @@ -1275,6 +1313,7 @@ static void vfio_teardown_msi(VFIOPCIDevice *vdev) msix_uninit(&vdev->pdev, &vdev->bars[vdev->msix->table_bar].region.mem, &vdev->bars[vdev->msix->pba_bar].region.mem); + g_free(vdev->msix->pending); } } diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h index f004d52b69..62565878fc 100644 --- a/hw/vfio/pci.h +++ b/hw/vfio/pci.h @@ -95,6 +95,7 @@ typedef struct VFIOMSIXInfo { uint32_t pba_offset; MemoryRegion mmap_mem; void *mmap; + unsigned long *pending; } VFIOMSIXInfo; typedef struct VFIOPCIDevice { |