aboutsummaryrefslogtreecommitdiff
path: root/samples/gpio-pci-idio-16.c
AgeCommit message (Collapse)AuthorFilesLines
2021-11-30introduce device quiesce callback (#609)Thanos Makatos1-2/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: John Leon <john.levon@nutanix.com>
2021-05-28gpio: optionally disable migration (#536)Thanos Makatos1-10/+16
This helps debugging. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2021-05-24fix region offset handling (#485)John Levon1-2/+2
The specification states that the region offset given in the region info should be used as the "offset" when mmap()ing the region from the client side. However, the library instead implemented a fixed offset scheme similar to that of vfio - and no clients actually set up the file like that. Instead, let servers define their own offsets, and pass them through to clients as is. It's up to the server to decide how its backing file or files is organized. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-05-21gpio-pci-idio-16: default to keep running (#470)John Levon1-7/+18
Default the gpio device server sample such that it stays running, so that we can do basic sanity testing of client re-connect. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2021-04-13tran_sock: use ERROR_INT() (#431)John Levon1-1/+0
Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-04-13drop use of __u* types (#438)John Levon1-7/+8
As we are now pure userspace, there is no need for us to use non-standard integer types. This leaves the copied defines from Linux's vfio.h alone, however. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-04-08Fix compiler error comparison is always true (#434)Michael Piszczek1-1/+1
Changed variable type for getopt() to fix compiler warning when compiling on arm Signed-off-by: mpiszczek <mpiszczek@ddn.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2021-03-31rework DMA callbacks (#396)John Levon1-14/+7
This fixes a number of issues with how DMA is handled, based on some changes by Thanos Makatos: - rename callbacks to register/unregister, as there is not necessarily any mapping - provide the (large) page-aligned mapped start and size, the page size used, as well as the protection flags: some API users need these - for convenience, provide the virtual address separately that corresponds to the mapped region - we should only require a DMA controller to use vfu_addr_to_sg(), not an unregister callback - the callbacks should return errno not -errno - region removal was incorrectly updating the region array - various other cleanups and clarifications Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-03-23add -Wmissing-declarations (#399)John Levon1-1/+1
This is used by SPDK, and it's generally useful. This also uncovered some issues in the test mocking. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2021-03-01optionally enable DMA controller in GPIO sample (#375)Thanos Makatos1-2/+25
This helps debugging. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2021-02-16support live migration in GPIO sample (#324)Thanos Makatos1-3/+84
* gpio: support live migration Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2021-02-10don't expose -errno in public API (#327)John Levon1-8/+4
Regardless of what we do internally, most of our API uses standard mechanisms for reporting errors. Fix vfu_run_ctx() to do so properly as well, and fix a couple of other references for user-provided callbacks. This will require a small fix to SPDK. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2021-01-04re-work PCI config setup API (#198)John Levon1-7/+5
Split up vfu_pci_setup_config_hdr(): individual "helpers" like vfu_pci_set_id() are much simpler to use than making the user specify the values in header-formatted structs; and this way if we want to add additional helpers, we won't need to modify the existing functions. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-01-04pass vfu_ctx_t to callbacks (#222)John Levon1-3/+3
It's easy (with the new vfu_get_private()) to go from a vfu_ctx to the private pointer, but not the reverse; pass the ctx into all the callbacks. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-15send file descriptors for sparse areas in get region info (#201)Thanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-10Drop vfu_ctx_drive() and use vfu_ctx_poll() (#178)swapnili1-1/+1
* Drop vfu_ctx_drive() and use vfu_run_ctx() Renamed vfu_ctx_poll() to vfu_run_ctx(). Updated vfu_run_ctx() to also handle blocking ctx. Instead of having separate functions for blocking and non-blocking ctx, better to have one. This way user can call same set of functions for both cases. Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-08Misc fixes for vfu_ctx_try_attach() and vfu_realize_ctx() (#175)swapnili1-0/+10
Misc changes for vfu_ctx_try_attach() * Rename to vfu_attach_ctx() * Removed call to vfu_realize_ctx(), should be called separately * Now vfu_attach_ctx() must also be called for blocking ctx. Misc changes for vfu_realize_ctx() * Made calling vfu_realize_ctx() mandatory * vfu_ctx_drive() and vfu_poll_ctx() returns EINVAL if the device is not realized. * Renamed vfu_ctx->ready to vfu_ctx->realized Added unit test for vfu_attach_ctx() and vfu_realize_ctx() Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-07setup an IRQ for the gpio sample server (#169)John Levon1-0/+5
Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-02rename VFU_REG_FLAG_* (#145)John Levon1-1/+1
We renamed other code to be "REGION" instead of "REG" so it's less ambiguous. Do the same for VFU_REG_FLAG_*. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-12-02use log level defines from syslogThanos Makatos1-2/+2
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-02introduce PCI typesThanos Makatos1-1/+2
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-02introduce device typeThanos Makatos1-1/+2
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-30Misc cleanup (#138)swapnili1-1/+1
* Rename vfu_ctx_destroy() to vfu_destroy_ctx() * Remove unused function copy_sparse_mmap_area() * Coding style fixes Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2020-11-30Update API's to accept sparse mmap areas as array and its count (#134)swapnili1-1/+1
* Pass region mmap areas as array * Pass migration sparse mmap areas as array * Move struct vfu_sparse_mmap_areas to lib/priv.h Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-27rename to libvfio-user (#128)John Levon1-18/+18
The muser name no longer reflects the implementation, and will just serve to confuse. Bite the bullet now, and rename ourselves to reflect the actual implementation. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-11-25PCI regions idx enum renamed to start with LM_PCI (#125)swapnili1-1/+1
* PCI regions idx enum renamed to start with LM_PCI Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-11-25Split log setup from lm_create_ctx() to lm_setup_log() (#126)swapnili1-2/+6
* Split log setup from lm_create_ctx() to lm_setup_log() Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-11-24fix compile with gcc 4.8.5John Levon1-4/+4
2020-11-24Api refactoring (#115)swapnili1-19/+23
API refactoring
2020-11-24clean up headersJohn Levon1-3/+3
Introduce include/ dir for public headers, and clean up include guards etc.
2020-11-19enable assert() in release builds (#98)John Levon1-6/+12
2020-11-19refactor socket code into lib/tran_sock.[ch] (#97)John Levon1-1/+2
2020-11-18small cleanups post-muser.ko removalJohn Levon1-8/+5
2020-11-17Fix compiler errors for non-dbg buildSwapnil Ingle1-4/+1
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-11-12Fix issues pointed by CFLAGS "-Wall -Werror -Wextra"Swapnil Ingle1-4/+5
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-09-28implement VFIO_USER_DEVICE_SET_IRQSThanos Makatos1-14/+0
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-24implement VFIO_USER_DMA_MAPThanos Makatos1-0/+13
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-23refactor send/recv of message plus fixesThanos Makatos1-2/+4
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-07-20update gpio's command lineThanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-07-06pass log level to log functionThanos Makatos1-1/+1
This is useful when using another log function from the log function callback. 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-25introduce vfio-over-socket transportThanos Makatos1-3/+29
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-02-25gpio sample: print error message when device UUID is missingThanos Makatos1-4/+10
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-11-20print error if device emulation fails in GPIO sampleThanos Makatos1-1/+7
closes #15 Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2019-11-02Add missing headersFelipe Franciosi1-0/+33
Several files were missing license headers. Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
2019-09-05introduce gpio sampleThanos Makatos1-0/+37
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>