From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42759) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZnrJb-0007Xt-RX for qemu-devel@nongnu.org; Sun, 18 Oct 2015 13:00:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZnrJb-0000LI-1C for qemu-devel@nongnu.org; Sun, 18 Oct 2015 13:00:11 -0400 Received: from mga09.intel.com ([134.134.136.24]:58036) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZnrJa-0000CK-SU for qemu-devel@nongnu.org; Sun, 18 Oct 2015 13:00:10 -0400 From: Xiao Guangrong Date: Mon, 19 Oct 2015 08:54:04 +0800 Message-Id: <1445216059-88521-19-git-send-email-guangrong.xiao@linux.intel.com> In-Reply-To: <1445216059-88521-1-git-send-email-guangrong.xiao@linux.intel.com> References: <1445216059-88521-1-git-send-email-guangrong.xiao@linux.intel.com> Subject: [Qemu-devel] [PATCH v4 18/33] 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 23d5daa..9e0403a 100644 --- a/hw/mem/dimm.c +++ b/hw/mem/dimm.c @@ -380,8 +380,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