Linux-MIPS Archive on lore.kernel.org
 help / color / Atom feed
From: Serge Semin <fancer.lancer@gmail.com>
To: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: linux-mips@vger.kernel.org, paul.burton@mips.com,
	yasha.che3@gmail.com, aurelien@aurel32.net, sfr@canb.auug.org.au,
	matt.redfearn@mips.com, chenhc@lemote.com
Subject: Re: [PATCH 3/7] MIPS: fw: Record prom memory
Date: Wed, 14 Aug 2019 15:03:41 +0300
Message-ID: <20190814120340.oz4kh7cbv653s5rd@mobilestation> (raw)
In-Reply-To: <20190808075013.4852-4-jiaxun.yang@flygoat.com>

On Thu, Aug 08, 2019 at 03:50:09PM +0800, Jiaxun Yang wrote:
> boot_mem_map is nolonger exist so we need to maintain a list
> of prom memory by ourselves.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>  arch/mips/fw/arc/memory.c | 20 ++++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/mips/fw/arc/memory.c b/arch/mips/fw/arc/memory.c
> index 429b7f8d2aeb..02e954b3700e 100644
> --- a/arch/mips/fw/arc/memory.c
> +++ b/arch/mips/fw/arc/memory.c
> @@ -27,6 +27,11 @@
>  
>  #undef DEBUG
>  
> +#define MAX_PROM_MEM 5
> +static phys_addr_t prom_mem_base[MAX_PROM_MEM] __initdata;
> +static phys_addr_t prom_mem_size[MAX_PROM_MEM] __initdata;
> +static unsigned int nr_prom_mem __initdata;
> +
>  /*
>   * For ARC firmware memory functions the unit of meassuring memory is always
>   * a 4k page of memory
> @@ -129,6 +134,7 @@ void __init prom_meminit(void)
>  	}
>  #endif
>  
> +	nr_prom_mem = 0;
>  	p = PROM_NULL_MDESC;
>  	while ((p = ArcGetMemoryDescriptor(p))) {
>  		unsigned long base, size;
> @@ -139,6 +145,12 @@ void __init prom_meminit(void)
>  		type = prom_memtype_classify(p->type);
>  
>  		add_memory_region(base, size, type);
> +
> +		if (type == BOOT_MEM_ROM_DATA) {
> +			prom_mem_base[nr_prom_mem] = base;
> +			prom_mem_size[nr_prom_mem] = size;
> +			nr_prom_mem++;

Are you sure, that five prom-mem regions is enough? What about adding
a sanity check here so no to exceed the array size?

-Sergey

> +		}
>  	}
>  }
>  
> @@ -150,12 +162,8 @@ void __init prom_free_prom_memory(void)
>  	if (prom_flags & PROM_FLAG_DONT_FREE_TEMP)
>  		return;
>  
> -	for (i = 0; i < boot_mem_map.nr_map; i++) {
> -		if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
> -			continue;
> -
> -		addr = boot_mem_map.map[i].addr;
> +	for (i = 0; i < nr_prom_mem; i++) {
>  		free_init_pages("prom memory",
> -				addr, addr + boot_mem_map.map[i].size);
> +			prom_mem_base[i], prom_mem_base[i] + prom_mem_size[i]);
>  	}
>  }
> -- 
> 2.22.0
> 

  reply index

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-08  7:50 Drop boot_mem_map Jiaxun Yang
2019-08-08  7:50 ` [PATCH 1/7] MIPS: init: " Jiaxun Yang
2019-08-14 11:54   ` Serge Semin
2019-08-14 13:40     ` Jiaxun Yang
2019-08-08  7:50 ` [PATCH 2/7] MIPS: OCTEON: " Jiaxun Yang
2019-08-08  7:50 ` [PATCH 3/7] MIPS: fw: Record prom memory Jiaxun Yang
2019-08-14 12:03   ` Serge Semin [this message]
2019-08-14 12:50     ` Thomas Bogendoerfer
2019-08-14 13:45     ` Jiaxun Yang
2019-08-08  7:50 ` [PATCH 4/7] MIPS: malta: Drop prom_free_prom_memory Jiaxun Yang
2019-08-08  7:50 ` [PATCH 5/7] MIPS: msp: Record prom memory Jiaxun Yang
2019-08-14 12:12   ` Serge Semin
2019-08-08  7:50 ` [PATCH 6/7] MIPS: ip22: Drop addr_is_ram Jiaxun Yang
2019-08-08  7:50 ` [PATCH 7/7] MIPS: xlp: Drop boot_mem_map Jiaxun Yang
2019-08-12  4:56 ` [EXTERNAL]Drop boot_mem_map Paul Burton
2019-08-12  5:28   ` Jiaxun Yang
2019-08-13  8:39     ` Serge Semin
2019-08-13 15:09       ` Jiaxun Yang
2019-08-19 14:23 ` [PATCH v1 0/8] MIPS: Drop boot_mem_map Jiaxun Yang
2019-08-19 14:23   ` [PATCH v1 1/8] MIPS: OCTEON: " Jiaxun Yang
2019-08-19 14:23   ` [PATCH v1 2/8] MIPS: fw: Record prom memory Jiaxun Yang
2019-08-19 14:23   ` [PATCH v1 3/8] MIPS: malta: Drop prom_free_prom_memory Jiaxun Yang
2019-08-19 14:23   ` [PATCH v1 4/8] MIPS: msp: Record prom memory Jiaxun Yang
2019-08-19 14:23   ` [PATCH v1 5/8] MIPS: ip22: Drop addr_is_ram Jiaxun Yang
2019-08-19 14:23   ` [PATCH v1 6/8] MIPS: xlp: Drop boot_mem_map Jiaxun Yang
2019-08-19 14:23   ` [PATCH v1 7/8] MIPS: mm: " Jiaxun Yang
2019-08-19 14:23   ` [PATCH v1 8/8] MIPS: init: " Jiaxun Yang
2019-08-23 14:45   ` [PATCH v1 0/8] MIPS: " Paul Burton
2019-08-23 17:20     ` Jiaxun Yang
2019-08-23 17:36       ` Jiaxun Yang
2019-08-23 18:05     ` Serge Semin
2019-08-14 14:20 [PATCH 3/7] MIPS: fw: Record prom memory Jiaxun Yang
2019-08-14 14:28 ` Thomas Bogendoerfer

Reply instructions:

You may reply publically 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=20190814120340.oz4kh7cbv653s5rd@mobilestation \
    --to=fancer.lancer@gmail.com \
    --cc=aurelien@aurel32.net \
    --cc=chenhc@lemote.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-mips@vger.kernel.org \
    --cc=matt.redfearn@mips.com \
    --cc=paul.burton@mips.com \
    --cc=sfr@canb.auug.org.au \
    --cc=yasha.che3@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

Linux-MIPS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mips/0 linux-mips/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mips linux-mips/ https://lore.kernel.org/linux-mips \
		linux-mips@vger.kernel.org linux-mips@archiver.kernel.org
	public-inbox-index linux-mips


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-mips


AGPL code for this site: git clone https://public-inbox.org/ public-inbox