Age | Commit message (Collapse) | Author | Files | Lines |
|
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
|
|
Also added some better logs messages
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
|
|
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
|
|
WIP: test sparse capability and add sample test for it
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
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>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
|
|
Initial client and server implementation of VFIO_USER_DEVICE_GET_INFO.
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
|
|
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>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
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>
|
|
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
|
|
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>
|
|
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>
|
|
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>
|
|
On certain error paths, @dma will be NULL. This makes the destructor
cope with it.
Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
|
|
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>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
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>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
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>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Very few capabilities are handled, and implementation isn't great.
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
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>
|
|
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>
|
|
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
|
|
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>
|
|
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>
|
|
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>
|