[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-arm] [PATCH v9 17/18] hw/arm/boot: Expose the pmem nodes in the DT
From: |
Eric Auger |
Subject: |
[Qemu-arm] [PATCH v9 17/18] hw/arm/boot: Expose the pmem nodes in the DT |
Date: |
Tue, 26 Feb 2019 21:44:38 +0100 |
In case of NV-DIMM slots, let's add /pmem DT nodes.
Signed-off-by: Eric Auger <address@hidden>
---
v6 -> v7
- does the same rework as for fdt_add_memory_node
---
hw/arm/boot.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index 4caaf91583..45e29b7b4a 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -450,6 +450,32 @@ out:
return ret;
}
+static int fdt_add_pmem_node(void *fdt, uint32_t acells, hwaddr mem_base,
+ uint32_t scells, hwaddr mem_len,
+ int numa_node_id)
+{
+ char *nodename;
+ int ret;
+
+ nodename = g_strdup_printf("/address@hidden" PRIx64, mem_base);
+ qemu_fdt_add_subnode(fdt, nodename);
+ qemu_fdt_setprop_string(fdt, nodename, "compatible", "pmem-region");
+ ret = qemu_fdt_setprop_sized_cells(fdt, nodename, "reg", acells, mem_base,
+ scells, mem_len);
+ if (ret < 0) {
+ goto out;
+ }
+
+ /* only set the NUMA ID if it is specified */
+ if (numa_node_id >= 0) {
+ ret = qemu_fdt_setprop_cell(fdt, nodename,
+ "numa-node-id", numa_node_id);
+ }
+out:
+ g_free(nodename);
+ return ret;
+}
+
static void fdt_add_psci_node(void *fdt)
{
uint32_t cpu_suspend_fn;
@@ -546,6 +572,20 @@ static int fdt_add_hotpluggable_memory_nodes(void *fdt,
}
break;
}
+ case MEMORY_DEVICE_INFO_KIND_NVDIMM:
+ {
+ PCDIMMDeviceInfo *di = mi->u.nvdimm.data;
+
+ ret = fdt_add_pmem_node(fdt, acells, di->addr,
+ scells, di->size, di->node);
+ if (ret) {
+ fprintf(stderr,
+ "couldn't add NVDIMM /address@hidden"PRIx64" node\n",
+ di->addr);
+ goto out;
+ }
+ break;
+ }
default:
fprintf(stderr, "%s memory nodes are not yet supported\n",
MemoryDeviceInfoKind_str(mi->type));
--
2.20.1
- [Qemu-arm] [PATCH v9 07/18] hw/arm/virt: Dynamic memory map depending on RAM requirements, (continued)
- [Qemu-arm] [PATCH v9 07/18] hw/arm/virt: Dynamic memory map depending on RAM requirements, Eric Auger, 2019/02/26
- [Qemu-arm] [PATCH v9 08/18] hw/arm/virt: Implement kvm_type function for 4.0 machine, Eric Auger, 2019/02/26
- [Qemu-arm] [PATCH v9 09/18] hw/arm/virt: Check the VCPU PA range in TCG mode, Eric Auger, 2019/02/26
- [Qemu-arm] [PATCH v9 10/18] hw/arm/virt: Bump the 255GB initial RAM limit, Eric Auger, 2019/02/26
- [Qemu-arm] [PATCH v9 11/18] hw/arm/virt: Add memory hotplug framework, Eric Auger, 2019/02/26
- [Qemu-arm] [PATCH v9 12/18] hw/arm/boot: Expose the PC-DIMM nodes in the DT, Eric Auger, 2019/02/26
- [Qemu-arm] [PATCH v9 13/18] hw/arm/virt-acpi-build: Add PC-DIMM in SRAT, Eric Auger, 2019/02/26
- [Qemu-arm] [PATCH v9 15/18] machine: Move acpi_nvdimm_state into struct MachineState, Eric Auger, 2019/02/26
- [Qemu-arm] [PATCH v9 14/18] nvdimm: Use configurable ACPI IO base and size, Eric Auger, 2019/02/26
- [Qemu-arm] [PATCH v9 16/18] hw/arm/virt: Add nvdimm hot-plug infrastructure, Eric Auger, 2019/02/26
- [Qemu-arm] [PATCH v9 17/18] hw/arm/boot: Expose the pmem nodes in the DT,
Eric Auger <=
- [Qemu-arm] [PATCH v9 18/18] hw/arm/virt: Allow nvdimm instantiation, Eric Auger, 2019/02/26