2015-12-02 10:20:56 +03:00
|
|
|
/*
|
|
|
|
* Non-Volatile Dual In-line Memory Module Virtualization Implementation
|
|
|
|
*
|
|
|
|
* Copyright(C) 2015 Intel Corporation.
|
|
|
|
*
|
|
|
|
* Author:
|
|
|
|
* Xiao Guangrong <guangrong.xiao@linux.intel.com>
|
|
|
|
*
|
|
|
|
* NVDIMM specifications and some documents can be found at:
|
|
|
|
* NVDIMM ACPI device and NFIT are introduced in ACPI 6:
|
|
|
|
* http://www.uefi.org/sites/default/files/resources/ACPI_6.0.pdf
|
|
|
|
* NVDIMM Namespace specification:
|
|
|
|
* http://pmem.io/documents/NVDIMM_Namespace_Spec.pdf
|
|
|
|
* DSM Interface Example:
|
|
|
|
* http://pmem.io/documents/NVDIMM_DSM_Interface_Example.pdf
|
|
|
|
* Driver Writer's Guide:
|
|
|
|
* http://pmem.io/documents/NVDIMM_Driver_Writers_Guide.pdf
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
|
|
* See the COPYING file in the top-level directory.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef QEMU_NVDIMM_H
|
|
|
|
#define QEMU_NVDIMM_H
|
|
|
|
|
|
|
|
#include "hw/mem/pc-dimm.h"
|
|
|
|
|
2016-03-04 19:00:32 +03:00
|
|
|
#define TYPE_NVDIMM "nvdimm"
|
nvdimm acpi: build ACPI NFIT table
NFIT is defined in ACPI 6.0: 5.2.25 NVDIMM Firmware Interface Table (NFIT)
Currently, we only support PMEM mode. Each device has 3 structures:
- SPA structure, defines the PMEM region info
- MEM DEV structure, it has the @handle which is used to associate specified
ACPI NVDIMM device we will introduce in later patch.
Also we can happily ignored the memory device's interleave, the real
nvdimm hardware access is hidden behind host
- DCR structure, it defines vendor ID used to associate specified vendor
nvdimm driver. Since we only implement PMEM mode this time, Command
window and Data window are not needed
The NVDIMM functionality is controlled by the parameter, 'nvdimm', which
is introduced for the machine, there is a example to enable it:
-machine pc,nvdimm -m 8G,maxmem=100G,slots=100 -object \
memory-backend-file,id=mem1,share,mem-path=/tmp/nvdimm1,size=10G -device \
nvdimm,memdev=mem1,id=nv1
It is disabled on default
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-12-02 10:20:58 +03:00
|
|
|
|
2016-03-04 19:00:32 +03:00
|
|
|
#define NVDIMM_DSM_MEM_FILE "etc/acpi/nvdimm-mem"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 32 bits IO port starting from 0x0a18 in guest is reserved for
|
|
|
|
* NVDIMM ACPI emulation.
|
|
|
|
*/
|
|
|
|
#define NVDIMM_ACPI_IO_BASE 0x0a18
|
|
|
|
#define NVDIMM_ACPI_IO_LEN 4
|
|
|
|
|
|
|
|
struct AcpiNVDIMMState {
|
|
|
|
/* detect if NVDIMM support is enabled. */
|
|
|
|
bool is_enabled;
|
|
|
|
|
|
|
|
/* the data of the fw_cfg file NVDIMM_DSM_MEM_FILE. */
|
|
|
|
GArray *dsm_mem;
|
|
|
|
/* the IO region used by OSPM to transfer control to QEMU. */
|
|
|
|
MemoryRegion io_mr;
|
|
|
|
};
|
|
|
|
typedef struct AcpiNVDIMMState AcpiNVDIMMState;
|
|
|
|
|
|
|
|
void nvdimm_init_acpi_state(AcpiNVDIMMState *state, MemoryRegion *io,
|
|
|
|
FWCfgState *fw_cfg, Object *owner);
|
nvdimm acpi: build ACPI NFIT table
NFIT is defined in ACPI 6.0: 5.2.25 NVDIMM Firmware Interface Table (NFIT)
Currently, we only support PMEM mode. Each device has 3 structures:
- SPA structure, defines the PMEM region info
- MEM DEV structure, it has the @handle which is used to associate specified
ACPI NVDIMM device we will introduce in later patch.
Also we can happily ignored the memory device's interleave, the real
nvdimm hardware access is hidden behind host
- DCR structure, it defines vendor ID used to associate specified vendor
nvdimm driver. Since we only implement PMEM mode this time, Command
window and Data window are not needed
The NVDIMM functionality is controlled by the parameter, 'nvdimm', which
is introduced for the machine, there is a example to enable it:
-machine pc,nvdimm -m 8G,maxmem=100G,slots=100 -object \
memory-backend-file,id=mem1,share,mem-path=/tmp/nvdimm1,size=10G -device \
nvdimm,memdev=mem1,id=nv1
It is disabled on default
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-12-02 10:20:58 +03:00
|
|
|
void nvdimm_build_acpi(GArray *table_offsets, GArray *table_data,
|
|
|
|
GArray *linker);
|
2015-12-02 10:20:56 +03:00
|
|
|
#endif
|