Description of problem: When set 'iommu_platform=on' on "vhost-vsock-pci" device, the following error is encountered: (qemu) qemu-kvm: vhost_set_features failed: Operation not supported (95) qemu-kvm: Error starting vhost: 95 Version-Release number of selected component (if applicable): Host name: ibm-x3850x6-04.lab.eng.pek2.redhat.com Host Distro: RHEL-8.3.0-20200912.n.0 BaseOS x86_64 Host Kernel: 4.18.0-236.el8.x86_64 Guest Kernel: 4.18.0-236.el8.x86_64 Qemu-kvm: qemu-kvm-5.1.0-6.module+el8.3.0+8041+42ff16b8 How reproducible: 100% Steps to Reproduce: 1. boot guest enable IOMMU: /usr/libexec/qemu-kvm \ -name 'avocado-vt-vm1' \ -sandbox on \ -machine q35 \ -device pcie-root-port,id=pcie-root-port-0,multifunction=on,bus=pcie.0,addr=0x1,chassis=1 \ -device pcie-pci-bridge,id=pcie-pci-bridge-0,addr=0x0,bus=pcie-root-port-0 \ -nodefaults \ -device VGA,bus=pcie.0,addr=0x2 \ -m 30720 \ -smp 40,maxcpus=40,cores=20,threads=1,dies=1,sockets=2 \ -cpu 'IvyBridge',+kvm_pv_unhalt \ -chardev socket,server,nowait,id=qmp_id_qmpmonitor1,path=/var/tmp/monitor-qmpmonitor1 \ -mon chardev=qmp_id_qmpmonitor1,mode=control \ -device pvpanic,ioport=0x505,id=idnEJdcf \ -chardev socket,server,nowait,id=chardev_serial0,path=/var/tmp/serial-serial0 \ -device isa-serial,id=serial0,chardev=chardev_serial0 \ -chardev socket,id=seabioslog_id_20200915-055422-8y4xDLCa,path=/var/tmp/seabios,server,nowait \ -device isa-debugcon,chardev=seabioslog_id_20200915-055422-8y4xDLCa,iobase=0x402 \ -device pcie-root-port,id=pcie-root-port-1,port=0x1,addr=0x1.0x1,bus=pcie.0,chassis=2 \ -device qemu-xhci,id=usb1,bus=pcie-root-port-1,addr=0x0 \ -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 \ -device pcie-root-port,id=pcie-root-port-2,port=0x2,addr=0x1.0x2,bus=pcie.0,chassis=3 \ -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pcie-root-port-2,addr=0x0 \ -blockdev node-name=file_image1,driver=file,aio=threads,filename=/home/test/os.qcow2,cache.direct=on,cache.no-flush=off \ -blockdev node-name=drive_image1,driver=qcow2,cache.direct=on,cache.no-flush=off,file=file_image1 \ -device scsi-hd,id=image1,drive=drive_image1,write-cache=on \ -device pcie-root-port,id=pcie-root-port-3,port=0x3,addr=0x1.0x3,bus=pcie.0,chassis=4 \ -device virtio-net-pci,mac=9a:af:90:80:2a:4f,id=idxXK3e9,netdev=idbkX3jT,bus=pcie-root-port-3,addr=0x0 \ -netdev tap,id=idbkX3jT,vhost=on \ -device pcie-root-port,id=pcie-root-port-4,port=0x4,addr=0x1.0x4,bus=pcie.0,chassis=5 \ -device vhost-vsock-pci,id=vhost_vsock0,guest-cid=3,bus=pcie-root-port-4,addr=0x0,iommu_platform=on \ -vnc :20 \ -rtc base=utc,clock=host,driftfix=slew \ -boot menu=off,order=cdn,once=c,strict=off \ -enable-kvm \ -device pcie-root-port,id=pcie_extra_root_port_0,multifunction=on,bus=pcie.0,addr=0x3,chassis=6 2. Hit this issue: qemu-kvm: vhost_set_features failed: Operation not supported (95) qemu-kvm: Error starting vhost: 95 3. Login guest: [root@vm-74-49 home]# lsmod|grep vsock vmw_vsock_virtio_transport 16384 0 vmw_vsock_virtio_transport_common 32768 1 vmw_vsock_virtio_transport vsock 45056 2 vmw_vsock_virtio_transport_common,vmw_vsock_virtio_transport [root@vm-74-49 home]# gcc -o nc-vsock nc-vsock.c gcc: error: nc-vsock.c: No such file or directory gcc: fatal error: no input files compilation terminated. Actual results: IOMMU enable failed on "vhost-vsock-pci" device Expected results: IOMMU can be enabled on the "vhost-vsock-pci" device Additional info:
Jon, should it be triaged by someone working on vsock?
Stefano - is there any relationship to bug 1868449 here? or is this something new?
(In reply to John Ferlan from comment #2) > Stefano - is there any relationship to bug 1868449 here? or is this > something new? No, I think it is not related. It seems that vhost-vsock doesn't support iommu-platform=on since the very beginning: https://patchew.org/QEMU/20200226094357.25061-1-jasowang@redhat.com I'll take a closer look!
QEMU should work as is, but I found a little issue that I fixed upstream: https://lists.gnu.org/archive/html/qemu-devel/2020-10/msg09077.html The patch was already merged: 384c2561bd ("vhost-vsock: set vhostfd to non-blocking mode") The issue is mainly related to the vhost-vsock kernel module that doesn't have IOTLB API support, so I'll create a new BZ for kernel.
Merged upstream in QEMU-5.2: 384c2561bddfa00cd3eaf9edbc1af6c7c120511f - set vhostfd to non-blocking mode But it depends on a kernel patch, so leaving it as POST + TestOnly.
Since this is testOnly, I'm moving it to ON_QA
Verified on RHEL8.5 kernel: 4.18.0-307.el8.x86_64 qemu-kvm: qemu-kvm-6.0.0-16.module+el8.5.0+10848+2dccc46d.x86_64 Enable iommu in command line for vsock, guest vm startup successfully. Command line 1: .... -machine q35,kernel-irqchip=split \ -device intel-iommu,intremap=on,device-iotlb=on \ -device vhost-vsock-pci,guest-cid=3,iommu_platform=on,ats=on \ .... Command line 2: ... -device vhost-vsock-pci,id=vhost_vsock0,guest-cid=3,bus=pcie-root-port-4,addr=0x0,iommu_platform=on \ ...
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (virt:av bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2021:4684