qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pseries: Correct RAM size check for SLOF
@ 2011-11-08  5:52 David Gibson
  2011-11-08 10:12 ` [Qemu-devel] [Qemu-ppc] " Thomas Huth
  0 siblings, 1 reply; 4+ messages in thread
From: David Gibson @ 2011-11-08  5:52 UTC (permalink / raw)
  To: agraf; +Cc: qemu-ppc, qemu-devel, thuth

The SLOF firmware used on the pseries machine needs a reasonable amount of
(guest) RAM in order to run, so we have a check in the machine init
function to check that this is available.  However, SLOF runs in real mode
(MMU off) which means it can only actually access the RMA (Real Mode Area),
not all of RAM.  In many cases the RMA is the same as all RAM, but when
running with Book3S HV KVM on PowerPC 970, the RMA must be especially
allocated to be (host) physically contiguous.  In this case, the RMA size
is determined by what the host admin allocated at boot time, and will
usually be less than the whole guest RAM size.

This patch corrects the test to see if SLOF has enough memory for this
case.

In addition, more recent versions of SLOF that were committed earlier don't
need quite as much memory as earlier versions.  Therefore, this patch also
reduces the amount of RAM we require to run SLOF.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/spapr.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/spapr.c b/hw/spapr.c
index 40cfc9b..e826e0b 100644
--- a/hw/spapr.c
+++ b/hw/spapr.c
@@ -57,7 +57,7 @@
 #define FW_MAX_SIZE             0x400000
 #define FW_FILE_NAME            "slof.bin"
 
-#define MIN_RAM_SLOF		512UL
+#define MIN_RMA_SLOF		128UL
 
 #define TIMEBASE_FREQ           512000000ULL
 
@@ -562,9 +562,9 @@ static void ppc_spapr_init(ram_addr_t ram_size,
 
         spapr->entry_point = KERNEL_LOAD_ADDR;
     } else {
-        if (ram_size < (MIN_RAM_SLOF << 20)) {
+        if (rma_size < (MIN_RMA_SLOF << 20)) {
             fprintf(stderr, "qemu: pSeries SLOF firmware requires >= "
-                    "%ldM guest RAM\n", MIN_RAM_SLOF);
+                    "%ldM guest RAM\n", MIN_RMA_SLOF);
             exit(1);
         }
         filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, FW_FILE_NAME);
-- 
1.7.7.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] pseries: Correct RAM size check for SLOF
  2011-11-08  5:52 [Qemu-devel] [PATCH] pseries: Correct RAM size check for SLOF David Gibson
@ 2011-11-08 10:12 ` Thomas Huth
  2011-11-11 10:51   ` Alexander Graf
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Huth @ 2011-11-08 10:12 UTC (permalink / raw)
  To: David Gibson; +Cc: qemu-ppc, agraf, qemu-devel

Am Tue,  8 Nov 2011 16:52:16 +1100
schrieb David Gibson <david@gibson.dropbear.id.au>:

> The SLOF firmware used on the pseries machine needs a reasonable amount of
> (guest) RAM in order to run, so we have a check in the machine init
> function to check that this is available.  However, SLOF runs in real mode
> (MMU off) which means it can only actually access the RMA (Real Mode Area),
> not all of RAM.  In many cases the RMA is the same as all RAM, but when
> running with Book3S HV KVM on PowerPC 970, the RMA must be especially
> allocated to be (host) physically contiguous.  In this case, the RMA size
> is determined by what the host admin allocated at boot time, and will
> usually be less than the whole guest RAM size.
> 
> This patch corrects the test to see if SLOF has enough memory for this
> case.
[...]
> @@ -562,9 +562,9 @@ static void ppc_spapr_init(ram_addr_t ram_size,
> 
>          spapr->entry_point = KERNEL_LOAD_ADDR;
>      } else {
> -        if (ram_size < (MIN_RAM_SLOF << 20)) {
> +        if (rma_size < (MIN_RMA_SLOF << 20)) {
>              fprintf(stderr, "qemu: pSeries SLOF firmware requires >= "
> -                    "%ldM guest RAM\n", MIN_RAM_SLOF);
> +                    "%ldM guest RAM\n", MIN_RMA_SLOF);

Maybe it's more helpful for the unexperienced users when we change the
term "guest RAM" to "real mode area (RMA) memory" here? What do you
think?

 Thomas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] pseries: Correct RAM size check for SLOF
  2011-11-08 10:12 ` [Qemu-devel] [Qemu-ppc] " Thomas Huth
@ 2011-11-11 10:51   ` Alexander Graf
  2011-11-14  1:44     ` David Gibson
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Graf @ 2011-11-11 10:51 UTC (permalink / raw)
  To: Thomas Huth; +Cc: qemu-ppc, qemu-devel, David Gibson

