From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zl0IG-0000jE-Un for qemu-devel@nongnu.org; Sat, 10 Oct 2015 15:59:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zl0IF-0003mT-AQ for qemu-devel@nongnu.org; Sat, 10 Oct 2015 15:59:00 -0400 Received: from mga03.intel.com ([134.134.136.65]:60642) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zl0IF-0003bu-5n for qemu-devel@nongnu.org; Sat, 10 Oct 2015 15:58:59 -0400 From: Xiao Guangrong Date: Sun, 11 Oct 2015 11:52:50 +0800 Message-Id: <1444535584-18220-19-git-send-email-guangrong.xiao@linux.intel.com> In-Reply-To: <1444535584-18220-1-git-send-email-guangrong.xiao@linux.intel.com> References: <1444535584-18220-1-git-send-email-guangrong.xiao@linux.intel.com> Subject: [Qemu-devel] [PATCH v3 18/32] dimm: get mapped memory region from DIMMDeviceClass->get_memory_region List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: pbonzini@redhat.com, imammedo@redhat.com Cc: Xiao Guangrong , ehabkost@redhat.com, kvm@vger.kernel.org, mst@redhat.com, gleb@kernel.org, mtosatti@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, dan.j.williams@intel.com, rth@twiddle.net Curretly, the memory region of backed memory is directly mapped to guest's address space, however, it is not true for nvdimm device This patch let dimm device realize this fact and use DIMMDeviceClass->get_memory_region method to get the mapped memory region Signed-off-by: Xiao Guangrong --- hw/mem/dimm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/mem/dimm.c b/hw/mem/dimm.c index 2e35764..b307511 100644 --- a/hw/mem/dimm.c +++ b/hw/mem/dimm.c @@ -373,8 +373,9 @@ static void dimm_get_size(Object *obj, Visitor *v, void *opaque, int64_t value; MemoryRegion *mr; DIMMDevice *dimm = DIMM(obj); + DIMMDeviceClass *ddc = 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, &value, name, errp); -- 1.8.3.1