summary refs log tree commit diff stats
path: root/hw/core/machine.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2018-09-12 16:18:00 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2019-01-07 16:18:42 +0400
commitfa0cb34d2210cc749b9a70db99bb41c56ad20831 (patch)
treef8d77d4385357c78e11d80b6dddec491252ddb8d /hw/core/machine.c
parent51e5ef459eca045d7e8afe880ee60190f0b75b26 (diff)
downloadfocaccia-qemu-fa0cb34d2210cc749b9a70db99bb41c56ad20831.tar.gz
focaccia-qemu-fa0cb34d2210cc749b9a70db99bb41c56ad20831.zip
hostmem: use object id for memory region name with >= 4.0
hostmem-file and hostmem-memfd use the whole object path for the
memory region name, and hostname-ram uses only the path component (the
object id, or canonical path basename):

qemu -m 1024 -object memory-backend-file,id=mem,size=1G,mem-path=/tmp/foo -numa node,memdev=mem -monitor stdio
(qemu) info ramblock
              Block Name    PSize              Offset               Used              Total
            /objects/mem    4 KiB  0x0000000000000000 0x0000000040000000 0x0000000040000000

qemu -m 1024 -object memory-backend-memfd,id=mem,size=1G -numa node,memdev=mem -monitor stdio
(qemu) info ramblock
              Block Name    PSize              Offset               Used              Total
            /objects/mem    4 KiB  0x0000000000000000 0x0000000040000000 0x0000000040000000

qemu -m 1024 -object memory-backend-ram,id=mem,size=1G -numa node,memdev=mem -monitor stdio
(qemu) info ramblock
              Block Name    PSize              Offset               Used              Total
                     mem    4 KiB  0x0000000000000000 0x0000000040000000 0x0000000040000000

For consistency, change to use object id for -file and -memfd as well
with >= 4.0.

Having a consistent naming allows to migrate to different hostmem
backends.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'hw/core/machine.c')
-rw-r--r--hw/core/machine.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 84a4c8cdc3..f8563efb86 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -32,6 +32,14 @@ GlobalProperty hw_compat_3_1[] = {
         .driver   = "pcie-root-port",
         .property = "x-width",
         .value    = "1",
+    },{
+        .driver   = "memory-backend-file",
+        .property = "x-use-canonical-path-for-ramblock-id",
+        .value    = "true",
+    },{
+        .driver   = "memory-backend-memfd",
+        .property = "x-use-canonical-path-for-ramblock-id",
+        .value    = "true",
     },
 };
 const size_t hw_compat_3_1_len = G_N_ELEMENTS(hw_compat_3_1);