diff options
author | John Levon <john.levon@nutanix.com> | 2021-01-20 09:46:32 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-20 09:46:32 +0000 |
commit | 5aa56c58446c43f085da7ff6ca339d7361b8302d (patch) | |
tree | 1561f51430830157615fcaf79ed5e92d37ce95d5 /lib/private.h | |
parent | 7a9335eb438d29bf5be8caa67bf5252bb891076f (diff) | |
download | libvfio-user-5aa56c58446c43f085da7ff6ca339d7361b8302d.zip libvfio-user-5aa56c58446c43f085da7ff6ca339d7361b8302d.tar.gz libvfio-user-5aa56c58446c43f085da7ff6ca339d7361b8302d.tar.bz2 |
re-work API for adding capabilities (#200)
Allow to add capabilities individually, including extended capabilities, and
those to be handled via the region callback.
As a side effect, rework config space accesses to handle reads that straddle
capabilities and non-standard areas and use callbacks as needed.
Signed-off-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'lib/private.h')
-rw-r--r-- | lib/private.h | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/lib/private.h b/lib/private.h index a3b90f5..1674271 100644 --- a/lib/private.h +++ b/lib/private.h @@ -33,6 +33,7 @@ #ifndef LIB_VFIO_USER_PRIVATE_H #define LIB_VFIO_USER_PRIVATE_H +#include "pci_caps.h" #include "dma.h" static inline int @@ -73,32 +74,23 @@ struct vfu_sparse_mmap_areas { }; typedef struct { - - /* - * Region flags, see VFU_REGION_FLAG_READ and friends. - */ + /* Region flags, see VFU_REGION_FLAG_READ and friends. */ uint32_t flags; - - /* - * Size of the region. - */ + /* Size of the region. */ uint32_t size; - - /* - * Callback function that is called when the region is read or written. - * Note that the memory of the region is owned by the user, except for the - * standard header (first 64 bytes) of the PCI configuration space. - */ + /* Callback that is called when the region is read or written. */ vfu_region_access_cb_t *cb; - - struct vfu_sparse_mmap_areas *mmap_areas; /* sparse mmap areas */ + /* Sparse mmap areas if set. */ + struct vfu_sparse_mmap_areas *mmap_areas; + /* fd for a mappable region, or -1. */ int fd; } vfu_reg_info_t; struct pci_dev { vfu_pci_type_t type; vfu_pci_config_space_t *config_space; - struct caps *caps; + struct pci_cap caps[VFU_MAX_CAPS]; + size_t nr_caps; }; struct vfu_ctx { |