Re: [Qemu-devel] [PATCH v7 08/35] exec: allow memory to be allocated from any kind of path

2015-11-03 Thread Xiao Guangrong
On 11/04/2015 07:00 AM, Eduardo Habkost wrote: On Mon, Nov 02, 2015 at 05:13:10PM +0800, Xiao Guangrong wrote: Currently file_ram_alloc() is designed for hugetlbfs, however, the memory of nvdimm can come from either raw pmem device eg, /dev/pmem, or the file locates at DAX enabled filesystem

Re: [Qemu-devel] [PATCH v7 03/35] acpi: add aml_create_field

2015-11-03 Thread Xiao Guangrong
On 11/03/2015 02:14 PM, Shannon Zhao wrote: On 2015/11/2 17:13, Xiao Guangrong wrote: Implement CreateField term which is used by NVDIMM _DSM method in later patch Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 13 + include/hw/acpi/aml-build.h | 1 + 2

Re: [Qemu-devel] [PATCH v7 13/35] hostmem-file: use whole file size if possible

2015-11-03 Thread Xiao Guangrong
On 11/03/2015 01:09 AM, Vladimir Sementsov-Ogievskiy wrote: On 02.11.2015 12:13, Xiao Guangrong wrote: Use the whole file size if @size is not specified which is useful if we want to directly pass a file to guest Signed-off-by: Xiao Guangrong --- backends/hostmem-file.c | 22

Re: [Qemu-devel] [PATCH v7 20/35] dimm: get mapped memory region from DIMMDeviceClass->get_memory_region

2015-11-03 Thread Xiao Guangrong
On 11/03/2015 12:16 AM, Vladimir Sementsov-Ogievskiy wrote: On 02.11.2015 18:06, Xiao Guangrong wrote: On 11/02/2015 10:26 PM, Vladimir Sementsov-Ogievskiy wrote: On 02.11.2015 16:08, Xiao Guangrong wrote: On 11/02/2015 08:19 PM, Vladimir Sementsov-Ogievskiy wrote: On 02.11.2015 12:13

Re: [Qemu-devel] [PATCH v7 09/35] exec: allow file_ram_alloc to work on file

2015-11-03 Thread Xiao Guangrong
On 11/03/2015 09:55 PM, Paolo Bonzini wrote: On 03/11/2015 04:56, Xiao Guangrong wrote: On 11/03/2015 05:12 AM, Paolo Bonzini wrote: On 02/11/2015 10:13, Xiao Guangrong wrote: Currently, file_ram_alloc() only works on directory - it creates a file under @path and do mmap on it This

Re: [Qemu-devel] [PATCH v7 27/35] nvdimm acpi: build ACPI nvdimm devices

2015-11-03 Thread Xiao Guangrong
On 11/03/2015 09:13 PM, Igor Mammedov wrote: On Mon, 2 Nov 2015 17:13:29 +0800 Xiao Guangrong wrote: NVDIMM devices is defined in ACPI 6.0 9.20 NVDIMM Devices There is a root device under \_SB and specified NVDIMM devices are under the root device. Each NVDIMM device has _ADR which

Re: [Qemu-devel] [PATCH v7 09/35] exec: allow file_ram_alloc to work on file

2015-11-03 Thread Xiao Guangrong
On 11/03/2015 08:34 PM, Igor Mammedov wrote: On Mon, 2 Nov 2015 17:13:11 +0800 Xiao Guangrong wrote: Currently, file_ram_alloc() only works on directory - it creates a file under @path and do mmap on it This patch tries to allow it to work on file directly, if @path is a directory it

Re: [Qemu-devel] [PATCH v7 06/35] acpi: add aml_method_serialized

2015-11-03 Thread Xiao Guangrong
On 11/03/2015 08:30 PM, Igor Mammedov wrote: On Mon, 2 Nov 2015 17:13:08 +0800 Xiao Guangrong wrote: It avoid explicit Mutex and will be used by NVDIMM ACPI Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 26 -- include/hw/acpi/aml-build.h | 1

Re: [Qemu-devel] [PATCH v7 09/35] exec: allow file_ram_alloc to work on file

2015-11-02 Thread Xiao Guangrong
On 11/03/2015 05:12 AM, Paolo Bonzini wrote: On 02/11/2015 10:13, Xiao Guangrong wrote: Currently, file_ram_alloc() only works on directory - it creates a file under @path and do mmap on it This patch tries to allow it to work on file directly, if @path is a directory it works as before

Re: [Qemu-devel] [PATCH v7 12/35] util: let qemu_fd_getlength support block device

2015-11-02 Thread Xiao Guangrong
On 11/03/2015 12:11 AM, Vladimir Sementsov-Ogievskiy wrote: On 02.11.2015 12:13, Xiao Guangrong wrote: lseek can not work for all block devices as the man page says: | Some devices are incapable of seeking and POSIX does not specify | which devices must support lseek(). This patch tries to

Re: [Qemu-devel] [PATCH v7 09/35] exec: allow file_ram_alloc to work on file

2015-11-02 Thread Xiao Guangrong
On 11/02/2015 11:12 PM, Vladimir Sementsov-Ogievskiy wrote: On 02.11.2015 12:13, Xiao Guangrong wrote: Currently, file_ram_alloc() only works on directory - it creates a file under @path and do mmap on it This patch tries to allow it to work on file directly, if @path is a It isn't t

Re: [Qemu-devel] [PATCH v7 08/35] exec: allow memory to be allocated from any kind of path

