aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-07-15use HTTPS for libpathtrapThanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-07-15fix verbose loggingThanos Makatos4-53/+42
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-07-15handle PCI capabilities internallyThanos Makatos4-44/+344
Very few capabilities are handled, and implementation isn't great. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-07-09minor improvements in non-blocking receive pathThanos Makatos1-15/+13
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-07-09Use MSG_DONTWAIT to receive requests if LM_FLAG_ATTACH_NB is specifiedBen Walker1-1/+18
If the user wanted non-blocking operation, don't block on the socket waiting for requests. Instead, use MSG_DONTWAIT to attempt to get the next request and return. The other operations all remain as blocking calls because they are not expected to ever need to wait. Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2020-07-09All transport operations now take an lm_ctx_t as an argumentBen Walker1-23/+36
This is both for consistency and because the socket transport is going to need some place to cache things to handle partial sends and receives. Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2020-07-08fix assertionThanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-07-08dma: notify device of DMA removal eventsThanos Makatos4-39/+106
This patch introduces a new device callback that is called when a DMA region is removed. The device must provide this callback and when the callback returns all references to the DMA regions must have been removed. This new functionality is necessary since a DMA region can be removed at any time, so the device must be given a chance to drop all references and perform the necessary cleanup. This patch also stores lm_ctx_t inside dma_controller_t so that we don't have to pass lm_ctx_t when calling dma_XXX functions. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-07-08null device: add muser prefix in log callbackThanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-07-08Add lm_ctx_poll() as an alternative to lm_ctx_drive()Ben Walker2-53/+82
Using lm_ctx_poll() simply polls for work and returns instead of blocking. It is only valid when used on an lm_ctx created with LM_FLAG_ATTACH_NB. Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2020-07-08Drop __attribute__((packed))from struct lm_ctxBen Walker1-13/+4
This makes it unsafe to take pointers to addresses within this data structure, and lots of the code does that. Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2020-07-06pass log level to log functionThanos Makatos4-4/+4
This is useful when using another log function from the log function callback. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-07-06don't leak caps when destroying LM contextThanos Makatos1-0/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-07-03ignore VGA palette snoopingThanos Makatos1-0/+5
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-07-03handle memory write and invalidateThanos Makatos1-0/+13
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-06-24don't blindly trust region_hintThanos Makatos2-1/+6
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-06-23improve message when VFIO client closes connectionThanos Makatos1-1/+5
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-06-12muser: 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> (cherry picked from commit 8ab7ca7d04365a7c39cd12ea45f8b9f7fa0afd47)
2020-06-04work in progress to make attaching to the transport optionally non-blockingThanos Makatos2-24/+109
This is required for using multiple controllers in SPDK. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-06-01let the control stack create IOMMU group symlink under /de/vfioThanos Makatos1-6/+0
2020-05-26FIXME loggingThanos Makatos1-1/+6
2020-05-26user arbitraty path for control filesThanos Makatos2-19/+20
The parent directories must exist and the last component must be the IOMMU group. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-05-21allow non-root access to UNIX domain socketThanos Makatos1-4/+11
SPDK has a hard time running as non-root. This is a temporary hack. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-05-20allow installation location to be overriddenThanos Makatos1-0/+2
This allows package systems to use /usr (instead of CMake's default /usr/local), which is the typical choice.
2020-05-15use /var/run/muser instead of /dev/vfioThanos Makatos4-3/+4
This avoids problems with cgroups. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-05-14install libvfio libraryThanos Makatos1-0/+2
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-05-13disable building kernel moduleThanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-03-27fix compilationThanos Makatos2-7/+4
Compilation is broken because it required an existing installation of libmuser, including the correct header files fixes it. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-03-25trap SIGINT in gpio sampleThanos Makatos1-2/+26
This allows system calls to return if a signal is sent (e.g. SIGINT) in order to clean uo properly. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-03-25use lm_ctx_destroy for cleaning up failed lm_ctx_createThanos Makatos1-7/+3
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-03-25don't close invalid fds and log error if close failsThanos Makatos2-9/+30
This helps reduce noise and debugging. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-03-25introduce vfio-over-socket transportThanos Makatos10-93/+1108
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-03-25save/restore errno in lm_logThanos Makatos1-4/+4
This simplifies callers of lm_log who use errno. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-03-24provide more information in some error casesThanos Makatos1-3/+10
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-03-24coding style fixesThanos Makatos1-16/+16
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-03-24don't use fd for matching DMA region for unmapThanos Makatos3-38/+30
The fd might come from another process so it doesn't make sense, the IOVA range alone is sufficient to determine the DMA region to unmap. Also, don't fail unmapping DMA regions that don't exist. Maybe we should revisit this and ignore the error at the client side? Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-03-24pack struct pmcsThanos Makatos1-2/+2
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-03-09ignore NULL arg in dma_controller_destroyThanos Makatos1-0/+3
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-02-28log error messages when failing to remove DMAThanos Makatos3-13/+21
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-02-28make remove DMA message consistent to addThanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-02-28don't pass negative error code to strerrorThanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-02-28don't dup DMA region fdThanos Makatos1-7/+1
fixes #47 Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-02-28code cleanupThanos Makatos1-1/+3
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-02-28add sample to test #47Thanos Makatos2-0/+111
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-02-28keep reference to file backing DMA regionThanos Makatos1-4/+2
This is required for restartable device emulation. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-02-28refactor libmuser_unl_ioctlThanos Makatos1-88/+93
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-02-28print file path for DMA map/unmapThanos Makatos1-9/+37
This should probably only be done for debug builds, and I don't think we need to print the fd. I'm enabling it for now because this is a new feature so it's good to have these messages until we're convinced it works properly. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-02-28improve readability of messages about memory rangesThanos Makatos1-1/+2
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-02-28ignore non-existent DMA regions when unmappingThanos Makatos1-2/+11
The problem of not receiving a DMA unmap looks like it will be solved by having VFIO send us the DMA unmap even if we haven't called vfio_pin_pages, so instead of failing for regions we haven't mapped (e.g. non-shared regions) we simply ignore that operation. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-02-28use correct fd for DMA unmapThanos Makatos2-4/+11
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>