virtio, pc: fixes, features
The following changes since commit 9a8abceb5f01d1066d3a1ac5a33aabcbaeec1860:
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-docs-20200225' into staging (2020-02-25 11:03:47 +0000)
are available in the Git repository at:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
for you to fetch changes up to afc37debf27ecf34d6bc1d4b52fa0918d0bd3f3c:
Fixed assert in vhost_user_set_mem_table_postcopy (2020-02-25 08:47:47 -0500)
----------------------------------------------------------------
virtio, pc: fixes, features
New virtio iommu.
Unrealize memory leaks.
In-band kick/call support.
Bugfixes, documentation all over the place.
----------------------------------------------------------------
Adrian Moreno (1):
vhost-user: only set slave channel for first vq
Eric Auger (10):
virtio-iommu: Add skeleton
virtio-iommu: Decode the command payload
virtio-iommu: Implement attach/detach command
virtio-iommu: Implement map/unmap
virtio-iommu: Implement translate
virtio-iommu: Implement fault reporting
virtio-iommu: Support migration
virtio-iommu-pci: Add virtio iommu pci support hw/arm/virt: Add the virtio-iommu device tree mappings
MAINTAINERS: add virtio-iommu related files
Igor Mammedov (1):
acpi: cpuhp: document CPHP_GET_CPU_ID_CMD command
Johannes Berg (6):
libvhost-user: implement VHOST_USER_PROTOCOL_F_REPLY_ACK
libvhost-user-glib: fix VugDev main fd cleanup
libvhost-user-glib: use g_main_context_get_thread_default()
libvhost-user: handle NOFD flag in call/kick/err better
docs: vhost-user: add in-band kick/call messages
libvhost-user: implement in-band notifications
Laurent Vivier (2):
tests/vhost-user-bridge: move to contrib/
virtiofsd: add it to the tools list
Michael S. Tsirkin (4):
bios-tables-test: tell people how to update
bios-tables-test: fix up DIFF generation
bios-tables-test: default diff command rebuild-expected-aml.sh: remind about the process
Pan Nengyuan (6):
vhost-user-fs: do delete virtio_queues in unrealize
vhost-user-fs: convert to the new virtio_delete_queue function
virtio-pmem: do delete rq_vq in virtio_pmem_unrealize
virtio-crypto: do delete ctrl_vq in virtio_crypto_device_unrealize
vhost-user-blk: delete virtioqueues in unrealize to fix memleaks
vhost-user-blk: convert to new virtio_delete_queue
Raphael Norwitz (1):
Fixed assert in vhost_user_set_mem_table_postcopy
Stefan Hajnoczi (1):
virtio: gracefully handle invalid region caches
docs/specs/acpi_cpu_hotplug.txt | 2 + configure | 3 + Makefile | 7 +- contrib/libvhost-user/libvhost-user-glib.h | 1 + contrib/libvhost-user/libvhost-user.h | 14 + include/hw/arm/virt.h | 2 + include/hw/pci/pci.h | 1 + include/hw/virtio/vhost-user-blk.h | 3 +- include/hw/virtio/vhost-user-fs.h | 2 + include/hw/virtio/virtio-iommu.h | 61 ++ contrib/libvhost-user/libvhost-user-glib.c | 17 +- contrib/libvhost-user/libvhost-user.c | 139 +++- .../vhost-user-bridge/main.c | 0 contrib/vhost-user-input/main.c | 6 +- hw/arm/virt.c | 57 +- hw/block/vhost-user-blk.c | 23 +- hw/virtio/vhost-user-fs.c | 16 +- hw/virtio/vhost-user.c | 10 +- hw/virtio/virtio-crypto.c | 3 +- hw/virtio/virtio-iommu-pci.c | 104 +++ hw/virtio/virtio-iommu.c | 890 +++++++++++++++++++++ hw/virtio/virtio-pmem.c | 1 + hw/virtio/virtio.c | 99 ++- qdev-monitor.c | 1 + tests/qtest/bios-tables-test.c | 31 +- MAINTAINERS | 6 + Makefile.objs | 1 + contrib/vhost-user-bridge/Makefile.objs | 1 + docs/devel/migration.rst | 2 +- docs/interop/vhost-user.rst | 122 ++- hw/virtio/Kconfig | 5 + hw/virtio/Makefile.objs | 2 + hw/virtio/trace-events | 20 + tests/Makefile.include | 1 - tests/data/acpi/rebuild-expected-aml.sh | 7 + 35 files changed, 1573 insertions(+), 87 deletions(-) create mode 100644 include/hw/virtio/virtio-iommu.h rename tests/vhost-user-bridge.c => contrib/vhost-user-bridge/main.c (100%) create mode 100644 hw/virtio/virtio-iommu-pci.c create mode 100644 hw/virtio/virtio-iommu.c create mode 100644 contrib/vhost-user-bridge/Makefile.objs
[PULL 01/32] bios-tables-test: tell people how to update
For now just a pointer to the source file.
--- tests/qtest/bios-tables-test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tests/qtest/bios-tables-test.c +3 -1
@@ -426,7 +426,9 @@ static void test_acpi_asl(test_data *data)fprintf (stderr,"acpi-test: Warning! %.4s binary file mismatch. " -"Actual [aml:%s], Expected [aml:%s].\n" , +"Actual [aml:%s], Expected [aml:%s].\n" +"See source file tests/qtest/bios-tables-test.c " +"for instructions on how to update expected files.\n" , exp_sdt->aml, sdt->aml_file, exp_sdt->aml_file); all_tables_match = all_tables_match &&
Signature · 1 line
MST
[PULL 02/32] bios-tables-test: fix up DIFF generation
In reply to Michael S. TsirkinTurns out it goes to stdout which is suppressed even with V=1. Force DIFF output to stderr to make it visible.
--- tests/qtest/bios-tables-test.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
tests/qtest/bios-tables-test.c +7 -1
@@ -463,13 +463,19 @@ static void test_acpi_asl(test_data *data)"Actual [asl:%s, aml:%s], Expected [asl:%s, aml:%s].\n" , exp_sdt->aml, sdt->asl_file, sdt->aml_file, exp_sdt->asl_file, exp_sdt->aml_file); +fflush (stderr);if (getenv ("V" )) {const char *diff_cmd =getenv ("DIFF" );if (diff_cmd) { - int ret G_GNUC_UNUSED;char *diff =g_strdup_printf ("%s %s %s" , diff_cmd, exp_sdt->asl_file, sdt->asl_file); +int out =dup (STDOUT_FILENO ); + int ret G_GNUC_UNUSED; + +dup2 (STDERR_FILENO ,STDOUT_FILENO ); ret =system (diff) ; +dup2 (out,STDOUT_FILENO ); +close (out);g_free (diff); }else { fprintf(stderr, "acpi-test: Warning. not showing "
Signature · 1 line
MST
[PULL 03/32] bios-tables-test: default diff command
In reply to Michael S. TsirkinMost people probably just want diff -u. So let's use that as the default.
--- tests/qtest/bios-tables-test.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-)
tests/qtest/bios-tables-test.c +11 -18
@@ -465,25 +465,18 @@ static void test_acpi_asl(test_data *data) exp_sdt->asl_file, exp_sdt->aml_file);fflush (stderr);if (getenv ("V" )) { -const char *diff_cmd =getenv ("DIFF" ); -if (diff_cmd) { -char *diff =g_strdup_printf ("%s %s %s" , diff_cmd, - exp_sdt->asl_file, sdt->asl_file); -int out =dup (STDOUT_FILENO ); - int ret G_GNUC_UNUSED; +const char *diff_env =getenv ("DIFF" ); +const char *diff_cmd = diff_env ? diff_env :"diff -u" ; +char *diff =g_strdup_printf ("%s %s %s" , diff_cmd, + exp_sdt->asl_file, sdt->asl_file); +int out =dup (STDOUT_FILENO ); + int ret G_GNUC_UNUSED; -dup2 (STDERR_FILENO ,STDOUT_FILENO ); - ret =system (diff) ; -dup2 (out,STDOUT_FILENO ); -close (out); -g_free (diff); - }else { -fprintf (stderr,"acpi-test: Warning. not showing " -"difference since no diff utility is specified. " -"Set 'DIFF' environment variable to a preferred " -"diff utility and run 'make V=1 check' again to " -"see ASL difference." ); - } +dup2 (STDERR_FILENO ,STDOUT_FILENO ); + ret =system (diff) ; +dup2 (out,STDOUT_FILENO ); +close (out); +g_free (diff); } } }
Signature · 1 line
MST
[PULL 05/32] vhost-user-fs: do delete virtio_queues in unrealize
In reply to Michael S. TsirkinFrom: Pan Nengyuan <[email protected]>
Similar to other virtio device(https://patchwork.kernel.org/patch/11399237/), virtio queues forgot to delete in unrealize, and aslo error path in realize, this patch fix these memleaks, the leak stack is as follow:
Direct leak of 57344 byte(s) in 1 object(s) allocated from:
#0 0x7f15784fb970 in __interceptor_calloc (/lib64/libasan.so.5+0xef970)
#1 0x7f157790849d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5249d)
#2 0x55587a1bf859 in virtio_add_queue /mnt/sdb/qemu-new/qemu_test/qemu/hw/virtio/virtio.c:2333
#3 0x55587a2071d5 in vuf_device_realize /mnt/sdb/qemu-new/qemu_test/qemu/hw/virtio/vhost-user-fs.c:212
#4 0x55587a1ae360 in virtio_device_realize /mnt/sdb/qemu-new/qemu_test/qemu/hw/virtio/virtio.c:3531
#5 0x55587a63fb7b in device_set_realized /mnt/sdb/qemu-new/qemu_test/qemu/hw/core/qdev.c:891
#6 0x55587acf03f5 in property_set_bool /mnt/sdb/qemu-new/qemu_test/qemu/qom/object.c:2238
#7 0x55587acfce0d in object_property_set_qobject /mnt/sdb/qemu-new/qemu_test/qemu/qom/qom-qobject.c:26
#8 0x55587acf5c8c in object_property_set_bool /mnt/sdb/qemu-new/qemu_test/qemu/qom/object.c:1390
#9 0x55587a8e22a2 in pci_qdev_realize /mnt/sdb/qemu-new/qemu_test/qemu/hw/pci/pci.c:2095
#10 0x55587a63fb7b in device_set_realized /mnt/sdb/qemu-new/qemu_test/qemu/hw/core/qdev.c:891
#11 0x55587acf03f5 in property_set_bool /mnt/sdb/qemu-new/qemu_test/qemu/qom/object.c:2238
#12 0x55587acfce0d in object_property_set_qobject /mnt/sdb/qemu-new/qemu_test/qemu/qom/qom-qobject.c:26
#13 0x55587acf5c8c in object_property_set_bool /mnt/sdb/qemu-new/qemu_test/qemu/qom/object.c:1390
#14 0x55587a496d65 in qdev_device_add /mnt/sdb/qemu-new/qemu_test/qemu/qdev-monitor.c:679Message-Id: <[email protected]>
--- hw/virtio/vhost-user-fs.c | 9 +++++++++ 1 file changed, 9 insertions(+)
hw/virtio/vhost-user-fs.c +9 -0
@@ -230,6 +230,10 @@ static void vuf_device_realize(DeviceState *dev, Error **errp) err_virtio:vhost_user_cleanup (&fs->vhost_user); +virtio_del_queue (vdev,0 ); +for (i =0 ; i < fs->conf.num_request_queues; i++) { +virtio_del_queue (vdev, i +1 ); + }virtio_cleanup (vdev);g_free (fs->vhost_dev.vqs);return ;
@@ -239,6 +243,7 @@ static void vuf_device_unrealize(DeviceState *dev, Error **errp) {VirtIODevice *vdev =VIRTIO_DEVICE (dev);VHostUserFS *fs =VHOST_USER_FS (dev); +int i;/* This will stop vhost backend if appropriate. */ vuf_set_status (vdev,0 );
@@ -247,6 +252,10 @@ static void vuf_device_unrealize(DeviceState *dev, Error **errp)vhost_user_cleanup (&fs->vhost_user); +virtio_del_queue (vdev,0 ); +for (i =0 ; i < fs->conf.num_request_queues; i++) { +virtio_del_queue (vdev, i +1 ); + }virtio_cleanup (vdev);g_free (fs->vhost_dev.vqs); fs->vhost_dev.vqs =NULL ;
Signature · 1 line
MST
[PULL 04/32] rebuild-expected-aml.sh: remind about the process
In reply to Michael S. TsirkinRemind users of rebuild-expected-aml.sh about the process to follow. Suppress the warning if allowed file list exists - that's a big hint user is already aware of the process.
--- tests/data/acpi/rebuild-expected-aml.sh | 7 +++++++ 1 file changed, 7 insertions(+)
tests/data/acpi/rebuild-expected-aml.sh +7 -0
@@ -31,6 +31,13 @@ done eval `grep SRC_PATH= config-host.mak` +old_allowed_dif=`grep -v -e 'List of comma-separated changed AML files to ignore' ${SRC_PATH}/tests/qtest/bios-tables-test-allowed-diff.h` + echo '/* List of comma-separated changed AML files to ignore */' > ${SRC_PATH}/tests/qtest/bios-tables-test-allowed-diff.h echo "The files were rebuilt and can be added to git." + +if [ -z "$old_allowed_dif" ]; then + echo "Note! Please do not commit expected files with source changes" + echo "Note! Please follow the process documented in ${SRC_PATH}/tests/qtest/bios-tables-test.c" +fi
Signature · 1 line
MST
[PULL 06/32] vhost-user-fs: convert to the new virtio_delete_queue function
In reply to Michael S. TsirkinFrom: Pan Nengyuan <[email protected]>
use the new virtio_delete_queue function to cleanup.
Message-Id: <[email protected]>
--- include/hw/virtio/vhost-user-fs.h | 2 ++ hw/virtio/vhost-user-fs.c | 15 +++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-)
include/hw/virtio/vhost-user-fs.h +2 -0
@@ -37,6 +37,8 @@ typedef struct {struct vhost_virtqueue *vhost_vqs;struct vhost_dev vhost_dev;VhostUserState vhost_user; +VirtQueue **req_vqs; +VirtQueue *hiprio_vq;/*< public >*/ } VHostUserFS;
hw/virtio/vhost-user-fs.c +9 -6
@@ -209,11 +209,12 @@ static void vuf_device_realize(DeviceState *dev, Error **errp) sizeof(struct virtio_fs_config));/* Hiprio queue */ -virtio_add_queue (vdev, fs->conf.queue_size, vuf_handle_output); + fs->hiprio_vq =virtio_add_queue (vdev, fs->conf.queue_size, vuf_handle_output);/* Request queues */ + fs->req_vqs = g_new(VirtQueue *, fs->conf.num_request_queues);for (i =0 ; i < fs->conf.num_request_queues; i++) { -virtio_add_queue (vdev, fs->conf.queue_size, vuf_handle_output); + fs->req_vqs[i] =virtio_add_queue (vdev, fs->conf.queue_size, vuf_handle_output); }/* 1 high prio queue, plus the number configured */
@@ -230,10 +231,11 @@ static void vuf_device_realize(DeviceState *dev, Error **errp) err_virtio:vhost_user_cleanup (&fs->vhost_user); -virtio_del_queue (vdev,0 ); +virtio_delete_queue (fs->hiprio_vq);for (i =0 ; i < fs->conf.num_request_queues; i++) { -virtio_del_queue (vdev, i +1 ); +virtio_delete_queue (fs->req_vqs[i]); } +g_free (fs->req_vqs);virtio_cleanup (vdev);g_free (fs->vhost_dev.vqs);return ;
@@ -252,10 +254,11 @@ static void vuf_device_unrealize(DeviceState *dev, Error **errp)vhost_user_cleanup (&fs->vhost_user); -virtio_del_queue (vdev,0 ); +virtio_delete_queue (fs->hiprio_vq);for (i =0 ; i < fs->conf.num_request_queues; i++) { -virtio_del_queue (vdev, i +1 ); +virtio_delete_queue (fs->req_vqs[i]); } +g_free (fs->req_vqs);virtio_cleanup (vdev);g_free (fs->vhost_dev.vqs); fs->vhost_dev.vqs =NULL ;
Signature · 1 line
MST
[PULL 17/32] virtio-iommu: Implement fault reporting
In reply to Michael S. TsirkinFrom: Eric Auger <[email protected]>
The event queue allows to report asynchronous errors. The translate function now injects faults when relevant.
Message-Id: <[email protected]>
--- hw/virtio/virtio-iommu.c | 70 +++++++++++++++++++++++++++++++++++++--- hw/virtio/trace-events | 1 + 2 files changed, 66 insertions(+), 5 deletions(-)
hw/virtio/virtio-iommu.c +65 -5
@@ -468,6 +468,48 @@ out: } } +static void virtio_iommu_report_fault (VirtIOIOMMU *viommu,uint8_t reason, +int flags,uint32_t endpoint, +uint64_t address) +{ +VirtIODevice *vdev = &viommu->parent_obj; +VirtQueue *vq = viommu->event_vq; +struct virtio_iommu_fault fault; +VirtQueueElement *elem; +size_t sz; + +memset (&fault,0 ,sizeof (fault)); + fault.reason = reason; + fault.flags =cpu_to_le32 (flags); + fault.endpoint =cpu_to_le32 (endpoint); + fault.address =cpu_to_le64 (address); + + elem =virtqueue_pop (vq,sizeof (VirtQueueElement)); + +if (!elem) { +error_report_once ( +"no buffer available in event queue to report event" ); +return ; + } + +if (iov_size (elem->in_sg, elem->in_num) <sizeof (fault)) { +virtio_error (vdev,"error buffer of wrong size" ); +virtqueue_detach_element (vq, elem,0 ); +g_free (elem); +return ; + } + + sz =iov_from_buf (elem->in_sg, elem->in_num,0 , + &fault,sizeof (fault)); +assert (sz ==sizeof (fault)); + +trace_virtio_iommu_report_fault (reason, flags, endpoint, address); +virtqueue_push (vq, elem, sz); +virtio_notify (vdev, vq); +g_free (elem); + +} +static IOMMUTLBEntry virtio_iommu_translate (IOMMUMemoryRegion *mr,hwaddr addr,IOMMUAccessFlags flag,int iommu_idx)
@@ -476,9 +518,10 @@ static IOMMUTLBEntry virtio_iommu_translate(IOMMUMemoryRegion *mr, hwaddr addr,VirtIOIOMMUInterval interval, *mapping_key;VirtIOIOMMUMapping *mapping_value;VirtIOIOMMU *s = sdev->viommu; +bool read_fault, write_fault;VirtIOIOMMUEndpoint *ep; +uint32_t sid, flags;bool bypass_allowed; -uint32_t sid;bool found; interval.low = addr;
@@ -504,6 +547,9 @@ static IOMMUTLBEntry virtio_iommu_translate(IOMMUMemoryRegion *mr, hwaddr addr,if (!ep) {if (!bypass_allowed) {error_report_once ("%s sid=%d is not known!!" , __func__, sid); +virtio_iommu_report_fault (s,VIRTIO_IOMMU_FAULT_R_UNKNOWN , +VIRTIO_IOMMU_FAULT_F_ADDRESS , + sid, addr); }else { entry.perm = flag; }
@@ -515,6 +561,9 @@ static IOMMUTLBEntry virtio_iommu_translate(IOMMUMemoryRegion *mr, hwaddr addr,error_report_once ("%s %02x:%02x.%01x not attached to any domain" , __func__,PCI_BUS_NUM (sid),PCI_SLOT (sid),PCI_FUNC (sid)); +virtio_iommu_report_fault (s,VIRTIO_IOMMU_FAULT_R_DOMAIN , +VIRTIO_IOMMU_FAULT_F_ADDRESS , + sid, addr); }else { entry.perm = flag; }
@@ -527,15 +576,26 @@ static IOMMUTLBEntry virtio_iommu_translate(IOMMUMemoryRegion *mr, hwaddr addr,if (!found) {error_report_once ("%s no mapping for 0x%" PRIx64" for sid=%d" , __func__, addr, sid); +virtio_iommu_report_fault (s,VIRTIO_IOMMU_FAULT_R_MAPPING , +VIRTIO_IOMMU_FAULT_F_ADDRESS , + sid, addr); goto unlock; } -if (((flag &IOMMU_RO ) && - !(mapping_value->flags &VIRTIO_IOMMU_MAP_F_READ )) || - ((flag &IOMMU_WO ) && - !(mapping_value->flags &VIRTIO_IOMMU_MAP_F_WRITE ))) { + read_fault = (flag &IOMMU_RO ) && + !(mapping_value->flags &VIRTIO_IOMMU_MAP_F_READ ); + write_fault = (flag &IOMMU_WO ) && + !(mapping_value->flags &VIRTIO_IOMMU_MAP_F_WRITE ); + + flags = read_fault ?VIRTIO_IOMMU_FAULT_F_READ :0 ; + flags |= write_fault ?VIRTIO_IOMMU_FAULT_F_WRITE :0 ; +if (flags) {error_report_once ("%s permission error on 0x%" PRIx64"(%d): allowed=%d" , __func__, addr, flag, mapping_value->flags); + flags |=VIRTIO_IOMMU_FAULT_F_ADDRESS ; +virtio_iommu_report_fault (s,VIRTIO_IOMMU_FAULT_R_MAPPING , + flags |VIRTIO_IOMMU_FAULT_F_ADDRESS , + sid, addr); goto unlock; } entry.translated_addr = addr - mapping_key->low + mapping_value->phys_addr;
hw/virtio/trace-events +1 -0
@@ -72,3 +72,4 @@ virtio_iommu_put_endpoint(uint32_t ep_id) "Free endpoint=%d" virtio_iommu_get_domain(uint32_t domain_id) "Alloc domain=%d" virtio_iommu_put_domain(uint32_t domain_id) "Free domain=%d" virtio_iommu_translate_out(uint64_t virt_addr, uint64_t phys_addr, uint32_t sid) "0x%"PRIx64" -> 0x%"PRIx64 " for sid=%d" +virtio_iommu_report_fault(uint8_t reason, uint32_t flags, uint32_t endpoint, uint64_t addr) "FAULT reason=%d flags=%d endpoint=%d address =0x%"PRIx64
Signature · 1 line
MST
[PULL 09/32] vhost-user-blk: delete virtioqueues in unrealize to fix memleaks
In reply to Michael S. TsirkinFrom: Pan Nengyuan <[email protected]>
virtio queues forgot to delete in unrealize, and aslo error path in realize, this patch fix these memleaks, the leak stack is as follow:
Direct leak of 114688 byte(s) in 16 object(s) allocated from:
#0 0x7f24024fdbf0 in calloc (/lib64/libasan.so.3+0xcabf0)
#1 0x7f2401642015 in g_malloc0 (/lib64/libglib-2.0.so.0+0x50015)
#2 0x55ad175a6447 in virtio_add_queue /mnt/sdb/qemu/hw/virtio/virtio.c:2327
#3 0x55ad17570cf9 in vhost_user_blk_device_realize /mnt/sdb/qemu/hw/block/vhost-user-blk.c:419
#4 0x55ad175a3707 in virtio_device_realize /mnt/sdb/qemu/hw/virtio/virtio.c:3509
#5 0x55ad176ad0d1 in device_set_realized /mnt/sdb/qemu/hw/core/qdev.c:876
#6 0x55ad1781ff9d in property_set_bool /mnt/sdb/qemu/qom/object.c:2080
#7 0x55ad178245ae in object_property_set_qobject /mnt/sdb/qemu/qom/qom-qobject.c:26
#8 0x55ad17821eb4 in object_property_set_bool /mnt/sdb/qemu/qom/object.c:1338
#9 0x55ad177aeed7 in virtio_pci_realize /mnt/sdb/qemu/hw/virtio/virtio-pci.c:1801Message-Id: <[email protected]>
--- hw/block/vhost-user-blk.c | 8 ++++++++ 1 file changed, 8 insertions(+)
hw/block/vhost-user-blk.c +8 -0
@@ -460,6 +460,9 @@ reconnect: virtio_err:g_free (s->vqs);g_free (s->inflight); +for (i =0 ; i < s->num_queues; i++) { +virtio_del_queue (vdev, i); + }virtio_cleanup (vdev);vhost_user_cleanup (&s->vhost_user); }
@@ -468,6 +471,7 @@ static void vhost_user_blk_device_unrealize(DeviceState *dev, Error **errp) {VirtIODevice *vdev =VIRTIO_DEVICE (dev);VHostUserBlk *s =VHOST_USER_BLK (dev); +int i;virtio_set_status (vdev,0 ); qemu_chr_fe_set_handlers(&s->chardev, NULL, NULL, NULL,
@@ -476,6 +480,10 @@ static void vhost_user_blk_device_unrealize(DeviceState *dev, Error **errp)vhost_dev_free_inflight (s->inflight);g_free (s->vqs);g_free (s->inflight); + +for (i =0 ; i < s->num_queues; i++) { +virtio_del_queue (vdev, i); + }virtio_cleanup (vdev);vhost_user_cleanup (&s->vhost_user); }
Signature · 1 line
MST
[PULL 10/32] vhost-user-blk: convert to new virtio_delete_queue
In reply to Michael S. TsirkinFrom: Pan Nengyuan <[email protected]>
use the new virtio_delete_queue function to cleanup.
Message-Id: <[email protected]>
--- include/hw/virtio/vhost-user-blk.h | 3 ++- hw/block/vhost-user-blk.c | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-)
include/hw/virtio/vhost-user-blk.h +2 -1
@@ -36,7 +36,8 @@ typedef struct VHostUserBlk {struct vhost_dev dev;struct vhost_inflight *inflight;VhostUserState vhost_user; -struct vhost_virtqueue *vqs; +struct vhost_virtqueue *vhost_vqs; +VirtQueue **virtqs;guint watch;bool connected; } VHostUserBlk;
hw/block/vhost-user-blk.c +11 -8
@@ -306,7 +306,7 @@ static int vhost_user_blk_connect(DeviceState *dev) s->connected = true; s->dev.nvqs = s->num_queues; - s->dev.vqs = s->vqs; + s->dev.vqs = s->vhost_vqs; s->dev.vq_index =0 ; s->dev.backend_features =0 ;
@@ -420,13 +420,14 @@ static void vhost_user_blk_device_realize(DeviceState *dev, Error **errp)virtio_init (vdev,"virtio-blk" ,VIRTIO_ID_BLOCK ,sizeof (struct virtio_blk_config )); + s->virtqs = g_new(VirtQueue *, s->num_queues);for (i =0 ; i < s->num_queues; i++) { -virtio_add_queue (vdev, s->queue_size, - vhost_user_blk_handle_output); + s->virtqs[i] =virtio_add_queue (vdev, s->queue_size, + vhost_user_blk_handle_output); } s->inflight = g_new0(struct vhost_inflight, 1); - s->vqs = g_new0(struct vhost_virtqueue, s->num_queues); + s->vhost_vqs = g_new0(struct vhost_virtqueue, s->num_queues); s->watch =0 ; s->connected = false;
@@ -458,11 +459,12 @@ reconnect:return ; virtio_err: -g_free (s->vqs); +g_free (s->vhost_vqs);g_free (s->inflight);for (i =0 ; i < s->num_queues; i++) { -virtio_del_queue (vdev, i); +virtio_delete_queue (s->virtqs[i]); } +g_free (s->virtqs);virtio_cleanup (vdev);vhost_user_cleanup (&s->vhost_user); }
@@ -478,12 +480,13 @@ static void vhost_user_blk_device_unrealize(DeviceState *dev, Error **errp) NULL, NULL, NULL, false);vhost_dev_cleanup (&s->dev);vhost_dev_free_inflight (s->inflight); -g_free (s->vqs); +g_free (s->vhost_vqs);g_free (s->inflight);for (i =0 ; i < s->num_queues; i++) { -virtio_del_queue (vdev, i); +virtio_delete_queue (s->virtqs[i]); } +g_free (s->virtqs);virtio_cleanup (vdev);vhost_user_cleanup (&s->vhost_user); }
Signature · 1 line
MST
[PULL 07/32] virtio-pmem: do delete rq_vq in virtio_pmem_unrealize
In reply to Michael S. TsirkinFrom: Pan Nengyuan <[email protected]>
Similar to other virtio-devices, rq_vq forgot to delete in virtio_pmem_unrealize, this patch fix it. This device has already maintained a vq pointer, thus we use the new virtio_delete_queue function directly to do the cleanup.
Message-Id: <[email protected]>
--- hw/virtio/virtio-pmem.c | 1 + 1 file changed, 1 insertion(+)
hw/virtio/virtio-pmem.c +1 -0
@@ -130,6 +130,7 @@ static void virtio_pmem_unrealize(DeviceState *dev, Error **errp)VirtIOPMEM *pmem =VIRTIO_PMEM (dev);host_memory_backend_set_mapped (pmem->memdev, false); +virtio_delete_queue (pmem->rq_vq);virtio_cleanup (vdev); }
Signature · 1 line
MST
[PULL 24/32] libvhost-user-glib: use g_main_context_get_thread_default()
In reply to Michael S. TsirkinFrom: Johannes Berg <[email protected]>
If we use NULL, we just get the main program default mainloop here. Using g_main_context_get_thread_default() has basically the same effect, but it lets us start different devices in different threads with different mainloops, which can be useful.
Message-Id: <[email protected]>
--- contrib/libvhost-user/libvhost-user-glib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/libvhost-user/libvhost-user-glib.c +1 -1
@@ -89,7 +89,7 @@ vug_source_new(VugDev *gdev, int fd, GIOCondition cond, src->gfd.events = cond;g_source_add_poll (gsrc, &src->gfd); - id =g_source_attach (gsrc,NULL ); + id =g_source_attach (gsrc,g_main_context_get_thread_default ());g_assert (id);return gsrc;
Signature · 1 line
MST
[PULL 19/32] virtio-iommu-pci: Add virtio iommu pci support
In reply to Michael S. TsirkinFrom: Eric Auger <[email protected]>
This patch adds virtio-iommu-pci, which is the pci proxy for the virtio-iommu device.
Currently non DT integration is not yet supported by the kernel. So the machine must implement a hotplug handler for the virtio-iommu-pci device that creates the device tree iommu-map bindings as documented in kernel documentation:
Documentation/devicetree/bindings/virtio/iommu.txt
Message-Id: <[email protected]>
--- include/hw/pci/pci.h | 1 + include/hw/virtio/virtio-iommu.h | 1 + hw/virtio/virtio-iommu-pci.c | 104 +++++++++++++++++++++++++++++++ qdev-monitor.c | 1 + hw/virtio/Makefile.objs | 1 + 5 files changed, 108 insertions(+) create mode 100644 hw/virtio/virtio-iommu-pci.c
include/hw/pci/pci.h +1 -0
@@ -86,6 +86,7 @@ extern bool pci_available;#define PCI_DEVICE_ID_VIRTIO_9P 0x1009#define PCI_DEVICE_ID_VIRTIO_VSOCK 0x1012#define PCI_DEVICE_ID_VIRTIO_PMEM 0x1013 +#define PCI_DEVICE_ID_VIRTIO_IOMMU 0x1014#define PCI_VENDOR_ID_REDHAT 0x1b36#define PCI_DEVICE_ID_REDHAT_BRIDGE 0x0001
include/hw/virtio/virtio-iommu.h +1 -0
@@ -25,6 +25,7 @@#include "hw/pci/pci.h" #define TYPE_VIRTIO_IOMMU "virtio-iommu-device" +#define TYPE_VIRTIO_IOMMU_PCI "virtio-iommu-device-base"#define VIRTIO_IOMMU (obj) \ OBJECT_CHECK(VirtIOIOMMU, (obj), TYPE_VIRTIO_IOMMU)
hw/virtio/virtio-iommu-pci.c new file +104 -0
104 lines not on this page · raw message
qdev-monitor.c +1 -0
@@ -67,6 +67,7 @@ static const QDevAlias qdev_alias_table[] = { { "virtio-input-host-ccw", "virtio-input-host", QEMU_ARCH_S390X }, { "virtio-input-host-pci", "virtio-input-host", QEMU_ARCH_ALL & ~QEMU_ARCH_S390X }, + { "virtio-iommu-pci", "virtio-iommu", QEMU_ARCH_ALL & ~QEMU_ARCH_S390X }, { "virtio-keyboard-ccw", "virtio-keyboard", QEMU_ARCH_S390X }, { "virtio-keyboard-pci", "virtio-keyboard", QEMU_ARCH_ALL & ~QEMU_ARCH_S390X },
hw/virtio/Makefile.objs +1 -0
@@ -29,6 +29,7 @@ obj-$(CONFIG_VIRTIO_INPUT_HOST) += virtio-input-host-pci.o obj-$(CONFIG_VIRTIO_INPUT) += virtio-input-pci.o obj-$(CONFIG_VIRTIO_RNG) += virtio-rng-pci.o obj-$(CONFIG_VIRTIO_BALLOON) += virtio-balloon-pci.o +obj-$(CONFIG_VIRTIO_IOMMU) += virtio-iommu-pci.o obj-$(CONFIG_VIRTIO_9P) += virtio-9p-pci.o obj-$(CONFIG_VIRTIO_SCSI) += virtio-scsi-pci.o obj-$(CONFIG_VIRTIO_BLK) += virtio-blk-pci.o
Signature · 1 line
MST
[PULL 15/32] virtio-iommu: Implement map/unmap
In reply to Michael S. TsirkinFrom: Eric Auger <[email protected]>
This patch implements virtio_iommu_map/unmap.
Message-Id: <[email protected]>
--- hw/virtio/virtio-iommu.c | 63 ++++++++++++++++++++++++++++++++++++++-- hw/virtio/trace-events | 1 + 2 files changed, 62 insertions(+), 2 deletions(-)
hw/virtio/virtio-iommu.c +61 -2
@@ -18,6 +18,7 @@*/ #include "qemu/osdep.h" +#include "qemu/log.h" #include "qemu/iov.h" #include "qemu-common.h" #include "hw/qdev-properties.h"
@@ -55,6 +56,11 @@ typedef struct VirtIOIOMMUInterval {uint64_t high; } VirtIOIOMMUInterval; +typedef struct VirtIOIOMMUMapping { +uint64_t phys_addr; +uint32_t flags; +}VirtIOIOMMUMapping ; +static inline uint16_t virtio_iommu_get_bdf (IOMMUDevice *dev) {return PCI_BUILD_BDF (pci_bus_num (dev->bus), dev->devfn);
@@ -301,10 +307,39 @@ static int virtio_iommu_map(VirtIOIOMMU *s,uint64_t virt_start =le64_to_cpu (req->virt_start);uint64_t virt_end =le64_to_cpu (req->virt_end);uint32_t flags =le32_to_cpu (req->flags); +VirtIOIOMMUDomain *domain; +VirtIOIOMMUInterval *interval; +VirtIOIOMMUMapping *mapping; + +if (flags & ~VIRTIO_IOMMU_MAP_F_MASK ) { +return VIRTIO_IOMMU_S_INVAL ; + } + + domain =g_tree_lookup (s->domains,GUINT_TO_POINTER (domain_id)); +if (!domain) { +return VIRTIO_IOMMU_S_NOENT ; + } + + interval =g_malloc0 (sizeof (*interval)); + + interval->low = virt_start; + interval->high = virt_end; + + mapping =g_tree_lookup (domain->mappings, (gpointer )interval); +if (mapping) { +g_free (interval); +return VIRTIO_IOMMU_S_INVAL ; + }trace_virtio_iommu_map (domain_id, virt_start, virt_end, phys_start, flags); -return VIRTIO_IOMMU_S_UNSUPP ; + mapping =g_malloc0 (sizeof (*mapping)); + mapping->phys_addr = phys_start; + mapping->flags = flags; + +g_tree_insert (domain->mappings, interval, mapping); + +return VIRTIO_IOMMU_S_OK ; } static int virtio_iommu_unmap(VirtIOIOMMU *s,
@@ -313,10 +348,34 @@ static int virtio_iommu_unmap(VirtIOIOMMU *s,uint32_t domain_id =le32_to_cpu (req->domain);uint64_t virt_start =le64_to_cpu (req->virt_start);uint64_t virt_end =le64_to_cpu (req->virt_end); +VirtIOIOMMUMapping *iter_val; +VirtIOIOMMUInterval interval, *iter_key; +VirtIOIOMMUDomain *domain; +int ret =VIRTIO_IOMMU_S_OK ;trace_virtio_iommu_unmap (domain_id, virt_start, virt_end); -return VIRTIO_IOMMU_S_UNSUPP ; + domain =g_tree_lookup (s->domains,GUINT_TO_POINTER (domain_id)); +if (!domain) { +return VIRTIO_IOMMU_S_NOENT ; + } + interval.low = virt_start; + interval.high = virt_end; + +while (g_tree_lookup_extended (domain->mappings, &interval, + (void **)&iter_key, (void **)&iter_val)) { +uint64_t current_low = iter_key->low; +uint64_t current_high = iter_key->high; + +if (interval.low <= current_low && interval.high >= current_high) { +g_tree_remove (domain->mappings, iter_key); +trace_virtio_iommu_unmap_done (domain_id, current_low, current_high); + }else { + ret =VIRTIO_IOMMU_S_RANGE ; +break ; + } + } +return ret; } static int virtio_iommu_iov_to_req(struct iovec *iov,
hw/virtio/trace-events +1 -0
@@ -64,6 +64,7 @@ virtio_iommu_attach(uint32_t domain_id, uint32_t ep_id) "domain=%d endpoint=%d" virtio_iommu_detach(uint32_t domain_id, uint32_t ep_id) "domain=%d endpoint=%d" virtio_iommu_map(uint32_t domain_id, uint64_t virt_start, uint64_t virt_end, uint64_t phys_start, uint32_t flags) "domain=%d virt_start=0x%"PRIx64" virt_end=0x%"PRIx64 " phys_start=0x%"PRIx64" flags=%d" virtio_iommu_unmap(uint32_t domain_id, uint64_t virt_start, uint64_t virt_end) "domain=%d virt_start=0x%"PRIx64" virt_end=0x%"PRIx64 +virtio_iommu_unmap_done(uint32_t domain_id, uint64_t virt_start, uint64_t virt_end) "domain=%d virt_start=0x%"PRIx64" virt_end=0x%"PRIx64 virtio_iommu_translate(const char *name, uint32_t rid, uint64_t iova, int flag) "mr=%s rid=%d addr=0x%"PRIx64" flag=%d" virtio_iommu_init_iommu_mr(char *iommu_mr) "init %s" virtio_iommu_get_endpoint(uint32_t ep_id) "Alloc endpoint=%d"
Signature · 1 line
MST
[PULL 08/32] virtio-crypto: do delete ctrl_vq in virtio_crypto_device_unrealize
In reply to Michael S. TsirkinFrom: Pan Nengyuan <[email protected]>
Similar to other virtio-deivces, ctrl_vq forgot to delete in virtio_crypto_device_unrealize, this patch fix it. This device has aleardy maintained vq pointers. Thus, we use the new virtio_delete_queue function directly to do the cleanup.
The leak stack:
Direct leak of 10752 byte(s) in 3 object(s) allocated from:
#0 0x7f4c024b1970 in __interceptor_calloc (/lib64/libasan.so.5+0xef970)
#1 0x7f4c018be49d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5249d)
#2 0x55a2f8017279 in virtio_add_queue /mnt/sdb/qemu-new/qemu_test/qemu/hw/virtio/virtio.c:2333
#3 0x55a2f8057035 in virtio_crypto_device_realize /mnt/sdb/qemu-new/qemu_test/qemu/hw/virtio/virtio-crypto.c:814
#4 0x55a2f8005d80 in virtio_device_realize /mnt/sdb/qemu-new/qemu_test/qemu/hw/virtio/virtio.c:3531
#5 0x55a2f8497d1b in device_set_realized /mnt/sdb/qemu-new/qemu_test/qemu/hw/core/qdev.c:891
#6 0x55a2f8b48595 in property_set_bool /mnt/sdb/qemu-new/qemu_test/qemu/qom/object.c:2238
#7 0x55a2f8b54fad in object_property_set_qobject /mnt/sdb/qemu-new/qemu_test/qemu/qom/qom-qobject.c:26
#8 0x55a2f8b4de2c in object_property_set_bool /mnt/sdb/qemu-new/qemu_test/qemu/qom/object.c:1390
#9 0x55a2f80609c9 in virtio_crypto_pci_realize /mnt/sdb/qemu-new/qemu_test/qemu/hw/virtio/virtio-crypto-pci.c:58Message-Id: <[email protected]>
--- hw/virtio/virtio-crypto.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/virtio/virtio-crypto.c +2 -1
@@ -831,12 +831,13 @@ static void virtio_crypto_device_unrealize(DeviceState *dev, Error **errp) max_queues = vcrypto->multiqueue ? vcrypto->max_queues :1 ;for (i =0 ; i < max_queues; i++) { -virtio_del_queue (vdev, i); +virtio_delete_queue (vcrypto->vqs[i].dataq); q = &vcrypto->vqs[i];qemu_bh_delete (q->dataq_bh); }g_free (vcrypto->vqs); +virtio_delete_queue (vcrypto->ctrl_vq);virtio_cleanup (vdev);cryptodev_backend_set_used (vcrypto->cryptodev, false);
Signature · 1 line
MST
[PULL 29/32] vhost-user: only set slave channel for first vq
In reply to Michael S. TsirkinFrom: Adrian Moreno <[email protected]>
When multiqueue is enabled, a vhost_dev is created for each queue pair. However, only one slave channel is needed.
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
hw/virtio/vhost-user.c +5 -3
@@ -1458,9 +1458,11 @@ static int vhost_user_backend_init(struct vhost_dev *dev, void *opaque) "VHOST_USER_PROTOCOL_F_LOG_SHMFD feature."); } - err =vhost_setup_slave_channel (dev); -if (err <0 ) { -return err; +if (dev->vq_index ==0 ) { + err =vhost_setup_slave_channel (dev); +if (err <0 ) { +return err; + } } u->postcopy_notifier.notify = vhost_user_postcopy_notifier;
Signature · 1 line
MST
[PULL 20/32] hw/arm/virt: Add the virtio-iommu device tree mappings
In reply to Michael S. TsirkinFrom: Eric Auger <[email protected]>
Adds the "virtio,pci-iommu" node in the host bridge node and the RID mapping, excluding the IOMMU RID.
This is done in the virtio-iommu-pci hotplug handler which gets called only if no firmware is loaded or if -no-acpi is passed on the command line. As non DT integration is not yet supported by the kernel we must make sure we are in DT mode. This limitation will be removed as soon as the topology description feature gets supported.
Message-Id: <[email protected]>
--- include/hw/arm/virt.h | 2 ++ hw/arm/virt.c | 57 +++++++++++++++++++++++++++++++++++++------ 2 files changed, 52 insertions(+), 7 deletions(-)
include/hw/arm/virt.h +2 -0
@@ -125,8 +125,10 @@ typedef struct {bool virt;int32_t gic_version;VirtIOMMUType iommu; +uint16_t virtio_iommu_bdf;struct arm_boot_info bootinfo;MemMapEntry *memmap; +char *pciehb_nodename;const int *irqmap;int smp_cpus;void *fdt;
hw/arm/virt.c +50 -7
107 lines not on this page · raw message
Signature · 1 line
MST
[PULL 16/32] virtio-iommu: Implement translate
In reply to Michael S. TsirkinFrom: Eric Auger <[email protected]>
This patch implements the translate callback
Message-Id: <[email protected]>
--- hw/virtio/virtio-iommu.c | 60 +++++++++++++++++++++++++++++++++++++++- hw/virtio/trace-events | 1 + 2 files changed, 60 insertions(+), 1 deletion(-)
hw/virtio/virtio-iommu.c +59 -1
@@ -473,19 +473,77 @@ static IOMMUTLBEntry virtio_iommu_translate(IOMMUMemoryRegion *mr, hwaddr addr, int iommu_idx) {IOMMUDevice *sdev =container_of (mr, IOMMUDevice, iommu_mr); +VirtIOIOMMUInterval interval, *mapping_key; +VirtIOIOMMUMapping *mapping_value; +VirtIOIOMMU *s = sdev->viommu; +VirtIOIOMMUEndpoint *ep; +bool bypass_allowed;uint32_t sid; +bool found; + + interval.low = addr; + interval.high = addr +1 ;IOMMUTLBEntry entry = { .target_as = &address_space_memory, .iova = addr, .translated_addr = addr, - .addr_mask = ~(hwaddr )0 , + .addr_mask = (1 <<ctz32 (s->config.page_size_mask)) -1 , .perm =IOMMU_NONE , }; + bypass_allowed =virtio_vdev_has_feature (&s->parent_obj, +VIRTIO_IOMMU_F_BYPASS ); + sid =virtio_iommu_get_bdf (sdev);trace_virtio_iommu_translate (mr->parent_obj.name, sid, addr, flag); +qemu_mutex_lock (&s->mutex); + + ep =g_tree_lookup (s->endpoints,GUINT_TO_POINTER (sid)); +if (!ep) { +if (!bypass_allowed) { +error_report_once ("%s sid=%d is not known!!" , __func__, sid); + }else { + entry.perm = flag; + } + goto unlock; + } + +if (!ep->domain) { +if (!bypass_allowed) { +error_report_once ("%s %02x:%02x.%01x not attached to any domain" , + __func__,PCI_BUS_NUM (sid), +PCI_SLOT (sid),PCI_FUNC (sid)); + }else { + entry.perm = flag; + } + goto unlock; + } + + found =g_tree_lookup_extended (ep->domain->mappings, (gpointer)(&interval), + (void **)&mapping_key, + (void **)&mapping_value); +if (!found) { +error_report_once ("%s no mapping for 0x%" PRIx64" for sid=%d" , + __func__, addr, sid); + goto unlock; + } + +if (((flag &IOMMU_RO ) && + !(mapping_value->flags &VIRTIO_IOMMU_MAP_F_READ )) || + ((flag &IOMMU_WO ) && + !(mapping_value->flags &VIRTIO_IOMMU_MAP_F_WRITE ))) { +error_report_once ("%s permission error on 0x%" PRIx64"(%d): allowed=%d" , + __func__, addr, flag, mapping_value->flags); + goto unlock; + } + entry.translated_addr = addr - mapping_key->low + mapping_value->phys_addr; + entry.perm = flag; +trace_virtio_iommu_translate_out (addr, entry.translated_addr, sid); + +unlock: +qemu_mutex_unlock (&s->mutex);return entry; }
hw/virtio/trace-events +1 -0
@@ -71,3 +71,4 @@ virtio_iommu_get_endpoint(uint32_t ep_id) "Alloc endpoint=%d" virtio_iommu_put_endpoint(uint32_t ep_id) "Free endpoint=%d" virtio_iommu_get_domain(uint32_t domain_id) "Alloc domain=%d" virtio_iommu_put_domain(uint32_t domain_id) "Free domain=%d" +virtio_iommu_translate_out(uint64_t virt_addr, uint64_t phys_addr, uint32_t sid) "0x%"PRIx64" -> 0x%"PRIx64 " for sid=%d"
Signature · 1 line
MST
[PULL 11/32] virtio: gracefully handle invalid region caches
In reply to Michael S. TsirkinFrom: Stefan Hajnoczi <[email protected]>
The virtqueue code sets up MemoryRegionCaches to access the virtqueue guest RAM data structures. The code currently assumes that VRingMemoryRegionCaches is initialized before device emulation code accesses the virtqueue. An assertion will fail in vring_get_region_caches() when this is not true. Device fuzzing found a case where this assumption is false (see below).
Virtqueue guest RAM addresses can also be changed from a vCPU thread while an IOThread is accessing the virtqueue. This breaks the same assumption but this time the caches could become invalid partway through the virtqueue code. The code fetches the caches RCU pointer multiple times so we will need to validate the pointer every time it is fetched.
Add checks each time we call vring_get_region_caches() and treat invalid caches as a nop: memory stores are ignored and memory reads return 0.
The fuzz test failure is as follows:
$ qemu -M pc -device virtio-blk-pci,id=drv0,drive=drive0,addr=4.0 \
-drive if=none,id=drive0,file=null-co://,format=raw,auto-read-only=off \
-drive if=none,id=drive1,file=null-co://,file.read-zeroes=on,format=raw \
-display none \
-qtest stdio
endianness
outl 0xcf8 0x80002020
outl 0xcfc 0xe0000000
outl 0xcf8 0x80002004
outw 0xcfc 0x7
write 0xe0000000 0x24 0x00ffffffabffffffabffffffabffffffabffffffabffffffabffffffabffffffabffffffabffffffabffffffabffffffabffffffabffffffab5cffffffabffffffabffffffabffffffabffffffabffffffabffffffabffffffabffffffabffffffabffffffabffffffabffffffabffffffabffffffab0000000001
inb 0x4
writew 0xe000001c 0x1
write 0xe0000014 0x1 0x0dThe following error message is produced:
qemu-system-x86_64: /home/stefanha/qemu/hw/virtio/virtio.c:286: vring_get_region_caches: Assertion `caches != NULL' failed.
The backtrace looks like this:
#0 0x00007ffff5520625 in raise () at /lib64/libc.so.6 #1 0x00007ffff55098d9 in abort () at /lib64/libc.so.6 #2 0x00007ffff55097a9 in _nl_load_domain.cold () at /lib64/libc.so.6 #3 0x00007ffff5518a66 in annobin_assert.c_end () at /lib64/libc.so.6 #4 0x00005555559073da in vring_get_region_caches (vq=<optimized out>) at qemu/hw/virtio/virtio.c:286 #5 vring_get_region_caches (vq=<optimized out>) at qemu/hw/virtio/virtio.c:283 #6 0x000055555590818d in vring_used_flags_set_bit (mask=1, vq=0x5555575ceea0) at qemu/hw/virtio/virtio.c:398 #7 virtio_queue_split_set_notification (enable=0, vq=0x5555575ceea0) at qemu/hw/virtio/virtio.c:398 #8 virtio_queue_set_notification (vq=vq@entry=0x5555575ceea0, enable=enable@entry=0) at qemu/hw/virtio/virtio.c:451 #9 0x0000555555908512 in virtio_queue_set_notification (vq=vq@entry=0x5555575ceea0, enable=enable@entry=0) at qemu/hw/virtio/virtio.c:444
#10 0x00005555558c697a in virtio_blk_handle_vq (s=0x5555575c57e0, vq=0x5555575ceea0) at qemu/hw/block/virtio-blk.c:775 #11 0x0000555555907836 in virtio_queue_notify_aio_vq (vq=0x5555575ceea0) at qemu/hw/virtio/virtio.c:2244
#12 0x0000555555cb5dd7 in aio_dispatch_handlers (ctx=ctx@entry=0x55555671a420) at util/aio-posix.c:429
#13 0x0000555555cb67a8 in aio_dispatch (ctx=0x55555671a420) at util/aio-posix.c:460
#14 0x0000555555cb307e in aio_ctx_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at util/async.c:260 #15 0x00007ffff7bbc510 in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
#16 0x0000555555cb5848 in glib_pollfds_poll () at util/main-loop.c:219
#17 os_host_main_loop_wait (timeout=<optimized out>) at util/main-loop.c:242
#18 main_loop_wait (nonblocking=<optimized out>) at util/main-loop.c:518
#19 0x00005555559b20c9 in main_loop () at vl.c:1683
#20 0x0000555555838115 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:4441
Message-Id: <[email protected]>
--- hw/virtio/virtio.c | 99 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 91 insertions(+), 8 deletions(-)
hw/virtio/virtio.c +91 -8
@@ -282,15 +282,19 @@ static void vring_packed_flags_write(VirtIODevice *vdev,/* Called within rcu_read_lock(). */ static VRingMemoryRegionCaches *vring_get_region_caches (struct VirtQueue *vq) { -VRingMemoryRegionCaches *caches =atomic_rcu_read (&vq->vring.caches); -assert (caches !=NULL ); -return caches; +return atomic_rcu_read (&vq->vring.caches); } +/* Called within rcu_read_lock(). */ static inline uint16_t vring_avail_flags (VirtQueue *vq) {VRingMemoryRegionCaches *caches =vring_get_region_caches (vq);hwaddr pa = offsetof(VRingAvail , flags); + +if (!caches) { +return 0 ; + } +return virtio_lduw_phys_cached (vq->vdev, &caches->avail, pa); }
@@ -299,6 +303,11 @@ static inline uint16_t vring_avail_idx(VirtQueue *vq) {VRingMemoryRegionCaches *caches =vring_get_region_caches (vq);hwaddr pa = offsetof(VRingAvail , idx); + +if (!caches) { +return 0 ; + } + vq->shadow_avail_idx =virtio_lduw_phys_cached (vq->vdev, &caches->avail, pa);return vq->shadow_avail_idx; }
@@ -308,6 +317,11 @@ static inline uint16_t vring_avail_ring(VirtQueue *vq, int i) {VRingMemoryRegionCaches *caches =vring_get_region_caches (vq); hwaddr pa = offsetof(VRingAvail, ring[i]); + +if (!caches) { +return 0 ; + } +return virtio_lduw_phys_cached (vq->vdev, &caches->avail, pa); }
@@ -323,6 +337,11 @@ static inline void vring_used_write(VirtQueue *vq, VRingUsedElem *uelem, {VRingMemoryRegionCaches *caches =vring_get_region_caches (vq); hwaddr pa = offsetof(VRingUsed, ring[i]); + +if (!caches) { +return ; + } +virtio_tswap32s (vq->vdev, &uelem->id);virtio_tswap32s (vq->vdev, &uelem->len);address_space_write_cached (&caches->used, pa, uelem,sizeof (VRingUsedElem));
@@ -334,6 +353,11 @@ static uint16_t vring_used_idx(VirtQueue *vq) {VRingMemoryRegionCaches *caches =vring_get_region_caches (vq);hwaddr pa = offsetof(VRingUsed , idx); + +if (!caches) { +return 0 ; + } +return virtio_lduw_phys_cached (vq->vdev, &caches->used, pa); }
@@ -342,8 +366,12 @@ static inline void vring_used_idx_set(VirtQueue *vq, uint16_t val) {VRingMemoryRegionCaches *caches =vring_get_region_caches (vq);hwaddr pa = offsetof(VRingUsed , idx); -virtio_stw_phys_cached (vq->vdev, &caches->used, pa, val); -address_space_cache_invalidate (&caches->used, pa,sizeof (val)); + +if (caches) { +virtio_stw_phys_cached (vq->vdev, &caches->used, pa, val); +address_space_cache_invalidate (&caches->used, pa,sizeof (val)); + } + vq->used_idx = val; }
@@ -353,8 +381,13 @@ static inline void vring_used_flags_set_bit(VirtQueue *vq, int mask)VRingMemoryRegionCaches *caches =vring_get_region_caches (vq);VirtIODevice *vdev = vq->vdev;hwaddr pa = offsetof(VRingUsed , flags); -uint16_t flags =virtio_lduw_phys_cached (vq->vdev, &caches->used, pa); +uint16_t flags; +if (!caches) { +return ; + } + + flags =virtio_lduw_phys_cached (vq->vdev, &caches->used, pa);virtio_stw_phys_cached (vdev, &caches->used, pa, flags | mask);address_space_cache_invalidate (&caches->used, pa,sizeof (flags)); }
@@ -365,8 +398,13 @@ static inline void vring_used_flags_unset_bit(VirtQueue *vq, int mask)VRingMemoryRegionCaches *caches =vring_get_region_caches (vq);VirtIODevice *vdev = vq->vdev;hwaddr pa = offsetof(VRingUsed , flags); -uint16_t flags =virtio_lduw_phys_cached (vq->vdev, &caches->used, pa); +uint16_t flags; +if (!caches) { +return ; + } + + flags =virtio_lduw_phys_cached (vq->vdev, &caches->used, pa);virtio_stw_phys_cached (vdev, &caches->used, pa, flags & ~mask);address_space_cache_invalidate (&caches->used, pa,sizeof (flags)); }
@@ -381,6 +419,10 @@ static inline void vring_set_avail_event(VirtQueue *vq, uint16_t val) } caches =vring_get_region_caches (vq); +if (!caches) { +return ; + } + pa = offsetof(VRingUsed, ring[vq->vring.num]);virtio_stw_phys_cached (vq->vdev, &caches->used, pa, val);address_space_cache_invalidate (&caches->used, pa,sizeof (val));
@@ -410,7 +452,11 @@ static void virtio_queue_packed_set_notification(VirtQueue *vq, int enable)VRingMemoryRegionCaches *caches;RCU_READ_LOCK_GUARD (); - caches =vring_get_region_caches (vq); + caches =vring_get_region_caches (vq); +if (!caches) { +return ; + } +vring_packed_event_read (vq->vdev, &caches->used, &e);if (!enable) {
@@ -597,6 +643,10 @@ static int virtio_queue_packed_empty_rcu(VirtQueue *vq) } cache =vring_get_region_caches (vq); +if (!cache) { +return 1 ; + } +vring_packed_desc_read_flags (vq->vdev, &desc.flags, &cache->desc, vq->last_avail_idx);
@@ -777,6 +827,10 @@ static void virtqueue_packed_fill_desc(VirtQueue *vq, } caches =vring_get_region_caches (vq); +if (!caches) { +return ; + } +vring_packed_desc_write (vq->vdev, &desc, &caches->desc, head, strict_order); }
@@ -949,6 +1003,10 @@ static void virtqueue_split_get_avail_bytes(VirtQueue *vq, max = vq->vring.num; caches =vring_get_region_caches (vq); +if (!caches) { + goto err; + } +while ((rc =virtqueue_num_heads (vq, idx)) >0 ) {MemoryRegionCache *desc_cache = &caches->desc;unsigned int num_bufs;
@@ -1089,6 +1147,9 @@ static void virtqueue_packed_get_avail_bytes(VirtQueue *vq, max = vq->vring.num; caches =vring_get_region_caches (vq); +if (!caches) { + goto err; + }for (;;) {unsigned int num_bufs = total_bufs;
@@ -1194,6 +1255,10 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int *in_bytes, } caches =vring_get_region_caches (vq); +if (!caches) { + goto err; + } + desc_size =virtio_vdev_has_feature (vq->vdev,VIRTIO_F_RING_PACKED ) ?sizeof (VRingPackedDesc) :sizeof (VRingDesc);if (caches->desc.len < vq->vring.num * desc_size) {
@@ -1387,6 +1452,11 @@ static void *virtqueue_split_pop(VirtQueue *vq, size_t sz) i = head; caches =vring_get_region_caches (vq); +if (!caches) { +virtio_error (vdev,"Region caches not initialized" ); + goto done; + } +if (caches->desc.len < max *sizeof (VRingDesc)) {virtio_error (vdev,"Cannot map descriptor ring" ); goto done;
@@ -1509,6 +1579,11 @@ static void *virtqueue_packed_pop(VirtQueue *vq, size_t sz) i = vq->last_avail_idx; caches =vring_get_region_caches (vq); +if (!caches) { +virtio_error (vdev,"Region caches not initialized" ); + goto done; + } +if (caches->desc.len < max *sizeof (VRingDesc)) {virtio_error (vdev,"Cannot map descriptor ring" ); goto done;
@@ -1628,6 +1703,10 @@ static unsigned int virtqueue_packed_drop_all(VirtQueue *vq)VRingPackedDesc desc; caches =vring_get_region_caches (vq); +if (!caches) { +return 0 ; + } + desc_cache = &caches->desc;virtio_queue_set_notification (vq,0 );
@@ -2412,6 +2491,10 @@ static bool virtio_packed_should_notify(VirtIODevice *vdev, VirtQueue *vq)VRingMemoryRegionCaches *caches; caches =vring_get_region_caches (vq); +if (!caches) { +return false; + } +vring_packed_event_read (vdev, &caches->avail, &e); old = vq->signalled_used;
Signature · 1 line
MST
[PULL 25/32] libvhost-user: handle NOFD flag in call/kick/err better
In reply to Michael S. TsirkinFrom: Johannes Berg <[email protected]>
The code here is odd, for example will it print out invalid file descriptor numbers that were never sent in the message.
Clean that up a bit so it's actually possible to implement a device that uses polling.
Message-Id: <[email protected]>
--- contrib/libvhost-user/libvhost-user.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
contrib/libvhost-user/libvhost-user.c +16 -8
@@ -948,6 +948,7 @@ static bool vu_check_queue_msg_file(VuDev *dev, VhostUserMsg *vmsg) {int index = vmsg->payload.u64 &VHOST_USER_VRING_IDX_MASK ; +bool nofd = vmsg->payload.u64 &VHOST_USER_VRING_NOFD_MASK ;if (index >= dev->max_queues) {vmsg_close_fds (vmsg);
@@ -955,8 +956,12 @@ vu_check_queue_msg_file(VuDev *dev, VhostUserMsg *vmsg)return false; } -if (vmsg->payload.u64 &VHOST_USER_VRING_NOFD_MASK || - vmsg->fd_num !=1 ) { +if (nofd) { +vmsg_close_fds (vmsg); +return true; + } + +if (vmsg->fd_num !=1 ) {vmsg_close_fds (vmsg);vu_panic (dev,"Invalid fds in request: %d" , vmsg->request);return false;
@@ -1053,6 +1058,7 @@ static bool vu_set_vring_kick_exec(VuDev *dev, VhostUserMsg *vmsg) {int index = vmsg->payload.u64 &VHOST_USER_VRING_IDX_MASK ; +bool nofd = vmsg->payload.u64 &VHOST_USER_VRING_NOFD_MASK ;DPRINT ("u64: 0x%016" PRIx64"\n" , vmsg->payload.u64);
@@ -1066,8 +1072,8 @@ vu_set_vring_kick_exec(VuDev *dev, VhostUserMsg *vmsg) dev->vq[index].kick_fd =-1 ; } - dev->vq[index].kick_fd = vmsg->fds[0 ]; -DPRINT ("Got kick_fd: %d for vq: %d\n" , vmsg->fds[0 ], index); + dev->vq[index].kick_fd = nofd ?-1 : vmsg->fds[0 ]; +DPRINT ("Got kick_fd: %d for vq: %d\n" , dev->vq[index].kick_fd, index); dev->vq[index].started = true;if (dev->iface->queue_set_started) {
@@ -1147,6 +1153,7 @@ static bool vu_set_vring_call_exec(VuDev *dev, VhostUserMsg *vmsg) {int index = vmsg->payload.u64 &VHOST_USER_VRING_IDX_MASK ; +bool nofd = vmsg->payload.u64 &VHOST_USER_VRING_NOFD_MASK ;DPRINT ("u64: 0x%016" PRIx64"\n" , vmsg->payload.u64);
@@ -1159,14 +1166,14 @@ vu_set_vring_call_exec(VuDev *dev, VhostUserMsg *vmsg) dev->vq[index].call_fd =-1 ; } - dev->vq[index].call_fd = vmsg->fds[0 ]; + dev->vq[index].call_fd = nofd ?-1 : vmsg->fds[0 ];/* in case of I/O hang after reconnecting */ -if (eventfd_write (vmsg->fds[0 ],1 )) { +if (dev->vq[index].call_fd !=-1 &&eventfd_write (vmsg->fds[0 ],1 )) {return -1 ; } -DPRINT ("Got call_fd: %d for vq: %d\n" , vmsg->fds[0 ], index); +DPRINT ("Got call_fd: %d for vq: %d\n" , dev->vq[index].call_fd, index);return false; }
@@ -1175,6 +1182,7 @@ static bool vu_set_vring_err_exec(VuDev *dev, VhostUserMsg *vmsg) {int index = vmsg->payload.u64 &VHOST_USER_VRING_IDX_MASK ; +bool nofd = vmsg->payload.u64 &VHOST_USER_VRING_NOFD_MASK ;DPRINT ("u64: 0x%016" PRIx64"\n" , vmsg->payload.u64);
@@ -1187,7 +1195,7 @@ vu_set_vring_err_exec(VuDev *dev, VhostUserMsg *vmsg) dev->vq[index].err_fd =-1 ; } - dev->vq[index].err_fd = vmsg->fds[0 ]; + dev->vq[index].err_fd = nofd ?-1 : vmsg->fds[0 ];return false; }
Signature · 1 line
MST
[PULL 18/32] virtio-iommu: Support migration
In reply to Michael S. TsirkinFrom: Eric Auger <[email protected]>
Add Migration support. We rely on recently added gtree and qlist migration. We only migrate the domain gtree. The endpoint gtree is re-constructed in a post-load operation.
Message-Id: <[email protected]>
--- hw/virtio/virtio-iommu.c | 109 +++++++++++++++++++++++++++++++++++---- 1 file changed, 99 insertions(+), 10 deletions(-)
hw/virtio/virtio-iommu.c +99 -10
@@ -643,16 +643,6 @@ static uint64_t virtio_iommu_get_features(VirtIODevice *vdev, uint64_t f,return f; } -/* -* Migration is not yet supported: most of the state consists -* of balanced binary trees which are not yet ready for getting -* migrated -*/ -static const VMStateDescription vmstate_virtio_iommu_device = { - .name ="virtio-iommu-device" , - .unmigratable =1 , -}; -static gint int_cmp (gconstpointer a,gconstpointer b,gpointer user_data) {guint ua =GPOINTER_TO_UINT (a);
@@ -736,9 +726,108 @@ static void virtio_iommu_instance_init(Object *obj) { } +#define VMSTATE_INTERVAL \ +{ \ + .name = "interval", \ + .version_id = 1, \ + .minimum_version_id = 1, \ + .fields = (VMStateField[]) { \ + VMSTATE_UINT64(low, VirtIOIOMMUInterval), \ + VMSTATE_UINT64(high, VirtIOIOMMUInterval), \ + VMSTATE_END_OF_LIST() \ + } \ +} + +#define VMSTATE_MAPPING \ +{ \ + .name = "mapping", \ + .version_id = 1, \ + .minimum_version_id = 1, \ + .fields = (VMStateField[]) { \ + VMSTATE_UINT64(phys_addr, VirtIOIOMMUMapping),\ + VMSTATE_UINT32(flags, VirtIOIOMMUMapping), \ + VMSTATE_END_OF_LIST() \ + }, \ +} + +static const VMStateDescription vmstate_interval_mapping[2 ] = { +VMSTATE_MAPPING ,/* value */ +VMSTATE_INTERVAL /* key */ +}; + +static int domain_preload (void *opaque) +{ +VirtIOIOMMUDomain *domain = opaque; + + domain->mappings =g_tree_new_full ((GCompareDataFunc )interval_cmp, +NULL , g_free, g_free); +return 0 ; +} + +static const VMStateDescription vmstate_endpoint = { + .name ="endpoint" , + .version_id =1 , + .minimum_version_id =1 , + .fields = (VMStateField []) { +VMSTATE_UINT32 (id, VirtIOIOMMUEndpoint), +VMSTATE_END_OF_LIST () + } +}; + +static const VMStateDescription vmstate_domain = { + .name ="domain" , + .version_id =1 , + .minimum_version_id =1 , + .pre_load = domain_preload, + .fields = (VMStateField []) { +VMSTATE_UINT32 (id, VirtIOIOMMUDomain), +VMSTATE_GTREE_V (mappings, VirtIOIOMMUDomain,1 , + vmstate_interval_mapping, + VirtIOIOMMUInterval, VirtIOIOMMUMapping), +VMSTATE_QLIST_V (endpoint_list, VirtIOIOMMUDomain,1 , + vmstate_endpoint, VirtIOIOMMUEndpoint, next), +VMSTATE_END_OF_LIST () + } +}; + +static gboolean reconstruct_endpoints (gpointer key,gpointer value, +gpointer data) +{ +VirtIOIOMMU *s = (VirtIOIOMMU *)data; +VirtIOIOMMUDomain *d = (VirtIOIOMMUDomain *)value; +VirtIOIOMMUEndpoint *iter; + + QLIST_FOREACH(iter, &d->endpoint_list, next) { + iter->domain = d; +g_tree_insert (s->endpoints,GUINT_TO_POINTER (iter->id), iter); + } +return false;/* continue the domain traversal */ +} + +static int iommu_post_load (void *opaque,int version_id) +{ +VirtIOIOMMU *s = opaque; + +g_tree_foreach (s->domains, reconstruct_endpoints, s); +return 0 ; +} + +static const VMStateDescription vmstate_virtio_iommu_device = { + .name ="virtio-iommu-device" , + .minimum_version_id =1 , + .version_id =1 , + .post_load = iommu_post_load, + .fields = (VMStateField []) { +VMSTATE_GTREE_DIRECT_KEY_V (domains, VirtIOIOMMU,1 , + &vmstate_domain, VirtIOIOMMUDomain), +VMSTATE_END_OF_LIST () + }, +}; +static const VMStateDescription vmstate_virtio_iommu = { .name ="virtio-iommu" , .minimum_version_id =1 , + .priority =MIG_PRI_IOMMU , .version_id =1 , .fields = (VMStateField []) {VMSTATE_VIRTIO_DEVICE ,
Signature · 1 line
MST
[PULL 13/32] virtio-iommu: Decode the command payload
In reply to Michael S. TsirkinFrom: Eric Auger <[email protected]>
This patch adds the command payload decoding and introduces the functions that will do the actual command handling. Those functions are not yet implemented.
Message-Id: <[email protected]>
--- hw/virtio/virtio-iommu.c | 76 +++++++++++++++++++++++++++++++++------- hw/virtio/trace-events | 4 +++ 2 files changed, 68 insertions(+), 12 deletions(-)
hw/virtio/virtio-iommu.c +64 -12
@@ -34,31 +34,83 @@/* Max size */ #define VIOMMU_DEFAULT_QUEUE_SIZE 256 -static int virtio_iommu_handle_attach (VirtIOIOMMU *s, -struct iovec *iov, -unsigned int iov_cnt) +static int virtio_iommu_attach (VirtIOIOMMU *s, +struct virtio_iommu_req_attach *req) { +uint32_t domain_id =le32_to_cpu (req->domain); +uint32_t ep_id =le32_to_cpu (req->endpoint); + +trace_virtio_iommu_attach (domain_id, ep_id); +return VIRTIO_IOMMU_S_UNSUPP ; } -static int virtio_iommu_handle_detach (VirtIOIOMMU *s, -struct iovec *iov, -unsigned int iov_cnt) + +static int virtio_iommu_detach (VirtIOIOMMU *s, +struct virtio_iommu_req_detach *req) { +uint32_t domain_id =le32_to_cpu (req->domain); +uint32_t ep_id =le32_to_cpu (req->endpoint); + +trace_virtio_iommu_detach (domain_id, ep_id); +return VIRTIO_IOMMU_S_UNSUPP ; } -static int virtio_iommu_handle_map (VirtIOIOMMU *s, -struct iovec *iov, -unsigned int iov_cnt) + +static int virtio_iommu_map (VirtIOIOMMU *s, +struct virtio_iommu_req_map *req) { +uint32_t domain_id =le32_to_cpu (req->domain); +uint64_t phys_start =le64_to_cpu (req->phys_start); +uint64_t virt_start =le64_to_cpu (req->virt_start); +uint64_t virt_end =le64_to_cpu (req->virt_end); +uint32_t flags =le32_to_cpu (req->flags); + +trace_virtio_iommu_map (domain_id, virt_start, virt_end, phys_start, flags); +return VIRTIO_IOMMU_S_UNSUPP ; } -static int virtio_iommu_handle_unmap (VirtIOIOMMU *s, -struct iovec *iov, -unsigned int iov_cnt) + +static int virtio_iommu_unmap (VirtIOIOMMU *s, +struct virtio_iommu_req_unmap *req) { +uint32_t domain_id =le32_to_cpu (req->domain); +uint64_t virt_start =le64_to_cpu (req->virt_start); +uint64_t virt_end =le64_to_cpu (req->virt_end); + +trace_virtio_iommu_unmap (domain_id, virt_start, virt_end); +return VIRTIO_IOMMU_S_UNSUPP ; } +static int virtio_iommu_iov_to_req (struct iovec *iov, +unsigned int iov_cnt, +void *req,size_t req_sz) +{ +size_t sz, payload_sz = req_sz -sizeof (struct virtio_iommu_req_tail ); + + sz =iov_to_buf (iov, iov_cnt,0 , req, payload_sz); +if (unlikely (sz != payload_sz)) { +return VIRTIO_IOMMU_S_INVAL ; + } +return 0 ; +} + +#define virtio_iommu_handle_req (__req) \ +static int virtio_iommu_handle_ ## __req(VirtIOIOMMU *s, \ + struct iovec *iov, \ + unsigned int iov_cnt) \ +{ \ + struct virtio_iommu_req_ ## __req req; \ + int ret = virtio_iommu_iov_to_req(iov, iov_cnt, &req, sizeof(req)); \ + \ + return ret ? ret : virtio_iommu_ ## __req(s, &req); \ +} + +virtio_iommu_handle_req (attach) +virtio_iommu_handle_req (detach ) +virtio_iommu_handle_req (map) +virtio_iommu_handle_req (unmap) + static voidvirtio_iommu_handle_command (VirtIODevice *vdev, VirtQueue *vq) {VirtIOIOMMU *s =VIRTIO_IOMMU (vdev);
hw/virtio/trace-events +4 -0
@@ -60,3 +60,7 @@ virtio_iommu_get_features(uint64_t features) "device supports features=0x%"PRIx6 virtio_iommu_device_status(uint8_t status) "driver status = %d" virtio_iommu_get_config(uint64_t page_size_mask, uint64_t start, uint64_t end, uint32_t domain_range, uint32_t probe_size) "page_size_mask=0x%"PRIx64" start=0x%"PRIx64" end=0x%"PRIx64" domain_range=%d probe_size=0x%x" virtio_iommu_set_config(uint64_t page_size_mask, uint64_t start, uint64_t end, uint32_t domain_range, uint32_t probe_size) "page_size_mask=0x%"PRIx64" start=0x%"PRIx64" end=0x%"PRIx64" domain_bits=%d probe_size=0x%x" +virtio_iommu_attach(uint32_t domain_id, uint32_t ep_id) "domain=%d endpoint=%d" +virtio_iommu_detach(uint32_t domain_id, uint32_t ep_id) "domain=%d endpoint=%d" +virtio_iommu_map(uint32_t domain_id, uint64_t virt_start, uint64_t virt_end, uint64_t phys_start, uint32_t flags) "domain=%d virt_start=0x%"PRIx64" virt_end=0x%"PRIx64 " phys_start=0x%"PRIx64" flags=%d" +virtio_iommu_unmap(uint32_t domain_id, uint64_t virt_start, uint64_t virt_end) "domain=%d virt_start=0x%"PRIx64" virt_end=0x%"PRIx64
Signature · 1 line
MST
[PULL 31/32] virtiofsd: add it to the tools list
In reply to Michael S. TsirkinFrom: Laurent Vivier <[email protected]>
it will be built only when tools are enabled (always enabled by default)
Message-Id: <[email protected]>
--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
@@ -327,7 +327,7 @@ HELPERS-y += vhost-user-gpu$(EXESUF) vhost-user-json-y += contrib/vhost-user-gpu/50-qemu-gpu.json endif -ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy) +ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG)$(CONFIG_TOOLS),yyyy) HELPERS-y += virtiofsd$(EXESUF) vhost-user-json-y += tools/virtiofsd/50-qemu-virtiofsd.json endif
@@ -697,7 +697,7 @@ rdmacm-mux$(EXESUF): $(rdmacm-mux-obj-y) $(COMMON_LDADDS) $(call LINK, $^) # relies on Linux-specific syscalls -ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy) +ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG)$(CONFIG_TOOLS),yyyy) virtiofsd$(EXESUF): $(virtiofsd-obj-y) libvhost-user.a $(COMMON_LDADDS) $(call LINK, $^) endif
Signature · 1 line
MST
[PULL 21/32] MAINTAINERS: add virtio-iommu related files
In reply to Michael S. TsirkinFrom: Eric Auger <[email protected]>
Add a new "virtio-iommu" section with the new files related to this device.
Message-Id: <[email protected]>
--- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
@@ -1631,6 +1631,12 @@ F: hw/input/virtio-input*.c F: include/hw/virtio/virtio-input.h F: contrib/vhost-user-input/* +virtio-iommu +M: Eric Auger <[email protected]> +S: Maintained +F: hw/virtio/virtio-iommu*.c +F: include/hw/virtio/virtio-iommu.h + virtio-serial M: Laurent Vivier <[email protected]> R: Amit Shah <[email protected]>
Signature · 1 line
MST
[PULL 12/32] virtio-iommu: Add skeleton
In reply to Michael S. TsirkinFrom: Eric Auger <[email protected]>
This patchs adds the skeleton for the virtio-iommu device.
Message-Id: <[email protected]>
--- include/hw/virtio/virtio-iommu.h | 57 +++++++ hw/virtio/virtio-iommu.c | 265 +++++++++++++++++++++++++++++++ hw/virtio/Kconfig | 5 + hw/virtio/Makefile.objs | 1 + hw/virtio/trace-events | 7 + 5 files changed, 335 insertions(+) create mode 100644 include/hw/virtio/virtio-iommu.h create mode 100644 hw/virtio/virtio-iommu.c
include/hw/virtio/virtio-iommu.h new file +57 -0
@@ -0,0 +1,57 @@ +/* +* virtio-iommu device +* +* Copyright (c) 2020 Red Hat, Inc. +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2 or later, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along with +* this program. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +#ifndef QEMU_VIRTIO_IOMMU_H +#define QEMU_VIRTIO_IOMMU_H + +#include "standard-headers/linux/virtio_iommu.h" +#include "hw/virtio/virtio.h" +#include "hw/pci/pci.h" + +#define TYPE_VIRTIO_IOMMU "virtio-iommu-device" +#define VIRTIO_IOMMU (obj) \ + OBJECT_CHECK(VirtIOIOMMU, (obj), TYPE_VIRTIO_IOMMU) + +typedef struct IOMMUDevice { +void *viommu; +PCIBus *bus; +int devfn; +IOMMUMemoryRegion iommu_mr; +AddressSpace as; +}IOMMUDevice ; + +typedef struct IOMMUPciBus { +PCIBus *bus; +IOMMUDevice *pbdev[0 ];/* Parent array is sparse, so dynamically alloc */ +}IOMMUPciBus ; + +typedef struct VirtIOIOMMU { +VirtIODevice parent_obj; +VirtQueue *req_vq; +VirtQueue *event_vq; +struct virtio_iommu_config config; +uint64_t features; +GHashTable *as_by_busptr; +PCIBus *primary_bus; +GTree *domains; +QemuMutex mutex; +GTree *endpoints; +}VirtIOIOMMU ; + +#endif
hw/virtio/virtio-iommu.c new file +265 -0
265 lines not on this page · raw message
hw/virtio/Kconfig +5 -0
@@ -9,6 +9,11 @@ config VIRTIO_RNG default y depends on VIRTIO +config VIRTIO_IOMMU + bool + default y + depends on VIRTIO + config VIRTIO_PCI bool default y if PCI_DEVICES
hw/virtio/Makefile.objs +1 -0
@@ -16,6 +16,7 @@ obj-$(call land,$(CONFIG_VIRTIO_CRYPTO),$(CONFIG_VIRTIO_PCI)) += virtio-crypto-p obj-$(CONFIG_VIRTIO_PMEM) += virtio-pmem.o common-obj-$(call land,$(CONFIG_VIRTIO_PMEM),$(CONFIG_VIRTIO_PCI)) += virtio-pmem-pci.o obj-$(call land,$(CONFIG_VHOST_USER_FS),$(CONFIG_VIRTIO_PCI)) += vhost-user-fs-pci.o +obj-$(CONFIG_VIRTIO_IOMMU) += virtio-iommu.o obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock.o ifeq ($(CONFIG_VIRTIO_PCI),y)
hw/virtio/trace-events +7 -0
@@ -53,3 +53,10 @@ virtio_mmio_write_offset(uint64_t offset, uint64_t value) "virtio_mmio_write off virtio_mmio_guest_page(uint64_t size, int shift) "guest page size 0x%" PRIx64 " shift %d" virtio_mmio_queue_write(uint64_t value, int max_size) "mmio_queue write 0x%" PRIx64 " max %d" virtio_mmio_setting_irq(int level) "virtio_mmio setting IRQ %d" + +# hw/virtio/virtio-iommu.c +virtio_iommu_device_reset(void) "reset!" +virtio_iommu_get_features(uint64_t features) "device supports features=0x%"PRIx64 +virtio_iommu_device_status(uint8_t status) "driver status = %d" +virtio_iommu_get_config(uint64_t page_size_mask, uint64_t start, uint64_t end, uint32_t domain_range, uint32_t probe_size) "page_size_mask=0x%"PRIx64" start=0x%"PRIx64" end=0x%"PRIx64" domain_range=%d probe_size=0x%x" +virtio_iommu_set_config(uint64_t page_size_mask, uint64_t start, uint64_t end, uint32_t domain_range, uint32_t probe_size) "page_size_mask=0x%"PRIx64" start=0x%"PRIx64" end=0x%"PRIx64" domain_bits=%d probe_size=0x%x"
Signature · 1 line
MST
[PULL 32/32] Fixed assert in vhost_user_set_mem_table_postcopy
In reply to Michael S. TsirkinFrom: Raphael Norwitz <[email protected]>
The current vhost_user_set_mem_table_postcopy() implementation populates each region of the VHOST_USER_SET_MEM_TABLE message without first checking if there are more than VHOST_MEMORY_MAX_NREGIONS already populated. This can cause memory corruption if too many regions are added to the message during the postcopy step.
This change moves an existing assert up such that attempting to construct a VHOST_USER_SET_MEM_TABLE message with too many memory regions will gracefully bring down qemu instead of corrupting memory.
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/vhost-user.c +1 -1
@@ -443,6 +443,7 @@ static int vhost_user_set_mem_table_postcopy(struct vhost_dev *dev, &offset); fd =memory_region_get_fd (mr);if (fd >0 ) { +assert (fd_num <VHOST_MEMORY_MAX_NREGIONS ); trace_vhost_user_set_mem_table_withfd(fd_num, mr->name, reg->memory_size, reg->guest_phys_addr,
@@ -455,7 +456,6 @@ static int vhost_user_set_mem_table_postcopy(struct vhost_dev *dev, msg.payload.memory.regions[fd_num].guest_phys_addr = reg->guest_phys_addr; msg.payload.memory.regions[fd_num].mmap_offset = offset; -assert (fd_num <VHOST_MEMORY_MAX_NREGIONS ); fds[fd_num++] = fd; }else { u->region_rb_offset[i] =0 ;
Signature · 1 line
MST
[PULL 23/32] libvhost-user-glib: fix VugDev main fd cleanup
In reply to Michael S. TsirkinFrom: Johannes Berg <[email protected]>
If you try to make a device implementation that can handle multiple connections and allow disconnections (which requires overriding the VHOST_USER_NONE handling), then glib will warn that we remove a src while it's still on the mainloop, and will poll() an FD that doesn't exist anymore.
Fix this by making vug_source_new() require pairing with the new vug_source_destroy() so we can keep the GSource referenced in the meantime.
Note that this requires calling the new API in vhost-user-input. vhost-user-gpu also uses vug_source_new(), but never seems to free the result at all, so I haven't changed anything there.
Message-Id: <[email protected]>
--- contrib/libvhost-user/libvhost-user-glib.h | 1 + contrib/libvhost-user/libvhost-user-glib.c | 15 ++++++++++++--- contrib/vhost-user-input/main.c | 6 ++---- 3 files changed, 15 insertions(+), 7 deletions(-)
contrib/libvhost-user/libvhost-user-glib.h +1 -0
@@ -31,5 +31,6 @@ void vug_deinit(VugDev *dev);GSource *vug_source_new (VugDev *dev,int fd,GIOCondition cond,vu_watch_cb vu_cb,gpointer data); +void vug_source_destroy (GSource *src);#endif /* LIBVHOST_USER_GLIB_H */
contrib/libvhost-user/libvhost-user-glib.c +12 -3
@@ -91,7 +91,6 @@ vug_source_new(VugDev *gdev, int fd, GIOCondition cond,g_source_add_poll (gsrc, &src->gfd); id =g_source_attach (gsrc,NULL );g_assert (id); -g_source_unref (gsrc);return gsrc; }
@@ -131,6 +130,16 @@ static void vug_watch(VuDev *dev, int condition, void *data) } } +void vug_source_destroy (GSource *src) +{ +if (!src) { +return ; + } + +g_source_destroy (src); +g_source_unref (src); +} +bool vug_init (VugDev *dev,uint16_t max_queues,int socket,vu_panic_cb panic,const VuDevIface *iface)
@@ -144,7 +153,7 @@ vug_init(VugDev *dev, uint16_t max_queues, int socket, } dev->fdmap =g_hash_table_new_full (NULL ,NULL ,NULL , - (GDestroyNotify ) g_source_destroy); + (GDestroyNotify ) vug_source_destroy); dev->src =vug_source_new (dev, socket,G_IO_IN , vug_watch,NULL );
@@ -157,5 +166,5 @@ vug_deinit(VugDev *dev)g_assert (dev);g_hash_table_unref (dev->fdmap); -g_source_unref (dev->src); +vug_source_destroy (dev->src); }
contrib/vhost-user-input/main.c +2 -4
@@ -187,7 +187,7 @@ vi_queue_set_started(VuDev *dev, int qidx, bool started) }if (!started && vi->evsrc) { -g_source_destroy (vi->evsrc); +vug_source_destroy (vi->evsrc); vi->evsrc =NULL ; } }
@@ -401,9 +401,7 @@ main(int argc, char *argv[])vug_deinit (&vi.dev); -if (vi.evsrc) { -g_source_unref (vi.evsrc); - } +vug_source_destroy (vi.evsrc);g_array_free (vi.config, TRUE);g_free (vi.queue);return 0 ;
Signature · 1 line
MST
[PULL 30/32] tests/vhost-user-bridge: move to contrib/
In reply to Michael S. TsirkinFrom: Laurent Vivier <[email protected]>
vhost-user-bridge is not a test. Move it to contrib/ and add it to the tools list.
It will be built only if tools (--enable-tools) and vhost-user (--enable-vhost-user) are enabled (both are set by default).
Message-Id: <[email protected]>
--- configure | 3 +++ Makefile | 3 +++ tests/vhost-user-bridge.c => contrib/vhost-user-bridge/main.c | 0 Makefile.objs | 1 + contrib/vhost-user-bridge/Makefile.objs | 1 + docs/devel/migration.rst | 2 +- tests/Makefile.include | 1 - 7 files changed, 9 insertions(+), 2 deletions(-) rename tests/vhost-user-bridge.c => contrib/vhost-user-bridge/main.c (100%) create mode 100644 contrib/vhost-user-bridge/Makefile.objs
configure +3 -0
@@ -6288,6 +6288,9 @@ if test "$want_tools" = "yes" ; then if [ "$curl" = "yes" ]; then tools="elf2dmp\$(EXESUF) $tools" fi + if [ "$vhost_user" = "yes" ]; then + tools="vhost-user-bridge\$(EXESUF) $tools" + fi fi if test "$softmmu" = yes ; then if test "$linux" = yes; then
Makefile +3 -0
@@ -445,6 +445,7 @@ dummy := $(call unnest-vars,, \ libvhost-user-obj-y \ vhost-user-scsi-obj-y \ vhost-user-blk-obj-y \ + vhost-user-bridge-obj-y \ vhost-user-input-obj-y \ vhost-user-gpu-obj-y \ qga-vss-dll-obj-y \
@@ -688,6 +689,8 @@ vhost-user-scsi$(EXESUF): $(vhost-user-scsi-obj-y) libvhost-user.a $(call LINK, $^) vhost-user-blk$(EXESUF): $(vhost-user-blk-obj-y) libvhost-user.a $(call LINK, $^) +vhost-user-bridge$(EXESUF): $(vhost-user-bridge-obj-y) libvhost-user.a + $(call LINK, $^) rdmacm-mux$(EXESUF): LIBS += "-libumad" rdmacm-mux$(EXESUF): $(rdmacm-mux-obj-y) $(COMMON_LDADDS)
contrib/vhost-user-bridge/main.c renamed from tests/vhost-user-bridge.c +0 -0
Makefile.objs +1 -0
@@ -107,6 +107,7 @@ vhost-user-scsi.o-cflags := $(LIBISCSI_CFLAGS) vhost-user-scsi.o-libs := $(LIBISCSI_LIBS) vhost-user-scsi-obj-y = contrib/vhost-user-scsi/ vhost-user-blk-obj-y = contrib/vhost-user-blk/ +vhost-user-bridge-obj-y = contrib/vhost-user-bridge/ rdmacm-mux-obj-y = contrib/rdmacm-mux/ vhost-user-input-obj-y = contrib/vhost-user-input/ vhost-user-gpu-obj-y = contrib/vhost-user-gpu/
contrib/vhost-user-bridge/Makefile.objs new file +1 -0
@@ -0,0 +1 @@ +vhost-user-bridge-obj-y = main.o
docs/devel/migration.rst +1 -1
@@ -807,7 +807,7 @@ The Linux kernel userfault support works on `/dev/shm` memory and on `hugetlbfs` for hugetlbfs which may be a problem in some configurations). The vhost-user code in QEMU supports clients that have Postcopy support, -and the `vhost-user-bridge` (in `tests/`) and the DPDK package have changes +and the `vhost-user-bridge` (in `contrib/`) and the DPDK package have changes to support postcopy. The client needs to open a userfaultfd and register the areas
tests/Makefile.include +0 -1
@@ -588,7 +588,6 @@ include $(SRC_PATH)/tests/qtest/Makefile.include tests/test-qga$(EXESUF): qemu-ga$(EXESUF) tests/test-qga$(EXESUF): tests/test-qga.o $(qtest-obj-y) -tests/vhost-user-bridge$(EXESUF): tests/vhost-user-bridge.o $(test-util-obj-y) libvhost-user.a SPEED = quick
Signature · 1 line
MST
[PULL 27/32] libvhost-user: implement in-band notifications
In reply to Michael S. TsirkinFrom: Johannes Berg <[email protected]>
Add support for VHOST_USER_PROTOCOL_F_IN_BAND_NOTIFICATIONS, but as it's not desired by default, don't enable it unless the device implementation opts in by returning it from its protocol features callback.
Note that I updated vu_set_vring_err_exec(), but didn't add any sending of the VHOST_USER_SLAVE_VRING_ERR message as there's no write to the err_fd today either.
This also adds vu_queue_notify_sync() which can be used to force a synchronous notification if inband notifications are supported. Previously, I had left out the slave->master direction handling of F_REPLY_ACK, this now adds some code to support it as well.
Message-Id: <[email protected]>
--- contrib/libvhost-user/libvhost-user.h | 14 ++++ contrib/libvhost-user/libvhost-user.c | 103 +++++++++++++++++++++++++- 2 files changed, 114 insertions(+), 3 deletions(-)
contrib/libvhost-user/libvhost-user.h +14 -0
@@ -54,6 +54,7 @@ enum VhostUserProtocolFeature {VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD =10 ,VHOST_USER_PROTOCOL_F_HOST_NOTIFIER =11 ,VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD =12 , +VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS =14 , VHOST_USER_PROTOCOL_F_MAX };
@@ -95,6 +96,7 @@ typedef enum VhostUserRequest {VHOST_USER_GET_INFLIGHT_FD =31 ,VHOST_USER_SET_INFLIGHT_FD =32 ,VHOST_USER_GPU_SET_SOCKET =33 , +VHOST_USER_VRING_KICK =35 , VHOST_USER_MAX } VhostUserRequest;
@@ -103,6 +105,8 @@ typedef enum VhostUserSlaveRequest {VHOST_USER_SLAVE_IOTLB_MSG =1 ,VHOST_USER_SLAVE_CONFIG_CHANGE_MSG =2 ,VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG =3 , +VHOST_USER_SLAVE_VRING_CALL =4 , +VHOST_USER_SLAVE_VRING_ERR =5 , VHOST_USER_SLAVE_MAX } VhostUserSlaveRequest;
@@ -528,6 +532,16 @@ bool vu_queue_empty(VuDev *dev, VuVirtq *vq);*/ void vu_queue_notify (VuDev *dev,VuVirtq *vq); +/** +* vu_queue_notify_sync: +* @dev: a VuDev context +* @vq: a VuVirtq queue +* +* Request to notify the queue via callfd (skipped if unnecessary) +* or sync message if possible. +*/ +void vu_queue_notify_sync (VuDev *dev,VuVirtq *vq); +/** * vu_queue_pop: * @dev: a VuDev context
contrib/libvhost-user/libvhost-user.c +100 -3
156 lines not on this page · raw message
Signature · 1 line
MST
[PULL 26/32] docs: vhost-user: add in-band kick/call messages
In reply to Michael S. TsirkinFrom: Johannes Berg <[email protected]>
For good reason, vhost-user is currently built asynchronously, that way better performance can be obtained. However, for certain use cases such as simulation, this is problematic.
Consider an event-based simulation in which both the device and CPU have scheduled according to a simulation "calendar". Now, consider the CPU sending I/O to the device, over a vring in the vhost-user protocol. In this case, the CPU must wait for the vring interrupt to have been processed by the device, so that the device is able to put an entry onto the simulation calendar to obtain time to handle the interrupt. Note that this doesn't mean the I/O is actually done at this time, it just means that the handling of it is scheduled before the CPU can continue running.
This cannot be done with the asynchronous eventfd based vring kick and call design.
Extend the protocol slightly, so that a message can be used for kick and call instead, if VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS is negotiated. This in itself doesn't guarantee synchronisation, but both sides can also negotiate VHOST_USER_PROTOCOL_F_REPLY_ACK and thus get a reply to this message by setting the need_reply flag, and ensure synchronisation this way.
To really use it in both directions, VHOST_USER_PROTOCOL_F_SLAVE_REQ is also needed.
Since it is used for simulation purposes and too many messages on the socket can lock up the virtual machine, document that this should only be used together with the mentioned features.
Message-Id: <[email protected]>
--- docs/interop/vhost-user.rst | 122 ++++++++++++++++++++++++++++++------ 1 file changed, 104 insertions(+), 18 deletions(-)
docs/interop/vhost-user.rst +104 -18
@@ -2,6 +2,7 @@ Vhost-user Protocol =================== :Copyright: 2014 Virtual Open Systems Sarl. +:Copyright: 2019 Intel Corporation :Licence: This work is licensed under the terms of the GNU GPL, version 2 or later. See the COPYING file in the top-level directory.
@@ -279,6 +280,9 @@ If *master* is unable to send the full message or receives a wrong reply it will close the connection. An optional reconnection mechanism can be implemented. +If *slave* detects some error such as incompatible features, it may also +close the connection. This should only happen in exceptional circumstances. + Any protocol extensions are gated by protocol feature bits, which allows full backwards compatibility on both master and slave. As older slaves don't support negotiating protocol features, a feature
@@ -315,7 +319,8 @@ it until ring is started, or after it has been stopped. Client must start ring upon receiving a kick (that is, detecting that file descriptor is readable) on the descriptor specified by -``VHOST_USER_SET_VRING_KICK``, and stop ring upon receiving +``VHOST_USER_SET_VRING_KICK`` or receiving the in-band message +``VHOST_USER_VRING_KICK`` if negotiated, and stop ring upon receiving ``VHOST_USER_GET_VRING_BASE``. While processing the rings (whether they are enabled or not), client
@@ -767,25 +772,49 @@ When reconnecting: #. Resubmit inflight ``DescStatePacked`` entries in order of their counter value +In-band notifications +--------------------- + +In some limited situations (e.g. for simulation) it is desirable to +have the kick, call and error (if used) signals done via in-band +messages instead of asynchronous eventfd notifications. This can be +done by negotiating the ``VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS`` +protocol feature. + +Note that due to the fact that too many messages on the sockets can +cause the sending application(s) to block, it is not advised to use +this feature unless absolutely necessary. It is also considered an +error to negotiate this feature without also negotiating +``VHOST_USER_PROTOCOL_F_SLAVE_REQ`` and ``VHOST_USER_PROTOCOL_F_REPLY_ACK``, +the former is necessary for getting a message channel from the slave +to the master, while the latter needs to be used with the in-band +notification messages to block until they are processed, both to avoid +blocking later and for proper processing (at least in the simulation +use case.) As it has no other way of signalling this error, the slave +should close the connection as a response to a +``VHOST_USER_SET_PROTOCOL_FEATURES`` message that sets the in-band +notifications feature flag without the other two. + Protocol features ----------------- .. code:: c - #define VHOST_USER_PROTOCOL_F_MQ 0 - #define VHOST_USER_PROTOCOL_F_LOG_SHMFD 1 - #define VHOST_USER_PROTOCOL_F_RARP 2 - #define VHOST_USER_PROTOCOL_F_REPLY_ACK 3 - #define VHOST_USER_PROTOCOL_F_MTU 4 - #define VHOST_USER_PROTOCOL_F_SLAVE_REQ 5 - #define VHOST_USER_PROTOCOL_F_CROSS_ENDIAN 6 - #define VHOST_USER_PROTOCOL_F_CRYPTO_SESSION 7 - #define VHOST_USER_PROTOCOL_F_PAGEFAULT 8 - #define VHOST_USER_PROTOCOL_F_CONFIG 9 - #define VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD 10 - #define VHOST_USER_PROTOCOL_F_HOST_NOTIFIER 11 - #define VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD 12 - #define VHOST_USER_PROTOCOL_F_RESET_DEVICE 13 + #define VHOST_USER_PROTOCOL_F_MQ 0 + #define VHOST_USER_PROTOCOL_F_LOG_SHMFD 1 + #define VHOST_USER_PROTOCOL_F_RARP 2 + #define VHOST_USER_PROTOCOL_F_REPLY_ACK 3 + #define VHOST_USER_PROTOCOL_F_MTU 4 + #define VHOST_USER_PROTOCOL_F_SLAVE_REQ 5 + #define VHOST_USER_PROTOCOL_F_CROSS_ENDIAN 6 + #define VHOST_USER_PROTOCOL_F_CRYPTO_SESSION 7 + #define VHOST_USER_PROTOCOL_F_PAGEFAULT 8 + #define VHOST_USER_PROTOCOL_F_CONFIG 9 + #define VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD 10 + #define VHOST_USER_PROTOCOL_F_HOST_NOTIFIER 11 + #define VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD 12 + #define VHOST_USER_PROTOCOL_F_RESET_DEVICE 13 + #define VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS 14 Master message types --------------------
@@ -947,7 +976,12 @@ Master message types Bits (0-7) of the payload contain the vring index. Bit 8 is the invalid FD flag. This flag is set when there is no file descriptor in the ancillary data. This signals that polling should be used - instead of waiting for a kick. + instead of waiting for the kick. Note that if the protocol feature + ``VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS`` has been negotiated + this message isn't necessary as the ring is also started on the + ``VHOST_USER_VRING_KICK`` message, it may however still be used to + set an event file descriptor (which will be preferred over the + message) or to enable polling. ``VHOST_USER_SET_VRING_CALL`` :id: 13
@@ -960,7 +994,12 @@ Master message types Bits (0-7) of the payload contain the vring index. Bit 8 is the invalid FD flag. This flag is set when there is no file descriptor in the ancillary data. This signals that polling will be used - instead of waiting for the call. + instead of waiting for the call. Note that if the protocol features + ``VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS`` and + ``VHOST_USER_PROTOCOL_F_SLAVE_REQ`` have been negotiated this message + isn't necessary as the ``VHOST_USER_SLAVE_VRING_CALL`` message can be + used, it may however still be used to set an event file descriptor + or to enable polling. ``VHOST_USER_SET_VRING_ERR`` :id: 14
@@ -972,7 +1011,12 @@ Master message types Bits (0-7) of the payload contain the vring index. Bit 8 is the invalid FD flag. This flag is set when there is no file descriptor - in the ancillary data. + in the ancillary data. Note that if the protocol features + ``VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS`` and + ``VHOST_USER_PROTOCOL_F_SLAVE_REQ`` have been negotiated this message + isn't necessary as the ``VHOST_USER_SLAVE_VRING_ERR`` message can be + used, it may however still be used to set an event file descriptor + (which will be preferred over the message). ``VHOST_USER_GET_QUEUE_NUM`` :id: 17
@@ -1205,6 +1249,20 @@ Master message types Only valid if the ``VHOST_USER_PROTOCOL_F_RESET_DEVICE`` protocol feature is set by the backend. +``VHOST_USER_VRING_KICK`` + :id: 35 + :equivalent ioctl: N/A + :slave payload: vring state description + :master payload: N/A + + When the ``VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS`` protocol + feature has been successfully negotiated, this message may be + submitted by the master to indicate that a buffer was added to + the vring instead of signalling it using the vring's kick file + descriptor or having the slave rely on polling. + + The state.num field is currently reserved and must be set to 0. + Slave message types -------------------
@@ -1261,6 +1319,34 @@ Slave message types ``VHOST_USER_PROTOCOL_F_HOST_NOTIFIER`` protocol feature has been successfully negotiated. +``VHOST_USER_SLAVE_VRING_CALL`` + :id: 4 + :equivalent ioctl: N/A + :slave payload: vring state description + :master payload: N/A + + When the ``VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS`` protocol + feature has been successfully negotiated, this message may be + submitted by the slave to indicate that a buffer was used from + the vring instead of signalling this using the vring's call file + descriptor or having the master relying on polling. + + The state.num field is currently reserved and must be set to 0. + +``VHOST_USER_SLAVE_VRING_ERR`` + :id: 5 + :equivalent ioctl: N/A + :slave payload: vring state description + :master payload: N/A + + When the ``VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS`` protocol + feature has been successfully negotiated, this message may be + submitted by the slave to indicate that an error occurred on the + specific vring, instead of signalling the error file descriptor + set by the master via ``VHOST_USER_SET_VRING_ERR``. + + The state.num field is currently reserved and must be set to 0. + .. _reply_ack: VHOST_USER_PROTOCOL_F_REPLY_ACK
Signature · 1 line
MST
[PULL 22/32] libvhost-user: implement VHOST_USER_PROTOCOL_F_REPLY_ACK
In reply to Michael S. TsirkinFrom: Johannes Berg <[email protected]>
This is really simple, since we know whether a response is already requested or not, so we can just send a (successful) response when there isn't one already.
Given that, it's not all _that_ useful but the master can at least be sure the message was processed, and we can exercise more code paths using the example code.
Message-Id: <[email protected]>
--- contrib/libvhost-user/libvhost-user.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
contrib/libvhost-user/libvhost-user.c +10 -2
@@ -1199,7 +1199,8 @@ vu_get_protocol_features_exec(VuDev *dev, VhostUserMsg *vmsg)1ULL <<VHOST_USER_PROTOCOL_F_LOG_SHMFD |1ULL <<VHOST_USER_PROTOCOL_F_SLAVE_REQ |1ULL <<VHOST_USER_PROTOCOL_F_HOST_NOTIFIER | -1ULL <<VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD ; +1ULL <<VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD | +1ULL <<VHOST_USER_PROTOCOL_F_REPLY_ACK ;if (have_userfault ()) { features |=1ULL <<VHOST_USER_PROTOCOL_F_PAGEFAULT ;
@@ -1581,13 +1582,20 @@ vu_dispatch(VuDev *dev) {VhostUserMsg vmsg = {0 , };int reply_requested; -bool success = false; +bool need_reply, success = false;if (!vu_message_read (dev, dev->sock, &vmsg)) { goto end; } + need_reply = vmsg.flags &VHOST_USER_NEED_REPLY_MASK ; + reply_requested =vu_process_message (dev, &vmsg); +if (!reply_requested && need_reply) { +vmsg_set_reply_u64 (&vmsg,0 ); + reply_requested =1 ; + } +if (!reply_requested) { success = true; goto end;
Signature · 1 line
MST
[PULL 28/32] acpi: cpuhp: document CPHP_GET_CPU_ID_CMD command
In reply to Michael S. TsirkinFrom: Igor Mammedov <[email protected]>
Commit 3a61c8db9d25 introduced CPHP_GET_CPU_ID_CMD command but did not sufficiently describe it. Fix it by adding missing command documentation.
Message-Id: <[email protected]>
--- docs/specs/acpi_cpu_hotplug.txt | 2 ++ 1 file changed, 2 insertions(+)
docs/specs/acpi_cpu_hotplug.txt +2 -0
@@ -94,6 +94,8 @@ write access: register in QEMU 2: following writes to 'Command data' register set OST status register in QEMU + 3: following reads from 'Command data' and 'Command data 2' return + architecture specific CPU ID value for currently selected CPU. other values: reserved [0x6-0x7] reserved [0x8] Command data: (DWORD access)
Signature · 1 line
MST
[PULL 14/32] virtio-iommu: Implement attach/detach command
In reply to Michael S. TsirkinFrom: Eric Auger <[email protected]>
This patch implements the endpoint attach/detach to/from a domain.
Domain and endpoint internal datatypes are introduced. Both are stored in RB trees. The domain owns a list of endpoints attached to it. Also helpers to get/put end points and domains are introduced.
As for the IOMMU memory regions, a callback is called on PCI bus enumeration that initializes for a given device on the bus hierarchy an IOMMU memory region. The PCI bus hierarchy is stored locally in IOMMUPciBus and IOMMUDevice objects.
At the time of the enumeration, the bus number may not be computed yet.
So operations that will need to retrieve the IOMMUdevice and its IOMMU memory region from the bus number and devfn, once the bus number is garanteed to be frozen, use an array of IOMMUPciBus, lazily populated.
Message-Id: <[email protected]>
--- include/hw/virtio/virtio-iommu.h | 3 + hw/virtio/virtio-iommu.c | 311 ++++++++++++++++++++++++++++++- hw/virtio/trace-events | 6 + 3 files changed, 318 insertions(+), 2 deletions(-)
include/hw/virtio/virtio-iommu.h +3 -0
@@ -28,6 +28,8 @@#define VIRTIO_IOMMU (obj) \ OBJECT_CHECK(VirtIOIOMMU, (obj), TYPE_VIRTIO_IOMMU) +#define TYPE_VIRTIO_IOMMU_MEMORY_REGION "virtio-iommu-memory-region" + typedef struct IOMMUDevice { void *viommu; PCIBus *bus;
@@ -48,6 +50,7 @@ typedef struct VirtIOIOMMU {struct virtio_iommu_config config;uint64_t features;GHashTable *as_by_busptr; +IOMMUPciBus *iommu_pcibus_by_bus_num[PCI_BUS_MAX ];PCIBus *primary_bus;GTree *domains;QemuMutex mutex;
hw/virtio/virtio-iommu.c +309 -2
395 lines not on this page · raw message
hw/virtio/trace-events +6 -0
@@ -64,3 +64,9 @@ virtio_iommu_attach(uint32_t domain_id, uint32_t ep_id) "domain=%d endpoint=%d" virtio_iommu_detach(uint32_t domain_id, uint32_t ep_id) "domain=%d endpoint=%d" virtio_iommu_map(uint32_t domain_id, uint64_t virt_start, uint64_t virt_end, uint64_t phys_start, uint32_t flags) "domain=%d virt_start=0x%"PRIx64" virt_end=0x%"PRIx64 " phys_start=0x%"PRIx64" flags=%d" virtio_iommu_unmap(uint32_t domain_id, uint64_t virt_start, uint64_t virt_end) "domain=%d virt_start=0x%"PRIx64" virt_end=0x%"PRIx64 +virtio_iommu_translate(const char *name, uint32_t rid, uint64_t iova, int flag) "mr=%s rid=%d addr=0x%"PRIx64" flag=%d" +virtio_iommu_init_iommu_mr(char *iommu_mr) "init %s" +virtio_iommu_get_endpoint(uint32_t ep_id) "Alloc endpoint=%d" +virtio_iommu_put_endpoint(uint32_t ep_id) "Free endpoint=%d" +virtio_iommu_get_domain(uint32_t domain_id) "Alloc domain=%d" +virtio_iommu_put_domain(uint32_t domain_id) "Free domain=%d"
Signature · 1 line
MST
Quoted 16 lines · Michael S. Tsirkin
The following changes since commit
9a8abceb5f01d1066d3a1ac5a33aabcbaeec1860:Merge remote-tracking branch 'remotes/pmaydell/tags/pull-docs-20200225' into staging (2020-02-25 11:03:47 +0000)
are available in the Git repository at:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.gittags/for_upstreamfor you to fetch changes up to
afc37debf27ecf34d6bc1d4b52fa0918d0bd3f3c:Fixed assert in
vhost_user_set_mem_table_postcopy(2020-02-25 08:47:47 -0500)----------------------------------------------------------------
virtio, pc: fixes, features
Quoted 6 lines
New virtio iommu.
Unrealize memory leaks.
In-band kick/call support.
Bugfixes, documentation all over the place.Signed-off-by Michael S. Tsirkin <[email protected]>
Hi; this fails to build on OSX:
CC contrib/libvhost-user/libvhost-user.o
/Users/pm215/src/qemu-for-merges/contrib/libvhost-user/libvhost-user.c:27:10:
fatal error: 'sys/eventfd.h' file not found
#include <sys/eventfd.h>
^~~~~~~~~~~~~~~In file included from /Users/pm215/src/qemu-for-merges/contrib/vhost-user-bridge/main.c:37:
/Users/pm215/src/qemu-for-merges/contrib/libvhost-user/libvhost-user.h:21:10:
fatal error: 'linux/vhost.h' file not found
#include <linux/vhost.h>
^~~~~~~~~~~~~~~1 error generated.
thanks
-- PMM
Quoted 24 lines · Peter Maydell
Quoted 16 lines · Michael S. Tsirkin
The following changes since commit
9a8abceb5f01d1066d3a1ac5a33aabcbaeec1860:Merge remote-tracking branch 'remotes/pmaydell/tags/pull-docs-20200225' into staging (2020-02-25 11:03:47 +0000)
are available in the Git repository at:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.gittags/for_upstreamfor you to fetch changes up to
afc37debf27ecf34d6bc1d4b52fa0918d0bd3f3c:Fixed assert in
vhost_user_set_mem_table_postcopy(2020-02-25 08:47:47 -0500)----------------------------------------------------------------
virtio, pc: fixes, featuresQuoted 6 lines
New virtio iommu.
Unrealize memory leaks.
In-band kick/call support.
Bugfixes, documentation all over the place.Signed-off-by Michael S. Tsirkin <[email protected]>
Quoted 8 lines
Hi; this fails to build on OSX:
CC
contrib/libvhost-user/libvhost-user.o
/Users/pm215/src/qemu-for-merges/contrib/libvhost-user/libvhost-user.c:27:10:
fatal error: 'sys/eventfd.h' file not found#include <sys/eventfd.h> ^~~~~~~~~~~~~~~In file included from
weird this is not new.
Quoted 9 lines
/Users/pm215/src/qemu-for-merges/contrib/vhost-user-bridge/main.c:37:
/Users/pm215/src/qemu-for-merges/contrib/libvhost-user/libvhost-user.h:21:10:
fatal error: 'linux/vhost.h' file not found#include <linux/vhost.h> ^~~~~~~~~~~~~~~1 error generated.
thanks
-- PMM
Quoted 35 lines · Peter Maydell
Quoted 16 lines · Michael S. Tsirkin
The following changes since commit
9a8abceb5f01d1066d3a1ac5a33aabcbaeec1860:Merge remote-tracking branch 'remotes/pmaydell/tags/pull-docs-20200225' into staging (2020-02-25 11:03:47 +0000)
are available in the Git repository at:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.gittags/for_upstreamfor you to fetch changes up to
afc37debf27ecf34d6bc1d4b52fa0918d0bd3f3c:Fixed assert in
vhost_user_set_mem_table_postcopy(2020-02-25 08:47:47 -0500)----------------------------------------------------------------
virtio, pc: fixes, featuresQuoted 6 lines
New virtio iommu.
Unrealize memory leaks.
In-band kick/call support.
Bugfixes, documentation all over the place.Signed-off-by Michael S. Tsirkin <[email protected]>Hi; this fails to build on OSX:
CC
contrib/libvhost-user/libvhost-user.o
/Users/pm215/src/qemu-for-merges/contrib/libvhost-user/libvhost-user.c:27:10:
fatal error: 'sys/eventfd.h' file not found#include <sys/eventfd.h> ^~~~~~~~~~~~~~~In file included from /Users/pm215/src/qemu-for-merges/contrib/vhost-user-bridge/main.c:37:
/Users/pm215/src/qemu-for-merges/contrib/libvhost-user/libvhost-user.h:21:10:
fatal error: 'linux/vhost.h' file not found
Quoted 6 lines
#include <linux/vhost.h> ^~~~~~~~~~~~~~~1 error generated.
thanks
-- PMM
OK this must be the move to contrib. Peter could you please try again now? New tag at c3744b57bb37cd1120acb621ce4683b1c8e8a1c6.
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Subject: [PULL 00/32] virtio, pc: fixes, features
Message-id: [email protected]
Type: series
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
1c37a27 Fixed assert in vhost_user_set_mem_table_postcopy bed1571 virtiofsd: add it to the tools list
9295d98 tests/vhost-user-bridge: move to contrib/
218b70f vhost-user: only set slave channel for first vq 5351c9b acpi: cpuhp: document CPHP_GET_CPU_ID_CMD command 082b014 libvhost-user: implement in-band notifications
84760e4 docs: vhost-user: add in-band kick/call messages 314ca4f libvhost-user: handle NOFD flag in call/kick/err better 57e2969 libvhost-user-glib: use g_main_context_get_thread_default() 2e9a28a libvhost-user-glib: fix VugDev main fd cleanup
abeaf81 libvhost-user: implement VHOST_USER_PROTOCOL_F_REPLY_ACK b2dcd9c MAINTAINERS: add virtio-iommu related files
c2b7c49 hw/arm/virt: Add the virtio-iommu device tree mappings e7d8ad0 virtio-iommu-pci: Add virtio iommu pci support
13a909a virtio-iommu: Support migration
3bc77b7 virtio-iommu: Implement fault reporting
4f6df8c virtio-iommu: Implement translate
eb6ee62 virtio-iommu: Implement map/unmap
c0d89aa virtio-iommu: Implement attach/detach command
30de952 virtio-iommu: Decode the command payload
faa62bf virtio-iommu: Add skeleton
1a2cc03 virtio: gracefully handle invalid region caches a9d2299 vhost-user-blk: convert to new virtio_delete_queue f5dba2c vhost-user-blk: delete virtioqueues in unrealize to fix memleaks b022556 virtio-crypto: do delete ctrl_vq in virtio_crypto_device_unrealize b7586a0 virtio-pmem: do delete rq_vq in virtio_pmem_unrealize 3d33901 vhost-user-fs: convert to the new virtio_delete_queue function fc938b8 vhost-user-fs: do delete virtio_queues in unrealize 24dee37 rebuild-expected-aml.sh: remind about the process 908d585 bios-tables-test: default diff command
6047460 bios-tables-test: fix up DIFF generation
98eabca bios-tables-test: tell people how to update
=== OUTPUT BEGIN ===
1/32 Checking commit 98eabca21985 (bios-tables-test: tell people how to update) 2/32 Checking commit 60474600983e (bios-tables-test: fix up DIFF generation) 3/32 Checking commit 908d58520019 (bios-tables-test: default diff command)
WARNING: line over 80 characters
#30: FILE: tests/qtest/bios-tables-test.c:471:
+ exp_sdt->asl_file, sdt->asl_file);
total: 0 errors, 1 warnings, 36 lines checked
Patch 3/32 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
4/32 Checking commit 24dee376fa13 (rebuild-expected-aml.sh: remind about the process)
ERROR: line over 90 characters
#22: FILE: tests/data/acpi/rebuild-expected-aml.sh:34:
+old_allowed_dif=grep -v -e 'List of comma-separated changed AML files to ignore' ${SRC_PATH}/tests/qtest/bios-tables-test-allowed-diff.h
ERROR: line over 90 characters
#30: FILE: tests/data/acpi/rebuild-expected-aml.sh:42:
+ echo "Note! Please follow the process documented in ${SRC_PATH}/tests/qtest/bios-tables-test.c"
total: 2 errors, 0 warnings, 13 lines checked
Patch 4/32 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
5/32 Checking commit fc938b8bf16f (vhost-user-fs: do delete virtio_queues in unrealize) 6/32 Checking commit 3d3390160abf (vhost-user-fs: convert to the new virtio_delete_queue function)
WARNING: line over 80 characters
#26: FILE: hw/virtio/vhost-user-fs.c:212:
+ fs->hiprio_vq = virtio_add_queue(vdev, fs->conf.queue_size, vuf_handle_output);
WARNING: line over 80 characters
#32: FILE: hw/virtio/vhost-user-fs.c:217:
+ fs->req_vqs[i] = virtio_add_queue(vdev, fs->conf.queue_size, vuf_handle_output);
total: 0 errors, 2 warnings, 48 lines checked
Patch 6/32 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
7/32 Checking commit b7586a03bd40 (virtio-pmem: do delete rq_vq in virtio_pmem_unrealize) 8/32 Checking commit b02255628ccc (virtio-crypto: do delete ctrl_vq in virtio_crypto_device_unrealize) 9/32 Checking commit f5dba2cc1755 (vhost-user-blk: delete virtioqueues in unrealize to fix memleaks) 10/32 Checking commit a9d229943363 (vhost-user-blk: convert to new virtio_delete_queue) 11/32 Checking commit 1a2cc0393dac (virtio: gracefully handle invalid region caches) 12/32 Checking commit faa62bf0efdb (virtio-iommu: Add skeleton)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#62:
new file mode 100644
total: 0 errors, 1 warnings, 350 lines checked
Patch 12/32 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
13/32 Checking commit 30de952a0895 (virtio-iommu: Decode the command payload) 14/32 Checking commit c0d89aa21d9c (virtio-iommu: Implement attach/detach command)
ERROR: spaces required around that '&' (ctx:WxV)
#134: FILE: hw/virtio/virtio-iommu.c:100:
+ return &dev->iommu_mr;
^ERROR: spaces required around that '-' (ctx:WxV)
#146: FILE: hw/virtio/virtio-iommu.c:112:
+ return -1;
^ERROR: spaces required around that '&' (ctx:WxV)
#263: FILE: hw/virtio/virtio-iommu.c:229:
+ return &sdev->as;
^total: 3 errors, 0 warnings, 419 lines checked
Patch 14/32 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
15/32 Checking commit eb6ee62eee5d (virtio-iommu: Implement map/unmap) 16/32 Checking commit 4f6df8cc7537 (virtio-iommu: Implement translate) 17/32 Checking commit 3bc77b78bf54 (virtio-iommu: Implement fault reporting) 18/32 Checking commit 13a909a3c904 (virtio-iommu: Support migration) 19/32 Checking commit e7d8ad08ff28 (virtio-iommu-pci: Add virtio iommu pci support)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #39:
new file mode 100644
total: 0 errors, 1 warnings, 132 lines checked
Patch 19/32 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
20/32 Checking commit c2b7c4924eaa (hw/arm/virt: Add the virtio-iommu device tree mappings) 21/32 Checking commit b2dcd9c7ccf9 (MAINTAINERS: add virtio-iommu related files) 22/32 Checking commit abeaf81bc440 (libvhost-user: implement VHOST_USER_PROTOCOL_F_REPLY_ACK) 23/32 Checking commit 2e9a28ae1018 (libvhost-user-glib: fix VugDev main fd cleanup) 24/32 Checking commit 57e296958348 (libvhost-user-glib: use g_main_context_get_thread_default()) 25/32 Checking commit 314ca4f7dde3 (libvhost-user: handle NOFD flag in call/kick/err better) 26/32 Checking commit 84760e4bbd49 (docs: vhost-user: add in-band kick/call messages) 27/32 Checking commit 082b014fe8a4 (libvhost-user: implement in-band notifications) 28/32 Checking commit 5351c9b649f9 (acpi: cpuhp: document CPHP_GET_CPU_ID_CMD command) 29/32 Checking commit 218b70f95e56 (vhost-user: only set slave channel for first vq) 30/32 Checking commit 9295d98bb196 (tests/vhost-user-bridge: move to contrib/)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#71:
new file mode 100644
total: 0 errors, 1 warnings, 47 lines checked
Patch 30/32 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
31/32 Checking commit bed15711c0e9 (virtiofsd: add it to the tools list) 32/32 Checking commit 1c37a2773ed1 (Fixed assert in vhost_user_set_mem_table_postcopy) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]