aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2020-07-06pass log level to log functionThanos Makatos2-2/+2
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-26user arbitraty path for control filesThanos Makatos1-18/+18
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-15use /var/run/muser instead of /dev/vfioThanos Makatos2-2/+3
This avoids problems with cgroups. 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 Makatos2-57/+429
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-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-28use correct fd for DMA unmapThanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-02-25mmap fd instead of grabbing pages when receiving DMA region registrationThanos Makatos1-9/+13
This enables huge pages to work. Also, it avoids requiring having to pin memory. The solution is not 100% correct because since we no longer call vfio_pin_pages, VFIO doesn't send the DMA registration event and we end up getting duplicate regions which we reject (this is because of our internal DMA bookkeeping implementation). We need to work with the community to find a solution. fixes #28 fixes #29 fixes #38 Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-02-25improve readability of messages about memory rangesThanos Makatos1-11/+15
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-01-13don't take address of packed memberThanos Makatos1-4/+5
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-12-17return correct error code on device map failure from user spaceThanos Makatos1-5/+5
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-11-21lib/dma: remove DMA_MAP_FAST_IMPLSwapnil Ingle4-56/+20
muser works only with DMA_MAP_FAST_IMPL, So no need to support !DMA_MAP_FAST_IMPL implementation. Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2019-11-13return zeros when unpopulated part of PCI config space is readThanos Makatos1-17/+22
fixes #10 Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-11-08libmuser: Organise lm_ctx_create and friendsFelipe Franciosi4-94/+96
Current state of lm_ctx_create is quite messy. This cleans it up considerably, moving the pci config space creation to a separate helper. It gets rid of the 'extended' bool from dev_info, meaning that a client that wants to have a 4KiB config header should specify it on the corresponding region. This may all need reviewing later if we decide that other regions may be always handled by libmuser, in which case we can hide config, vga (and maybe rom?) entirely from our clients. Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
2019-11-08Integrate with Travis CIv0.1Felipe Franciosi1-0/+1
This adds a simple .travis.yml file for integration with Travis CI. It tries to build muser.git on a Ubuntu Bionic environment using the Linux kernel 5.2.21. Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
2019-11-07enable -Wall, -Wextra, and -Werror and fix all warningsThanos Makatos9-47/+57
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-11-06muser, libmuser: Do not abuse muser_cmd.mmap.response to return errSwapnil Ingle1-12/+3
muser_cmd.mmap.response is unsigned and should not be used to return errors, instead use muser_cmd.err Also fixed the code path to use valid errno values. Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2019-11-04muser.h: remove unused variable struct muser_cmd_rw.bufSwapnil Ingle1-14/+14
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2019-11-04Merge pull request #2 from franciozzy/cleanupFelipe Franciosi18-214/+355
Cleanup
2019-11-04Hide ERR/REQ IRQs from clientsFelipe Franciosi2-9/+4
Users of libmuser do not need to know about ERR/REQ IRQs. We can later plumb the correct support to fire REQ IRQs (for graceful removal of devices) via a dedicated method (if ever needed). Similarly we should offer a method to raise an ERR IRQ accordingly. Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
2019-11-04Remove incorrect guards on dump_buffer()Felipe Franciosi1-2/+0
The dump_buffer() method has internal guards, causing the function to be optimised out (within a compilation unit) if DEBUG is not set. The guards around the function export are not needed. Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
2019-11-04Standardise function signaturesFelipe Franciosi10-150/+173
This makes all function signatures consistent, using a line break after the return type. It also review the usage of const across the project and fixes some other minor alignment issues. Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
2019-11-02libmuser: grammar fix for lm_irq_trigger() doc commentsStefan Hajnoczi1-2/+2
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-11-02libmuser: fix 'hanlded' typoStefan Hajnoczi1-1/+1
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-11-02Fix shell script shebangFelipe Franciosi1-1/+1
It wasn't on the right place... Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
2019-11-02Fix various guard issuesFelipe Franciosi8-4/+27
Some guards were missing, others were misaligned. Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
2019-11-02Add missing headersFelipe Franciosi3-0/+96
Several files were missing license headers. Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
2019-11-02Fix various format issuesFelipe Franciosi10-52/+58
Remove various spurious whitespaces and empty lines. Some other alignment issues, too. Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
2019-10-03libmuser: check pointers following coding styleFelipe Franciosi1-7/+7
Coding style says pointers should be explicitly checked.
2019-10-03Minor alignment fixesFelipe Franciosi1-5/+9