2014-06-02 17:25:05 +04:00
|
|
|
/*
|
|
|
|
* 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"
|
2018-04-23 19:51:17 +03:00
|
|
|
#include "hw/boards.h"
|
2014-06-02 17:25:05 +04:00
|
|
|
|
|
|
|
#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:
|
2016-05-20 11:19:59 +03:00
|
|
|
* @realize: called after common dimm is realized so that the dimm based
|
|
|
|
* devices get the chance to do specified operations.
|
2016-06-07 15:21:57 +03:00
|
|
|
* @get_vmstate_memory_region: returns #MemoryRegion which indicates the
|
2018-06-19 16:41:41 +03:00
|
|
|
* memory of @dimm should be kept during live migration. Will not fail
|
|
|
|
* after the device was realized.
|
2014-06-02 17:25:05 +04:00
|
|
|
*/
|
|
|
|
typedef struct PCDIMMDeviceClass {
|
|
|
|
/* private */
|
|
|
|
DeviceClass parent_class;
|
|
|
|
|
|
|
|
/* public */
|
2016-05-20 11:19:59 +03:00
|
|
|
void (*realize)(PCDIMMDevice *dimm, Error **errp);
|
2018-06-19 16:41:37 +03:00
|
|
|
MemoryRegion *(*get_vmstate_memory_region)(PCDIMMDevice *dimm,
|
|
|
|
Error **errp);
|
2014-06-02 17:25:05 +04:00
|
|
|
} PCDIMMDeviceClass;
|
|
|
|
|
2018-10-05 12:20:12 +03:00
|
|
|
void pc_dimm_pre_plug(PCDIMMDevice *dimm, MachineState *machine,
|
2018-08-01 16:34:44 +03:00
|
|
|
const uint64_t *legacy_align, Error **errp);
|
2018-10-05 12:20:12 +03:00
|
|
|
void pc_dimm_plug(PCDIMMDevice *dimm, MachineState *machine, Error **errp);
|
|
|
|
void pc_dimm_unplug(PCDIMMDevice *dimm, MachineState *machine);
|
2014-06-02 17:25:05 +04:00
|
|
|
#endif
|