[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/5] hw/arm/boot: Expose the pmem nodes in the DT
From: |
Igor Mammedov |
Subject: |
Re: [PATCH 4/5] hw/arm/boot: Expose the pmem nodes in the DT |
Date: |
Mon, 11 Nov 2019 15:46:27 +0100 |
On Fri, 4 Oct 2019 16:53:01 +0100
Shameer Kolothum <address@hidden> wrote:
> From: Eric Auger <address@hidden>
>
> In case of NV-DIMM slots, let's add /pmem DT nodes
Why should we do it for NVDIMM but not for PC-DIMM?
>
> Signed-off-by: Eric Auger <address@hidden>
> Signed-off-by: Shameer Kolothum <address@hidden>
> ---
> hw/arm/boot.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 45 insertions(+)
>
> diff --git a/hw/arm/boot.c b/hw/arm/boot.c
> index c264864c11..bd6d72b33e 100644
> --- a/hw/arm/boot.c
> +++ b/hw/arm/boot.c
> @@ -20,6 +20,7 @@
> #include "hw/boards.h"
> #include "sysemu/reset.h"
> #include "hw/loader.h"
> +#include "hw/mem/memory-device.h"
> #include "elf.h"
> #include "sysemu/device_tree.h"
> #include "qemu/config-file.h"
> @@ -523,6 +524,44 @@ static void fdt_add_psci_node(void *fdt)
> qemu_fdt_setprop_cell(fdt, "/psci", "migrate", migrate_fn);
> }
>
> +static int fdt_add_pmem_node(void *fdt, uint32_t acells, uint32_t scells)
> +{
> + MemoryDeviceInfoList *info, *info_list = qmp_memory_device_list();
> + MemoryDeviceInfo *mi;
> + int ret;
> +
> + for (info = info_list; info != NULL; info = info->next) {
> + mi = info->value;
> +
> + if (mi->type == MEMORY_DEVICE_INFO_KIND_NVDIMM) {
> + PCDIMMDeviceInfo *di = mi->u.nvdimm.data;
> + char *nodename;
> +
> + nodename = g_strdup_printf("/pmem@%" PRIx64, di->addr);
> + 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,
> + di->addr, scells, di->size);
> + /* only set the NUMA ID if it is specified */
> + if (!ret && di->node >= 0) {
> + ret = qemu_fdt_setprop_cell(fdt, nodename, "numa-node-id",
> + di->node);
> + }
> +
> + g_free(nodename);
> +
> + if (ret < 0) {
> + fprintf(stderr, "couldn't add NVDIMM /memory@%"PRIx64"
> node\n",
shouldn't it be s:/memory:/pmem:
and maybe move error printing outside like it's done in fdt_add_memory_node()
to be consistent with current code.
> + di->addr);
> + goto out;
> + }
> + }
> + }
> +out:
> + qapi_free_MemoryDeviceInfoList(info_list);
> + return ret;
> +}
> +
> int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
> hwaddr addr_limit, AddressSpace *as, MachineState *ms)
> {
> @@ -622,6 +661,12 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info
> *binfo,
> }
> }
>
> + rc = fdt_add_pmem_node(fdt, acells, scells);
> + if (rc < 0) {
> + fprintf(stderr, "couldn't add pmem memory nodes\n");
> + goto fail;
> + }
> +
> rc = fdt_path_offset(fdt, "/chosen");
> if (rc < 0) {
> qemu_fdt_add_subnode(fdt, "/chosen");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH 4/5] hw/arm/boot: Expose the pmem nodes in the DT,
Igor Mammedov <=