mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: "Myaskouvskey, Artiom" <artiom.myaskouvskey@intel.com>
Cc: davej@codemonkey.org.uk, hpa@zytor.com,
	linux-kernel@vger.kernel.org, shai.satt@intel.com
Subject: Re: [PATCH 2.6.19-rc5-git7] EFI: mapping memory region of runtime services when using memmap kernel parameter
Date: Thu, 16 Nov 2006 13:30:33 -0800	[thread overview]
Message-ID: <20061116133033.c4f60cc2.randy.dunlap@oracle.com> (raw)
In-Reply-To: <C1467C8B168BCF40ACEC2324C1A2B074A6A69F@hasmsx411.ger.corp.intel.com>

On Thu, 16 Nov 2006 22:50:03 +0200 Myaskouvskey, Artiom wrote:

> From: Artiom Myaskouvskey <artiom.myaskouvskey@intel.com>
> 
>  
> 
> When using memmap kernel parameter in EFI boot we should also add to memory map 
> 
> memory regions of runtime services to enable their mapping later.
> 
>  
> 
> Signed-off-by: Artiom Myaskouvskey <artiom.myaskouvskey@intel.com>
> 
> ---

The patch does not apply cleanly due to extra blank lines
between each real/expected line.

More comments below.


> diff -uprN linux-2.6.19-rc5-git7.orig/include/linux/efi.h linux-2.6.19-rc5-git7/include/linux/efi.h
> 
> --- linux-2.6.19-rc5-git7.orig/include/linux/efi.h    2006-11-16 20:45:58.000000000 +0200
> 
> +++ linux-2.6.19-rc5-git7/include/linux/efi.h   2006-11-16 22:10:54.000000000 +0200
> 
> @@ -302,6 +302,7 @@ extern void efi_initialize_iomem_resourc
> 
>                               struct resource *data_resource);
> 
>  extern unsigned long __init efi_get_time(void);
> 
>  extern int __init efi_set_rtc_mmss(unsigned long nowtime);
> 
> +extern int is_available_memory(efi_memory_desc_t * md);
> 
>  extern struct efi_memory_map memmap;
> 
>  
> 
>  /**
> 
> diff -uprN linux-2.6.19-rc5-git7.orig/arch/i386/kernel/setup.c linux-2.6.19-rc5-git7/arch/i386/kernel/setup.c
> 
> --- linux-2.6.19-rc5-git7.orig/arch/i386/kernel/setup.c     2006-11-16 20:45:19.000000000 +0200
> 
> +++ linux-2.6.19-rc5-git7/arch/i386/kernel/setup.c    2006-11-16 22:05:01.000000000 +0200
> 
> @@ -349,25 +349,42 @@ static void __init probe_roms(void)
> 
>  static void __init limit_regions(unsigned long long size)
> 
>  {
> 
>       unsigned long long current_addr = 0;
> 
> -     int i;
> 
> +     int i , j;

	int i, j;

> 
>       if (efi_enabled) {
> 
> -           efi_memory_desc_t *md;
> 
> -           void *p;
> 
> +           efi_memory_desc_t *md, *next_md = 0;
> 
> +           void *p, *p1;
> 
>  
> 
> -           for (p = memmap.map, i = 0; p < memmap.map_end;
> 
> -                 p += memmap.desc_size, i++) {
> 
> +           for (p = memmap.map, i = 0,j = 0, p1 = memmap.map;

	space after comma, please.

> +                       p < memmap.map_end; p += memmap.desc_size, i++) {
> 
>                   md = p;
> 
> -                 current_addr = md->phys_addr + (md->num_pages << 12);
> 
> -                 if (md->type == EFI_CONVENTIONAL_MEMORY) {
> 
> +                 next_md = p1;
> 
> +                 current_addr = md->phys_addr + PFN_PHYS(md->num_pages);
> 
> +                 if (is_available_memory(md)) {
> 
> +                       if (md->phys_addr >= size) continue;

	Split to 2 lines:
			if (condition)
				continue;

> +                       memcpy(next_md, md, memmap.desc_size);
> 
>                         if (current_addr >= size) {
> 
> -                             md->num_pages -=
> 
> -                                   (((current_addr-size) + PAGE_SIZE-1) >> PAGE_SHIFT);
> 
> -                             memmap.nr_map = i + 1;
> 
> -                             return;
> 
> +                             next_md->num_pages -=
> 
> +                                   PFN_UP(current_addr-size);

					...(current_addr - size);
> 
>                         }
> 
> +                       p1 += memmap.desc_size;
> 
> +                       next_md = p1;
> 
> +                       j++;
> 
> +                 }
> 
> +                 else if ((md->attribute & EFI_MEMORY_RUNTIME) ==
> 
> +                             EFI_MEMORY_RUNTIME) {
> 
> +                       /* In order to make runtime services available
> 
> +                       * we have to include runtime
> 
> +                       * memory regions in memory map */
> 
> +                       memcpy(next_md, md, memmap.desc_size);
> 
> +                       p1 += memmap.desc_size;
> 
> +                       next_md = p1;
> 
> +                       j++;
> 
>                   }
> 
>             }
> 
> +           memmap.nr_map = j;
> 
> +           memmap.map_end = memmap.map + (memmap.nr_map * memmap.desc_size);
> 
> +           return;
> 
>       }
> 
>       for (i = 0; i < e820.nr_map; i++) {
> 
>             current_addr = e820.map[i].addr + e820.map[i].size;
> 
>  
> -

---
~Randy

      reply	other threads:[~2006-11-16 21:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-16 20:50 Myaskouvskey, Artiom
2006-11-16 21:30 ` Randy Dunlap [this message]

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=20061116133033.c4f60cc2.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=artiom.myaskouvskey@intel.com \
    --cc=davej@codemonkey.org.uk \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shai.satt@intel.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

Powered by JetHome