[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 24/25] pc-dimm: introduce realize callback
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 24/25] pc-dimm: introduce realize callback |
Date: |
Sun, 5 Jun 2016 16:22:09 +0300 |
From: Xiao Guangrong <address@hidden>
nvdimm needs to check if the backend memory is large enough to contain
label data and init its memory region when the device is realized, so
introduce realize callback which is called after common dimm has been
realize
Signed-off-by: Xiao Guangrong <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
---
include/hw/mem/pc-dimm.h | 3 +++
hw/mem/pc-dimm.c | 5 +++++
2 files changed, 8 insertions(+)
diff --git a/include/hw/mem/pc-dimm.h b/include/hw/mem/pc-dimm.h
index 6024627..67e92d8 100644
--- a/include/hw/mem/pc-dimm.h
+++ b/include/hw/mem/pc-dimm.h
@@ -58,6 +58,8 @@ typedef struct PCDIMMDevice {
/**
* PCDIMMDeviceClass:
+ * @realize: called after common dimm is realized so that the dimm based
+ * devices get the chance to do specified operations.
* @get_memory_region: returns #MemoryRegion associated with @dimm which
* is directly mapped into the physical address space of guest
*/
@@ -66,6 +68,7 @@ typedef struct PCDIMMDeviceClass {
DeviceClass parent_class;
/* public */
+ void (*realize)(PCDIMMDevice *dimm, Error **errp);
MemoryRegion *(*get_memory_region)(PCDIMMDevice *dimm);
} PCDIMMDeviceClass;
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index 70b9451..6de2275 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -400,6 +400,7 @@ static void pc_dimm_init(Object *obj)
static void pc_dimm_realize(DeviceState *dev, Error **errp)
{
PCDIMMDevice *dimm = PC_DIMM(dev);
+ PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);
if (!dimm->hostmem) {
error_setg(errp, "'" PC_DIMM_MEMDEV_PROP "' property is not set");
@@ -412,6 +413,10 @@ static void pc_dimm_realize(DeviceState *dev, Error **errp)
dimm->node, nb_numa_nodes ? nb_numa_nodes : 1);
return;
}
+
+ if (ddc->realize) {
+ ddc->realize(dimm, errp);
+ }
}
static MemoryRegion *pc_dimm_get_memory_region(PCDIMMDevice *dimm)
--
MST
- [Qemu-devel] [PULL 13/25] ipmi: rework the fwinfo to be fetched from the interface, (continued)
- [Qemu-devel] [PULL 13/25] ipmi: rework the fwinfo to be fetched from the interface, Michael S. Tsirkin, 2016/06/05
- [Qemu-devel] [PULL 14/25] pc: Postpone SMBIOS table installation to post machine init, Michael S. Tsirkin, 2016/06/05
- [Qemu-devel] [PULL 15/25] acpi: extend ACPI interface to provide send_event hook, Michael S. Tsirkin, 2016/06/05
- [Qemu-devel] [PULL 16/25] pc: use AcpiDeviceIfClass.send_event to issue GPE events, Michael S. Tsirkin, 2016/06/05
- [Qemu-devel] [PULL 20/25] tpm: apci: cleanup TCPA table initialization, Michael S. Tsirkin, 2016/06/05
- [Qemu-devel] [PULL 19/25] acpi: cleanup bios_linker_loader_cleanup(), Michael S. Tsirkin, 2016/06/05
- [Qemu-devel] [PULL 17/25] acpi: convert linker from GArray to BIOSLinker structure, Michael S. Tsirkin, 2016/06/05
- [Qemu-devel] [PULL 23/25] pc-dimm: get memory region from ->get_memory_region(), Michael S. Tsirkin, 2016/06/05
- [Qemu-devel] [PULL 18/25] acpi: simplify bios_linker API by removing redundant 'table' argument, Michael S. Tsirkin, 2016/06/05
- [Qemu-devel] [PULL 24/25] pc-dimm: introduce realize callback,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 22/25] acpi: make bios_linker_loader_add_checksum() API offset based, Michael S. Tsirkin, 2016/06/05
- [Qemu-devel] [PULL 21/25] acpi: make bios_linker_loader_add_pointer() API offset based, Michael S. Tsirkin, 2016/06/05
- [Qemu-devel] [PULL 25/25] virtio: move bi-endian target support to a single location, Michael S. Tsirkin, 2016/06/05
- Re: [Qemu-devel] [PULL 00/25] pc, pci, virtio: new features, cleanups, fixes, Peter Maydell, 2016/06/06