aboutsummaryrefslogtreecommitdiff
path: root/include/libvfio-user.h
diff options
context:
space:
mode:
authorThanos Makatos <thanos.makatos@nutanix.com>2020-12-08 10:58:29 -0500
committerThanos Makatos <tmakatos@gmail.com>2020-12-11 12:54:21 +0000
commit90211fbd2c7c310df593736b18f1c99f053e2957 (patch)
tree03462a28541581cbf3ea6eb8f9fde05591c3e893 /include/libvfio-user.h
parenta7ecdc3de9f237d600ceaaa44285115a4e790829 (diff)
downloadlibvfio-user-90211fbd2c7c310df593736b18f1c99f053e2957.zip
libvfio-user-90211fbd2c7c310df593736b18f1c99f053e2957.tar.gz
libvfio-user-90211fbd2c7c310df593736b18f1c99f053e2957.tar.bz2
add support PCI vendor-specific capability
The PCI vendor-specific capability is blindly read/written by the library. It is possible that the user might want to intercept accesses to it, in which case we'll have to add callback. The best way to do this to introduce a new function that configures callbacks for the PCI capabilities, e.g. typedef ssize_t (vfu_cap_access_t) (void *pvt, uint8_t id, char *buf, size_t count, loff_t offset, bool is_write); vfu_pci_cap_set_cb(vfu_ctx-T *vfu_ctx, uint8_t cap_id, vfu_cap_access_t *cb); This way the existing API won't have to change. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'include/libvfio-user.h')
-rw-r--r--include/libvfio-user.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/include/libvfio-user.h b/include/libvfio-user.h
index e5b6474..95c5e7d 100644
--- a/include/libvfio-user.h
+++ b/include/libvfio-user.h
@@ -221,6 +221,7 @@ vfu_ctx_t *
vfu_create_ctx(vfu_trans_t trans, const char *path,
int flags, void *pvt, vfu_dev_type_t dev_type);
+
/**
* Setup logging information.
* @vfu_ctx: the libvfio-user context
@@ -261,15 +262,18 @@ vfu_pci_setup_config_hdr(vfu_ctx_t *vfu_ctx, vfu_pci_hdr_id_t id,
/* FIXME does it have to be packed as well? */
typedef union {
- struct msicap msi;
- struct msixcap msix;
- struct pmcap pm;
- struct pxcap px;
+ struct msicap msi;
+ struct msixcap msix;
+ struct pmcap pm;
+ struct pxcap px;
+ struct vsc vsc;
} vfu_cap_t;
//TODO: Support variable size capabilities.
+
/**
* Setup PCI capabilities.
+ *
* @vfu_ctx: the libvfio-user context
* @caps: array of (vfu_cap_t *)
* @nr_caps: number of elements in @caps