]>
Commit | Line | Data |
---|---|---|
10b7e74b VL |
1 | /* |
2 | * PC DIMM device | |
3 | * | |
4 | * Copyright ProfitBricks GmbH 2012 | |
5 | * Copyright (C) 2013-2014 Red Hat Inc | |
6 | * | |
7 | * Authors: | |
8 | * Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com> | |
9 | * Igor Mammedov <imammedo@redhat.com> | |
10 | * | |
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. | |
13 | * | |
14 | */ | |
15 | ||
16 | #ifndef QEMU_PC_DIMM_H | |
17 | #define QEMU_PC_DIMM_H | |
18 | ||
19 | #include "exec/memory.h" | |
a27bd6c7 | 20 | #include "hw/qdev-core.h" |
db1015e9 | 21 | #include "qom/object.h" |
10b7e74b | 22 | |
10b7e74b | 23 | #define TYPE_PC_DIMM "pc-dimm" |
db1015e9 EH |
24 | typedef struct PCDIMMDevice PCDIMMDevice; |
25 | typedef struct PCDIMMDeviceClass PCDIMMDeviceClass; | |
8110fa1d EH |
26 | DECLARE_OBJ_CHECKERS(PCDIMMDevice, PCDIMMDeviceClass, |
27 | PC_DIMM, TYPE_PC_DIMM) | |
10b7e74b VL |
28 | |
29 | #define PC_DIMM_ADDR_PROP "addr" | |
30 | #define PC_DIMM_SLOT_PROP "slot" | |
31 | #define PC_DIMM_NODE_PROP "node" | |
32 | #define PC_DIMM_SIZE_PROP "size" | |
33 | #define PC_DIMM_MEMDEV_PROP "memdev" | |
34 | ||
35 | #define PC_DIMM_UNASSIGNED_SLOT -1 | |
36 | ||
37 | /** | |
38 | * PCDIMMDevice: | |
39 | * @addr: starting guest physical address, where @PCDIMMDevice is mapped. | |
40 | * Default value: 0, means that address is auto-allocated. | |
41 | * @node: numa node to which @PCDIMMDevice is attached. | |
42 | * @slot: slot number into which @PCDIMMDevice is plugged in. | |
43 | * Default value: -1, means that slot is auto-allocated. | |
44 | * @hostmem: host memory backend providing memory for @PCDIMMDevice | |
45 | */ | |
db1015e9 | 46 | struct PCDIMMDevice { |
10b7e74b VL |
47 | /* private */ |
48 | DeviceState parent_obj; | |
49 | ||
50 | /* public */ | |
51 | uint64_t addr; | |
52 | uint32_t node; | |
53 | int32_t slot; | |
54 | HostMemoryBackend *hostmem; | |
db1015e9 | 55 | }; |
10b7e74b VL |
56 | |
57 | /** | |
58 | * PCDIMMDeviceClass: | |
9f318f8f XG |
59 | * @realize: called after common dimm is realized so that the dimm based |
60 | * devices get the chance to do specified operations. | |
8df1426e | 61 | * @get_vmstate_memory_region: returns #MemoryRegion which indicates the |
f0b7bca6 DH |
62 | * memory of @dimm should be kept during live migration. Will not fail |
63 | * after the device was realized. | |
10b7e74b | 64 | */ |
db1015e9 | 65 | struct PCDIMMDeviceClass { |
10b7e74b VL |
66 | /* private */ |
67 | DeviceClass parent_class; | |
68 | ||
69 | /* public */ | |
9f318f8f | 70 | void (*realize)(PCDIMMDevice *dimm, Error **errp); |
a57d1911 DH |
71 | MemoryRegion *(*get_vmstate_memory_region)(PCDIMMDevice *dimm, |
72 | Error **errp); | |
db1015e9 | 73 | }; |
10b7e74b | 74 | |
fd3416f5 | 75 | void pc_dimm_pre_plug(PCDIMMDevice *dimm, MachineState *machine, |
b0e62443 | 76 | const uint64_t *legacy_align, Error **errp); |
fd3416f5 DH |
77 | void pc_dimm_plug(PCDIMMDevice *dimm, MachineState *machine, Error **errp); |
78 | void pc_dimm_unplug(PCDIMMDevice *dimm, MachineState *machine); | |
10b7e74b | 79 | #endif |