aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/vfio-user.rst14
-rw-r--r--include/vfio-user.h11
-rw-r--r--lib/libvfio-user.c4
-rw-r--r--samples/client.c6
-rw-r--r--test/unit-tests.c4
5 files changed, 25 insertions, 14 deletions
diff --git a/docs/vfio-user.rst b/docs/vfio-user.rst
index b3498ee..a031778 100644
--- a/docs/vfio-user.rst
+++ b/docs/vfio-user.rst
@@ -156,10 +156,10 @@ Device-Specific Regions
"""""""""""""""""""""""
A device can define regions additional to the standard ones (e.g. PCI indexes
-0-8). This is achieved by including a VFIO_REGION_INFO_CAP_TYPE capability
-in the region info reply of a device-specific region. Such regions are reflected
-in ``struct vfio_device_info.num_regions``. Thus, for PCI devices this value can
-be equal to, or higher than, VFIO_PCI_NUM_REGIONS.
+0-8). This is achieved by including a VFIO_REGION_INFO_CAP_TYPE capability in
+the region info reply of a device-specific region. Such regions are reflected in
+``struct vfio_user_device_info.num_regions``. Thus, for PCI devices this value
+can be equal to, or higher than, VFIO_PCI_NUM_REGIONS.
Region I/O via file descriptors
-------------------------------
@@ -737,8 +737,7 @@ Message format
+--------------+----------------------------+
This command message is sent by the client to the server to query for basic
-information about the device. The VFIO device info structure is defined in
-``<linux/vfio.h>`` (``struct vfio_device_info``).
+information about the device.
VFIO device info format
^^^^^^^^^^^^^^^^^^^^^^^
@@ -765,7 +764,8 @@ VFIO device info format
* *argsz* is the size of the VFIO device info structure. This is the only field
that should be set to non-zero in the request, identifying the client's expected
-size. Currently this is a fixed value.
+size. This must be at least the size of the struct above; it will be set to
+actual size filled in in the reply.
* *flags* contains the following device attributes.
* VFIO_DEVICE_FLAGS_RESET indicates that the device supports the
diff --git a/include/vfio-user.h b/include/vfio-user.h
index 11eb366..053ead2 100644
--- a/include/vfio-user.h
+++ b/include/vfio-user.h
@@ -96,6 +96,17 @@ struct vfio_user_version {
uint8_t data[];
} __attribute__((packed));
+/*
+ * Similar to vfio_device_info, but without caps (yet).
+ */
+struct vfio_user_device_info {
+ uint32_t argsz;
+ /* VFIO_DEVICE_FLAGS_* */
+ uint32_t flags;
+ uint32_t num_regions;
+ uint32_t num_irqs;
+} __attribute__((packed));
+
struct vfio_user_dma_region {
uint64_t addr;
uint64_t size;
diff --git a/lib/libvfio-user.c b/lib/libvfio-user.c
index 8a80dfc..817d9e9 100644
--- a/lib/libvfio-user.c
+++ b/lib/libvfio-user.c
@@ -347,8 +347,8 @@ handle_region_access(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg)
int
handle_device_get_info(vfu_ctx_t *vfu_ctx, vfu_msg_t *msg)
{
- struct vfio_device_info *in_info;
- struct vfio_device_info *out_info;
+ struct vfio_user_device_info *in_info;
+ struct vfio_user_device_info *out_info;
assert(vfu_ctx != NULL);
assert(msg != NULL);
diff --git a/samples/client.c b/samples/client.c
index e27a323..fb69ce8 100644
--- a/samples/client.c
+++ b/samples/client.c
@@ -338,7 +338,7 @@ get_device_region_info(int sock, uint32_t index)
}
static void
-get_device_regions_info(int sock, struct vfio_device_info *client_dev_info)
+get_device_regions_info(int sock, struct vfio_user_device_info *client_dev_info)
{
unsigned int i;
@@ -348,7 +348,7 @@ get_device_regions_info(int sock, struct vfio_device_info *client_dev_info)
}
static void
-get_device_info(int sock, struct vfio_device_info *dev_info)
+get_device_info(int sock, struct vfio_user_device_info *dev_info)
{
uint16_t msg_id = 0xb10c;
int ret;
@@ -1063,7 +1063,7 @@ int main(int argc, char *argv[])
{
int ret, sock, irq_fd;
struct vfio_user_dma_region *dma_regions;
- struct vfio_device_info client_dev_info = {0};
+ struct vfio_user_device_info client_dev_info = {0};
int *dma_region_fds;
int i;
FILE *fp;
diff --git a/test/unit-tests.c b/test/unit-tests.c
index 28eec74..86cc11e 100644
--- a/test/unit-tests.c
+++ b/test/unit-tests.c
@@ -1237,8 +1237,8 @@ test_pci_ext_caps(void **state UNUSED)
static void
test_device_get_info(void **state UNUSED)
{
- struct vfio_device_info d_in = { .argsz = sizeof(d_in) + 1 };
- struct vfio_device_info *d_out;
+ struct vfio_user_device_info d_in = { .argsz = sizeof(d_in) + 1 };
+ struct vfio_user_device_info *d_out;
int ret;
vfu_ctx.nr_regions = 0xdeadbeef;