[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH v1 5/8] pc-dimm: implement new memory device functions
From: |
David Hildenbrand |
Subject: |
[Qemu-ppc] [PATCH v1 5/8] pc-dimm: implement new memory device functions |
Date: |
Thu, 3 May 2018 17:49:33 +0200 |
Implement the new functions, we don't have to care about alignment for
these DIMMs right now, so leave that function unimplemented.
Signed-off-by: David Hildenbrand <address@hidden>
---
hw/mem/pc-dimm.c | 22 ++++++++++++++++++++++
include/hw/mem/memory-device.h | 4 ++--
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index 12da89d562..7ab9e77747 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -244,6 +244,26 @@ static uint64_t pc_dimm_md_get_addr(const
MemoryDeviceState *md)
return dimm->addr;
}
+static void pc_dimm_md_set_addr(MemoryDeviceState *md, uint64_t addr)
+{
+ PCDIMMDevice *dimm = PC_DIMM(md);
+
+ dimm->addr = addr;
+}
+
+static MemoryRegion *pc_dimm_md_get_memory_region(MemoryDeviceState *md)
+{
+ PCDIMMDevice *dimm = PC_DIMM(md);
+
+ const PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(md);
+ MemoryRegion *mr;
+
+ mr = ddc->get_memory_region(dimm, &error_abort);
+ g_assert(mr);
+
+ return mr;
+}
+
static uint64_t pc_dimm_md_get_region_size(const MemoryDeviceState *md)
{
/* dropping const here is fine as we don't touch the memory region */
@@ -304,6 +324,8 @@ static void pc_dimm_class_init(ObjectClass *oc, void *data)
ddc->get_vmstate_memory_region = pc_dimm_get_vmstate_memory_region;
mdc->get_addr = pc_dimm_md_get_addr;
+ mdc->set_addr = pc_dimm_md_set_addr;
+ mdc->get_memory_region = pc_dimm_md_get_memory_region;
/* for a dimm plugged_size == region_size */
mdc->get_plugged_size = pc_dimm_md_get_region_size;
mdc->get_region_size = pc_dimm_md_get_region_size;
diff --git a/include/hw/mem/memory-device.h b/include/hw/mem/memory-device.h
index e43ce1c8d3..e10f2e854a 100644
--- a/include/hw/mem/memory-device.h
+++ b/include/hw/mem/memory-device.h
@@ -34,8 +34,8 @@ typedef struct MemoryDeviceClass {
/* required functions that have to be implemented */
uint64_t (*get_addr)(const MemoryDeviceState *md);
- uint64_t (*set_addr)(MemoryDeviceState *md);
- MemoryRegion * (*get_memory_region)(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,
--
2.14.3
- [Qemu-ppc] [PATCH v1 0/8] MemoryDevice: introduce and use ResourceHandler, David Hildenbrand, 2018/05/03
- [Qemu-ppc] [PATCH v1 1/8] memory-device: always compile support for memory devices for SOFTMMU, David Hildenbrand, 2018/05/03
- [Qemu-ppc] [PATCH v1 3/8] machine: provide default resource handler, David Hildenbrand, 2018/05/03
- [Qemu-ppc] [PATCH v1 2/8] qdev: introduce ResourceHandler as a first-stage hotplug handler, David Hildenbrand, 2018/05/03
- [Qemu-ppc] [PATCH v1 4/8] memory-device: new functions to handle resource assignment, David Hildenbrand, 2018/05/03
- [Qemu-ppc] [PATCH v1 5/8] pc-dimm: implement new memory device functions,
David Hildenbrand <=
- [Qemu-ppc] [PATCH v1 7/8] memory-device: factor out pre-assign into default resource handler, David Hildenbrand, 2018/05/03
- [Qemu-ppc] [PATCH v1 6/8] machine: introduce enforce_memory_device_align() and add it for pc, David Hildenbrand, 2018/05/03
- [Qemu-ppc] [PATCH v1 8/8] memory-device: factor out (un)assign into default resource handler, David Hildenbrand, 2018/05/03
- Re: [Qemu-ppc] [Qemu-devel] [PATCH v1 0/8] MemoryDevice: introduce and use ResourceHandler, Igor Mammedov, 2018/05/04
- Re: [Qemu-ppc] [PATCH v1 0/8] MemoryDevice: introduce and use ResourceHandler, David Hildenbrand, 2018/05/09