[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v3 10/18] memory-device: new functions to handle plu
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PATCH v3 10/18] memory-device: new functions to handle plug/unplug |
Date: |
Mon, 14 May 2018 12:00:15 +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
- [qemu-s390x] [PATCH v3 02/18] memory-device: introduce separate config option, (continued)
- [qemu-s390x] [PATCH v3 06/18] spapr: prepare for multi stage hotplug handlers, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 04/18] pc: prepare for multi stage hotplug handlers, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 09/18] spapr: handle cpu core unplug via hotplug handler chain, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 08/18] spapr: handle pc-dimm unplug via hotplug handler chain, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 11/18] pc-dimm: implement new memory device functions, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 07/18] spapr: route all memory devices through the machine hotplug handler, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 10/18] memory-device: new functions to handle plug/unplug,
David Hildenbrand <=
- [qemu-s390x] [PATCH v3 14/18] memory-device: factor out plug into hotplug handler, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 13/18] memory-device: factor out unplug into hotplug handler, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 15/18] s390x/sclp: make sure ram_size and maxram_size stay in sync, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 17/18] s390x: initialize memory region for memory devices, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 12/18] memory-device: factor out pre-plug into hotplug handler, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 18/18] s390x: support memory devices, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 16/18] s390x: prepare for multi stage hotplug handlers, David Hildenbrand, 2018/05/14