mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Oleksij Rempel <linux@rempel-privat.de>
Cc: barebox@lists.infradead.org, Peter Mamonov <pmamonov@gmail.com>
Subject: Re: [PATCH v1 05/10] MIPS: add kexec ELF loading support
Date: Fri, 18 May 2018 07:46:27 +0200	[thread overview]
Message-ID: <20180518054627.c47vwuvraewfaa2a@pengutronix.de> (raw)
In-Reply-To: <57e4a17b-9d1e-ae10-9985-6b0e9eacba7e@rempel-privat.de>

On Thu, May 17, 2018 at 12:07:29PM +0200, Oleksij Rempel wrote:
> Am 17.05.2018 um 11:56 schrieb Sascha Hauer:
> > On Wed, May 16, 2018 at 06:42:28PM +0200, Oleksij Rempel wrote:
> >> From: Antony Pavlov <antonynpavlov@gmail.com>
> >>
> >> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> >> Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
> >> ---
> >>  arch/mips/include/asm/elf.h        |   8 +-
> >>  arch/mips/lib/Makefile             |   4 +
> >>  arch/mips/lib/kexec-mach-generic.c |  21 +++
> >>  arch/mips/lib/kexec-mips.c         | 307 +++++++++++++++++++++++++++++++++++++
> >>  arch/mips/lib/machine_kexec.h      |  21 +++
> >>  arch/mips/lib/relocate_kernel.S    | 108 +++++++++++++
> >>  6 files changed, 468 insertions(+), 1 deletion(-)
> >>  create mode 100644 arch/mips/lib/kexec-mach-generic.c
> >>  create mode 100644 arch/mips/lib/kexec-mips.c
> >>  create mode 100644 arch/mips/lib/machine_kexec.h
> >>  create mode 100644 arch/mips/lib/relocate_kernel.S
> >>
> >> +int kexec_load(struct image_data *data, void *entry,
> >> +	       unsigned long nr_segments,
> >> +	       struct kexec_segment *segments)
> >> +{
> >> +	int i;
> >> +	struct resource *elf;
> >> +	resource_size_t start;
> >> +	LIST_HEAD(elf_segments);
> >> +
> >> +	for (i = 0; i < nr_segments; i++) {
> >> +		resource_size_t mem = (resource_size_t)segments[i].mem;
> >> +
> >> +		elf = create_resource("elf segment",
> >> +			mem, mem + segments[i].memsz - 1);
> >> +
> >> +		list_add_used_region(&elf->sibling, &elf_segments);
> >> +	}
> >> +
> >> +	if (check_room_for_elf(&elf_segments)) {
> >> +		pr_err("ELF can't be loaded!\n");
> >> +		return -ENOSPC;
> >> +	}
> >> +
> >> +	start = dcheck_res(&elf_segments);
> >> +
> >> +	/* relocate_new_kernel() copy by register (4 or 8 bytes)
> >> +	   so start address must be aligned to 4/8 */
> >> +	start = (start + 15) & 0xfffffff0;
> >> +
> >> +	for (i = 0; i < nr_segments; i++) {
> >> +		segments[i].mem = (void *)(phys_to_virt((unsigned long)segments[i].mem));
> >> +		memcpy(phys_to_virt(start), segments[i].buf, segments[i].bufsz);
> >> +		request_sdram_region("kexec relocatable segment",
> >> +			(unsigned long)phys_to_virt(start),
> >> +			(unsigned long)segments[i].bufsz);
> > 
> > The return value of request_sdram_region should be checked and of course
> > the resource should be used after having checked the return value, not
> > before. Same for the other calls to request_sdram_region.
> 
> Will it be enough for initial inclusion?

No, to merge it I need the feeling that this code is understood, not in
the works-for-me state.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2018-05-18  5:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-16 16:42 [PATCH v1 00/10] provide ELF/KEXEC support for MIPS ath79 and malta Oleksij Rempel
2018-05-16 16:42 ` [PATCH v1 01/10] resource: add create_resource() helper function Oleksij Rempel
2018-05-16 16:42 ` [PATCH v1 02/10] port resource_overlaps() from kernel Oleksij Rempel
2018-05-16 16:42 ` [PATCH v1 03/10] filetype: add ELF type Oleksij Rempel
2018-05-16 16:42 ` [PATCH v1 04/10] bootm: add kexec ELF support Oleksij Rempel
2018-05-16 21:34   ` Peter Mamonov
2018-05-17  4:52     ` Oleksij Rempel
2018-05-17  7:01       ` Sascha Hauer
2018-05-17  9:51         ` Peter Mamonov
2018-05-16 16:42 ` [PATCH v1 05/10] MIPS: add kexec ELF loading support Oleksij Rempel
2018-05-17  9:56   ` Sascha Hauer
2018-05-17 10:07     ` Oleksij Rempel
2018-05-18  5:46       ` Sascha Hauer [this message]
2018-05-16 16:42 ` [PATCH v1 06/10] MIPS: ath79: enable kexec Oleksij Rempel
2018-05-16 16:42 ` [PATCH v1 07/10] MIPS: malta: " Oleksij Rempel
2018-05-16 16:42 ` [PATCH v1 08/10] MIPS: configs: add KEXEC=y to atheros devices Oleksij Rempel
2018-05-16 16:42 ` [PATCH v1 09/10] MIPS: configs: dptechnics-dpt-module: enable watchdog poller Oleksij Rempel
2018-05-16 16:42 ` [PATCH v1 10/10] MIPS: malta: update malta qemu defconfig Oleksij Rempel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180518054627.c47vwuvraewfaa2a@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=linux@rempel-privat.de \
    --cc=pmamonov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox