aboutsummaryrefslogtreecommitdiff
path: root/lib/migration.c
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2021-01-07 19:55:44 +0000
committerGitHub <noreply@github.com>2021-01-07 19:55:44 +0000
commit6ec31642f6253f5c19187c1ffb396d5921138b67 (patch)
tree9dd88104b0d56e63a83a48efbec6887cafc26730 /lib/migration.c
parent70524c550322948765415d9b0eb29ac766e32e79 (diff)
downloadlibvfio-user-6ec31642f6253f5c19187c1ffb396d5921138b67.zip
libvfio-user-6ec31642f6253f5c19187c1ffb396d5921138b67.tar.gz
libvfio-user-6ec31642f6253f5c19187c1ffb396d5921138b67.tar.bz2
re-work access handling (#220)
Various cleanups and fixes to handling of region accesses, including: - there should be no reason for us to split accesses into 1/2/4/8 byte accesses: in general, the client will have already be doing that, and if not, there's no particular reason we should be the ones to split up such larger accesses. - use a callback for PCI config space reads and writes if one is provided (needs more work for capabilities) 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/migration.c')
-rw-r--r--lib/migration.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/migration.c b/lib/migration.c
index 29c667b..91fd09f 100644
--- a/lib/migration.c
+++ b/lib/migration.c
@@ -36,6 +36,7 @@
#include "common.h"
#include "migration.h"
+#include "private.h"
enum migr_iter_state {
VFIO_USER_MIGR_ITER_STATE_INITIAL,
@@ -380,10 +381,10 @@ handle_data_size(vfu_ctx_t *vfu_ctx, struct migration *migr,
}
static ssize_t
-handle_region_access_registers(vfu_ctx_t *vfu_ctx, struct migration *migr,
- char *buf, size_t count,
- loff_t pos, bool is_write)
+migration_region_access_registers(vfu_ctx_t *vfu_ctx, char *buf, size_t count,
+ loff_t pos, bool is_write)
{
+ struct migration *migr = vfu_ctx->migration;
int ret;
assert(migr != NULL);
@@ -430,18 +431,18 @@ handle_region_access_registers(vfu_ctx_t *vfu_ctx, struct migration *migr,
}
ssize_t
-handle_migration_region_access(vfu_ctx_t *vfu_ctx, struct migration *migr,
- char *buf, size_t count,
- loff_t pos, bool is_write)
+migration_region_access(vfu_ctx_t *vfu_ctx, char *buf, size_t count,
+ loff_t pos, bool is_write)
{
- int ret = -EINVAL;
+ struct migration *migr = vfu_ctx->migration;
+ ssize_t ret = -EINVAL;
assert(migr != NULL);
assert(buf != NULL);
if (pos + count <= sizeof(struct vfio_device_migration_info)) {
- ret = handle_region_access_registers(vfu_ctx, migr, buf,
- count, pos, is_write);
+ ret = migration_region_access_registers(vfu_ctx, buf, count,
+ pos, is_write);
} else {
pos -= sizeof(struct vfio_device_migration_info);
if (is_write) {