oracle / qemu

QEMU git Oracle repository
Other
22 stars 20 forks source link

various fixes for use with libmuser #1

Closed jlevon closed 3 years ago

jlevon commented 3 years ago

This is against https://github.com/nutanix/muser/tree/jlevon.sock-func-rework

With these fixes (and at least a couple of hacks), I get far enough to reach:

./x86_64-softmmu/qemu-system-x86_64 -D qemu.log -vnc :8000 -mem-prealloc -m 1024 -cpu kvm64 -smp 1 -object memory-backend-file,id=ram-node0,prealloc=yes,mem-path=mem,share=yes,size=1073741824  -device vfio-user-pci,socket=/tmp/muser  ~/centos73_vdisk.qcow2
qemu-system-x86_64: -device vfio-user-pci,socket=/tmp/muser: warning: vfio VFIO user </tmp/muser>: Could not enable error recovery for the device
qemu-system-x86_64: Container 0x55a057183400 can't map guest IOVA region 0xc0000..0xcffff
qemu: hardware error: vfio: DMA mapping failed, unable to continue

via

#0  0x00005590afe9492c in vfio_user_dma_map (proxy=0x5590b1ea6bd0, map=map@entry=0x7ffc00c41330, fds=fds@entry=0x0, nelem=nelem@entry=1) at /home/john.levon/src/qemu/hw/vfio/user.c:553
#1  0x00005590afe82b8b in vfio_dma_map (container=container@entry=0x5590b1e49400, mr=0x5590b12122c0, iova=iova@entry=0, size=size@entry=655360, vaddr=vaddr@entry=0x7f3c36400000, readonly=<optimized out>)
    at /home/john.levon/src/qemu/hw/vfio/common.c:402
#2  0x00005590afe840ed in vfio_listener_region_add (listener=0x5590b1e49410, section=<optimized out>) at /home/john.levon/src/qemu/hw/vfio/common.c:752
#3  0x00005590afe23e5e in memory_listener_register (as=<optimized out>, listener=0x5590b1e49410) at /home/john.levon/src/qemu/memory.c:2679
#4  0x00005590afe23e5e in memory_listener_register (listener=listener@entry=0x5590b1e49410, as=<optimized out>) at /home/john.levon/src/qemu/memory.c:2746
#5  0x00005590afe8ec9b in vfio_user_pci_realize (pdev=0x5590b1ea57c0, errp=0x7ffc00c415d0) at /home/john.levon/src/qemu/hw/vfio/pci.c:3495
#6  0x00005590b0038da7 in pci_qdev_realize (qdev=0x5590b1ea57c0, errp=0x7ffc00c41670) at hw/pci/pci.c:2098

We're trying to map a region, but that region does not have VFIO_REGION_INFO_FLAG_MMAP, so its fd is not set (in fact, muser can't do that yet).

This is as far as I got today.

tmakatos commented 3 years ago

@jlevon I've hacked your code a bit further attempting to get SPDK run, I can't seem to be able to create a PR against your branch, could you cherry-pick the commits from https://github.com/tmakatos/qemu/tree/vfio-user-integration?

jlevon commented 3 years ago

fixes long since merged in