* [PATCH 0/2] remoteproc: add rproc_coredump_set_elf_info @ 2020-04-10 10:24 Clement Leger 2020-04-10 10:24 ` [PATCH 1/2] " Clement Leger 2020-04-10 10:24 ` [PATCH 2/2] remoteproc: use rproc_coredump_set_elf_info in drivers Clement Leger 0 siblings, 2 replies; 9+ messages in thread From: Clement Leger @ 2020-04-10 10:24 UTC (permalink / raw) To: Andy Gross, Bjorn Andersson, Ohad Ben-Cohen, Maxime Coquelin, Alexandre Torgue Cc: linux-arm-msm, linux-remoteproc, linux-kernel, linux-stm32, linux-arm-kernel, Clement Leger This patch adds a way to set the elf informations that will be used to generate the coredump. Second patch fixes drivers to use this function. Clement Leger (2): remoteproc: add rproc_coredump_set_elf_info remoteproc: use rproc_coredump_set_elf_info in drivers drivers/remoteproc/qcom_q6v5_adsp.c | 1 + drivers/remoteproc/qcom_q6v5_mss.c | 3 ++ drivers/remoteproc/qcom_q6v5_pas.c | 1 + drivers/remoteproc/qcom_wcnss.c | 1 + drivers/remoteproc/remoteproc_core.c | 32 ++++++++++++++++++++-- drivers/remoteproc/remoteproc_elf_loader.c | 3 -- drivers/remoteproc/stm32_rproc.c | 1 + include/linux/remoteproc.h | 2 ++ 8 files changed, 39 insertions(+), 5 deletions(-) -- 2.17.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] remoteproc: add rproc_coredump_set_elf_info 2020-04-10 10:24 [PATCH 0/2] remoteproc: add rproc_coredump_set_elf_info Clement Leger @ 2020-04-10 10:24 ` Clement Leger 2020-04-11 1:29 ` Bjorn Andersson 2020-04-17 19:38 ` Mathieu Poirier 2020-04-10 10:24 ` [PATCH 2/2] remoteproc: use rproc_coredump_set_elf_info in drivers Clement Leger 1 sibling, 2 replies; 9+ messages in thread From: Clement Leger @ 2020-04-10 10:24 UTC (permalink / raw) To: Andy Gross, Bjorn Andersson, Ohad Ben-Cohen, Maxime Coquelin, Alexandre Torgue Cc: linux-arm-msm, linux-remoteproc, linux-kernel, linux-stm32, linux-arm-kernel, Clement Leger This function allows drivers to correctly setup the coredump output elf information. Signed-off-by: Clement Leger <cleger@kalray.eu> --- drivers/remoteproc/remoteproc_core.c | 32 ++++++++++++++++++++-- drivers/remoteproc/remoteproc_elf_loader.c | 3 -- include/linux/remoteproc.h | 2 ++ 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index a9ac1d01e09b..382443bab583 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1562,6 +1562,28 @@ int rproc_coredump_add_custom_segment(struct rproc *rproc, } EXPORT_SYMBOL(rproc_coredump_add_custom_segment); +/** + * rproc_coredump_set_elf_info() - set coredump elf information + * @rproc: handle of a remote processor + * @class: elf class for coredump elf file + * @size: elf machine for coredump elf file + * + * Set elf information which will be used for coredump elf file. + * + * Return: 0 on success, negative errno on error. + */ +int rproc_coredump_set_elf_info(struct rproc *rproc, u8 class, u16 machine) +{ + if (class != ELFCLASS64 && class != ELFCLASS32) + return -EINVAL; + + rproc->elf_class = class; + rproc->elf_machine = machine; + + return 0; +} +EXPORT_SYMBOL(rproc_coredump_set_elf_info); + /** * rproc_coredump() - perform coredump * @rproc: rproc handle @@ -1584,6 +1606,11 @@ static void rproc_coredump(struct rproc *rproc) if (list_empty(&rproc->dump_segments)) return; + if (class == ELFCLASSNONE) { + dev_err(&rproc->dev, "Elf class is not set\n"); + return; + } + data_size = elf_size_of_hdr(class); list_for_each_entry(segment, &rproc->dump_segments, node) { data_size += elf_size_of_phdr(class) + segment->size; @@ -1602,7 +1629,7 @@ static void rproc_coredump(struct rproc *rproc) elf_hdr_init_ident(ehdr, class); elf_hdr_set_e_type(class, ehdr, ET_CORE); - elf_hdr_set_e_machine(class, ehdr, EM_NONE); + elf_hdr_set_e_machine(class, ehdr, rproc->elf_machine); elf_hdr_set_e_version(class, ehdr, EV_CURRENT); elf_hdr_set_e_entry(class, ehdr, rproc->bootaddr); elf_hdr_set_e_phoff(class, ehdr, elf_size_of_hdr(class)); @@ -2043,7 +2070,8 @@ struct rproc *rproc_alloc(struct device *dev, const char *name, rproc->name = name; rproc->priv = &rproc[1]; rproc->auto_boot = true; - rproc->elf_class = ELFCLASS32; + rproc->elf_class = ELFCLASSNONE; + rproc->elf_machine = EM_NONE; device_initialize(&rproc->dev); rproc->dev.parent = dev; diff --git a/drivers/remoteproc/remoteproc_elf_loader.c b/drivers/remoteproc/remoteproc_elf_loader.c index 16e2c496fd45..4869fb7d8fe4 100644 --- a/drivers/remoteproc/remoteproc_elf_loader.c +++ b/drivers/remoteproc/remoteproc_elf_loader.c @@ -248,9 +248,6 @@ int rproc_elf_load_segments(struct rproc *rproc, const struct firmware *fw) memset(ptr + filesz, 0, memsz - filesz); } - if (ret == 0) - rproc->elf_class = class; - return ret; } EXPORT_SYMBOL(rproc_elf_load_segments); diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index ed127b2d35ca..d67eb5a40476 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -515,6 +515,7 @@ struct rproc { struct list_head dump_segments; int nb_vdev; u8 elf_class; + u16 elf_machine; }; /** @@ -619,6 +620,7 @@ int rproc_coredump_add_custom_segment(struct rproc *rproc, struct rproc_dump_segment *segment, void *dest), void *priv); +int rproc_coredump_set_elf_info(struct rproc *rproc, u8 class, u16 machine); static inline struct rproc_vdev *vdev_to_rvdev(struct virtio_device *vdev) { -- 2.17.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] remoteproc: add rproc_coredump_set_elf_info 2020-04-10 10:24 ` [PATCH 1/2] " Clement Leger @ 2020-04-11 1:29 ` Bjorn Andersson 2020-04-17 19:38 ` Mathieu Poirier 1 sibling, 0 replies; 9+ messages in thread From: Bjorn Andersson @ 2020-04-11 1:29 UTC (permalink / raw) To: Clement Leger Cc: Andy Gross, Ohad Ben-Cohen, Maxime Coquelin, Alexandre Torgue, linux-arm-msm, linux-remoteproc, linux-kernel, linux-stm32, linux-arm-kernel On Fri 10 Apr 03:24 PDT 2020, Clement Leger wrote: > This function allows drivers to correctly setup the coredump output > elf information. > > Signed-off-by: Clement Leger <cleger@kalray.eu> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> > --- > drivers/remoteproc/remoteproc_core.c | 32 ++++++++++++++++++++-- > drivers/remoteproc/remoteproc_elf_loader.c | 3 -- > include/linux/remoteproc.h | 2 ++ > 3 files changed, 32 insertions(+), 5 deletions(-) > > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c > index a9ac1d01e09b..382443bab583 100644 > --- a/drivers/remoteproc/remoteproc_core.c > +++ b/drivers/remoteproc/remoteproc_core.c > @@ -1562,6 +1562,28 @@ int rproc_coredump_add_custom_segment(struct rproc *rproc, > } > EXPORT_SYMBOL(rproc_coredump_add_custom_segment); > > +/** > + * rproc_coredump_set_elf_info() - set coredump elf information > + * @rproc: handle of a remote processor > + * @class: elf class for coredump elf file > + * @size: elf machine for coredump elf file > + * > + * Set elf information which will be used for coredump elf file. > + * > + * Return: 0 on success, negative errno on error. > + */ > +int rproc_coredump_set_elf_info(struct rproc *rproc, u8 class, u16 machine) > +{ > + if (class != ELFCLASS64 && class != ELFCLASS32) > + return -EINVAL; > + > + rproc->elf_class = class; > + rproc->elf_machine = machine; > + > + return 0; > +} > +EXPORT_SYMBOL(rproc_coredump_set_elf_info); > + > /** > * rproc_coredump() - perform coredump > * @rproc: rproc handle > @@ -1584,6 +1606,11 @@ static void rproc_coredump(struct rproc *rproc) > if (list_empty(&rproc->dump_segments)) > return; > > + if (class == ELFCLASSNONE) { > + dev_err(&rproc->dev, "Elf class is not set\n"); > + return; > + } > + > data_size = elf_size_of_hdr(class); > list_for_each_entry(segment, &rproc->dump_segments, node) { > data_size += elf_size_of_phdr(class) + segment->size; > @@ -1602,7 +1629,7 @@ static void rproc_coredump(struct rproc *rproc) > elf_hdr_init_ident(ehdr, class); > > elf_hdr_set_e_type(class, ehdr, ET_CORE); > - elf_hdr_set_e_machine(class, ehdr, EM_NONE); > + elf_hdr_set_e_machine(class, ehdr, rproc->elf_machine); > elf_hdr_set_e_version(class, ehdr, EV_CURRENT); > elf_hdr_set_e_entry(class, ehdr, rproc->bootaddr); > elf_hdr_set_e_phoff(class, ehdr, elf_size_of_hdr(class)); > @@ -2043,7 +2070,8 @@ struct rproc *rproc_alloc(struct device *dev, const char *name, > rproc->name = name; > rproc->priv = &rproc[1]; > rproc->auto_boot = true; > - rproc->elf_class = ELFCLASS32; > + rproc->elf_class = ELFCLASSNONE; > + rproc->elf_machine = EM_NONE; > > device_initialize(&rproc->dev); > rproc->dev.parent = dev; > diff --git a/drivers/remoteproc/remoteproc_elf_loader.c b/drivers/remoteproc/remoteproc_elf_loader.c > index 16e2c496fd45..4869fb7d8fe4 100644 > --- a/drivers/remoteproc/remoteproc_elf_loader.c > +++ b/drivers/remoteproc/remoteproc_elf_loader.c > @@ -248,9 +248,6 @@ int rproc_elf_load_segments(struct rproc *rproc, const struct firmware *fw) > memset(ptr + filesz, 0, memsz - filesz); > } > > - if (ret == 0) > - rproc->elf_class = class; > - > return ret; > } > EXPORT_SYMBOL(rproc_elf_load_segments); > diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h > index ed127b2d35ca..d67eb5a40476 100644 > --- a/include/linux/remoteproc.h > +++ b/include/linux/remoteproc.h > @@ -515,6 +515,7 @@ struct rproc { > struct list_head dump_segments; > int nb_vdev; > u8 elf_class; > + u16 elf_machine; > }; > > /** > @@ -619,6 +620,7 @@ int rproc_coredump_add_custom_segment(struct rproc *rproc, > struct rproc_dump_segment *segment, > void *dest), > void *priv); > +int rproc_coredump_set_elf_info(struct rproc *rproc, u8 class, u16 machine); > > static inline struct rproc_vdev *vdev_to_rvdev(struct virtio_device *vdev) > { > -- > 2.17.1 > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] remoteproc: add rproc_coredump_set_elf_info 2020-04-10 10:24 ` [PATCH 1/2] " Clement Leger 2020-04-11 1:29 ` Bjorn Andersson @ 2020-04-17 19:38 ` Mathieu Poirier 2020-04-17 19:43 ` Clément Leger 1 sibling, 1 reply; 9+ messages in thread From: Mathieu Poirier @ 2020-04-17 19:38 UTC (permalink / raw) To: Clement Leger Cc: Andy Gross, Bjorn Andersson, Ohad Ben-Cohen, Maxime Coquelin, Alexandre Torgue, linux-arm-msm, linux-remoteproc, linux-kernel, linux-stm32, linux-arm-kernel On Fri, Apr 10, 2020 at 12:24:32PM +0200, Clement Leger wrote: > This function allows drivers to correctly setup the coredump output > elf information. > > Signed-off-by: Clement Leger <cleger@kalray.eu> > --- > drivers/remoteproc/remoteproc_core.c | 32 ++++++++++++++++++++-- > drivers/remoteproc/remoteproc_elf_loader.c | 3 -- > include/linux/remoteproc.h | 2 ++ > 3 files changed, 32 insertions(+), 5 deletions(-) > > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c > index a9ac1d01e09b..382443bab583 100644 > --- a/drivers/remoteproc/remoteproc_core.c > +++ b/drivers/remoteproc/remoteproc_core.c > @@ -1562,6 +1562,28 @@ int rproc_coredump_add_custom_segment(struct rproc *rproc, > } > EXPORT_SYMBOL(rproc_coredump_add_custom_segment); > > +/** > + * rproc_coredump_set_elf_info() - set coredump elf information > + * @rproc: handle of a remote processor > + * @class: elf class for coredump elf file > + * @size: elf machine for coredump elf file > + * > + * Set elf information which will be used for coredump elf file. > + * > + * Return: 0 on success, negative errno on error. > + */ > +int rproc_coredump_set_elf_info(struct rproc *rproc, u8 class, u16 machine) > +{ > + if (class != ELFCLASS64 && class != ELFCLASS32) > + return -EINVAL; > + > + rproc->elf_class = class; > + rproc->elf_machine = machine; > + > + return 0; > +} > +EXPORT_SYMBOL(rproc_coredump_set_elf_info); > + > /** > * rproc_coredump() - perform coredump > * @rproc: rproc handle > @@ -1584,6 +1606,11 @@ static void rproc_coredump(struct rproc *rproc) > if (list_empty(&rproc->dump_segments)) > return; > > + if (class == ELFCLASSNONE) { > + dev_err(&rproc->dev, "Elf class is not set\n"); > + return; > + } > + > data_size = elf_size_of_hdr(class); > list_for_each_entry(segment, &rproc->dump_segments, node) { > data_size += elf_size_of_phdr(class) + segment->size; > @@ -1602,7 +1629,7 @@ static void rproc_coredump(struct rproc *rproc) > elf_hdr_init_ident(ehdr, class); > > elf_hdr_set_e_type(class, ehdr, ET_CORE); > - elf_hdr_set_e_machine(class, ehdr, EM_NONE); > + elf_hdr_set_e_machine(class, ehdr, rproc->elf_machine); > elf_hdr_set_e_version(class, ehdr, EV_CURRENT); > elf_hdr_set_e_entry(class, ehdr, rproc->bootaddr); > elf_hdr_set_e_phoff(class, ehdr, elf_size_of_hdr(class)); > @@ -2043,7 +2070,8 @@ struct rproc *rproc_alloc(struct device *dev, const char *name, > rproc->name = name; > rproc->priv = &rproc[1]; > rproc->auto_boot = true; > - rproc->elf_class = ELFCLASS32; > + rproc->elf_class = ELFCLASSNONE; > + rproc->elf_machine = EM_NONE; > > device_initialize(&rproc->dev); > rproc->dev.parent = dev; > diff --git a/drivers/remoteproc/remoteproc_elf_loader.c b/drivers/remoteproc/remoteproc_elf_loader.c > index 16e2c496fd45..4869fb7d8fe4 100644 > --- a/drivers/remoteproc/remoteproc_elf_loader.c > +++ b/drivers/remoteproc/remoteproc_elf_loader.c > @@ -248,9 +248,6 @@ int rproc_elf_load_segments(struct rproc *rproc, const struct firmware *fw) > memset(ptr + filesz, 0, memsz - filesz); > } > > - if (ret == 0) > - rproc->elf_class = class; > - > return ret; > } > EXPORT_SYMBOL(rproc_elf_load_segments); > diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h > index ed127b2d35ca..d67eb5a40476 100644 > --- a/include/linux/remoteproc.h > +++ b/include/linux/remoteproc.h > @@ -515,6 +515,7 @@ struct rproc { > struct list_head dump_segments; > int nb_vdev; > u8 elf_class; > + u16 elf_machine; > }; Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> > > /** > @@ -619,6 +620,7 @@ int rproc_coredump_add_custom_segment(struct rproc *rproc, > struct rproc_dump_segment *segment, > void *dest), > void *priv); > +int rproc_coredump_set_elf_info(struct rproc *rproc, u8 class, u16 machine); > > static inline struct rproc_vdev *vdev_to_rvdev(struct virtio_device *vdev) > { > -- > 2.17.1 > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] remoteproc: add rproc_coredump_set_elf_info 2020-04-17 19:38 ` Mathieu Poirier @ 2020-04-17 19:43 ` Clément Leger 2020-04-20 5:57 ` Bjorn Andersson 0 siblings, 1 reply; 9+ messages in thread From: Clément Leger @ 2020-04-17 19:43 UTC (permalink / raw) To: Mathieu Poirier Cc: Andy Gross, Bjorn Andersson, Ohad Ben-Cohen, Maxime Coquelin, Alexandre Torgue, linux-arm-msm, linux-remoteproc, linux-kernel, linux-stm32, linux-arm-kernel ----- On 17 Apr, 2020, at 21:38, Mathieu Poirier mathieu.poirier@linaro.org wrote: > On Fri, Apr 10, 2020 at 12:24:32PM +0200, Clement Leger wrote: >> This function allows drivers to correctly setup the coredump output >> elf information. >> >> Signed-off-by: Clement Leger <cleger@kalray.eu> >> --- >> drivers/remoteproc/remoteproc_core.c | 32 ++++++++++++++++++++-- >> drivers/remoteproc/remoteproc_elf_loader.c | 3 -- >> include/linux/remoteproc.h | 2 ++ >> 3 files changed, 32 insertions(+), 5 deletions(-) >> >> diff --git a/drivers/remoteproc/remoteproc_core.c >> b/drivers/remoteproc/remoteproc_core.c >> index a9ac1d01e09b..382443bab583 100644 >> --- a/drivers/remoteproc/remoteproc_core.c >> +++ b/drivers/remoteproc/remoteproc_core.c >> @@ -1562,6 +1562,28 @@ int rproc_coredump_add_custom_segment(struct rproc >> *rproc, >> } >> EXPORT_SYMBOL(rproc_coredump_add_custom_segment); >> >> +/** >> + * rproc_coredump_set_elf_info() - set coredump elf information >> + * @rproc: handle of a remote processor >> + * @class: elf class for coredump elf file >> + * @size: elf machine for coredump elf file I just noticed that there is a typo, this should be "machine" and not "size". Let me know if you'll fix it when applying. Thanks, Clément >> + * >> + * Set elf information which will be used for coredump elf file. >> + * >> + * Return: 0 on success, negative errno on error. >> + */ >> +int rproc_coredump_set_elf_info(struct rproc *rproc, u8 class, u16 machine) >> +{ >> + if (class != ELFCLASS64 && class != ELFCLASS32) >> + return -EINVAL; >> + >> + rproc->elf_class = class; >> + rproc->elf_machine = machine; >> + >> + return 0; >> +} >> +EXPORT_SYMBOL(rproc_coredump_set_elf_info); >> + >> /** >> * rproc_coredump() - perform coredump >> * @rproc: rproc handle >> @@ -1584,6 +1606,11 @@ static void rproc_coredump(struct rproc *rproc) >> if (list_empty(&rproc->dump_segments)) >> return; >> >> + if (class == ELFCLASSNONE) { >> + dev_err(&rproc->dev, "Elf class is not set\n"); >> + return; >> + } >> + >> data_size = elf_size_of_hdr(class); >> list_for_each_entry(segment, &rproc->dump_segments, node) { >> data_size += elf_size_of_phdr(class) + segment->size; >> @@ -1602,7 +1629,7 @@ static void rproc_coredump(struct rproc *rproc) >> elf_hdr_init_ident(ehdr, class); >> >> elf_hdr_set_e_type(class, ehdr, ET_CORE); >> - elf_hdr_set_e_machine(class, ehdr, EM_NONE); >> + elf_hdr_set_e_machine(class, ehdr, rproc->elf_machine); >> elf_hdr_set_e_version(class, ehdr, EV_CURRENT); >> elf_hdr_set_e_entry(class, ehdr, rproc->bootaddr); >> elf_hdr_set_e_phoff(class, ehdr, elf_size_of_hdr(class)); >> @@ -2043,7 +2070,8 @@ struct rproc *rproc_alloc(struct device *dev, const char >> *name, >> rproc->name = name; >> rproc->priv = &rproc[1]; >> rproc->auto_boot = true; >> - rproc->elf_class = ELFCLASS32; >> + rproc->elf_class = ELFCLASSNONE; >> + rproc->elf_machine = EM_NONE; >> >> device_initialize(&rproc->dev); >> rproc->dev.parent = dev; >> diff --git a/drivers/remoteproc/remoteproc_elf_loader.c >> b/drivers/remoteproc/remoteproc_elf_loader.c >> index 16e2c496fd45..4869fb7d8fe4 100644 >> --- a/drivers/remoteproc/remoteproc_elf_loader.c >> +++ b/drivers/remoteproc/remoteproc_elf_loader.c >> @@ -248,9 +248,6 @@ int rproc_elf_load_segments(struct rproc *rproc, const >> struct firmware *fw) >> memset(ptr + filesz, 0, memsz - filesz); >> } >> >> - if (ret == 0) >> - rproc->elf_class = class; >> - >> return ret; >> } >> EXPORT_SYMBOL(rproc_elf_load_segments); >> diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h >> index ed127b2d35ca..d67eb5a40476 100644 >> --- a/include/linux/remoteproc.h >> +++ b/include/linux/remoteproc.h >> @@ -515,6 +515,7 @@ struct rproc { >> struct list_head dump_segments; >> int nb_vdev; >> u8 elf_class; >> + u16 elf_machine; >> }; > > Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> > >> >> /** >> @@ -619,6 +620,7 @@ int rproc_coredump_add_custom_segment(struct rproc *rproc, >> struct rproc_dump_segment *segment, >> void *dest), >> void *priv); >> +int rproc_coredump_set_elf_info(struct rproc *rproc, u8 class, u16 machine); >> >> static inline struct rproc_vdev *vdev_to_rvdev(struct virtio_device *vdev) >> { >> -- >> 2.17.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] remoteproc: add rproc_coredump_set_elf_info 2020-04-17 19:43 ` Clément Leger @ 2020-04-20 5:57 ` Bjorn Andersson 0 siblings, 0 replies; 9+ messages in thread From: Bjorn Andersson @ 2020-04-20 5:57 UTC (permalink / raw) To: Cl?ment Leger Cc: Mathieu Poirier, Andy Gross, Ohad Ben-Cohen, Maxime Coquelin, Alexandre Torgue, linux-arm-msm, linux-remoteproc, linux-kernel, linux-stm32, linux-arm-kernel On Fri 17 Apr 12:43 PDT 2020, Cl?ment Leger wrote: > ----- On 17 Apr, 2020, at 21:38, Mathieu Poirier mathieu.poirier@linaro.org wrote: > > > On Fri, Apr 10, 2020 at 12:24:32PM +0200, Clement Leger wrote: > >> This function allows drivers to correctly setup the coredump output > >> elf information. > >> > >> Signed-off-by: Clement Leger <cleger@kalray.eu> > >> --- > >> drivers/remoteproc/remoteproc_core.c | 32 ++++++++++++++++++++-- > >> drivers/remoteproc/remoteproc_elf_loader.c | 3 -- > >> include/linux/remoteproc.h | 2 ++ > >> 3 files changed, 32 insertions(+), 5 deletions(-) > >> > >> diff --git a/drivers/remoteproc/remoteproc_core.c > >> b/drivers/remoteproc/remoteproc_core.c > >> index a9ac1d01e09b..382443bab583 100644 > >> --- a/drivers/remoteproc/remoteproc_core.c > >> +++ b/drivers/remoteproc/remoteproc_core.c > >> @@ -1562,6 +1562,28 @@ int rproc_coredump_add_custom_segment(struct rproc > >> *rproc, > >> } > >> EXPORT_SYMBOL(rproc_coredump_add_custom_segment); > >> > >> +/** > >> + * rproc_coredump_set_elf_info() - set coredump elf information > >> + * @rproc: handle of a remote processor > >> + * @class: elf class for coredump elf file > >> + * @size: elf machine for coredump elf file > > I just noticed that there is a typo, this should be "machine" and not "size". > Let me know if you'll fix it when applying. > Thanks for noticing, I fixed this up and applied the two patches. Thanks, Bjorn > Thanks, > > Clément > > >> + * > >> + * Set elf information which will be used for coredump elf file. > >> + * > >> + * Return: 0 on success, negative errno on error. > >> + */ > >> +int rproc_coredump_set_elf_info(struct rproc *rproc, u8 class, u16 machine) > >> +{ > >> + if (class != ELFCLASS64 && class != ELFCLASS32) > >> + return -EINVAL; > >> + > >> + rproc->elf_class = class; > >> + rproc->elf_machine = machine; > >> + > >> + return 0; > >> +} > >> +EXPORT_SYMBOL(rproc_coredump_set_elf_info); > >> + > >> /** > >> * rproc_coredump() - perform coredump > >> * @rproc: rproc handle > >> @@ -1584,6 +1606,11 @@ static void rproc_coredump(struct rproc *rproc) > >> if (list_empty(&rproc->dump_segments)) > >> return; > >> > >> + if (class == ELFCLASSNONE) { > >> + dev_err(&rproc->dev, "Elf class is not set\n"); > >> + return; > >> + } > >> + > >> data_size = elf_size_of_hdr(class); > >> list_for_each_entry(segment, &rproc->dump_segments, node) { > >> data_size += elf_size_of_phdr(class) + segment->size; > >> @@ -1602,7 +1629,7 @@ static void rproc_coredump(struct rproc *rproc) > >> elf_hdr_init_ident(ehdr, class); > >> > >> elf_hdr_set_e_type(class, ehdr, ET_CORE); > >> - elf_hdr_set_e_machine(class, ehdr, EM_NONE); > >> + elf_hdr_set_e_machine(class, ehdr, rproc->elf_machine); > >> elf_hdr_set_e_version(class, ehdr, EV_CURRENT); > >> elf_hdr_set_e_entry(class, ehdr, rproc->bootaddr); > >> elf_hdr_set_e_phoff(class, ehdr, elf_size_of_hdr(class)); > >> @@ -2043,7 +2070,8 @@ struct rproc *rproc_alloc(struct device *dev, const char > >> *name, > >> rproc->name = name; > >> rproc->priv = &rproc[1]; > >> rproc->auto_boot = true; > >> - rproc->elf_class = ELFCLASS32; > >> + rproc->elf_class = ELFCLASSNONE; > >> + rproc->elf_machine = EM_NONE; > >> > >> device_initialize(&rproc->dev); > >> rproc->dev.parent = dev; > >> diff --git a/drivers/remoteproc/remoteproc_elf_loader.c > >> b/drivers/remoteproc/remoteproc_elf_loader.c > >> index 16e2c496fd45..4869fb7d8fe4 100644 > >> --- a/drivers/remoteproc/remoteproc_elf_loader.c > >> +++ b/drivers/remoteproc/remoteproc_elf_loader.c > >> @@ -248,9 +248,6 @@ int rproc_elf_load_segments(struct rproc *rproc, const > >> struct firmware *fw) > >> memset(ptr + filesz, 0, memsz - filesz); > >> } > >> > >> - if (ret == 0) > >> - rproc->elf_class = class; > >> - > >> return ret; > >> } > >> EXPORT_SYMBOL(rproc_elf_load_segments); > >> diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h > >> index ed127b2d35ca..d67eb5a40476 100644 > >> --- a/include/linux/remoteproc.h > >> +++ b/include/linux/remoteproc.h > >> @@ -515,6 +515,7 @@ struct rproc { > >> struct list_head dump_segments; > >> int nb_vdev; > >> u8 elf_class; > >> + u16 elf_machine; > >> }; > > > > Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> > > > >> > >> /** > >> @@ -619,6 +620,7 @@ int rproc_coredump_add_custom_segment(struct rproc *rproc, > >> struct rproc_dump_segment *segment, > >> void *dest), > >> void *priv); > >> +int rproc_coredump_set_elf_info(struct rproc *rproc, u8 class, u16 machine); > >> > >> static inline struct rproc_vdev *vdev_to_rvdev(struct virtio_device *vdev) > >> { > >> -- > >> 2.17.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/2] remoteproc: use rproc_coredump_set_elf_info in drivers 2020-04-10 10:24 [PATCH 0/2] remoteproc: add rproc_coredump_set_elf_info Clement Leger 2020-04-10 10:24 ` [PATCH 1/2] " Clement Leger @ 2020-04-10 10:24 ` Clement Leger 2020-04-11 1:30 ` Bjorn Andersson 2020-04-17 19:39 ` Mathieu Poirier 1 sibling, 2 replies; 9+ messages in thread From: Clement Leger @ 2020-04-10 10:24 UTC (permalink / raw) To: Andy Gross, Bjorn Andersson, Ohad Ben-Cohen, Maxime Coquelin, Alexandre Torgue Cc: linux-arm-msm, linux-remoteproc, linux-kernel, linux-stm32, linux-arm-kernel, Clement Leger Modify drivers which are using remoteproc coredump functionnality to use rproc_coredump_set_elf_info in order to create correct elf coredump format. Signed-off-by: Clement Leger <cleger@kalray.eu> --- drivers/remoteproc/qcom_q6v5_adsp.c | 1 + drivers/remoteproc/qcom_q6v5_mss.c | 3 +++ drivers/remoteproc/qcom_q6v5_pas.c | 1 + drivers/remoteproc/qcom_wcnss.c | 1 + drivers/remoteproc/stm32_rproc.c | 1 + 5 files changed, 7 insertions(+) diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c index 2b01f2282062..8c3bd0954a13 100644 --- a/drivers/remoteproc/qcom_q6v5_adsp.c +++ b/drivers/remoteproc/qcom_q6v5_adsp.c @@ -423,6 +423,7 @@ static int adsp_probe(struct platform_device *pdev) dev_err(&pdev->dev, "unable to allocate remoteproc\n"); return -ENOMEM; } + rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE); adsp = (struct qcom_adsp *)rproc->priv; adsp->dev = &pdev->dev; diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c index 03ffc6db4c68..5a7ff1092362 100644 --- a/drivers/remoteproc/qcom_q6v5_mss.c +++ b/drivers/remoteproc/qcom_q6v5_mss.c @@ -1355,6 +1355,8 @@ static int qcom_q6v5_register_dump_segments(struct rproc *rproc, return ret; } + rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE); + ehdr = (struct elf32_hdr *)fw->data; phdrs = (struct elf32_phdr *)(ehdr + 1); qproc->dump_complete_mask = 0; @@ -1632,6 +1634,7 @@ static int q6v5_probe(struct platform_device *pdev) } rproc->auto_boot = false; + rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE); qproc = (struct q6v5 *)rproc->priv; qproc->dev = &pdev->dev; diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index a41860d2243a..991f57e8e55b 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -390,6 +390,7 @@ static int adsp_probe(struct platform_device *pdev) } rproc->auto_boot = desc->auto_boot; + rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE); adsp = (struct qcom_adsp *)rproc->priv; adsp->dev = &pdev->dev; diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcnss.c index 0c7afd038f0d..5d65e1a9329a 100644 --- a/drivers/remoteproc/qcom_wcnss.c +++ b/drivers/remoteproc/qcom_wcnss.c @@ -480,6 +480,7 @@ static int wcnss_probe(struct platform_device *pdev) dev_err(&pdev->dev, "unable to allocate remoteproc\n"); return -ENOMEM; } + rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE); wcnss = (struct qcom_wcnss *)rproc->priv; wcnss->dev = &pdev->dev; diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c index 6a66dbf2df40..0f9d02ca4f5a 100644 --- a/drivers/remoteproc/stm32_rproc.c +++ b/drivers/remoteproc/stm32_rproc.c @@ -625,6 +625,7 @@ static int stm32_rproc_probe(struct platform_device *pdev) if (!rproc) return -ENOMEM; + rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE); rproc->has_iommu = false; ddata = rproc->priv; ddata->workqueue = create_workqueue(dev_name(dev)); -- 2.17.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] remoteproc: use rproc_coredump_set_elf_info in drivers 2020-04-10 10:24 ` [PATCH 2/2] remoteproc: use rproc_coredump_set_elf_info in drivers Clement Leger @ 2020-04-11 1:30 ` Bjorn Andersson 2020-04-17 19:39 ` Mathieu Poirier 1 sibling, 0 replies; 9+ messages in thread From: Bjorn Andersson @ 2020-04-11 1:30 UTC (permalink / raw) To: Clement Leger Cc: Andy Gross, Ohad Ben-Cohen, Maxime Coquelin, Alexandre Torgue, linux-arm-msm, linux-remoteproc, linux-kernel, linux-stm32, linux-arm-kernel On Fri 10 Apr 03:24 PDT 2020, Clement Leger wrote: > Modify drivers which are using remoteproc coredump functionnality to use > rproc_coredump_set_elf_info in order to create correct elf coredump > format. > Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> > Signed-off-by: Clement Leger <cleger@kalray.eu> > --- > drivers/remoteproc/qcom_q6v5_adsp.c | 1 + > drivers/remoteproc/qcom_q6v5_mss.c | 3 +++ > drivers/remoteproc/qcom_q6v5_pas.c | 1 + > drivers/remoteproc/qcom_wcnss.c | 1 + > drivers/remoteproc/stm32_rproc.c | 1 + > 5 files changed, 7 insertions(+) > > diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c > index 2b01f2282062..8c3bd0954a13 100644 > --- a/drivers/remoteproc/qcom_q6v5_adsp.c > +++ b/drivers/remoteproc/qcom_q6v5_adsp.c > @@ -423,6 +423,7 @@ static int adsp_probe(struct platform_device *pdev) > dev_err(&pdev->dev, "unable to allocate remoteproc\n"); > return -ENOMEM; > } > + rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE); > > adsp = (struct qcom_adsp *)rproc->priv; > adsp->dev = &pdev->dev; > diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c > index 03ffc6db4c68..5a7ff1092362 100644 > --- a/drivers/remoteproc/qcom_q6v5_mss.c > +++ b/drivers/remoteproc/qcom_q6v5_mss.c > @@ -1355,6 +1355,8 @@ static int qcom_q6v5_register_dump_segments(struct rproc *rproc, > return ret; > } > > + rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE); > + > ehdr = (struct elf32_hdr *)fw->data; > phdrs = (struct elf32_phdr *)(ehdr + 1); > qproc->dump_complete_mask = 0; > @@ -1632,6 +1634,7 @@ static int q6v5_probe(struct platform_device *pdev) > } > > rproc->auto_boot = false; > + rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE); > > qproc = (struct q6v5 *)rproc->priv; > qproc->dev = &pdev->dev; > diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c > index a41860d2243a..991f57e8e55b 100644 > --- a/drivers/remoteproc/qcom_q6v5_pas.c > +++ b/drivers/remoteproc/qcom_q6v5_pas.c > @@ -390,6 +390,7 @@ static int adsp_probe(struct platform_device *pdev) > } > > rproc->auto_boot = desc->auto_boot; > + rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE); > > adsp = (struct qcom_adsp *)rproc->priv; > adsp->dev = &pdev->dev; > diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcnss.c > index 0c7afd038f0d..5d65e1a9329a 100644 > --- a/drivers/remoteproc/qcom_wcnss.c > +++ b/drivers/remoteproc/qcom_wcnss.c > @@ -480,6 +480,7 @@ static int wcnss_probe(struct platform_device *pdev) > dev_err(&pdev->dev, "unable to allocate remoteproc\n"); > return -ENOMEM; > } > + rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE); > > wcnss = (struct qcom_wcnss *)rproc->priv; > wcnss->dev = &pdev->dev; > diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c > index 6a66dbf2df40..0f9d02ca4f5a 100644 > --- a/drivers/remoteproc/stm32_rproc.c > +++ b/drivers/remoteproc/stm32_rproc.c > @@ -625,6 +625,7 @@ static int stm32_rproc_probe(struct platform_device *pdev) > if (!rproc) > return -ENOMEM; > > + rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE); > rproc->has_iommu = false; > ddata = rproc->priv; > ddata->workqueue = create_workqueue(dev_name(dev)); > -- > 2.17.1 > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] remoteproc: use rproc_coredump_set_elf_info in drivers 2020-04-10 10:24 ` [PATCH 2/2] remoteproc: use rproc_coredump_set_elf_info in drivers Clement Leger 2020-04-11 1:30 ` Bjorn Andersson @ 2020-04-17 19:39 ` Mathieu Poirier 1 sibling, 0 replies; 9+ messages in thread From: Mathieu Poirier @ 2020-04-17 19:39 UTC (permalink / raw) To: Clement Leger Cc: Andy Gross, Bjorn Andersson, Ohad Ben-Cohen, Maxime Coquelin, Alexandre Torgue, linux-arm-msm, linux-remoteproc, linux-kernel, linux-stm32, linux-arm-kernel On Fri, Apr 10, 2020 at 12:24:33PM +0200, Clement Leger wrote: > Modify drivers which are using remoteproc coredump functionnality to use s/functionnality/functionality > rproc_coredump_set_elf_info in order to create correct elf coredump > format. > > Signed-off-by: Clement Leger <cleger@kalray.eu> > --- > drivers/remoteproc/qcom_q6v5_adsp.c | 1 + > drivers/remoteproc/qcom_q6v5_mss.c | 3 +++ > drivers/remoteproc/qcom_q6v5_pas.c | 1 + > drivers/remoteproc/qcom_wcnss.c | 1 + > drivers/remoteproc/stm32_rproc.c | 1 + > 5 files changed, 7 insertions(+) > > diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c > index 2b01f2282062..8c3bd0954a13 100644 > --- a/drivers/remoteproc/qcom_q6v5_adsp.c > +++ b/drivers/remoteproc/qcom_q6v5_adsp.c > @@ -423,6 +423,7 @@ static int adsp_probe(struct platform_device *pdev) > dev_err(&pdev->dev, "unable to allocate remoteproc\n"); > return -ENOMEM; > } > + rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE); > > adsp = (struct qcom_adsp *)rproc->priv; > adsp->dev = &pdev->dev; > diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c > index 03ffc6db4c68..5a7ff1092362 100644 > --- a/drivers/remoteproc/qcom_q6v5_mss.c > +++ b/drivers/remoteproc/qcom_q6v5_mss.c > @@ -1355,6 +1355,8 @@ static int qcom_q6v5_register_dump_segments(struct rproc *rproc, > return ret; > } > > + rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE); > + > ehdr = (struct elf32_hdr *)fw->data; > phdrs = (struct elf32_phdr *)(ehdr + 1); > qproc->dump_complete_mask = 0; > @@ -1632,6 +1634,7 @@ static int q6v5_probe(struct platform_device *pdev) > } > > rproc->auto_boot = false; > + rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE); > > qproc = (struct q6v5 *)rproc->priv; > qproc->dev = &pdev->dev; > diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c > index a41860d2243a..991f57e8e55b 100644 > --- a/drivers/remoteproc/qcom_q6v5_pas.c > +++ b/drivers/remoteproc/qcom_q6v5_pas.c > @@ -390,6 +390,7 @@ static int adsp_probe(struct platform_device *pdev) > } > > rproc->auto_boot = desc->auto_boot; > + rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE); > > adsp = (struct qcom_adsp *)rproc->priv; > adsp->dev = &pdev->dev; > diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcnss.c > index 0c7afd038f0d..5d65e1a9329a 100644 > --- a/drivers/remoteproc/qcom_wcnss.c > +++ b/drivers/remoteproc/qcom_wcnss.c > @@ -480,6 +480,7 @@ static int wcnss_probe(struct platform_device *pdev) > dev_err(&pdev->dev, "unable to allocate remoteproc\n"); > return -ENOMEM; > } > + rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE); > > wcnss = (struct qcom_wcnss *)rproc->priv; > wcnss->dev = &pdev->dev; > diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c > index 6a66dbf2df40..0f9d02ca4f5a 100644 > --- a/drivers/remoteproc/stm32_rproc.c > +++ b/drivers/remoteproc/stm32_rproc.c > @@ -625,6 +625,7 @@ static int stm32_rproc_probe(struct platform_device *pdev) > if (!rproc) > return -ENOMEM; > > + rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE); With the above: Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> > rproc->has_iommu = false; > ddata = rproc->priv; > ddata->workqueue = create_workqueue(dev_name(dev)); > -- > 2.17.1 > ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2020-04-20 5:57 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-04-10 10:24 [PATCH 0/2] remoteproc: add rproc_coredump_set_elf_info Clement Leger 2020-04-10 10:24 ` [PATCH 1/2] " Clement Leger 2020-04-11 1:29 ` Bjorn Andersson 2020-04-17 19:38 ` Mathieu Poirier 2020-04-17 19:43 ` Clément Leger 2020-04-20 5:57 ` Bjorn Andersson 2020-04-10 10:24 ` [PATCH 2/2] remoteproc: use rproc_coredump_set_elf_info in drivers Clement Leger 2020-04-11 1:30 ` Bjorn Andersson 2020-04-17 19:39 ` Mathieu Poirier
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).