aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorYury Kotov <yury-kotov@yandex-team.ru>2019-02-15 20:45:44 +0300
committerDr. David Alan Gilbert <dgilbert@redhat.com>2019-03-06 10:49:17 +0000
commit754cb9c0ebcf2164107baf39e75517e459887622 (patch)
tree935baacab47105e5ac101848413b7bb3b39008d0 /util
parent9589e7630139700581eff3ba9ddfdfbe99362440 (diff)
downloadqemu-754cb9c0ebcf2164107baf39e75517e459887622.zip
qemu-754cb9c0ebcf2164107baf39e75517e459887622.tar.gz
qemu-754cb9c0ebcf2164107baf39e75517e459887622.tar.bz2
exec: Change RAMBlockIterFunc definition
Currently, qemu_ram_foreach_* calls RAMBlockIterFunc with many block-specific arguments. But often iter func needs RAMBlock*. This refactoring is needed for fast access to RAMBlock flags from qemu_ram_foreach_block's callback. The only way to achieve this now is to call qemu_ram_block_from_host (which also enumerates blocks). So, this patch reduces complexity of qemu_ram_foreach_block() -> cb() -> qemu_ram_block_from_host() from O(n^2) to O(n). Fix RAMBlockIterFunc definition and add some functions to read RAMBlock* fields witch were passed. Signed-off-by: Yury Kotov <yury-kotov@yandex-team.ru> Message-Id: <20190215174548.2630-2-yury-kotov@yandex-team.ru> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'util')
-rw-r--r--util/vfio-helpers.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c
index 342d4a2..2367fe8 100644
--- a/util/vfio-helpers.c
+++ b/util/vfio-helpers.c
@@ -391,10 +391,10 @@ static void qemu_vfio_ram_block_removed(RAMBlockNotifier *n,
}
}
-static int qemu_vfio_init_ramblock(const char *block_name, void *host_addr,
- ram_addr_t offset, ram_addr_t length,
- void *opaque)
+static int qemu_vfio_init_ramblock(RAMBlock *rb, void *opaque)
{
+ void *host_addr = qemu_ram_get_host_addr(rb);
+ ram_addr_t length = qemu_ram_get_used_length(rb);
int ret;
QEMUVFIOState *s = opaque;