2015-11-02 Thread Xiao Guangrong
On 11/02/2015 10:51 PM, Vladimir Sementsov-Ogievskiy wrote: On 02.11.2015 12:13, Xiao Guangrong wrote: Currently file_ram_alloc() is designed for hugetlbfs, however, the memory of nvdimm can come from either raw pmem device eg, /dev/pmem, or the file locates at DAX enabled filesystem So this

Re: [Qemu-devel] [PATCH v7 20/35] dimm: get mapped memory region from DIMMDeviceClass->get_memory_region

2015-11-02 Thread Xiao Guangrong
On 11/02/2015 10:26 PM, Vladimir Sementsov-Ogievskiy wrote: On 02.11.2015 16:08, Xiao Guangrong wrote: On 11/02/2015 08:19 PM, Vladimir Sementsov-Ogievskiy wrote: On 02.11.2015 12:13, Xiao Guangrong wrote: Curretly, the memory region of backed memory is directly mapped to guest's ad

Re: [Qemu-devel] [PATCH v7 20/35] dimm: get mapped memory region from DIMMDeviceClass->get_memory_region

2015-11-02 Thread Xiao Guangrong
On 11/02/2015 08:19 PM, Vladimir Sementsov-Ogievskiy wrote: On 02.11.2015 12:13, Xiao Guangrong wrote: Curretly, the memory region of backed memory is directly mapped to guest's address space, however, it is not true for nvdimm device This patch let dimm device realize this fact an

[Qemu-devel] [PATCH v7 35/35] nvdimm: add maintain info

2015-11-02 Thread Xiao Guangrong
Add NVDIMM maintainer Signed-off-by: Xiao Guangrong --- MAINTAINERS | 7 +++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 3144113..865c0cf 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -907,6 +907,13 @@ M: Jiri Pirko S: Maintained F: hw/net/rocker

[Qemu-devel] [PATCH v7 32/35] nvdimm acpi: support Set Namespace Label Data function

2015-11-02 Thread Xiao Guangrong
Function 6 is used to set Namespace Label Data Reviewed-by: Stefan Hajnoczi Signed-off-by: Xiao Guangrong --- hw/acpi/nvdimm.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c index f30e2ff..2553be9 100644 --- a/hw/acpi

[Qemu-devel] [PATCH v7 31/35] nvdimm acpi: support Get Namespace Label Data function

2015-11-02 Thread Xiao Guangrong
Function 5 is used to get Namespace Label Data Reviewed-by: Stefan Hajnoczi Signed-off-by: Xiao Guangrong --- hw/acpi/nvdimm.c | 63 1 file changed, 63 insertions(+) diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c index cdc361c

[Qemu-devel] [PATCH v7 27/35] nvdimm acpi: build ACPI nvdimm devices

2015-11-02 Thread Xiao Guangrong
, we save handle, handle, arg1 and arg2 to dsm memory. Arg3 is conditionally saved in later patch Signed-off-by: Xiao Guangrong --- hw/acpi/nvdimm.c | 184 +++ 1 file changed, 184 insertions(+) diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c

[Qemu-devel] [PATCH v7 25/35] nvdimm acpi: init the resource used by NVDIMM ACPI

2015-11-02 Thread Xiao Guangrong
is true on default and it is false on 2.4 and its earlier version to keep compatibility Signed-off-by: Xiao Guangrong --- default-configs/i386-softmmu.mak | 1 + default-configs/mips-softmmu.mak | 1 + default-configs/mips64-softmmu.mak | 1 + default-configs/mips64el-softmmu.mak | 1

[Qemu-devel] [PATCH v7 26/35] nvdimm acpi: build ACPI NFIT table

2015-11-02 Thread Xiao Guangrong
w and Data window are not needed Signed-off-by: Xiao Guangrong --- hw/acpi/nvdimm.c| 355 hw/i386/acpi-build.c| 6 + include/hw/mem/nvdimm.h | 10 ++ 3 files changed, 371 insertions(+) diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvd

[Qemu-devel] [PATCH v7 34/35] nvdimm acpi: support _FIT method

2015-11-02 Thread Xiao Guangrong
FIT buffer is not completely mapped into guest address space, so a new function, Read FIT, function index 0x, is reserved by QEMU to read the piece of FIT buffer. The buffer is concatenated before _FIT return Refer to docs/specs/acpi-nvdimm.txt for detailed design Signed-off-by: Xiao

[Qemu-devel] [PATCH v7 23/35] nvdimm: implement NVDIMM device abstract

2015-11-02 Thread Xiao Guangrong
ry-backend-file, id=mem1,size=1G,mem-path=/dev/pmem0 -device nvdimm,memdev=mem1" to create NVDIMM device for guest Signed-off-by: Xiao Guangrong --- default-configs/i386-softmmu.mak | 1 + default-configs/x86_64-softmmu.mak | 1 + hw/acpi/memory_hotplug.c | 6 ++

[Qemu-devel] [PATCH v7 30/35] nvdimm acpi: support Get Namespace Label Size function

2015-11-02 Thread Xiao Guangrong
Function 4 is used to get Namespace label size Reviewed-by: Stefan Hajnoczi Signed-off-by: Xiao Guangrong --- hw/acpi/nvdimm.c | 87 +++- 1 file changed, 86 insertions(+), 1 deletion(-) diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c index

[Qemu-devel] [PATCH v7 28/35] nvdimm acpi: save arg3 for NVDIMM device _DSM method

