memory-device: factor out get_memory_region() from pc-dimm
commit3a0a2b0a2ba87ed00b732f061e59f890aaa27c17
authorDavid Hildenbrand <david@redhat.com>
Fri, 5 Oct 2018 09:20:18 +0000 (5 11:20 +0200)
committerEduardo Habkost <ehabkost@redhat.com>
Wed, 24 Oct 2018 09:44:59 +0000 (24 06:44 -0300)
tree29c74b2b83426ff0959fbd8a704445133b2395b7
parent946d6154aba9aaa4d19433a6a8bcd3de3b119240
memory-device: factor out get_memory_region() from pc-dimm

The memory region is necessary for plugging/unplugging a memory device.
The region size (via get_region_size()) is no longer sufficient, as
besides the alignment, also the region itself is required in order to
add it to the device memory region of the machine via
- memory_region_add_subregion
- memory_region_del_subregion

So, to factor out plugging/unplugging of memory devices from pc-dimm
code, we have to factor out access to the memory region first.

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20181005092024.14344-11-david@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
hw/mem/nvdimm.c
hw/mem/pc-dimm.c
include/hw/mem/memory-device.h
include/hw/mem/pc-dimm.h