linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Geoff Levand <geoff@infradead.org>
To: Andre Heider <a.heider@gmail.com>
Cc: cbe-oss-dev@lists.ozlabs.org,
	Hector Martin <hector@marcansoft.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH part1 v2 2/9] ps3: Add helper functions to read highmem info from the repository
Date: Tue, 23 Aug 2011 13:53:33 -0700	[thread overview]
Message-ID: <4E54134D.7080004@infradead.org> (raw)
In-Reply-To: <1313091073-4572-3-git-send-email-a.heider@gmail.com>

On 08/11/2011 12:31 PM, Andre Heider wrote:
> An earlier step in the boot chain can preallocate the highmem region.
> A boot loader doing so will place the region infos in the repository.
> Provide helper functions to read the required nodes.
> 
> Signed-off-by: Andre Heider <a.heider@gmail.com>
> ---
>  arch/powerpc/platforms/ps3/platform.h   |    3 ++
>  arch/powerpc/platforms/ps3/repository.c |   36 +++++++++++++++++++++++++++++++
>  2 files changed, 39 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/ps3/platform.h b/arch/powerpc/platforms/ps3/platform.h
> index 9a196a8..d9b4ec0 100644
> --- a/arch/powerpc/platforms/ps3/platform.h
> +++ b/arch/powerpc/platforms/ps3/platform.h
> @@ -187,6 +187,9 @@ int ps3_repository_read_rm_size(unsigned int ppe_id, u64 *rm_size);
>  int ps3_repository_read_region_total(u64 *region_total);
>  int ps3_repository_read_mm_info(u64 *rm_base, u64 *rm_size,
>  	u64 *region_total);
> +int ps3_repository_read_highmem_base(u64 *highmem_base);
> +int ps3_repository_read_highmem_size(u64 *highmem_size);
> +int ps3_repository_read_highmem_info(u64 *highmem_base, u64 *highmem_size);

In the general case we could have multiple regions.  If we
add a region arg here we can handle that if needed.
region_index would be {1..}.  ps3_repository_read_highmem_info
could hold how many regions, so:

  int ps3_repository_read_highmem_base(unsigned int region_index, u64 *highmem_base);
  int ps3_repository_read_highmem_size(unsigned int region_index, u64 *highmem_size);
  int ps3_repository_read_highmem_region(unsigned int region_index, u64 *highmem_base, u64 *highmem_size);

>  
>  /* repository pme info */
>  
> diff --git a/arch/powerpc/platforms/ps3/repository.c b/arch/powerpc/platforms/ps3/repository.c
> index 5e304c2..9908d61 100644
> --- a/arch/powerpc/platforms/ps3/repository.c
> +++ b/arch/powerpc/platforms/ps3/repository.c
> @@ -778,6 +778,42 @@ int ps3_repository_read_mm_info(u64 *rm_base, u64 *rm_size, u64 *region_total)
>  		: ps3_repository_read_region_total(region_total);
>  }
>  
> +int ps3_repository_read_highmem_base(u64 *highmem_base)
> +{
> +	return read_node(PS3_LPAR_ID_CURRENT,
> +			 make_first_field("bi", 0),
> +			 make_field("highmem", 0),
> +			 make_field("base", 0),
> +			 0,
> +			 highmem_base, NULL);
> +}

I think something like this seems better:

int ps3_repository_read_highmem_base(unsigned int region_index, u64 *highmem_base)
{
	return read_node(PS3_LPAR_ID_CURRENT,
		make_first_field("highmem", 0),
		make_field("region", region_index),
		make_field("base", 0),
		0,
		highmem_base, NULL);
}

