linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Fontenot <nfont@austin.ibm.com>
To: Chandru <chandru@in.ibm.com>
Cc: linuxppc-dev@ozlabs.org, kexec@lists.infradead.org
Subject: Re: [PATCH 1/4] kdump : add support for ibm, dynamic-reconfiguration-memory for kexec/kdump
Date: Thu, 10 Jul 2008 17:27:53 -0500	[thread overview]
Message-ID: <48768CE9.2080802@austin.ibm.com> (raw)
In-Reply-To: <200807080014.24910.chandru@in.ibm.com>

Hello Chandru,

>  static int __init early_init_dt_scan_drconf_memory(unsigned long node)
>  {
> -	cell_t *dm, *ls;
> +	cell_t *dm, *ls, *endp, *usm;
>  	unsigned long l, n, flags;
>  	u64 base, size, lmb_size;
> +	char buf[32], t[8];
>  
>  	ls = (cell_t *)of_get_flat_dt_prop(node, "ibm,lmb-size", &l);
>  	if (ls == NULL || l < dt_root_size_cells * sizeof(cell_t))
> @@ -917,7 +918,33 @@ static int __init early_init_dt_scan_drc
>  			if ((base + size) > 0x80000000ul)
>  				size = 0x80000000ul - base;
>  		}
> -		lmb_add(base, size);
> +		strcpy(buf, "linux,usable-memory");
> +		sprintf(t, "%d", (int)n);
> +		strcat(buf, t);
> +		usm = (cell_t *)of_get_flat_dt_prop(node,
> +						 (const char *)buf, &l);
> +		if (usm != NULL) {
> +			endp = usm + (l / sizeof(cell_t));
> +			while ((endp - usm) >= (dt_root_addr_cells +
> +						 dt_root_size_cells)) {
> +				base = dt_mem_next_cell(dt_root_addr_cells,
> +								 &usm);
> +				size = dt_mem_next_cell(dt_root_size_cells,
> +								 &usm);
> +				if (size == 0)
> +					continue;
> +				if (iommu_is_off) {
> +					if ((base + size) > 0x80000000ul)
> +						size = 0x80000000ul - base;
> +				}
> +				lmb_add(base, size);
> +			}
> +
> +			/* Continue with next lmb entry */
> +			continue;
> +		} else {
> +			lmb_add(base, size);
> +		}
>  	}

I am still digging through the kexec tools but I don't think you want
the processing of the linux,usable-memory property inside of the
for (; n!= 0; --n) loop.  This should be moved up so that it looks for
the linux,usable-memory property and parses it, then if it is not found
look for the ibm,dynamic-reconfiguration-memory property and parse it.

There is no need to look for the linux-usable-memory property every time
a piece of the ibm,dynamic-reconfiguration-memory property is parsed.

-Nathan

  parent reply	other threads:[~2008-07-10 22:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-07 18:44 [PATCH 1/4] kdump : add support for ibm, dynamic-reconfiguration-memory for kexec/kdump Chandru
2008-07-08  1:36 ` Stephen Rothwell
2008-07-08 10:58   ` Chandru
2008-07-08  1:56 ` Michael Neuling
2008-07-10 22:27 ` Nathan Fontenot [this message]
2008-07-11 11:09   ` [PATCH 1/4] kdump : add support for ibm, dynamic-reconfiguration-memory for kexec/kdump Chandru
2008-07-11 13:49     ` [PATCH 1/4][V2] powerpc : add support for linux, usable-memory properties for drconf memory Chandru
2008-07-22  9:01       ` Chandru
2008-07-22  9:12         ` Benjamin Herrenschmidt
2008-07-22  9:16         ` Paul Mackerras
2008-07-25 16:51           ` Chandru

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=48768CE9.2080802@austin.ibm.com \
    --to=nfont@austin.ibm.com \
    --cc=chandru@in.ibm.com \
    --cc=kexec@lists.infradead.org \
    --cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).