pc-dimm: get memory region from ->get_memory_region()
authorXiao Guangrong <guangrong.xiao@linux.intel.com>
Fri, 20 May 2016 08:19:58 +0000 (16:19 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 7 Jun 2016 12:39:28 +0000 (15:39 +0300)
Curretly, the memory region of backed memory is all directly
mapped to guest's address space, however, it will be not true
for nvdimm device if we introduce nvdimm label which only can
be indirectly accessed by ACPI DSM method

Also it improves the comments a bit to reflect this fact

Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
hw/mem/pc-dimm.c
include/hw/mem/pc-dimm.h

index 9e7de5682986e13648a8fa4c32769491fe464a05..70b9451654bbf4de22565905b209b21e7b0aa752 100644 (file)
@@ -354,8 +354,9 @@ static void pc_dimm_get_size(Object *obj, Visitor *v, const char *name,
     int64_t value;
     MemoryRegion *mr;
     PCDIMMDevice *dimm = PC_DIMM(obj);
+    PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(obj);
 
-    mr = host_memory_backend_get_memory(dimm->hostmem, errp);
+    mr = ddc->get_memory_region(dimm);
     value = memory_region_size(mr);
 
     visit_type_int(v, name, &value, errp);
index 8cdc3266b30e552615cee26dbbf26147ec35466e..602462716776503fbfcd880ed207b3d0b3ba45a9 100644 (file)
@@ -58,7 +58,8 @@ typedef struct PCDIMMDevice {
 
 /**
  * PCDIMMDeviceClass:
- * @get_memory_region: returns #MemoryRegion associated with @dimm
+ * @get_memory_region: returns #MemoryRegion associated with @dimm which
+ * is directly mapped into the physical address space of guest
  */
 typedef struct PCDIMMDeviceClass {
     /* private */