aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
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
2019-10-03libmuser: add default noop_cb for config regionFelipe Franciosi1-1/+8
This got broken at some point and we missed it. If a device doesn't add capabilities then reading from the config region returns short and fails. Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
2019-09-27merge FIXME commentsThanos Makatos1-2/+0
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-09-27update comment regading using local variableThanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-09-27use local variable for clarityThanos Makatos1-6/+6
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-09-27fix typosThanos Makatos2-3/+4
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-09-27clarify usage of lm_irq_triggerThanos Makatos1-2/+5
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-09-27don't omit number of bytes read from the standard PCI header when returning ↵Thanos Makatos1-17/+22
total number of bytes read Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-09-27don't fail reads for capabilities that do not existThanos Makatos1-1/+1
Previously we failed reads for capabilities that do not exist, that is any read in region 0x40 and 0x100. It is s perfectly legitimate to read that part of the PCI config space even if there's nothing there, we just return zeros. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-09-27don't trigger INTx IRQ if it's disabledThanos Makatos1-0/+15
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-09-27print offset of bad access to capabilities using hexThanos Makatos1-1/+1
All other prints for offset use hex, so let's make it consistent. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-09-27make debug logging more configurableThanos Makatos3-0/+20
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-09-27add more debug messages when handling interruptsThanos Makatos1-0/+21
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-09-27add MSI-X capability headerThanos Makatos1-0/+70
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-09-27add some function documentationThanos Makatos2-0/+14
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-09-27fix order of MSI capability id and nextThanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-09-27add FIXME commentThanos Makatos1-0/+4
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-09-20remove unnecessary initialization of global pointerThanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-09-20stylistic correctionsThanos Makatos1-5/+4
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-09-20remove unused includeThanos Makatos1-1/+0
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-09-20remove unnecessary space around double #Thanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-09-20fix coding style violation rergarding curly bracketThanos Makatos1-34/+17
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>