aboutsummaryrefslogtreecommitdiff
path: root/qapi
diff options
context:
space:
mode:
authorAlexander Graf <graf@amazon.com>2023-04-03 22:14:21 +0000
committerDavid Hildenbrand <david@redhat.com>2023-05-23 16:47:03 +0200
commit4b870dc4d0c0895859d34d14ce0272a4bcbccf78 (patch)
tree8af35d1db6ba0cd63419627870a0a75aec9bf150 /qapi
parent886c0453cbf10eebd42a9ccf89c3e46eb389c357 (diff)
hostmem-file: add offset option
Add an option for hostmem-file to start the memory object at an offset into the target file. This is useful if multiple memory objects reside inside the same target file, such as a device node. In particular, it's useful to map guest memory directly into /dev/mem for experimentation. To make this work consistently, also fix up all places in QEMU that expect fd offsets to be 0. Signed-off-by: Alexander Graf <graf@amazon.com> Message-Id: <20230403221421.60877-1-graf@amazon.com> Acked-by: Markus Armbruster <armbru@redhat.com> Acked-by: Peter Xu <peterx@redhat.com> Reviewed-by: David Hildenbrand <david@redhat.com> Signed-off-by: David Hildenbrand <david@redhat.com>
Diffstat (limited to 'qapi')
-rw-r--r--qapi/qom.json5
1 files changed, 5 insertions, 0 deletions
diff --git a/qapi/qom.json b/qapi/qom.json
index f61badaba4..7f92ea43e8 100644
--- a/qapi/qom.json
+++ b/qapi/qom.json
@@ -647,6 +647,10 @@
# selects a default alignment (currently the page size).
# (default: 0)
#
+# @offset: the offset into the target file that the region starts at. You
+# can use this option to back multiple regions with a single file. Must
+# be a multiple of the page size. (default: 0) (since 8.1)
+#
# @discard-data: if true, the file contents can be destroyed when QEMU
# exits, to avoid unnecessarily flushing data to the backing file.
# Note that @discard-data is only an optimization, and QEMU might
@@ -668,6 +672,7 @@
{ 'struct': 'MemoryBackendFileProperties',
'base': 'MemoryBackendProperties',
'data': { '*align': 'size',
+ '*offset': 'size',
'*discard-data': 'bool',
'mem-path': 'str',
'*pmem': { 'type': 'bool', 'if': 'CONFIG_LIBPMEM' },