public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
From: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
To: horms@verge.net.au
Cc: "kexec@lists.infradead.org" <kexec@lists.infradead.org>
Subject: Re: [PATCH 1/2] kexec,x86: remove duplicate get_memory_ranges
Date: Tue, 15 Jan 2013 12:56:02 +0800	[thread overview]
Message-ID: <50F4E162.7020908@cn.fujitsu.com> (raw)
In-Reply-To: <50EFD3F0.9030900@cn.fujitsu.com>

ping...

于 2013年01月11日 16:57, Zhang Yanfei 写道:
> At first, we have already filled the kexec_info.memory_ranges by
> calling my_load() -> get_memory_ranges(). So if we want to
> get the memory information, we could just use the existing
> one instead of calling get_memory_ranges again.
> 
> Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
> ---
>  kexec/arch/i386/kexec-bzImage.c       |    2 +-
>  kexec/arch/i386/kexec-elf-x86.c       |    2 +-
>  kexec/arch/i386/kexec-multiboot-x86.c |    7 ++-----
>  kexec/arch/i386/x86-linux-setup.c     |   10 ++++------
>  kexec/arch/i386/x86-linux-setup.h     |    4 ++--
>  kexec/arch/x86_64/kexec-elf-x86_64.c  |    2 +-
>  6 files changed, 11 insertions(+), 16 deletions(-)
> 
> diff --git a/kexec/arch/i386/kexec-bzImage.c b/kexec/arch/i386/kexec-bzImage.c
> index 0605909..83a023d 100644
> --- a/kexec/arch/i386/kexec-bzImage.c
> +++ b/kexec/arch/i386/kexec-bzImage.c
> @@ -324,7 +324,7 @@ int do_bzImage_load(struct kexec_info *info,
>  
>  	/* Fill in the information BIOS calls would normally provide. */
>  	if (!real_mode_entry) {
> -		setup_linux_system_parameters(real_mode, info->kexec_flags);
> +		setup_linux_system_parameters(info, real_mode);
>  	}
>  
>  	return 0;
> diff --git a/kexec/arch/i386/kexec-elf-x86.c b/kexec/arch/i386/kexec-elf-x86.c
> index 8bd5ef6..e62ebcb 100644
> --- a/kexec/arch/i386/kexec-elf-x86.c
> +++ b/kexec/arch/i386/kexec-elf-x86.c
> @@ -272,7 +272,7 @@ int elf_x86_load(int argc, char **argv, const char *buf, off_t len,
>  			ramdisk_buf, ramdisk_length);
>  
>  		/* Fill in the information bios calls would usually provide */
> -		setup_linux_system_parameters(&hdr->hdr, info->kexec_flags);
> +		setup_linux_system_parameters(info, &hdr->hdr);
>  
>  		/* Initialize the registers */
>  		elf_rel_get_symbol(&info->rhdr, "entry32_regs", &regs, sizeof(regs));
> diff --git a/kexec/arch/i386/kexec-multiboot-x86.c b/kexec/arch/i386/kexec-multiboot-x86.c
> index 23dab7b..de2a423 100644
> --- a/kexec/arch/i386/kexec-multiboot-x86.c
> +++ b/kexec/arch/i386/kexec-multiboot-x86.c
> @@ -248,11 +248,8 @@ int multiboot_x86_load(int argc, char **argv, const char *buf, off_t len,
>  	mbi->boot_loader_name = sizeof(*mbi) + command_line_len; 
>  
>  	/* Memory map */
> -	if ((get_memory_ranges(&range, &ranges, info->kexec_flags) < 0)
> -			|| ranges == 0) {
> -		fprintf(stderr, "Cannot get memory information\n");
> -		return -1;
> -	}
> +	range = info->memory_range;
> +	ranges = info->memory_ranges;
>  	mmap = xmalloc(ranges * sizeof(*mmap));
>  	for (i=0; i<ranges; i++) {
>  		unsigned long long length;
> diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
> index b7ab8ea..ef62553 100644
> --- a/kexec/arch/i386/x86-linux-setup.c
> +++ b/kexec/arch/i386/x86-linux-setup.c
> @@ -441,8 +441,8 @@ close:
>  	close(data_file);
>  }
>  
> -void setup_linux_system_parameters(struct x86_linux_param_header *real_mode,
> -					unsigned long kexec_flags)
> +void setup_linux_system_parameters(struct kexec_info *info,
> +				   struct x86_linux_param_header *real_mode)
>  {
>  	/* Fill in information the BIOS would usually provide */
>  	struct memory_range *range;
> @@ -486,10 +486,8 @@ void setup_linux_system_parameters(struct x86_linux_param_header *real_mode,
>  	/* another safe default */
>  	real_mode->aux_device_info = 0;
>  
> -	/* Fill in the memory info */
> -	if ((get_memory_ranges(&range, &ranges, kexec_flags) < 0) || ranges == 0) {
> -		die("Cannot get memory information\n");
> -	}
> +	range = info->memory_range;
> +	ranges = info->memory_ranges;
>  	if (ranges > E820MAX) {
>  		fprintf(stderr, "Too many memory ranges, truncating...\n");
>  		ranges = E820MAX;
> diff --git a/kexec/arch/i386/x86-linux-setup.h b/kexec/arch/i386/x86-linux-setup.h
> index 8862513..96fbd33 100644
> --- a/kexec/arch/i386/x86-linux-setup.h
> +++ b/kexec/arch/i386/x86-linux-setup.h
> @@ -7,8 +7,8 @@ void setup_linux_bootloader_parameters(
>  	unsigned long real_mode_base, unsigned long cmdline_offset,
>  	const char *cmdline, off_t cmdline_len,
>  	const char *initrd_buf, off_t initrd_size);
> -void setup_linux_system_parameters(struct x86_linux_param_header *real_mode,
> -					unsigned long kexec_flags);
> +void setup_linux_system_parameters(struct kexec_info *info,
> +	struct x86_linux_param_header *real_mode);
>  
>  
>  #define SETUP_BASE    0x90000
> diff --git a/kexec/arch/x86_64/kexec-elf-x86_64.c b/kexec/arch/x86_64/kexec-elf-x86_64.c
> index fe4b76b..a3fc728 100644
> --- a/kexec/arch/x86_64/kexec-elf-x86_64.c
> +++ b/kexec/arch/x86_64/kexec-elf-x86_64.c
> @@ -253,7 +253,7 @@ int elf_x86_64_load(int argc, char **argv, const char *buf, off_t len,
>  			ramdisk_buf, ramdisk_length);
>  
>  		/* Fill in the information bios calls would usually provide */
> -		setup_linux_system_parameters(&hdr->hdr, info->kexec_flags);
> +		setup_linux_system_parameters(info, &hdr->hdr);
>  
>  		/* Initialize the registers */
>  		elf_rel_get_symbol(&info->rhdr, "entry64_regs", &regs, sizeof(regs));


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

  parent reply	other threads:[~2013-01-15  4:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-11  8:57 [PATCH 1/2] kexec,x86: remove duplicate get_memory_ranges Zhang Yanfei
2013-01-11  8:58 ` [PATCH 2/2] kexec: add additional check when getting memory info Zhang Yanfei
2013-01-30  4:16   ` Simon Horman
2013-01-15  4:56 ` Zhang Yanfei [this message]
2013-01-30  4:16   ` [PATCH 1/2] kexec,x86: remove duplicate get_memory_ranges Simon Horman

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=50F4E162.7020908@cn.fujitsu.com \
    --to=zhangyanfei@cn.fujitsu.com \
    --cc=horms@verge.net.au \
    --cc=kexec@lists.infradead.org \
    /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