summaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2011-05-03 12:48:09 -0600
committerAurelien Jarno <aurelien@aurel32.net>2011-06-03 22:59:15 +0200
commit1f2e98b62d62205de9d52e81aca78e78712af973 (patch)
treedafc7bc15b6bfb6af3a425ab52448cc83b1ed4c6 /exec.c
parentc83066d4c4a13d687d60f1f18c748f934b5a5be6 (diff)
downloadqemu-1f2e98b62d62205de9d52e81aca78e78712af973.tar.gz
qemu-1f2e98b62d62205de9d52e81aca78e78712af973.tar.bz2
qemu-1f2e98b62d62205de9d52e81aca78e78712af973.zip
exec: Implement qemu_ram_free_from_ptr()
Required for regions mapped via qemu_ram_alloc_from_ptr(). VFIO and ivshmem will make use of this to remove mappings when devices are hot unplugged. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/exec.c b/exec.c
index 8529390cb2..6f339efb10 100644
--- a/exec.c
+++ b/exec.c
@@ -2952,6 +2952,19 @@ ram_addr_t qemu_ram_alloc(DeviceState *dev, const char *name, ram_addr_t size)
return qemu_ram_alloc_from_ptr(dev, name, size, NULL);
}
+void qemu_ram_free_from_ptr(ram_addr_t addr)
+{
+ RAMBlock *block;
+
+ QLIST_FOREACH(block, &ram_list.blocks, next) {
+ if (addr == block->offset) {
+ QLIST_REMOVE(block, next);
+ qemu_free(block);
+ return;
+ }
+ }
+}
+
void qemu_ram_free(ram_addr_t addr)
{
RAMBlock *block;