From patchwork Mon Oct 10 00:34:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haozhong Zhang X-Patchwork-Id: 9368767 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3990E6048F for ; Mon, 10 Oct 2016 00:35:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 269DB1FEBD for ; Mon, 10 Oct 2016 00:35:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1773D28B2B; Mon, 10 Oct 2016 00:35:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B76F628B27 for ; Mon, 10 Oct 2016 00:35:30 +0000 (UTC) Received: from localhost ([::1]:46588 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btOYz-0005rx-Cw for patchwork-qemu-devel@patchwork.kernel.org; Sun, 09 Oct 2016 20:35:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btOYR-0005qH-O7 for qemu-devel@nongnu.org; Sun, 09 Oct 2016 20:34:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1btOYN-000366-H3 for qemu-devel@nongnu.org; Sun, 09 Oct 2016 20:34:54 -0400 Received: from mga06.intel.com ([134.134.136.31]:59044) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btOYN-00035w-BH for qemu-devel@nongnu.org; Sun, 09 Oct 2016 20:34:51 -0400 Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP; 09 Oct 2016 17:34:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,469,1473145200"; d="scan'208";a="17842850" Received: from hz-desktop.sh.intel.com (HELO localhost) ([10.239.159.148]) by fmsmga006.fm.intel.com with ESMTP; 09 Oct 2016 17:34:48 -0700 From: Haozhong Zhang To: qemu-devel@nongnu.org, xen-devel@lists.xensource.com Date: Mon, 10 Oct 2016 08:34:16 +0800 Message-Id: <20161010003423.4333-2-haozhong.zhang@intel.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161010003423.4333-1-haozhong.zhang@intel.com> References: <20161010003423.4333-1-haozhong.zhang@intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.31 Subject: [Qemu-devel] [RFC QEMU PATCH 1/8] nvdimm: do not initialize label_data if label_size is zero X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Haozhong Zhang , Igor Mammedov , "Michael S. Tsirkin" , Xiao Guangrong , Konrad Rzeszutek Wilk Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP When memory-backend-xen is used, the label_data pointer can not be got via memory_region_get_ram_ptr(). We will use other functions to get label_data once we introduce NVDIMM label support to Xen. Signed-off-by: Haozhong Zhang --- Cc: Xiao Guangrong Cc: "Michael S. Tsirkin" Cc: Igor Mammedov --- hw/mem/nvdimm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c index 7895805..d25993b 100644 --- a/hw/mem/nvdimm.c +++ b/hw/mem/nvdimm.c @@ -87,7 +87,9 @@ static void nvdimm_realize(PCDIMMDevice *dimm, Error **errp) align = memory_region_get_alignment(mr); pmem_size = size - nvdimm->label_size; - nvdimm->label_data = memory_region_get_ram_ptr(mr) + pmem_size; + if (nvdimm->label_size) { + nvdimm->label_data = memory_region_get_ram_ptr(mr) + pmem_size; + } pmem_size = QEMU_ALIGN_DOWN(pmem_size, align); if (size <= nvdimm->label_size || !pmem_size) {