qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC PATCH 1/1] nvdimm: let qemu requiring section alignment of pmem resource.
@ 2018-06-11 10:54 Zhang Yi
  2018-06-11 16:26 ` Stefan Hajnoczi
  0 siblings, 1 reply; 7+ messages in thread
From: Zhang Yi @ 2018-06-11 10:54 UTC (permalink / raw)
  To: xiaoguangrong.eric, dan.j.williams, ross.zwisler, stefanha,
	yu.c.zhang
  Cc: mst, qemu-devel, imammedo, linux-nvdimm, ehabkost, Zhang Yi

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-06-13 16:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-11 10:54 [Qemu-devel] [RFC PATCH 1/1] nvdimm: let qemu requiring section alignment of pmem resource Zhang Yi
2018-06-11 16:26 ` 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

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).