MAINTAINERS: Make section QOM cover hw/core/*bus.c as well
[qemu/armbru.git] / include / hw / mem / pc-dimm.h
blob289edc0f3d347526a12697b579b34004bf5f40eb
1 /*
2 * PC DIMM device
4 * Copyright ProfitBricks GmbH 2012
5 * Copyright (C) 2013-2014 Red Hat Inc
7 * Authors:
8 * Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
9 * Igor Mammedov <imammedo@redhat.com>
11 * This work is licensed under the terms of the GNU GPL, version 2 or later.
12 * See the COPYING file in the top-level directory.
16 #ifndef QEMU_PC_DIMM_H
17 #define QEMU_PC_DIMM_H
19 #include "exec/memory.h"
20 #include "hw/qdev-core.h"
22 #define TYPE_PC_DIMM "pc-dimm"
23 #define PC_DIMM(obj) \
24 OBJECT_CHECK(PCDIMMDevice, (obj), TYPE_PC_DIMM)
25 #define PC_DIMM_CLASS(oc) \
26 OBJECT_CLASS_CHECK(PCDIMMDeviceClass, (oc), TYPE_PC_DIMM)
27 #define PC_DIMM_GET_CLASS(obj) \
28 OBJECT_GET_CLASS(PCDIMMDeviceClass, (obj), TYPE_PC_DIMM)
30 #define PC_DIMM_ADDR_PROP "addr"
31 #define PC_DIMM_SLOT_PROP "slot"
32 #define PC_DIMM_NODE_PROP "node"
33 #define PC_DIMM_SIZE_PROP "size"
34 #define PC_DIMM_MEMDEV_PROP "memdev"
36 #define PC_DIMM_UNASSIGNED_SLOT -1
38 /**
39 * PCDIMMDevice:
40 * @addr: starting guest physical address, where @PCDIMMDevice is mapped.
41 * Default value: 0, means that address is auto-allocated.
42 * @node: numa node to which @PCDIMMDevice is attached.
43 * @slot: slot number into which @PCDIMMDevice is plugged in.
44 * Default value: -1, means that slot is auto-allocated.
45 * @hostmem: host memory backend providing memory for @PCDIMMDevice
47 typedef struct PCDIMMDevice {
48 /* private */
49 DeviceState parent_obj;
51 /* public */
52 uint64_t addr;
53 uint32_t node;
54 int32_t slot;
55 HostMemoryBackend *hostmem;
56 } PCDIMMDevice;
58 /**
59 * PCDIMMDeviceClass:
60 * @realize: called after common dimm is realized so that the dimm based
61 * devices get the chance to do specified operations.
62 * @get_vmstate_memory_region: returns #MemoryRegion which indicates the
63 * memory of @dimm should be kept during live migration. Will not fail
64 * after the device was realized.
66 typedef struct PCDIMMDeviceClass {
67 /* private */
68 DeviceClass parent_class;
70 /* public */
71 void (*realize)(PCDIMMDevice *dimm, Error **errp);
72 MemoryRegion *(*get_vmstate_memory_region)(PCDIMMDevice *dimm,
73 Error **errp);
74 } PCDIMMDeviceClass;
76 void pc_dimm_pre_plug(PCDIMMDevice *dimm, MachineState *machine,
77 const uint64_t *legacy_align, Error **errp);
78 void pc_dimm_plug(PCDIMMDevice *dimm, MachineState *machine, Error **errp);
79 void pc_dimm_unplug(PCDIMMDevice *dimm, MachineState *machine);
80 #endif