remoteproc: zynqmp: Add coredump support

Supporting remoteproc coredump requires the platform-specific driver to
register coredump segments to be dumped. Do this by calling
rproc_coredump_add_segment for every carveout.

Also call rproc_coredump_set_elf_info when then rproc is created. If the
ELFCLASS parameter is not provided then coredump fails with an error.
Other drivers seem to pass EM_NONE for the machine argument but for me
this shows a warning in gdb. Pass EM_ARM because this is an ARM R5.

Signed-off-by: Leonard Crestez <cdleonard@gmail.com>
Link: https://lore.kernel.org/r/d4556268-8274-4089-949f-3b97d67793c7@gmail.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
This commit is contained in:
Leonard Crestez 2024-03-16 20:16:42 +02:00 committed by Mathieu Poirier
parent 331f91d86f
commit fec2601f20

View File

@ -486,6 +486,7 @@ static int add_mem_regions_carveout(struct rproc *rproc)
}
rproc_add_carveout(rproc, rproc_mem);
rproc_coredump_add_segment(rproc, rmem->base, rmem->size);
dev_dbg(&rproc->dev, "reserved mem carveout %s addr=%llx, size=0x%llx",
it.node->name, rmem->base, rmem->size);
@ -597,6 +598,7 @@ static int add_tcm_carveout_split_mode(struct rproc *rproc)
}
rproc_add_carveout(rproc, rproc_mem);
rproc_coredump_add_segment(rproc, da, bank_size);
}
return 0;
@ -676,6 +678,7 @@ static int add_tcm_carveout_lockstep_mode(struct rproc *rproc)
/* If registration is success, add carveouts */
rproc_add_carveout(rproc, rproc_mem);
rproc_coredump_add_segment(rproc, da, bank_size);
dev_dbg(dev, "TCM carveout lockstep mode %s addr=0x%llx, da=0x%x, size=0x%lx",
bank_name, bank_addr, da, bank_size);
@ -853,6 +856,8 @@ static struct zynqmp_r5_core *zynqmp_r5_add_rproc_core(struct device *cdev)
return ERR_PTR(-ENOMEM);
}
rproc_coredump_set_elf_info(r5_rproc, ELFCLASS32, EM_ARM);
r5_rproc->auto_boot = false;
r5_core = r5_rproc->priv;
r5_core->dev = cdev;