On 11/08/2011 11:12 AM, Thomas Huth wrote:
> Am Tue,  8 Nov 2011 16:52:16 +1100
> schrieb David Gibson<david@gibson.dropbear.id.au>:
>
>> The SLOF firmware used on the pseries machine needs a reasonable amount of
>> (guest) RAM in order to run, so we have a check in the machine init
>> function to check that this is available.  However, SLOF runs in real mode
>> (MMU off) which means it can only actually access the RMA (Real Mode Area),
>> not all of RAM.  In many cases the RMA is the same as all RAM, but when
>> running with Book3S HV KVM on PowerPC 970, the RMA must be especially
>> allocated to be (host) physically contiguous.  In this case, the RMA size
>> is determined by what the host admin allocated at boot time, and will
>> usually be less than the whole guest RAM size.
>>
>> This patch corrects the test to see if SLOF has enough memory for this
>> case.
> [...]
>> @@ -562,9 +562,9 @@ static void ppc_spapr_init(ram_addr_t ram_size,
>>
>>           spapr->entry_point = KERNEL_LOAD_ADDR;
>>       } else {
>> -        if (ram_size<  (MIN_RAM_SLOF<<  20)) {
>> +        if (rma_size<  (MIN_RMA_SLOF<<  20)) {
>>               fprintf(stderr, "qemu: pSeries SLOF firmware requires>= "
>> -                    "%ldM guest RAM\n", MIN_RAM_SLOF);
>> +                    "%ldM guest RAM\n", MIN_RMA_SLOF);
> Maybe it's more helpful for the unexperienced users when we change the
> term "guest RAM" to "real mode area (RMA) memory" here? What do you
> think?

Yes, please. That's basically what the patch is changing, so the printf 
should be changed as well :). If you find it too confusing, you can say 
"%ldM guest RAM (RMA)". Whoever uses KVM on a 970 will have to manually 
allocate RMA regions in the first place, so he will know what it means. 
Everyone else will read RAM (which should be correct for p7 KVM and TCG).


Alex

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] pseries: Correct RAM size check for SLOF
  2011-11-11 10:51   ` Alexander Graf
@ 2011-11-14  1:44     ` David Gibson
  0 siblings, 0 replies; 4+ messages in thread
From: David Gibson @ 2011-11-14  1:44 UTC (permalink / raw)
  To: Alexander Graf; +Cc: qemu-ppc, Thomas Huth, qemu-devel

On Fri, Nov 11, 2011 at 11:51:12AM +0100, Alexander Graf wrote:
> On 11/08/2011 11:12 AM, Thomas Huth wrote:
> >Am Tue,  8 Nov 2011 16:52:16 +1100
> >schrieb David Gibson<david@gibson.dropbear.id.au>:
> >
> >>The SLOF firmware used on the pseries machine needs a reasonable amount of
> >>(guest) RAM in order to run, so we have a check in the machine init
> >>function to check that this is available.  However, SLOF runs in real mode
> >>(MMU off) which means it can only actually access the RMA (Real Mode Area),
> >>not all of RAM.  In many cases the RMA is the same as all RAM, but when
> >>running with Book3S HV KVM on PowerPC 970, the RMA must be especially
> >>allocated to be (host) physically contiguous.  In this case, the RMA size
> >>is determined by what the host admin allocated at boot time, and will
> >>usually be less than the whole guest RAM size.
> >>
> >>This patch corrects the test to see if SLOF has enough memory for this
> >>case.
> >[...]
> >>@@ -562,9 +562,9 @@ static void ppc_spapr_init(ram_addr_t ram_size,
> >>
> >>          spapr->entry_point = KERNEL_LOAD_ADDR;
> >>      } else {
> >>-        if (ram_size<  (MIN_RAM_SLOF<<  20)) {
> >>+        if (rma_size<  (MIN_RMA_SLOF<<  20)) {
> >>              fprintf(stderr, "qemu: pSeries SLOF firmware requires>= "
> >>-                    "%ldM guest RAM\n", MIN_RAM_SLOF);
> >>+                    "%ldM guest RAM\n", MIN_RMA_SLOF);
> >Maybe it's more helpful for the unexperienced users when we change the
> >term "guest RAM" to "real mode area (RMA) memory" here? What do you
> >think?
> 
> Yes, please. That's basically what the patch is changing, so the
> printf should be changed as well :). If you find it too confusing,
> you can say "%ldM guest RAM (RMA)". Whoever uses KVM on a 970 will
> have to manually allocate RMA regions in the first place, so he will
> know what it means. Everyone else will read RAM (which should be
> correct for p7 KVM and TCG).

Duh, yeah, oversight.  New version coming.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-11-14  1:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-08  5:52 [Qemu-devel] [PATCH] pseries: Correct RAM size check for SLOF David Gibson
2011-11-08 10:12 ` [Qemu-devel] [Qemu-ppc] " Thomas Huth
2011-11-11 10:51   ` Alexander Graf
2011-11-14  1:44     ` David Gibson

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).