summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2016-02-10 11:49:22 +0300
committerMichael S. Tsirkin <mst@redhat.com>2016-02-23 12:55:16 +0200
commit39de99843e4c15504812e12807728339c54b9194 (patch)
tree7353d98cf8cced8ab0dc5b6f3f552348bd2dde9a /hw
parentffe42cc14c770549abc7995a90cf53bca3659b7f (diff)
downloadqemu-39de99843e4c15504812e12807728339c54b9194.tar.gz
qemu-39de99843e4c15504812e12807728339c54b9194.tar.bz2
qemu-39de99843e4c15504812e12807728339c54b9194.zip
move get_current_ram_size to virtio-balloon.c
get_current_ram_size() is used only in virtio-balloon.c This patch moves it into virtio-balloon and make it static, to allow some balloon-specific tuning. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/mem/pc-dimm.c26
-rw-r--r--hw/virtio/virtio-balloon.c26
2 files changed, 26 insertions, 26 deletions
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index 1aa12c64d0..650f0f89f4 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -192,32 +192,6 @@ int qmp_pc_dimm_device_list(Object *obj, void *opaque)
return 0;
}
-ram_addr_t get_current_ram_size(void)
-{
- MemoryDeviceInfoList *info_list = NULL;
- MemoryDeviceInfoList **prev = &info_list;
- MemoryDeviceInfoList *info;
- ram_addr_t size = ram_size;
-
- qmp_pc_dimm_device_list(qdev_get_machine(), &prev);
- for (info = info_list; info; info = info->next) {
- MemoryDeviceInfo *value = info->value;
-
- if (value) {
- switch (value->type) {
- case MEMORY_DEVICE_INFO_KIND_DIMM:
- size += value->u.dimm->size;
- break;
- default:
- break;
- }
- }
- }
- qapi_free_MemoryDeviceInfoList(info_list);
-
- return size;
-}
-
static int pc_dimm_slot2bitmap(Object *obj, void *opaque)
{
unsigned long *bitmap = opaque;
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index a382f43f92..d6d7e96aa4 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -305,6 +305,32 @@ static void virtio_balloon_get_config(VirtIODevice *vdev, uint8_t *config_data)
memcpy(config_data, &config, sizeof(struct virtio_balloon_config));
}
+static ram_addr_t get_current_ram_size(void)
+{
+ MemoryDeviceInfoList *info_list = NULL;
+ MemoryDeviceInfoList **prev = &info_list;
+ MemoryDeviceInfoList *info;
+ ram_addr_t size = ram_size;
+
+ qmp_pc_dimm_device_list(qdev_get_machine(), &prev);
+ for (info = info_list; info; info = info->next) {
+ MemoryDeviceInfo *value = info->value;
+
+ if (value) {
+ switch (value->type) {
+ case MEMORY_DEVICE_INFO_KIND_DIMM:
+ size += value->u.dimm->size;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ qapi_free_MemoryDeviceInfoList(info_list);
+
+ return size;
+}
+
static void virtio_balloon_set_config(VirtIODevice *vdev,
const uint8_t *config_data)
{