2015-11-02 Thread Xiao Guangrong
Check if the input Arg3 is valid then store it into dsm_in if needed Signed-off-by: Xiao Guangrong --- hw/acpi/nvdimm.c | 27 ++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c index 53ed675..e179a72 100644 --- a/hw/acpi

[Qemu-devel] [PATCH v7 16/35] pc-dimm: drop the prefix of pc-dimm

2015-11-02 Thread Xiao Guangrong
i "s/PCDIMM/DIMM/g" find ./ -name "*.[ch]" -o -name "*.json" -o -name "trace-events" \ | xargs sed -i "s/pc_dimm/dimm/g" find ./ -name "trace-events" | xargs sed -i "s/pc-dimm/dimm/g" It prepares the work which abstracts dimm device

[Qemu-devel] [PATCH v7 17/35] stubs: rename qmp_pc_dimm_device_list.c

2015-11-02 Thread Xiao Guangrong
Rename qmp_pc_dimm_device_list.c to qmp_dimm_device_list.c Signed-off-by: Xiao Guangrong --- stubs/Makefile.objs | 2 +- stubs/{qmp_pc_dimm_device_list.c => qmp_dimm_device_list.c} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename st

[Qemu-devel] [PATCH v7 24/35] docs: add NVDIMM ACPI documentation

2015-11-02 Thread Xiao Guangrong
It describes the basic concepts of NVDIMM ACPI and the interface between QEMU and the ACPI BIOS Signed-off-by: Xiao Guangrong --- docs/specs/acpi_nvdimm.txt | 179 + 1 file changed, 179 insertions(+) create mode 100644 docs/specs/acpi_nvdimm.txt

[Qemu-devel] [PATCH v7 18/35] pc-dimm: rename pc-dimm.c and pc-dimm.h

2015-11-02 Thread Xiao Guangrong
Rename: pc-dimm.c => dimm.c pc-dimm.h => dimm.h It prepares the work which abstracts dimm device type for both pc-dimm and nvdimm Reviewed-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Xiao Guangrong --- hw/Makefile.objs | 2 +- hw/acpi/

[Qemu-devel] [PATCH v7 19/35] dimm: abstract dimm device from pc-dimm

2015-11-02 Thread Xiao Guangrong
A base device, dimm, is abstracted from pc-dimm, so that we can build nvdimm device based on dimm in the later patch Reviewed-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Xiao Guangrong --- default-configs/i386-softmmu.mak | 1 + default-configs/ppc64-softmmu.mak | 1 + default-configs

[Qemu-devel] [PATCH v7 12/35] util: let qemu_fd_getlength support block device

2015-11-02 Thread Xiao Guangrong
lseek can not work for all block devices as the man page says: | Some devices are incapable of seeking and POSIX does not specify | which devices must support lseek(). This patch tries to add the support on Linux by using BLKGETSIZE64 ioctl Signed-off-by: Xiao Guangrong --- util/osdep.c | 20

[Qemu-devel] [PATCH v7 09/35] exec: allow file_ram_alloc to work on file

