10b7e74bf2
Each hotplug-able memory slot is a PCDIMMDevice. A hot-add operation for a memory device: - creates a new PCDIMMDevice and makes hotplug controller to map it into guest address space Hotplug operations are done through normal device_add commands. For migration case, all hotplugged memory devices on source should be specified on target's command line using '-device' option with properties set to the same values as on source. To simplify review, patch introduces only PCDIMMDevice QOM skeleton that will be extended by following patches to implement actual memory hotplug and related functions. Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com> Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
74 lines
1.9 KiB
C
74 lines
1.9 KiB
C
/*
|
|
* PC DIMM device
|
|
*
|
|
* Copyright ProfitBricks GmbH 2012
|
|
* Copyright (C) 2013-2014 Red Hat Inc
|
|
*
|
|
* Authors:
|
|
* Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
|
|
* Igor Mammedov <imammedo@redhat.com>
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
* See the COPYING file in the top-level directory.
|
|
*
|
|
*/
|
|
|
|
#ifndef QEMU_PC_DIMM_H
|
|
#define QEMU_PC_DIMM_H
|
|
|
|
#include "exec/memory.h"
|
|
#include "sysemu/hostmem.h"
|
|
#include "hw/qdev.h"
|
|
|
|
#define DEFAULT_PC_DIMMSIZE (1024*1024*1024)
|
|
|
|
#define TYPE_PC_DIMM "pc-dimm"
|
|
#define PC_DIMM(obj) \
|
|
OBJECT_CHECK(PCDIMMDevice, (obj), TYPE_PC_DIMM)
|
|
#define PC_DIMM_CLASS(oc) \
|
|
OBJECT_CLASS_CHECK(PCDIMMDeviceClass, (oc), TYPE_PC_DIMM)
|
|
#define PC_DIMM_GET_CLASS(obj) \
|
|
OBJECT_GET_CLASS(PCDIMMDeviceClass, (obj), TYPE_PC_DIMM)
|
|
|
|
#define PC_DIMM_ADDR_PROP "addr"
|
|
#define PC_DIMM_SLOT_PROP "slot"
|
|
#define PC_DIMM_NODE_PROP "node"
|
|
#define PC_DIMM_SIZE_PROP "size"
|
|
#define PC_DIMM_MEMDEV_PROP "memdev"
|
|
|
|
#define PC_DIMM_UNASSIGNED_SLOT -1
|
|
|
|
/**
|
|
* PCDIMMDevice:
|
|
* @addr: starting guest physical address, where @PCDIMMDevice is mapped.
|
|
* Default value: 0, means that address is auto-allocated.
|
|
* @node: numa node to which @PCDIMMDevice is attached.
|
|
* @slot: slot number into which @PCDIMMDevice is plugged in.
|
|
* Default value: -1, means that slot is auto-allocated.
|
|
* @hostmem: host memory backend providing memory for @PCDIMMDevice
|
|
*/
|
|
typedef struct PCDIMMDevice {
|
|
/* private */
|
|
DeviceState parent_obj;
|
|
|
|
/* public */
|
|
uint64_t addr;
|
|
uint32_t node;
|
|
int32_t slot;
|
|
HostMemoryBackend *hostmem;
|
|
} PCDIMMDevice;
|
|
|
|
/**
|
|
* PCDIMMDeviceClass:
|
|
* @get_memory_region: returns #MemoryRegion associated with @dimm
|
|
*/
|
|
typedef struct PCDIMMDeviceClass {
|
|
/* private */
|
|
DeviceClass parent_class;
|
|
|
|
/* public */
|
|
MemoryRegion *(*get_memory_region)(PCDIMMDevice *dimm);
|
|
} PCDIMMDeviceClass;
|
|
|
|
#endif
|