From: Zhang Yi <yi.z.zhang@linux.intel.com>
To: xiaoguangrong.eric@gmail.com, dan.j.williams@intel.com,
ross.zwisler@linux.intel.com, stefanha@redhat.com,
yu.c.zhang@linux.intel.com
Cc: mst@redhat.com, qemu-devel@nongnu.org, imammedo@redhat.com,
linux-nvdimm@lists.01.org, ehabkost@redhat.com,
Zhang Yi <yi.z.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 [thread overview]
Message-ID: <e74aee54657de6f8d643a92ba21f467db149c2c8.1528714312.git.yi.z.zhang@linux.intel.com> (raw)
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 <yi.z.zhang@linux.intel.com>
---
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)
--
2.7.4
next reply other threads:[~2018-06-11 2:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-11 10:54 Zhang Yi [this message]
2018-06-11 16:26 ` [Qemu-devel] [RFC PATCH 1/1] nvdimm: let qemu requiring section alignment of pmem resource Stefan Hajnoczi
2018-06-12 2:55 ` Dan Williams
2018-06-12 13:27 ` Zhang,Yi
2018-06-12 15:04 ` Haozhong Zhang
2018-06-13 14:16 ` Stefan Hajnoczi
2018-06-13 16:30 ` Igor Mammedov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e74aee54657de6f8d643a92ba21f467db149c2c8.1528714312.git.yi.z.zhang@linux.intel.com \
--to=yi.z.zhang@linux.intel.com \
--cc=dan.j.williams@intel.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=linux-nvdimm@lists.01.org \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=ross.zwisler@linux.intel.com \
--cc=stefanha@redhat.com \
--cc=xiaoguangrong.eric@gmail.com \
--cc=yu.c.zhang@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).