2015-11-02 Thread Xiao Guangrong
-by: Xiao Guangrong --- exec.c | 80 ++ 1 file changed, 51 insertions(+), 29 deletions(-) diff --git a/exec.c b/exec.c index 9075f4d..db0fdaf 100644 --- a/exec.c +++ b/exec.c @@ -1174,14 +1174,60 @@ void qemu_mutex_unlock_ramlist(void

Re: [Qemu-devel] [PATCH v6 18/33] dimm: get mapped memory region from DIMMDeviceClass->get_memory_region

2015-11-02 Thread Xiao Guangrong
On 10/31/2015 10:15 PM, Xiao Guangrong wrote: On 10/31/2015 06:52 PM, Vladimir Sementsov-Ogievskiy wrote: On 30.10.2015 08:56, Xiao Guangrong wrote: Curretly, the memory region of backed memory is directly mapped to guest's address space, however, it is not true for nvdimm device

[Qemu-devel] [PATCH v7 14/35] pc-dimm: remove DEFAULT_PC_DIMMSIZE

2015-11-02 Thread Xiao Guangrong
It's not used any more Signed-off-by: Xiao Guangrong --- include/hw/mem/pc-dimm.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/hw/mem/pc-dimm.h b/include/hw/mem/pc-dimm.h index d83bf30..11a8937 100644 --- a/include/hw/mem/pc-dimm.h +++ b/include/hw/mem/pc-dimm.h @@ -20,8

[Qemu-devel] [PATCH v7 20/35] dimm: get mapped memory region from DIMMDeviceClass->get_memory_region

2015-11-02 Thread Xiao Guangrong
e return value of get_memory_region as it assumed the backend memory of pc-dimm is always properly initialized, we make get_memory_region internally catch the case if something is wrong Signed-off-by: Xiao Guangrong --- hw/mem/dimm.c| 3 ++- hw/mem/pc-dimm.c | 12 +++- 2 files cha

[Qemu-devel] [PATCH v7 10/35] hostmem-file: clean up memory allocation

2015-11-02 Thread Xiao Guangrong
sov-Ogievskiy Signed-off-by: Xiao Guangrong --- backends/hostmem-file.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index e9b6d21..9097a57 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -46

[Qemu-devel] [PATCH v7 08/35] exec: allow memory to be allocated from any kind of path

2015-11-02 Thread Xiao Guangrong
Currently file_ram_alloc() is designed for hugetlbfs, however, the memory of nvdimm can come from either raw pmem device eg, /dev/pmem, or the file locates at DAX enabled filesystem So this patch let it work on any kind of path Signed-off-by: Xiao Guangrong --- exec.c | 24

[Qemu-devel] [PATCH v7 33/35] nvdimm: allow using whole backend memory as pmem

2015-11-02 Thread Xiao Guangrong
is is useful for the users who want to pass whole nvdimm device and make its data completely be visible to guest The parameter is false on default Signed-off-by: Xiao Guangrong --- hw/acpi/nvdimm.c| 12 hw/mem/nvdimm.c | 43 ---

[Qemu-devel] [PATCH v7 13/35] hostmem-file: use whole file size if possible

2015-11-02 Thread Xiao Guangrong
Use the whole file size if @size is not specified which is useful if we want to directly pass a file to guest Signed-off-by: Xiao Guangrong --- backends/hostmem-file.c | 22 ++ 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/backends/hostmem-file.c b/backends

[Qemu-devel] [PATCH v7 04/35] acpi: add aml_concatenate

2015-11-02 Thread Xiao Guangrong
Implement Concatenate term which is used by NVDIMM _DSM method in later patch Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 14 ++ include/hw/acpi/aml-build.h | 1 + 2 files changed, 15 insertions(+) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index

[Qemu-devel] [PATCH v7 06/35] acpi: add aml_method_serialized

2015-11-02 Thread Xiao Guangrong
It avoid explicit Mutex and will be used by NVDIMM ACPI Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 26 -- include/hw/acpi/aml-build.h | 1 + 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c

[Qemu-devel] [PATCH v7 29/35] nvdimm acpi: support function 0

2015-11-02 Thread Xiao Guangrong
currently only allow to access device's Label Namespace Reviewed-by: Stefan Hajnoczi Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 2 +- hw/acpi/nvdimm.c| 158 +++- include/hw/acpi/aml-build.h | 1 + 3 files changed

[Qemu-devel] [PATCH v7 11/35] util: introduce qemu_file_getlength()

2015-11-02 Thread Xiao Guangrong
It is used to get the size of the specified file, also qemu_fd_getlength() is introduced to unify the code with raw_getlength() in block/raw-posix.c Signed-off-by: Xiao Guangrong --- block/raw-posix.c| 7 +-- include/qemu/osdep.h | 2 ++ util/osdep.c | 31

[Qemu-devel] [PATCH v7 03/35] acpi: add aml_create_field

2015-11-02 Thread Xiao Guangrong
Implement CreateField term which is used by NVDIMM _DSM method in later patch Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 13 + include/hw/acpi/aml-build.h | 1 + 2 files changed, 14 insertions(+) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index

[Qemu-devel] [PATCH v7 00/35] implement vNVDIMM

2015-11-02 Thread Xiao Guangrong
continue; } - if (nfit_mem->bdw && nfit_mem->memdev_pmem) + //if (nfit_mem->bdw && nfit_mem->memdev_pmem) + if (nfit_mem->memdev_pmem) flags |= NDD_ALIASING; You

[Qemu-devel] [PATCH v7 22/35] dimm: introduce realize callback

2015-11-02 Thread Xiao Guangrong
nvdimm need check if the backend memory is large enough to contain label data and init its memory region when the device is realized, so introduce realize callback which is called after common dimm has been realize Reviewed-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Xiao Guangrong --- hw

[Qemu-devel] [PATCH v7 05/35] acpi: add aml_object_type

2015-11-02 Thread Xiao Guangrong
Implement ObjectType which is used by NVDIMM _DSM method in later patch Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 8 include/hw/acpi/aml-build.h | 1 + 2 files changed, 9 insertions(+) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index efc06ab..9f792ab

[Qemu-devel] [PATCH v7 01/35] acpi: add aml_derefof

2015-11-02 Thread Xiao Guangrong
Implement DeRefOf term which is used by NVDIMM _DSM method in later patch Reviewed-by: Igor Mammedov Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 8 include/hw/acpi/aml-build.h | 1 + 2 files changed, 9 insertions(+) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml

[Qemu-devel] [PATCH v7 02/35] acpi: add aml_sizeof

2015-11-02 Thread Xiao Guangrong
Implement SizeOf term which is used by NVDIMM _DSM method in later patch Reviewed-by: Igor Mammedov Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 8 include/hw/acpi/aml-build.h | 1 + 2 files changed, 9 insertions(+) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml

[Qemu-devel] [PATCH v7 21/35] dimm: keep the state of the whole backend memory

2015-11-02 Thread Xiao Guangrong
QEMU keeps the state of memory of dimm device during live migration, however, it is not enough for nvdimm device as its memory does not contain its label data, so that we should protect the whole backend memory instead Signed-off-by: Xiao Guangrong --- hw/mem/dimm.c | 14 -- 1 file

[Qemu-devel] [PATCH v7 15/35] pc-dimm: make pc_existing_dimms_capacity static and rename it

2015-11-02 Thread Xiao Guangrong
pc_existing_dimms_capacity() can be static since it is not used out of pc-dimm.c and drop the pc_ prefix to prepare the work which abstracts dimm device type from pc-dimm Reviewed-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Xiao Guangrong --- hw/mem/pc-dimm.c | 73

[Qemu-devel] [PATCH v7 07/35] util: introduce qemu_file_get_page_size()

2015-11-02 Thread Xiao Guangrong
Signed-off-by: Xiao Guangrong --- exec.c | 33 ++--- include/qemu/osdep.h | 1 + target-ppc/kvm.c | 23 +-- util/oslib-posix.c | 37 + util/oslib-win32.c | 5 + 5 files changed, 50

