summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2014-06-02 15:25:13 +0200
committerMichael S. Tsirkin <mst@redhat.com>2014-06-19 16:41:49 +0300
commit0b3125711606374f04e279aebefcb7275480f040 (patch)
tree4d917c4e2c127a6d044aa3a0113ed7f67e9a0c16 /include
parent95bee274fd1d22dc6d35e52987f8b5d29fe754dd (diff)
downloadqemu-0b3125711606374f04e279aebefcb7275480f040.tar.gz
pc-dimm: add busy address check and address auto-allocation
- if 'addr' property is not specified on -device/device_add command, treat the default value as request for assigning PCDIMMDevice to the first free memory region. - if 'addr' is provided with -device/device_add command, attempt to use it or fail command if it's already occupied or falls inside of an existing PCDIMMDevice memory region. Note: GCompareFunc(a, b) used by g_slist_insert_sorted() returns 'gint', however it might be too small to fit difference between 2 addresses. So use 128bit to calculate the difference and normalize result to -1/0/1 return values. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Tested-by: Andrey Korolyov <andrey@xdel.ru> MST: commit log tweaks
Diffstat (limited to 'include')
-rw-r--r--include/hw/mem/pc-dimm.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/hw/mem/pc-dimm.h b/include/hw/mem/pc-dimm.h
index 42118cb91d..5a3e7df13c 100644
--- a/include/hw/mem/pc-dimm.h
+++ b/include/hw/mem/pc-dimm.h
@@ -70,4 +70,8 @@ typedef struct PCDIMMDeviceClass {
MemoryRegion *(*get_memory_region)(PCDIMMDevice *dimm);
} PCDIMMDeviceClass;
+uint64_t pc_dimm_get_free_addr(uint64_t address_space_start,
+ uint64_t address_space_size,
+ uint64_t *hint, uint64_t size,
+ Error **errp);
#endif