diff options
author | Felipe Franciosi <felipe@nutanix.com> | 2019-10-03 17:44:08 +0100 |
---|---|---|
committer | Felipe Franciosi <felipe@nutanix.com> | 2019-10-03 17:54:56 +0100 |
commit | 9e73c73ac9adc6ee49632ef8be2bf8d987087912 (patch) | |
tree | 196cc4bee50b73a4c91418acbf1e66a2d89474ed /lib/libmuser.c | |
parent | d6faa3db75bc177ebdda4b3d93e1d2ec6168f283 (diff) | |
download | libvfio-user-9e73c73ac9adc6ee49632ef8be2bf8d987087912.zip libvfio-user-9e73c73ac9adc6ee49632ef8be2bf8d987087912.tar.gz libvfio-user-9e73c73ac9adc6ee49632ef8be2bf8d987087912.tar.bz2 |
libmuser: add default noop_cb for config region
This got broken at some point and we missed it. If a device doesn't add
capabilities then reading from the config region returns short and fails.
Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
Diffstat (limited to 'lib/libmuser.c')
-rw-r--r-- | lib/libmuser.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/libmuser.c b/lib/libmuser.c index 3b83ab5..b0165ce 100644 --- a/lib/libmuser.c +++ b/lib/libmuser.c @@ -655,6 +655,12 @@ lm_get_region(const loff_t pos, const size_t count, loff_t * const off) } static ssize_t +noop_cb(void *pvt, char * const buf, size_t count, + loff_t offset, const bool is_write) { + return count; +} + +static ssize_t handle_pci_config_space_access(lm_ctx_t *lm_ctx, char *buf, size_t count, loff_t pos, bool is_write, lm_region_access_t *pci_config_fn) @@ -1150,7 +1156,8 @@ lm_ctx_create(lm_dev_info_t * const dev_info) { static const lm_reg_info_t default_cfg_reg_info = { .flags = LM_REG_FLAG_RW, - .size = PCI_CFG_SPACE_SIZE + .size = PCI_CFG_SPACE_SIZE, + .fn = noop_cb }; lm_ctx->pci_info.reg_info[LM_DEV_CFG_REG_IDX] = default_cfg_reg_info; } |