Re: [Qemu-devel] [PATCH v6 07/33] util: introduce qemu_file_get_page_size()

2015-10-31 Thread Xiao Guangrong
On 10/31/2015 10:11 PM, Eduardo Habkost wrote: On Sat, Oct 31, 2015 at 04:09:56PM +0800, Xiao Guangrong wrote: On 10/30/2015 11:54 PM, Eduardo Habkost wrote: On Fri, Oct 30, 2015 at 01:56:01PM +0800, Xiao Guangrong wrote: There are three places use the some logic to get the page size on the

Re: [Qemu-devel] [PATCH v6 11/33] hostmem-file: use whole file size if possible

2015-10-31 Thread Xiao Guangrong
On 10/31/2015 09:45 PM, Eduardo Habkost wrote: On Sat, Oct 31, 2015 at 04:46:05PM +0800, Xiao Guangrong wrote: On 10/31/2015 01:30 AM, Eduardo Habkost wrote: On Fri, Oct 30, 2015 at 01:56:05PM +0800, Xiao Guangrong wrote: Use the whole file size if @size is not specified which is useful if

Re: [Qemu-devel] [PATCH v6 08/33] exec: allow memory to be allocated from any kind of path

2015-10-31 Thread Xiao Guangrong
On 10/31/2015 09:55 PM, Eduardo Habkost wrote: On Sat, Oct 31, 2015 at 03:44:39PM +0800, Xiao Guangrong wrote: On 10/30/2015 10:04 PM, Vladimir Sementsov-Ogievskiy wrote: On 30.10.2015 08:56, Xiao Guangrong wrote: Currently file_ram_alloc() is designed for hugetlbfs, however, the memory of

Re: [Qemu-devel] [PATCH v6 19/33] dimm: keep the state of the whole backend memory

2015-10-31 Thread Xiao Guangrong
On 10/31/2015 07:05 PM, Vladimir Sementsov-Ogievskiy wrote: On 30.10.2015 08:56, Xiao Guangrong wrote: QEMU keeps the state of memory of dimm device during live migration, however, it is not enough for nvdimm device as its memory does not contain its label data, so that we should protect the

Re: [Qemu-devel] [PATCH v6 18/33] dimm: get mapped memory region from DIMMDeviceClass->get_memory_region

2015-10-31 Thread Xiao Guangrong
On 10/31/2015 06:52 PM, Vladimir Sementsov-Ogievskiy wrote: On 30.10.2015 08:56, Xiao Guangrong wrote: Curretly, the memory region of backed memory is directly mapped to guest's address space, however, it is not true for nvdimm device This patch let dimm device realize this fact an

Re: [Qemu-devel] [PATCH v6 07/33] util: introduce qemu_file_get_page_size()

2015-10-31 Thread Xiao Guangrong
On 10/31/2015 05:37 PM, Vladimir Sementsov-Ogievskiy wrote: On 31.10.2015 10:26, Xiao Guangrong wrote: On 10/30/2015 09:26 PM, Vladimir Sementsov-Ogievskiy wrote: logic is changed: in old version gethugepagesize on statfs error generates exit(1) in new it returns getpagesize() in

Re: [Qemu-devel] [PATCH v6 11/33] hostmem-file: use whole file size if possible

2015-10-31 Thread Xiao Guangrong
On 10/31/2015 01:30 AM, Eduardo Habkost wrote: On Fri, Oct 30, 2015 at 01:56:05PM +0800, Xiao Guangrong wrote: Use the whole file size if @size is not specified which is useful if we want to directly pass a file to guest Signed-off-by: Xiao Guangrong --- backends/hostmem-file.c | 48

Re: [Qemu-devel] [PATCH v6 07/33] util: introduce qemu_file_get_page_size()

2015-10-31 Thread Xiao Guangrong
On 10/30/2015 11:54 PM, Eduardo Habkost wrote: On Fri, Oct 30, 2015 at 01:56:01PM +0800, Xiao Guangrong wrote: There are three places use the some logic to get the page size on the file path or file fd This patch introduces qemu_file_get_page_size() to unify the code Signed-off-by: Xiao

Re: [Qemu-devel] [PATCH v6 14/33] pc-dimm: drop the prefix of pc-dimm

2015-10-31 Thread Xiao Guangrong
On 10/31/2015 01:06 AM, Eric Blake wrote: On 10/29/2015 11:56 PM, Xiao Guangrong wrote: This patch is generated by this script: find ./ -name "*.[ch]" -o -name "*.json" -o -name "trace-events" -type f \ | xargs sed -i "s/PC_DIMM/DIMM/g" find ./ -

Re: [Qemu-devel] [PATCH v6 14/33] pc-dimm: drop the prefix of pc-dimm

2015-10-31 Thread Xiao Guangrong
On 10/31/2015 12:10 AM, Vladimir Sementsov-Ogievskiy wrote: On 30.10.2015 08:56, Xiao Guangrong wrote: This patch is generated by this script: find ./ -name "*.[ch]" -o -name "*.json" -o -name "trace-events" -type f \ | xargs sed -i "s/PC_DIMM/DIMM/g"

Re: [Qemu-devel] [PATCH v6 07/33] util: introduce qemu_file_get_page_size()

