[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v2 09/17] memory-device: new functions to handle plu
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PATCH v2 09/17] memory-device: new functions to handle plug/unplug |
Date: |
Fri, 11 May 2018 15:19:45 +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] [PATCH v2 01/17] memory-device: drop assert related to align and start of address space, (continued)
- [qemu-s390x] [PATCH v2 04/17] pc: route all memory devices through the machine hotplug handler, David Hildenbrand, 2018/05/11
- [qemu-s390x] [PATCH v2 05/17] spapr: prepare for multi stage hotplug handlers, David Hildenbrand, 2018/05/11
- [qemu-s390x] [PATCH v2 06/17] spapr: route all memory devices through the machine hotplug handler, David Hildenbrand, 2018/05/11
- [qemu-s390x] [PATCH v2 03/17] pc: prepare for multi stage hotplug handlers, David Hildenbrand, 2018/05/11
- [qemu-s390x] [PATCH v2 07/17] spapr: handle pc-dimm unplug via hotplug handler chain, David Hildenbrand, 2018/05/11
- [qemu-s390x] [PATCH v2 08/17] spapr: handle cpu core unplug via hotplug handler chain, David Hildenbrand, 2018/05/11
- [qemu-s390x] [PATCH v2 09/17] memory-device: new functions to handle plug/unplug,
David Hildenbrand <=
- [qemu-s390x] [PATCH v2 10/17] pc-dimm: implement new memory device functions, David Hildenbrand, 2018/05/11
- [qemu-s390x] [PATCH v2 11/17] memory-device: factor out pre-plug into hotplug handler, David Hildenbrand, 2018/05/11
- [qemu-s390x] [PATCH v2 12/17] memory-device: factor out unplug into hotplug handler, David Hildenbrand, 2018/05/11
- [qemu-s390x] [PATCH v2 13/17] memory-device: factor out plug into hotplug handler, David Hildenbrand, 2018/05/11
- [qemu-s390x] [PATCH v2 14/17] s390x/sclp: make sure ram_size and maxram_size stay in sync, David Hildenbrand, 2018/05/11
- [qemu-s390x] [PATCH v2 16/17] s390x: initialize memory region for memory devices, David Hildenbrand, 2018/05/11