diff options
-rw-r--r-- | include/libvfio-user.h | 7 | ||||
-rw-r--r-- | lib/libvfio-user.c | 8 |
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; |