Message ID | 20170320001249.25521-2-haozhong.zhang@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Mar 20, 2017 at 08:12:40AM +0800, Haozhong Zhang wrote: > If xen_enabled(), memory_region_get_ram_ptr() always returns NULL and > nvdimm_realize() cannot get the correct pointer to the label area. This > commit disables the label support for Xen accelerator to workaround > this issue. > > Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com> > --- > Cc: "Michael S. Tsirkin" <mst@redhat.com> > Cc: Igor Mammedov <imammedo@redhat.com> > Cc: Xiao Guangrong <guangrong.xiao@linux.intel.com> > --- > hw/mem/nvdimm.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c > index db896b0bb6..0d3e17e94c 100644 > --- a/hw/mem/nvdimm.c > +++ b/hw/mem/nvdimm.c > @@ -87,7 +87,11 @@ 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; > + /* > + * TODO: explain the reason Ahem? > + */ > + 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) { > -- > 2.12.0 >
diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c index db896b0bb6..0d3e17e94c 100644 --- a/hw/mem/nvdimm.c +++ b/hw/mem/nvdimm.c @@ -87,7 +87,11 @@ 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; + /* + * TODO: explain the reason + */ + 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) {
If xen_enabled(), memory_region_get_ram_ptr() always returns NULL and nvdimm_realize() cannot get the correct pointer to the label area. This commit disables the label support for Xen accelerator to workaround this issue. Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com> --- Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Igor Mammedov <imammedo@redhat.com> Cc: Xiao Guangrong <guangrong.xiao@linux.intel.com> --- hw/mem/nvdimm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)