mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
nvdimm: Add realize, unrealize callbacks to NVDIMMDevice class
A new subclass inheriting NVDIMMDevice is going to be introduced in subsequent patches. The new subclass uses the realize and unrealize callbacks. Add them on NVDIMMClass to appropriately call them as part of plug-unplug. Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com> Acked-by: Daniel Henrique Barboza <danielhb413@gmail.com> Message-Id: <164396253158.109112.1926755104259023743.stgit@ltczzess4.aus.stglabs.ibm.com> Signed-off-by: Cédric Le Goater <clg@kaod.org>
This commit is contained in:
parent
c13b8e9973
commit
3e35960bf1
4 changed files with 24 additions and 0 deletions
|
@ -181,10 +181,25 @@ static MemoryRegion *nvdimm_md_get_memory_region(MemoryDeviceState *md,
|
|||
static void nvdimm_realize(PCDIMMDevice *dimm, Error **errp)
|
||||
{
|
||||
NVDIMMDevice *nvdimm = NVDIMM(dimm);
|
||||
NVDIMMClass *ndc = NVDIMM_GET_CLASS(nvdimm);
|
||||
|
||||
if (!nvdimm->nvdimm_mr) {
|
||||
nvdimm_prepare_memory_region(nvdimm, errp);
|
||||
}
|
||||
|
||||
if (ndc->realize) {
|
||||
ndc->realize(nvdimm, errp);
|
||||
}
|
||||
}
|
||||
|
||||
static void nvdimm_unrealize(PCDIMMDevice *dimm)
|
||||
{
|
||||
NVDIMMDevice *nvdimm = NVDIMM(dimm);
|
||||
NVDIMMClass *ndc = NVDIMM_GET_CLASS(nvdimm);
|
||||
|
||||
if (ndc->unrealize) {
|
||||
ndc->unrealize(nvdimm);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -240,6 +255,7 @@ static void nvdimm_class_init(ObjectClass *oc, void *data)
|
|||
DeviceClass *dc = DEVICE_CLASS(oc);
|
||||
|
||||
ddc->realize = nvdimm_realize;
|
||||
ddc->unrealize = nvdimm_unrealize;
|
||||
mdc->get_memory_region = nvdimm_md_get_memory_region;
|
||||
device_class_set_props(dc, nvdimm_properties);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue