From patchwork Mon Jun 11 10:54:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Yi" X-Patchwork-Id: 10456913 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 4ABA360467 for ; Mon, 11 Jun 2018 02:16:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B2F9283D9 for ; Mon, 11 Jun 2018 02:16:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C5D9283E7; Mon, 11 Jun 2018 02:16:29 +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=-1.0 required=2.0 tests=BAYES_00, DATE_IN_FUTURE_06_12, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4BDF5283D9 for ; Mon, 11 Jun 2018 02:16:27 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 132892117FD58; Sun, 10 Jun 2018 19:16:27 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: None (no SPF record) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=yi.z.zhang@linux.intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0BC1221159C91 for ; Sun, 10 Jun 2018 19:16:25 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jun 2018 19:16:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,499,1520924400"; d="scan'208";a="46126115" Received: from linux.intel.com ([10.54.29.200]) by fmsmga007.fm.intel.com with ESMTP; 10 Jun 2018 19:16:25 -0700 Received: from dazhang1-ssd.sh.intel.com (unknown [10.239.48.78]) by linux.intel.com (Postfix) with ESMTP id 424B05802A9; Sun, 10 Jun 2018 19:16:23 -0700 (PDT) From: Zhang Yi To: xiaoguangrong.eric@gmail.com, dan.j.williams@intel.com, ross.zwisler@linux.intel.com, stefanha@redhat.com, yu.c.zhang@linux.intel.com Subject: [Qemu-devel] [RFC PATCH 1/1] nvdimm: let qemu requiring section alignment of pmem resource. Date: Mon, 11 Jun 2018 18:54:25 +0800 Message-Id: X-Mailer: git-send-email 2.7.4 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ehabkost@redhat.com, linux-nvdimm@lists.01.org, mst@redhat.com, qemu-devel@nongnu.org, Zhang Yi , imammedo@redhat.com MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP Nvdimm driver use Memory hot-plug APIs to map it's pmem resource, which at a section granularity. When QEMU emulated the vNVDIMM device, decrease the label-storage, QEMU will put the vNVDIMMs directly next to one another in physical address space, which means that the boundary between them won't align to the 128 MB memory section size. Signed-off-by: Zhang Yi --- hw/mem/nvdimm.c | 2 +- include/hw/mem/nvdimm.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c index 4087aca..ff6e171 100644 --- a/hw/mem/nvdimm.c +++ b/hw/mem/nvdimm.c @@ -109,7 +109,7 @@ static void nvdimm_realize(PCDIMMDevice *dimm, Error **errp) NVDIMMDevice *nvdimm = NVDIMM(dimm); uint64_t align, pmem_size, size = memory_region_size(mr); - align = memory_region_get_alignment(mr); + align = MAX(memory_region_get_alignment(mr), NVDIMM_ALIGN_SIZE); pmem_size = size - nvdimm->label_size; nvdimm->label_data = memory_region_get_ram_ptr(mr) + pmem_size; diff --git a/include/hw/mem/nvdimm.h b/include/hw/mem/nvdimm.h index 3c82751..1d384e4 100644 --- a/include/hw/mem/nvdimm.h +++ b/include/hw/mem/nvdimm.h @@ -41,6 +41,7 @@ * at least 128KB in size, which holds around 1000 labels." */ #define MIN_NAMESPACE_LABEL_SIZE (128UL << 10) +#define NVDIMM_ALIGN_SIZE (128UL << 20) #define TYPE_NVDIMM "nvdimm" #define NVDIMM(obj) OBJECT_CHECK(NVDIMMDevice, (obj), TYPE_NVDIMM)