> +
> +int ps3_repository_read_highmem_size(u64 *highmem_size)
> +{
> +	return read_node(PS3_LPAR_ID_CURRENT,
> +			 make_first_field("bi", 0),
> +			 make_field("highmem", 0),
> +			 make_field("size", 0),
> +			 0,
> +			 highmem_size, NULL);
> +}
> +
> +/**
> + * ps3_repository_read_highmem_info - Read high memory info
> + * @highmem_base: High memory base address.
> + * @highmem_size: High mode memory size.
> + */
> +
> +int ps3_repository_read_highmem_info(u64 *highmem_base, u64 *highmem_size)
> +{
> +	int result;
> +
> +	*highmem_base = 0;
> +	result = ps3_repository_read_highmem_base(highmem_base);
> +	return result ? result
> +		: ps3_repository_read_highmem_size(highmem_size);


	ps3_repository_read_highmem_base(1, highmem_base);
	...
> +}
> +
>  /**
>   * ps3_repository_read_num_spu_reserved - Number of physical spus reserved.
>   * @num_spu: Number of physical spus.

-Geoff

  reply	other threads:[~2011-08-23 20:53 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-01 20:02 [PATCH 00/15] ps3: Support more than the OtherOS lpar Andre Heider
2011-08-01 20:02 ` [PATCH 01/15] [PS3] Add udbg driver using the PS3 gelic Ethernet device Andre Heider
2011-08-03 22:32   ` Geoff Levand
2011-08-04 16:35     ` Andre Heider
2011-08-11 12:13     ` [Cbe-oss-dev] " Arnd Bergmann
2011-08-11 17:32       ` Andre Heider
2011-08-31  4:26         ` Benjamin Herrenschmidt
2011-08-01 20:02 ` [PATCH 02/15] [PS3] Get lv1 high memory region from devtree Andre Heider
2011-08-03 22:30   ` Geoff Levand
2011-08-04  1:19     ` Hector Martin
2011-08-04 19:24       ` Geoff Levand
2011-08-06 11:50         ` Andre Heider
2011-08-01 20:02 ` [PATCH 03/15] [PS3] Add region 1 memory early Andre Heider
2011-08-03 22:32   ` Geoff Levand
2011-08-04  0:08     ` Hector Martin
2011-08-04  7:05       ` Geert Uytterhoeven
2011-08-04 11:13         ` Hector Martin
2011-08-04 15:57       ` Geoff Levand
2011-08-01 20:02 ` [PATCH 04/15] ps3: MEMORY_HOTPLUG is not a requirement anymore Andre Heider
2011-08-01 20:02 ` [PATCH 05/15] ps3: Detect the current lpar environment Andre Heider
2011-08-03 22:31   ` Geoff Levand
2011-08-04 16:34     ` Andre Heider
2011-08-01 20:02 ` [PATCH 06/15] ps3flash: Fix region align checks Andre Heider
2011-08-01 20:29   ` [Cbe-oss-dev] " Geert Uytterhoeven
2011-08-01 20:56     ` Andre Heider
2011-08-01 21:00       ` Geert Uytterhoeven
2011-08-01 20:02 ` [PATCH 07/15] ps3flash: Refuse to work in lpars other than OtherOS Andre Heider
2011-08-03 22:34   ` Geoff Levand
2011-08-04 16:40     ` Andre Heider
2011-08-04 19:27       ` [Cbe-oss-dev] " Geert Uytterhoeven
2011-08-06 12:40         ` Andre Heider
2011-08-01 20:02 ` [PATCH 08/15] ps3: Only prealloc the flash bounce buffer for the OtherOS lpar Andre Heider
2011-08-01 20:03 ` [PATCH 09/15] ps3: Limit the number of regions per storage device Andre Heider
2011-08-01 20:30   ` [Cbe-oss-dev] " Geert Uytterhoeven
2011-08-01 20:58     ` Andre Heider
2011-08-06 12:28       ` Andre Heider
2011-08-06 12:47         ` Andre Heider
2011-08-01 20:03 ` [PATCH 10/15] ps3stor_lib: Add support for multiple regions Andre Heider
2011-08-01 20:35   ` Geert Uytterhoeven
2011-08-01 21:01     ` Andre Heider
2011-08-01 20:03 ` [PATCH 11/15] ps3disk: Provide a gendisk per accessible region Andre Heider
2011-08-01 20:03 ` [PATCH 12/15] ps3stor_lib: Add support for storage access flags Andre Heider
2011-08-01 20:03 ` [PATCH 13/15] ps3disk: Use region flags Andre Heider
2011-08-01 20:03 ` [PATCH 14/15] ps3: Add a vflash driver for lpars other than OtherOS Andre Heider
2011-08-01 20:03 ` [PATCH 15/15] ps3: Add a NOR FLASH driver for PS3s without NAND Andre Heider
2011-08-03 22:23 ` [PATCH 00/15] ps3: Support more than the OtherOS lpar Geoff Levand
2011-08-04 16:31   ` Andre Heider
2011-08-11 12:17 ` [Cbe-oss-dev] " Arnd Bergmann
2011-08-11 17:34   ` Andre Heider
2011-08-11 19:31 ` [PATCH part1 v2 0/9] ps3: General improvements and preparation for support " Andre Heider
2011-08-11 19:31   ` [PATCH part1 v2 1/9] Add udbg driver using the PS3 gelic Ethernet device Andre Heider
2011-08-23 20:53     ` Geoff Levand
2011-08-31 16:32       ` [PATCH] [ps3] Add gelic udbg driver Geoff Levand
2011-08-11 19:31   ` [PATCH part1 v2 2/9] ps3: Add helper functions to read highmem info from the repository Andre Heider
2011-08-23 20:53     ` Geoff Levand [this message]
2011-08-11 19:31   ` [PATCH part1 v2 3/9] ps3: Get lv1 high memory region " Andre Heider
2011-08-23 20:53     ` Geoff Levand
2011-08-11 19:31   ` [PATCH part1 v2 4/9] Add region 1 memory early Andre Heider
2011-08-23 20:53     ` Geoff Levand
2011-08-23 22:37       ` [Cbe-oss-dev] " Antonio Ospite
2011-08-24  2:15         ` Geoff Levand
2011-08-11 19:31   ` [PATCH part1 v2 5/9] ps3: MEMORY_HOTPLUG is not a requirement anymore Andre Heider
2011-08-23 20:53     ` Geoff Levand
2011-08-11 19:31   ` [PATCH part1 v2 6/9] ps3: Detect the current lpar Andre Heider
2011-08-23 22:08     ` Geoff Levand
2011-08-11 19:31   ` [PATCH part1 v2 7/9] ps3: Log the detected lpar on startup Andre Heider
2011-08-11 19:31   ` [PATCH part1 v2 8/9] ps3flash: Refuse to work in lpars other than OtherOS Andre Heider
2011-08-23 22:12     ` Geoff Levand
2011-08-11 19:31   ` [PATCH part1 v2 9/9] ps3: Only prealloc the flash bounce buffer for the OtherOS lpar Andre Heider
2011-08-31  4:29   ` [PATCH part1 v2 0/9] ps3: General improvements and preparation for support more than " Benjamin Herrenschmidt

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=4E54134D.7080004@infradead.org \
    --to=geoff@infradead.org \
    --cc=a.heider@gmail.com \
    --cc=cbe-oss-dev@lists.ozlabs.org \
    --cc=hector@marcansoft.com \
    --cc=linuxppc-dev@lists.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).