xref: /openbmc/qemu/include/hw/ppc/spapr_nvdimm.h (revision 1da79ecc)
1 /*
2  * QEMU PowerPC PAPR SCM backend definitions
3  *
4  * Copyright (c) 2020, IBM Corporation.
5  *
6  * This code is licensed under the GPL version 2 or later. See the
7  * COPYING file in the top-level directory.
8  */
9 
10 #ifndef HW_SPAPR_NVDIMM_H
11 #define HW_SPAPR_NVDIMM_H
12 
13 #include "hw/mem/nvdimm.h"
14 #include "hw/ppc/spapr.h"
15 
16 /*
17  * The nvdimm size should be aligned to SCM block size.
18  * The SCM block size should be aligned to SPAPR_MEMORY_BLOCK_SIZE
19  * inorder to have SCM regions not to overlap with dimm memory regions.
20  * The SCM devices can have variable block sizes. For now, fixing the
21  * block size to the minimum value.
22  */
23 #define SPAPR_MINIMUM_SCM_BLOCK_SIZE SPAPR_MEMORY_BLOCK_SIZE
24 
25 /* Have an explicit check for alignment */
26 QEMU_BUILD_BUG_ON(SPAPR_MINIMUM_SCM_BLOCK_SIZE % SPAPR_MEMORY_BLOCK_SIZE);
27 
28 int spapr_pmem_dt_populate(SpaprDrc *drc, SpaprMachineState *spapr,
29                            void *fdt, int *fdt_start_offset, Error **errp);
30 void spapr_dt_persistent_memory(SpaprMachineState *spapr, void *fdt);
31 bool spapr_nvdimm_validate(HotplugHandler *hotplug_dev, NVDIMMDevice *nvdimm,
32                            uint64_t size, Error **errp);
33 void spapr_add_nvdimm(DeviceState *dev, uint64_t slot);
34 
35 #endif
36