2015-10-31 Thread Xiao Guangrong
On 10/30/2015 11:54 PM, Eduardo Habkost wrote: On Fri, Oct 30, 2015 at 01:56:01PM +0800, Xiao Guangrong wrote: There are three places use the some logic to get the page size on the file path or file fd This patch introduces qemu_file_get_page_size() to unify the code Signed-off-by: Xiao

Re: [Qemu-devel] [PATCH v6 11/33] hostmem-file: use whole file size if possible

2015-10-31 Thread Xiao Guangrong
On 10/30/2015 11:27 PM, Vladimir Sementsov-Ogievskiy wrote: On 30.10.2015 08:56, Xiao Guangrong wrote: Use the whole file size if @size is not specified which is useful if we want to directly pass a file to guest Signed-off-by: Xiao Guangrong --- backends/hostmem-file.c | 48

Re: [Qemu-devel] [PATCH v6 09/33] exec: allow file_ram_alloc to work on file

2015-10-31 Thread Xiao Guangrong
On 10/30/2015 10:25 PM, Vladimir Sementsov-Ogievskiy wrote: On 30.10.2015 08:56, Xiao Guangrong wrote: Currently, file_ram_alloc() only works on directory - it creates a file under @path and do mmap on it This patch tries to allow it to work on file directly, if @path is a directory it works

Re: [Qemu-devel] [PATCH v6 08/33] exec: allow memory to be allocated from any kind of path

2015-10-31 Thread Xiao Guangrong
On 10/30/2015 10:04 PM, Vladimir Sementsov-Ogievskiy wrote: On 30.10.2015 08:56, Xiao Guangrong wrote: Currently file_ram_alloc() is designed for hugetlbfs, however, the memory of nvdimm can come from either raw pmem device eg, /dev/pmem, or the file locates at DAX enabled filesystem So this

Re: [Qemu-devel] [PATCH v6 07/33] util: introduce qemu_file_get_page_size()

2015-10-31 Thread Xiao Guangrong
On 10/30/2015 09:26 PM, Vladimir Sementsov-Ogievskiy wrote: logic is changed: in old version gethugepagesize on statfs error generates exit(1) in new it returns getpagesize() in this case (through fd_getpagesize) (I think, fd_getpagesize should be fixed to handle error) Indeed. I wi

Re: [Qemu-devel] [PATCH v6 27/33] nvdimm acpi: support function 0

