aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-09-28have process_request return -EINTRThanos Makatos1-0/+3
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-28Fix handling of VFIO_USER_DEVICE_GET_INFOSwapnil Ingle2-15/+27
vfio_device_info.argsz is set by the client and server is expected to use/validate it. Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-09-25implement VFIO_USER_DEVICE_GET_IRQ_INFOThanos Makatos3-21/+104
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-25implement VFIO_USER_DMA_UNMAPThanos Makatos2-24/+79
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-25remove extraneous newlineThanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-24implement VFIO_USER_DMA_MAPThanos Makatos4-83/+203
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-23libmuser: minor coding style fixesSwapnil Ingle1-27/+36
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-09-23Initial implementation of VFIO_USER_DEVICE_GET_INFOSwapnil Ingle2-1/+75
Initial client and server implementation of VFIO_USER_DEVICE_GET_INFO. Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-09-23Merge pull request #59 from swapnili/vfio-userswapnili1-4/+2
Fix catching error from init_sock
2020-09-23Fix catching error from init_sockSwapnil Ingle1-4/+2
init_sock() returns -errno, so no need to user errno variable to get the error value. Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-09-23start handling MAP_DMA, FDs not yet receivedThanos Makatos3-95/+147
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-23refactor send/recv of message plus fixesThanos Makatos6-104/+239
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-23drop extraneous newline from some log messagesThanos Makatos1-3/+3
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-23drop newline from gpio logging functionThanos Makatos1-1/+1
libmuser always adds a newline Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-23refactor initializing socket and setting version into separate functionsThanos Makatos1-15/+37
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-23add simple client application for testing vfio-userThanos Makatos2-0/+114
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-23exchange vfio-user version with clientThanos Makatos1-1/+101
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-23don't assert on failure to initThanos Makatos1-2/+6
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-23return error code when failing to attachThanos Makatos1-8/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-23add vfio-user version supported by libmuserThanos Makatos1-0/+3
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-23rename command to cmdThanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-23add missing headerThanos Makatos1-0/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-23FIXME move vfio_user.h to correct locationThanos Makatos1-0/+0
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-23include vfio.h in vfio_user.hThanos Makatos1-0/+2
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-23add vfio_user.h to MakefileThanos Makatos2-0/+2
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-23fix attribute keywordThanos Makatos1-3/+3
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-23Add vfio_user.h from https://github.com/tmakatos/muser/pull/6Thanos Makatos1-0/+90
Signed-off-by: Changpeng Liu changpeng.liu@intel.com
2020-09-23Handle cleanup in init_socket for error outSwapnil Ingle1-35/+39
This patch adds cleanup during error out in init_socket. Also no need to create control socket path, bind() on AF_UNIX creates the path internally. Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-09-17use correct socket fd in fcntlThanos Makatos1-1/+1
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-17don't reuse listening socket fd for connected socket fdThanos Makatos1-11/+12
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2020-08-12Merge pull request #22 from franciozzy/cleanup_3Felipe Franciosi8-85/+89
Cleanup 3
2020-08-12samples/test_dma_map: Style fixesFelipe Franciosi1-2/+2
Fixes the type used in a format string and remove some whitespaces. Signed-off-by: Felipe Franciosi <felipe@nutanix.com> Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-08-12muser.ko: Update for Linux 5.8Felipe Franciosi3-63/+24
This fixes vfio.diff to apply cleanly on Linux 5.8 and renames vm_insert_pages to _vm_insert_pages because an upstream function of the same name has been added to the kernel since. Future work will include replacing our version of vm_insert_pages with the upstream and redo all necessary testing. We also update travis to use v5.8. Signed-off-by: Felipe Franciosi <felipe@nutanix.com> Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-08-12Split compilation unit of muser shared libraryFelipe Franciosi1-8/+19
This creates several smaller libraries out of the compilation units of the muser userspace library. It then links them together to build the shared library. In this process, we also generate unit test version of the libraries which include --coverage in the compilation and linking of those files. Those will be statically linked to unit tests later on. Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
2020-08-12Bounce pci_info with pci_info_bounce()Felipe Franciosi1-1/+23
During lm_ctx_create, the pci_info struct from dev_info was being completely copied with a big memcpy(). That had the side-effect of copying pointers that were not allocated by us. Shortly after, copy_sparse_mmap_areas() rewrites these pointers with memory allocated by the library. As a result, any failure half-way through setting up the context would result in free_sparse_mmap_areas() calling free() on pointers we did not allocate (which resulted in errors or double frees). This fixes it by replacing the memcpy() with pci_info_bounce() which selectively copies only what is needed. Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
2020-08-12sparse_mmap: Free bounced areas on lm_ctx_destroyFelipe Franciosi1-9/+10
We were leaking the areas bounced by copy_sparse_mmap_areas(). This fixes the leak by freeing the areas on the destructor. Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
2020-08-12dma: Cope with dma being NULL in destructorFelipe Franciosi1-0/+4
On certain error paths, @dma will be NULL. This makes the destructor cope with it. Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
2020-08-12Rename libmuser*c source filesFelipe Franciosi3-4/+9
For clarity and better project organisation towards unit tests, this renames libmuser.c to muser_ctx.c and libmuser_pci.c to muser_pci.c. CMakeLists is fixed accordingly including some other minor cleanup. Future work should further split muser_ctx.c so that unit tests can genuinely be written towards testing compilation units. Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
2020-07-22clarify use of lm_irq_triggerThanos Makatos2-8/+8
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-07-22muser: use the correct PCI_COMMAND interrupt disable(ID) bitChangpeng Liu2-15/+2
When PCI_COMMAND interrupt disable bit set to 1, it means disable the pin-based INTx interrupt. For NVMe controller, it will use INTx first, and then switch to MSIX, the interrupt vector 0 is both valid for INTx and MSIX, so here we remove the check when posting an interrupt, just check the interrupt fd is valid or not. Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2020-07-22add optional callback to notify context when DMA region is addedThanos Makatos2-0/+11
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-07-21document current work regarding VFIO-over-socketThanos Makatos1-0/+11
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-07-21focus README on VFIO-over-socketThanos Makatos1-81/+71
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-07-21change libvfio logging path to something more sensibleThanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-07-21make unmap_dma callback optionalThanos Makatos2-10/+34
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-07-20update gpio's command lineThanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-07-17update libpathtrapThanos Makatos1-0/+0
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-07-17refactor PCI capabilitiesThanos Makatos4-204/+140
This patch greatly refactors PCI capabilities. The main change is that we don't keep them in a list but simply store them in the PCI configuration space. Some corner cases aren't handled yet. It also fixes a bug where a capability isn't properly read depending on where it's located. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-07-16add common definition for PCI capability headerThanos Makatos5-26/+58
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-07-15libpathtrap: fix compilation for gcc 10 / ld 2.34Thanos Makatos1-0/+0
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>