qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

virtio-blk: enable multiple vectors when using multiple I/O queues

Currently virtio-pci driver hardcoded 2 vectors for virtio-blk device,
for multiple I/O queues scenario, all the I/O queues will share one
interrupt vector, while here, enable multiple vectors according to
the number of I/O queues.

Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

authored by

Changpeng Liu and committed by
Michael S. Tsirkin
0ebf9a74 9d6b9db1

+20 -2
+12 -2
hw/virtio/virtio-pci.c
··· 1932 1932 DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0), 1933 1933 DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, 1934 1934 VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true), 1935 - DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2), 1935 + DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 1936 + DEV_NVECTORS_UNSPECIFIED), 1936 1937 DEFINE_PROP_END_OF_LIST(), 1937 1938 }; 1938 1939 ··· 1940 1941 { 1941 1942 VirtIOBlkPCI *dev = VIRTIO_BLK_PCI(vpci_dev); 1942 1943 DeviceState *vdev = DEVICE(&dev->vdev); 1944 + 1945 + if (vpci_dev->nvectors == DEV_NVECTORS_UNSPECIFIED) { 1946 + vpci_dev->nvectors = dev->vdev.conf.num_queues + 1; 1947 + } 1943 1948 1944 1949 qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); 1945 1950 object_property_set_bool(OBJECT(vdev), true, "realized", errp); ··· 1983 1988 1984 1989 static Property vhost_user_blk_pci_properties[] = { 1985 1990 DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0), 1986 - DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2), 1991 + DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 1992 + DEV_NVECTORS_UNSPECIFIED), 1987 1993 DEFINE_PROP_END_OF_LIST(), 1988 1994 }; 1989 1995 ··· 1991 1997 { 1992 1998 VHostUserBlkPCI *dev = VHOST_USER_BLK_PCI(vpci_dev); 1993 1999 DeviceState *vdev = DEVICE(&dev->vdev); 2000 + 2001 + if (vpci_dev->nvectors == DEV_NVECTORS_UNSPECIFIED) { 2002 + vpci_dev->nvectors = dev->vdev.num_queues + 1; 2003 + } 1994 2004 1995 2005 qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); 1996 2006 object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+8
include/hw/compat.h
··· 6 6 .driver = "hpet",\ 7 7 .property = "hpet-offset-saved",\ 8 8 .value = "false",\ 9 + },{\ 10 + .driver = "virtio-blk-pci",\ 11 + .property = "vectors",\ 12 + .value = "2",\ 13 + },{\ 14 + .driver = "vhost-user-blk-pci",\ 15 + .property = "vectors",\ 16 + .value = "2",\ 9 17 }, 10 18 11 19 #define HW_COMPAT_2_10 \