[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v4 10/14] memory-device: new functions to handle plu
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PATCH v4 10/14] memory-device: new functions to handle plug/unplug |
Date: |
Thu, 17 May 2018 10:15:23 +0200 |
We will need a handful of new functions:
- set_addr(): To set the calculated address
- get_memory_region(): To add it to the memory region container
- get_addr(): If the device has any specific alignment requirements
Using these and the existing functions, we can properly plug/unplug
memory devices.
Signed-off-by: David Hildenbrand <address@hidden>
---
include/hw/mem/memory-device.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/hw/mem/memory-device.h b/include/hw/mem/memory-device.h
index 2853b084b5..62d906be50 100644
--- a/include/hw/mem/memory-device.h
+++ b/include/hw/mem/memory-device.h
@@ -29,14 +29,24 @@ typedef struct MemoryDeviceState {
Object parent_obj;
} MemoryDeviceState;
+/*
+ * MemoryDeviceClass functions should only be called on realized
+ * MemoryDevice instances.
+ */
typedef struct MemoryDeviceClass {
InterfaceClass parent_class;
+ /* required functions that have to be implemented */
uint64_t (*get_addr)(const MemoryDeviceState *md);
+ void (*set_addr)(MemoryDeviceState *md, uint64_t addr);
+ MemoryRegion *(*get_memory_region)(MemoryDeviceState *md);
uint64_t (*get_plugged_size)(const MemoryDeviceState *md);
uint64_t (*get_region_size)(const MemoryDeviceState *md);
void (*fill_device_info)(const MemoryDeviceState *md,
MemoryDeviceInfo *info);
+
+ /* optional functions that can be implemented */
+ uint64_t (*get_align)(const MemoryDeviceState *md);
} MemoryDeviceClass;
MemoryDeviceInfoList *qmp_memory_device_list(void);
--
2.14.3
- Re: [qemu-s390x] [Qemu-ppc] [PATCH v4 06/14] spapr: prepare for multi stage hotplug handlers, (continued)
- [qemu-s390x] [PATCH v4 08/14] spapr: handle pc-dimm unplug via hotplug handler chain, David Hildenbrand, 2018/05/17
- [qemu-s390x] [PATCH v4 07/14] spapr: route all memory devices through the machine hotplug handler, David Hildenbrand, 2018/05/17
- [qemu-s390x] [PATCH v4 09/14] spapr: handle cpu core unplug via hotplug handler chain, David Hildenbrand, 2018/05/17
- [qemu-s390x] [PATCH v4 11/14] pc-dimm: implement new memory device functions, David Hildenbrand, 2018/05/17
- [qemu-s390x] [PATCH v4 12/14] memory-device: factor out pre-plug into hotplug handler, David Hildenbrand, 2018/05/17
- [qemu-s390x] [PATCH v4 10/14] memory-device: new functions to handle plug/unplug,
David Hildenbrand <=
- [qemu-s390x] [PATCH v4 13/14] memory-device: factor out unplug into hotplug handler, David Hildenbrand, 2018/05/17
- [qemu-s390x] [PATCH v4 14/14] memory-device: factor out plug into hotplug handler, David Hildenbrand, 2018/05/17
- Re: [qemu-s390x] [PATCH v4 00/14] MemoryDevice: use multi stage hotplug handlers, David Hildenbrand, 2018/05/25