2015-10-30 Thread Xiao Guangrong
On 10/30/2015 06:14 PM, Stefan Hajnoczi wrote: On Fri, Oct 30, 2015 at 01:56:21PM +0800, Xiao Guangrong wrote: static uint64_t nvdimm_dsm_read(void *opaque, hwaddr addr, unsigned size) { -return 0; +AcpiNVDIMMState *state = opaque; +MemoryRegion *dsm_ram_mr = &state->

[Qemu-devel] [PATCH v6 33/33] nvdimm: add maintain info

2015-10-29 Thread Xiao Guangrong
Add NVDIMM maintainer Signed-off-by: Xiao Guangrong --- MAINTAINERS | 7 +++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 3144113..865c0cf 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -907,6 +907,13 @@ M: Jiri Pirko S: Maintained F: hw/net/rocker

[Qemu-devel] [PATCH v6 30/33] nvdimm acpi: support Set Namespace Label Data function

2015-10-29 Thread Xiao Guangrong
Function 6 is used to set Namespace Label Data Signed-off-by: Xiao Guangrong --- hw/acpi/nvdimm.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c index 8c27b25..5c8be41 100644 --- a/hw/acpi/nvdimm.c +++ b/hw/acpi/nvdimm.c

[Qemu-devel] [PATCH v6 29/33] nvdimm acpi: support Get Namespace Label Data function

2015-10-29 Thread Xiao Guangrong
Function 5 is used to get Namespace Label Data Signed-off-by: Xiao Guangrong --- hw/acpi/nvdimm.c | 63 1 file changed, 63 insertions(+) diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c index 67c4699..8c27b25 100644 --- a/hw/acpi

[Qemu-devel] [PATCH v6 28/33] nvdimm acpi: support Get Namespace Label Size function

2015-10-29 Thread Xiao Guangrong
Function 4 is used to get Namespace label size Signed-off-by: Xiao Guangrong --- hw/acpi/nvdimm.c | 87 +++- 1 file changed, 86 insertions(+), 1 deletion(-) diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c index 300a3aa..67c4699 100644 --- a

[Qemu-devel] [PATCH v6 27/33] nvdimm acpi: support function 0

2015-10-29 Thread Xiao Guangrong
currently only allow to access device's Label Namespace Reviewed-by: Stefan Hajnoczi Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 2 +- hw/acpi/nvdimm.c| 156 +++- include/hw/acpi/aml-build.h | 1 + 3 files changed

[Qemu-devel] [PATCH v6 32/33] nvdimm acpi: support _FIT method

2015-10-29 Thread Xiao Guangrong
FIT buffer is not completely mapped into guest address space, so a new function, Read FIT, function index 0x, is reserved by QEMU to read the piece of FIT buffer. The buffer is concatenated before _FIT return Refer to docs/specs/acpi-nvdimm.txt for detailed design Signed-off-by: Xiao

[Qemu-devel] [PATCH v6 25/33] nvdimm acpi: build ACPI nvdimm devices

2015-10-29 Thread Xiao Guangrong
, we save handle, handle, arg1 and arg2 to dsm memory. Arg3 is conditionally saved in later patch Signed-off-by: Xiao Guangrong --- hw/acpi/nvdimm.c | 184 +++ 1 file changed, 184 insertions(+) diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c

[Qemu-devel] [PATCH v6 24/33] nvdimm acpi: build ACPI NFIT table

2015-10-29 Thread Xiao Guangrong
w and Data window are not needed Signed-off-by: Xiao Guangrong --- hw/acpi/nvdimm.c| 355 hw/i386/acpi-build.c| 6 + include/hw/mem/nvdimm.h | 10 ++ 3 files changed, 371 insertions(+) diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvd

[Qemu-devel] [PATCH v6 23/33] nvdimm acpi: init the resource used by NVDIMM ACPI

2015-10-29 Thread Xiao Guangrong
is true on default and it is false on 2.4 and its earlier version to keep compatibility Signed-off-by: Xiao Guangrong --- default-configs/i386-softmmu.mak | 1 + default-configs/mips-softmmu.mak | 1 + default-configs/mips64-softmmu.mak | 1 + default-configs/mips64el-softmmu.mak | 1

[Qemu-devel] [PATCH v6 26/33] nvdimm acpi: save arg3 for NVDIMM device _DSM method

2015-10-29 Thread Xiao Guangrong
Check if the input Arg3 is valid then store it into dsm_in if needed Signed-off-by: Xiao Guangrong --- hw/acpi/nvdimm.c | 27 ++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c index 53ed675..e179a72 100644 --- a/hw/acpi

[Qemu-devel] [PATCH v6 31/33] nvdimm: allow using whole backend memory as pmem

2015-10-29 Thread Xiao Guangrong
is is useful for the users who want to pass whole nvdimm device and make its data completely be visible to guest The parameter is false on default Signed-off-by: Xiao Guangrong --- hw/acpi/nvdimm.c| 12 hw/mem/nvdimm.c | 43 ---

[Qemu-devel] [PATCH v6 22/33] docs: add NVDIMM ACPI documentation

2015-10-29 Thread Xiao Guangrong
It describes the basic concepts of NVDIMM ACPI and the interface between QEMU and the ACPI BIOS Signed-off-by: Xiao Guangrong --- docs/specs/acpi_nvdimm.txt | 179 + 1 file changed, 179 insertions(+) create mode 100644 docs/specs/acpi_nvdimm.txt

[Qemu-devel] [PATCH v6 21/33] nvdimm: implement NVDIMM device abstract

2015-10-29 Thread Xiao Guangrong
ry-backend-file, id=mem1,size=1G,mem-path=/dev/pmem0 -device nvdimm,memdev=mem1" to create NVDIMM device for guest Signed-off-by: Xiao Guangrong --- default-configs/i386-softmmu.mak | 1 + default-configs/x86_64-softmmu.mak | 1 + hw/acpi/memory_hotplug.c | 6 ++

[Qemu-devel] [PATCH v6 18/33] dimm: get mapped memory region from DIMMDeviceClass->get_memory_region

2015-10-29 Thread Xiao Guangrong
Curretly, the memory region of backed memory is directly mapped to guest's address space, however, it is not true for nvdimm device This patch let dimm device realize this fact and use DIMMDeviceClass->get_memory_region method to get the mapped memory region Signed-off-by: Xiao G

[Qemu-devel] [PATCH v6 14/33] pc-dimm: drop the prefix of pc-dimm

2015-10-29 Thread Xiao Guangrong
f \ | xargs sed -i "s/PCDIMM/DIMM/g" find ./ -name "*.[ch]" -o -name "*.json" -o -name "trace-events" -type f \ | xargs sed -i "s/pc_dimm/dimm/g" find ./ -name "trace-events" -type f | xargs sed -i "s/pc-dimm/dimm/g" It prepares the

[Qemu-devel] [PATCH v6 19/33] dimm: keep the state of the whole backend memory

2015-10-29 Thread Xiao Guangrong
QEMU keeps the state of memory of dimm device during live migration, however, it is not enough for nvdimm device as its memory does not contain its label data, so that we should protect the whole backend memory instead Signed-off-by: Xiao Guangrong --- hw/mem/dimm.c | 14 -- 1 file

[Qemu-devel] [PATCH v6 20/33] dimm: introduce realize callback

2015-10-29 Thread Xiao Guangrong
nvdimm need check if the backend memory is large enough to contain label data and init its memory region when the device is realized, so introduce realize callback which is called after common dimm has been realize Signed-off-by: Xiao Guangrong --- hw/mem/dimm.c | 5 + include/hw

[Qemu-devel] [PATCH v6 15/33] stubs: rename qmp_pc_dimm_device_list.c

2015-10-29 Thread Xiao Guangrong
Rename qmp_pc_dimm_device_list.c to qmp_dimm_device_list.c Signed-off-by: Xiao Guangrong --- stubs/Makefile.objs | 2 +- stubs/{qmp_pc_dimm_device_list.c => qmp_dimm_device_list.c} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename st

[Qemu-devel] [PATCH v6 13/33] pc-dimm: make pc_existing_dimms_capacity static and rename it

2015-10-29 Thread Xiao Guangrong
pc_existing_dimms_capacity() can be static since it is not used out of pc-dimm.c and drop the pc_ prefix to prepare the work which abstracts dimm device type from pc-dimm Signed-off-by: Xiao Guangrong --- hw/mem/pc-dimm.c | 73 include/hw

[Qemu-devel] [PATCH v6 17/33] dimm: abstract dimm device from pc-dimm

2015-10-29 Thread Xiao Guangrong
A base device, dimm, is abstracted from pc-dimm, so that we can build nvdimm device based on dimm in the later patch Signed-off-by: Xiao Guangrong --- default-configs/i386-softmmu.mak | 1 + default-configs/ppc64-softmmu.mak | 1 + default-configs/x86_64-softmmu.mak | 1 + hw/mem

[Qemu-devel] [PATCH v6 12/33] pc-dimm: remove DEFAULT_PC_DIMMSIZE

2015-10-29 Thread Xiao Guangrong
It's not used any more Signed-off-by: Xiao Guangrong --- include/hw/mem/pc-dimm.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/hw/mem/pc-dimm.h b/include/hw/mem/pc-dimm.h index d83bf30..11a8937 100644 --- a/include/hw/mem/pc-dimm.h +++ b/include/hw/mem/pc-dimm.h @@ -20,8

[Qemu-devel] [PATCH v6 10/33] hostmem-file: clean up memory allocation

2015-10-29 Thread Xiao Guangrong
- hostmem-file.c is compiled only if CONFIG_LINUX is enabled so that is unnecessary to do the same check in the source file - the interface, HostMemoryBackendClass->alloc(), is not called many times, do not need to check if the memory-region is initialized Signed-off-by: Xiao Guangr

[Qemu-devel] [PATCH v6 09/33] exec: allow file_ram_alloc to work on file

2015-10-29 Thread Xiao Guangrong
-by: Xiao Guangrong --- exec.c | 80 ++ 1 file changed, 51 insertions(+), 29 deletions(-) diff --git a/exec.c b/exec.c index 3ca7e50..f219010 100644 --- a/exec.c +++ b/exec.c @@ -1174,14 +1174,60 @@ void qemu_mutex_unlock_ramlist(void

[Qemu-devel] [PATCH v6 16/33] pc-dimm: rename pc-dimm.c and pc-dimm.h

2015-10-29 Thread Xiao Guangrong
Rename: pc-dimm.c => dimm.c pc-dimm.h => dimm.h It prepares the work which abstracts dimm device type for both pc-dimm and nvdimm Signed-off-by: Xiao Guangrong --- hw/Makefile.objs | 2 +- hw/acpi/ich9.c | 2 +- hw/acpi/memory_hot

[Qemu-devel] [PATCH v6 06/33] acpi: add aml_method_serialized

2015-10-29 Thread Xiao Guangrong
It avoid explicit Mutex and will be used by NVDIMM ACPI Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 26 -- include/hw/acpi/aml-build.h | 1 + 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c

[Qemu-devel] [PATCH v6 08/33] exec: allow memory to be allocated from any kind of path

2015-10-29 Thread Xiao Guangrong
Currently file_ram_alloc() is designed for hugetlbfs, however, the memory of nvdimm can come from either raw pmem device eg, /dev/pmem, or the file locates at DAX enabled filesystem So this patch let it work on any kind of path Signed-off-by: Xiao Guangrong --- exec.c | 56

[Qemu-devel] [PATCH v6 05/33] acpi: add aml_object_type

2015-10-29 Thread Xiao Guangrong
Implement ObjectType which is used by NVDIMM _DSM method in later patch Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 8 include/hw/acpi/aml-build.h | 1 + 2 files changed, 9 insertions(+) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index efc06ab..9f792ab

[Qemu-devel] [PATCH v6 04/33] acpi: add aml_concatenate

2015-10-29 Thread Xiao Guangrong
Implement Concatenate term which is used by NVDIMM _DSM method in later patch Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 14 ++ include/hw/acpi/aml-build.h | 1 + 2 files changed, 15 insertions(+) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index

[Qemu-devel] [PATCH v6 11/33] hostmem-file: use whole file size if possible

2015-10-29 Thread Xiao Guangrong
Use the whole file size if @size is not specified which is useful if we want to directly pass a file to guest Signed-off-by: Xiao Guangrong --- backends/hostmem-file.c | 48 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/backends

[Qemu-devel] [PATCH v6 07/33] util: introduce qemu_file_get_page_size()

2015-10-29 Thread Xiao Guangrong
There are three places use the some logic to get the page size on the file path or file fd This patch introduces qemu_file_get_page_size() to unify the code Signed-off-by: Xiao Guangrong --- include/qemu/osdep.h | 1 + target-ppc/kvm.c | 21 +++-- util/oslib-posix.c | 16

[Qemu-devel] [PATCH v6 01/33] acpi: add aml_derefof

2015-10-29 Thread Xiao Guangrong
Implement DeRefOf term which is used by NVDIMM _DSM method in later patch Reviewed-by: Igor Mammedov Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 8 include/hw/acpi/aml-build.h | 1 + 2 files changed, 9 insertions(+) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml

[Qemu-devel] [PATCH v6 00/33] implement vNVDIMM

2015-10-29 Thread Xiao Guangrong
//if (nfit_mem->bdw && nfit_mem->memdev_pmem) + if (nfit_mem->memdev_pmem) flags |= NDD_ALIASING; You can append another NVDIMM device in guest and do: # cd /sys/bus/nd/devices/ # cd namespace1.0/ # echo `uuidgen` &

[Qemu-devel] [PATCH v6 02/33] acpi: add aml_sizeof

2015-10-29 Thread Xiao Guangrong
Implement SizeOf term which is used by NVDIMM _DSM method in later patch Reviewed-by: Igor Mammedov Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 8 include/hw/acpi/aml-build.h | 1 + 2 files changed, 9 insertions(+) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml

<    1   2   3   4   5   6   7   8   9   >