aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Makatos <thanos.makatos@nutanix.com>2020-12-08 10:49:17 -0500
committerThanos Makatos <tmakatos@gmail.com>2020-12-11 12:54:21 +0000
commita7ecdc3de9f237d600ceaaa44285115a4e790829 (patch)
treeffbe0f047c3895e72235584ec2c2c81d1477e91f
parenta11cac3d0820999e2c2b03b26f8c5a2ed48e2a89 (diff)
downloadlibvfio-user-a7ecdc3de9f237d600ceaaa44285115a4e790829.zip
libvfio-user-a7ecdc3de9f237d600ceaaa44285115a4e790829.tar.gz
libvfio-user-a7ecdc3de9f237d600ceaaa44285115a4e790829.tar.bz2
minor comment fixes
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
-rw-r--r--include/libvfio-user.h7
-rw-r--r--lib/libvfio-user.c8
2 files changed, 11 insertions, 4 deletions
diff --git a/include/libvfio-user.h b/include/libvfio-user.h
index 120ffa4..e5b6474 100644
--- a/include/libvfio-user.h
+++ b/include/libvfio-user.h
@@ -272,7 +272,7 @@ typedef union {
* Setup PCI capabilities.
* @vfu_ctx: the libvfio-user context
* @caps: array of (vfu_cap_t *)
- * *nr_caps: number of elements in @caps
+ * @nr_caps: number of elements in @caps
*/
int
vfu_pci_setup_caps(vfu_ctx_t *vfu_ctx, vfu_cap_t **caps, int nr_caps);
@@ -600,9 +600,8 @@ vfu_realize_ctx(vfu_ctx_t *vfu_ctx);
int
vfu_attach_ctx(vfu_ctx_t *vfu_ctx);
-/*
- * FIXME need to make sure that there can be at most one capability with a given
- * ID, otherwise this function will return the first one with this ID.
+/* FIXME this function is broken as the can be multiples capabilities with the
+ * same ID, e.g. the vendor-specific capability.
* @vfu_ctx: the libvfio-user context
* @id: capability id
*/
diff --git a/lib/libvfio-user.c b/lib/libvfio-user.c
index 082ac7c..af7a7bf 100644
--- a/lib/libvfio-user.c
+++ b/lib/libvfio-user.c
@@ -284,6 +284,10 @@ pci_config_space_size(vfu_ctx_t *vfu_ctx)
return region_size(vfu_ctx, VFU_PCI_DEV_CFG_REGION_IDX);
}
+/*
+ * Accesses the non-standard part (offset >= 0x40) of the PCI configuration
+ * space.
+ */
static ssize_t
handle_pci_config_space_access(vfu_ctx_t *vfu_ctx, char *buf, size_t count,
loff_t pos, bool is_write)
@@ -299,6 +303,10 @@ handle_pci_config_space_access(vfu_ctx_t *vfu_ctx, char *buf, size_t count,
return ret;
}
} else {
+ /*
+ * It is legitimate to read the non-standard part of the PCI config
+ * space even if there are no capabilities.
+ */
memcpy(buf, vfu_ctx->pci.config_space->raw + pos, count);
}
return count;