From: "Blue Swirl" <blauwirbel@gmail.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [4246] RAM usage information in machine definition.
Date: Sun, 27 Apr 2008 10:22:44 +0300 [thread overview]
Message-ID: <f43fc5580804270022r5d860ea0v5133dd01a5822688@mail.gmail.com> (raw)
In-Reply-To: <fb249edb0804261508w76d52d99y245589d10d05cbee@mail.gmail.com>
On 4/27/08, andrzej zaborowski <balrogg@gmail.com> wrote:
> On 26/04/2008, Igor Kovalenko <igor.v.kovalenko@gmail.com> wrote:
> > On Sun, Apr 27, 2008 at 1:32 AM, andrzej zaborowski <balrogg@gmail.com> wrote:
> > >
> > > On 26/04/2008, Igor Kovalenko <igor.v.kovalenko@gmail.com> wrote:
> > > > On Thu, Apr 24, 2008 at 9:59 PM, Andrzej Zaborowski <balrogg@gmail.com> wrote:
> > > > > Revision: 4246
> > > > > http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4246
> > > > > Author: balrog
> > > > > Date: 2008-04-24 17:59:27 +0000 (Thu, 24 Apr 2008)
> > > > >
> > > > > Log Message:
> > > > > -----------
> > > > > RAM usage information in machine definition.
> > > > [...]
> > > > > Modified: trunk/hw/sun4u.c
> > > > > ===================================================================
> > > > > --- trunk/hw/sun4u.c 2008-04-24 17:20:25 UTC (rev 4245)
> > > > > +++ trunk/hw/sun4u.c 2008-04-24 17:59:27 UTC (rev 4246)
> > > > > @@ -385,4 +385,5 @@
> > > > > "sun4u",
> > > > > "Sun4u platform",
> > > > > sun4u_init,
> > > > > + PROM_SIZE_MAX + VGA_RAM_SIZE,
> > > > > };
> > > > >
> > > > [...]
> > > > > Modified: trunk/vl.c
> > > > > ===================================================================
> > > > > --- trunk/vl.c 2008-04-24 17:20:25 UTC (rev 4245)
> > > > > +++ trunk/vl.c 2008-04-24 17:59:27 UTC (rev 4246)
> > > > > @@ -8277,7 +8277,7 @@
> > > > > machine = first_machine;
> > > > > cpu_model = NULL;
> > > > > initrd_filename = NULL;
> > > > > - ram_size = DEFAULT_RAM_SIZE * 1024 * 1024;
> > > > > + ram_size = -1;
> > > > > vga_ram_size = VGA_RAM_SIZE;
> > > > > #ifdef CONFIG_GDBSTUB
> > > > > use_gdbstub = 0;
> > > > > @@ -8963,8 +8963,26 @@
> > > > > #endif
> > > > >
> > > > > /* init the memory */
> > > > > - phys_ram_size = ram_size + vga_ram_size + MAX_BIOS_SIZE;
> > > > > + phys_ram_size = machine->ram_require & ~RAMSIZE_FIXED;
> > > > >
> > > > > + if (machine->ram_require & RAMSIZE_FIXED) {
> > > > > + if (ram_size > 0) {
> > > > > + if (ram_size < phys_ram_size) {
> > > > > + fprintf(stderr, "Machine `%s' requires %i bytes of memory\n",
> > > > > + machine->name, phys_ram_size);
> > > > > + exit(-1);
> > > > > + }
> > > > > +
> > > > > + phys_ram_size = ram_size;
> > > > > + } else
> > > > > + ram_size = phys_ram_size;
> > > > > + } else {
> > > > > + if (ram_size < 0)
> > > > > + ram_size = DEFAULT_RAM_SIZE * 1024 * 1024;
> > > > > +
> > > > > + phys_ram_size += ram_size;
> > > > > + }
> > > > > +
> > > > > phys_ram_base = qemu_vmalloc(phys_ram_size);
> > > > > if (!phys_ram_base) {
> > > > > fprintf(stderr, "Could not allocate physical memory\n");
> > > > >
> > > >
> > > > 512K is not enough to load sparc64 openbios ELF image
> > > > Can we do something to make sure the elf loader is aware of available space?
> > > > Or just restore old behavior:
> > >
> > > The old behaviour shouldn't be changed as far as I can tell - only the
> > > first PROM_SIZE_MAX bytes of the PROM were mapped to physical memory
> > > even if it was larger. If that's too little then yes, probably
> > > PROM_SIZE_MAX was set too low, and yes the elf loader should know how
> > > much space is available and not load images too big.
> > >
> >
> >
> > Well, it was defined to 4M before r4246 in sysemu.h, see below.
> > Seems like for sun4u that was a typo, please apply the patch to
> > increase PROM_SIZE_MAX for sun4u.c
>
>
> That was MAX_BIOS_SIZE, but still only 512kB of the PROM was visible
> in the guest. So to restore the exact old behaviour would be to
> increase the amount in sun4u_machine.ram_require but not touch
> PROM_SIZE_MAX. I'm not sure what is more correct? Was it not a problem
> before that part of the openbios ELF was effectively not loaded into
> guest accessible ram?
Shouldn't be:
$ objdump -h pc-bios/openbios-sparc64
pc-bios/openbios-sparc64: file format elf64-sparc
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 0002d188 00000000ffd00000 00000000ffd00000 00004000 2**14
CONTENTS, ALLOC, LOAD, CODE
1 .rodata 000316b4 00000000ffd30000 00000000ffd30000 00034000 2**3
CONTENTS, ALLOC, LOAD, READONLY, DATA
2 .data 000000e0 00000000ffd70000 00000000ffd70000 00074000 2**3
CONTENTS, ALLOC, LOAD, DATA
3 .bss 00095000 00000000ffd71000 00000000ffd71000 000740e0 2**3
ALLOC
But increasing the limit to 4M in both sizes should be safer.
prev parent reply other threads:[~2008-04-27 7:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-24 17:59 [Qemu-devel] [4246] RAM usage information in machine definition Andrzej Zaborowski
2008-04-26 21:15 ` Igor Kovalenko
2008-04-26 21:32 ` andrzej zaborowski
2008-04-26 21:47 ` Igor Kovalenko
2008-04-26 22:08 ` andrzej zaborowski
2008-04-27 7:22 ` Blue Swirl [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=f43fc5580804270022r5d860ea0v5133dd01a5822688@mail.gmail.com \
--to=blauwirbel@gmail.com \
--cc=qemu-devel@nongnu.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).