Re: [SeaBIOS] How much RAM is required?

2012-09-06 Thread Markus Armbruster
Markus Armbruster  writes:

> "Kevin O'Connor"  writes:
>
>> On Fri, Aug 10, 2012 at 04:54:06PM +0200, Markus Armbruster wrote:
>>> Peter Stuge  writes:
>>> > Markus Armbruster wrote:
>>> >> Could SeaBIOS fail more cleanly when it detects insufficient RAM?
>>> >
>>> > What would you propose?
>>> 
>>> Fail POST with panic("Not enough RAM")?
>>
>> The amount of memory is communicated from QEMU to SeaBIOS via nvram
>> variables.  As far as I know, those variables can only communicate ram
>> sizes in 1meg chunks - so there is no way to communicate (and/or
>> detect) a ramsize of under 1 meg.
>
> Not true, the variables *can* communicate more.
>
> Here's what QEMU stores in the RTC's NVRAM ("CMOS memory") on RAM:
>
> addr  size  meaning [unit]
> 0x15 2  base memory (below 1MiB) [KiB]
> 0x17 2  extended memory (between 1MiB and 64MiB) [KiB]
> 0x30 2  copy of 0x17/0x18
> 0x34 2  memory between 16MiB and 4GiB [64KiB]
> 0x5b 3  memory above 4GiB [64KiB]
>
> Thus, memory sizes up to 16MiB can be declared with 1KiB granularity,
> and up to 1TiB with 64KiB granularity.
>
> Note that RAM 0xa..0xf is inaccessible.
>
> However, the values QEMU *currently* stores are buggy for RAM sizes
> under 640KiB: base memory is set to 640KiB, and extended memory
> underflows.  Code is pc_cmos_init() in hw/pc.c.  I'll try to get that
> fixed, either by storing correct values, or by enforcing a 1MiB minimum.

1MiB minimum was rejected.  Instead, QEMU 1.2 got this fix:

commit e89001f72edde37fb36fa7c964daa1bbeb2eca26
Author: Markus Armbruster 
Date:   Wed Aug 15 13:12:20 2012 +0200

pc: Fix RTC CMOS info on RAM for ram_size < 1MiB

pc_cmos_init() always claims 640KiB base memory, and ram_size - 1MiB
extended memory.  The latter can underflow to "lots of extended
memory".  Fix both, and clean up some.

Note: SeaBIOS currently requires 1MiB of RAM, and doesn't check
whether it got enough.

[...]

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] How much RAM is required?

2012-08-13 Thread Markus Armbruster
"Kevin O'Connor"  writes:

> On Fri, Aug 10, 2012 at 04:54:06PM +0200, Markus Armbruster wrote:
>> Peter Stuge  writes:
>> > Markus Armbruster wrote:
>> >> Could SeaBIOS fail more cleanly when it detects insufficient RAM?
>> >
>> > What would you propose?
>> 
>> Fail POST with panic("Not enough RAM")?
>
> The amount of memory is communicated from QEMU to SeaBIOS via nvram
> variables.  As far as I know, those variables can only communicate ram
> sizes in 1meg chunks - so there is no way to communicate (and/or
> detect) a ramsize of under 1 meg.

Not true, the variables *can* communicate more.

Here's what QEMU stores in the RTC's NVRAM ("CMOS memory") on RAM:

addr  size  meaning [unit]
0x15 2  base memory (below 1MiB) [KiB]
0x17 2  extended memory (between 1MiB and 64MiB) [KiB]
0x30 2  copy of 0x17/0x18
0x34 2  memory between 16MiB and 4GiB [64KiB]
0x5b 3  memory above 4GiB [64KiB]

Thus, memory sizes up to 16MiB can be declared with 1KiB granularity,
and up to 1TiB with 64KiB granularity.

Note that RAM 0xa..0xf is inaccessible.

However, the values QEMU *currently* stores are buggy for RAM sizes
under 640KiB: base memory is set to 640KiB, and extended memory
underflows.  Code is pc_cmos_init() in hw/pc.c.  I'll try to get that
fixed, either by storing correct values, or by enforcing a 1MiB minimum.

Here's how SeaBIOS uses this information, in ram_probe():

1. read memory above 16MiB from 0x34/0x35.

2. if non-zero, add 16MiB,
   else read memory between 1MiB and 64MiB from 0x30/0x31, add 1MiB

3. read memory above 4GiB

SeaBIOS doesn't read 0x15/0x16 at all.  However, this SeaBIOS
shortcoming is currently masked by the QEMU bug.

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] How much RAM is required?

2012-08-12 Thread Kevin O'Connor
On Fri, Aug 10, 2012 at 04:54:06PM +0200, Markus Armbruster wrote:
> Peter Stuge  writes:
> > Markus Armbruster wrote:
> >> Could SeaBIOS fail more cleanly when it detects insufficient RAM?
> >
> > What would you propose?
> 
> Fail POST with panic("Not enough RAM")?

The amount of memory is communicated from QEMU to SeaBIOS via nvram
variables.  As far as I know, those variables can only communicate ram
sizes in 1meg chunks - so there is no way to communicate (and/or
detect) a ramsize of under 1 meg.

-Kevin

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] How much RAM is required?

2012-08-10 Thread Fred .
Yeah, but how about on real hardware?

Does SeaBIOS have some POST beep codes?


On Fri, Aug 10, 2012 at 9:30 PM, Markus Armbruster  wrote:
> "Fred ."  writes:
>
>> On Fri, Aug 10, 2012 at 5:28 PM, Markus Armbruster  wrote:
>>> Frediano Ziglio  writes:
>>>
 On Fri, 2012-08-10 at 16:24 +0200, Peter Stuge wrote:
> Fred . wrote:
> > No, I am not.
>
> Ok, so there's only a hypothesis.
>
>
> > But I believe QEMU does have the functionality to load an arbitrary
> > firmware. So the firmware doesn't necessarily have to be SeaBIOS.
>
> As you may know the 8086 reset vector is at 1MB-16 so it will be
> really difficult to run a PC-like machine with less than 1MB of
> memory. I don't believe one has ever existed.
>

 I remember that my manual of the NEC V20 (a 8086 clone with 10 MHZ!) has
 settings for 256KB of RAM (jumpers of course!)

 The ROM was "mapped" (physically!) at f with extended ROM at e.
>>>
>>> According to Wikipedia, the original IBM PC was sold with as little as
>>> 16KiB RAM.  IIRC, 64KiB BIOS ROM at the top of the 1MiB address space.
>>>
>>> http://en.wikipedia.org/wiki/IBM_PC
>>>
>>> [...]
>
>> Some machines also have broken memory modules.
>> So some computers have 0 byte RAM in that case. :D
>
> Yup, be we *can* catch that in QEMU :)

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] How much RAM is required?

2012-08-10 Thread Markus Armbruster
"Fred ."  writes:

> On Fri, Aug 10, 2012 at 5:28 PM, Markus Armbruster  wrote:
>> Frediano Ziglio  writes:
>>
>>> On Fri, 2012-08-10 at 16:24 +0200, Peter Stuge wrote:
 Fred . wrote:
 > No, I am not.

 Ok, so there's only a hypothesis.


 > But I believe QEMU does have the functionality to load an arbitrary
 > firmware. So the firmware doesn't necessarily have to be SeaBIOS.

 As you may know the 8086 reset vector is at 1MB-16 so it will be
 really difficult to run a PC-like machine with less than 1MB of
 memory. I don't believe one has ever existed.

>>>
>>> I remember that my manual of the NEC V20 (a 8086 clone with 10 MHZ!) has
>>> settings for 256KB of RAM (jumpers of course!)
>>>
>>> The ROM was "mapped" (physically!) at f with extended ROM at e.
>>
>> According to Wikipedia, the original IBM PC was sold with as little as
>> 16KiB RAM.  IIRC, 64KiB BIOS ROM at the top of the 1MiB address space.
>>
>> http://en.wikipedia.org/wiki/IBM_PC
>>
>> [...]

> Some machines also have broken memory modules.
> So some computers have 0 byte RAM in that case. :D

Yup, be we *can* catch that in QEMU :)

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] How much RAM is required?

2012-08-10 Thread Fred .
Some machines also have broken memory modules.
So some computers have 0 byte RAM in that case. :D

On Fri, Aug 10, 2012 at 5:28 PM, Markus Armbruster  wrote:
> Frediano Ziglio  writes:
>
>> On Fri, 2012-08-10 at 16:24 +0200, Peter Stuge wrote:
>>> Fred . wrote:
>>> > No, I am not.
>>>
>>> Ok, so there's only a hypothesis.
>>>
>>>
>>> > But I believe QEMU does have the functionality to load an arbitrary
>>> > firmware. So the firmware doesn't necessarily have to be SeaBIOS.
>>>
>>> As you may know the 8086 reset vector is at 1MB-16 so it will be
>>> really difficult to run a PC-like machine with less than 1MB of
>>> memory. I don't believe one has ever existed.
>>>
>>
>> I remember that my manual of the NEC V20 (a 8086 clone with 10 MHZ!) has
>> settings for 256KB of RAM (jumpers of course!)
>>
>> The ROM was "mapped" (physically!) at f with extended ROM at e.
>
> According to Wikipedia, the original IBM PC was sold with as little as
> 16KiB RAM.  IIRC, 64KiB BIOS ROM at the top of the 1MiB address space.
>
> http://en.wikipedia.org/wiki/IBM_PC
>
> [...]
>
> ___
> SeaBIOS mailing list
> SeaBIOS@seabios.org
> http://www.seabios.org/mailman/listinfo/seabios

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] How much RAM is required?

2012-08-10 Thread Markus Armbruster
Frediano Ziglio  writes:

> On Fri, 2012-08-10 at 16:24 +0200, Peter Stuge wrote:
>> Fred . wrote:
>> > No, I am not.
>> 
>> Ok, so there's only a hypothesis.
>> 
>> 
>> > But I believe QEMU does have the functionality to load an arbitrary
>> > firmware. So the firmware doesn't necessarily have to be SeaBIOS.
>> 
>> As you may know the 8086 reset vector is at 1MB-16 so it will be
>> really difficult to run a PC-like machine with less than 1MB of
>> memory. I don't believe one has ever existed.
>> 
>
> I remember that my manual of the NEC V20 (a 8086 clone with 10 MHZ!) has
> settings for 256KB of RAM (jumpers of course!)
>
> The ROM was "mapped" (physically!) at f with extended ROM at e.

According to Wikipedia, the original IBM PC was sold with as little as
16KiB RAM.  IIRC, 64KiB BIOS ROM at the top of the 1MiB address space.

http://en.wikipedia.org/wiki/IBM_PC

[...]

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] How much RAM is required?

2012-08-10 Thread Frediano Ziglio
On Fri, 2012-08-10 at 16:24 +0200, Peter Stuge wrote:
> Fred . wrote:
> > No, I am not.
> 
> Ok, so there's only a hypothesis.
> 
> 
> > But I believe QEMU does have the functionality to load an arbitrary
> > firmware. So the firmware doesn't necessarily have to be SeaBIOS.
> 
> As you may know the 8086 reset vector is at 1MB-16 so it will be
> really difficult to run a PC-like machine with less than 1MB of
> memory. I don't believe one has ever existed.
> 

I remember that my manual of the NEC V20 (a 8086 clone with 10 MHZ!) has
settings for 256KB of RAM (jumpers of course!)

The ROM was "mapped" (physically!) at f with extended ROM at e.

> > Don't know if its possible to make QEMU use an UEFI or OpenFirmware
> > image instead, or if such an image exists.
> 
> Sure, but UEFI rather requires 1GB than 1MB.
> 
> 
> //Peter
> 

Frediano

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] How much RAM is required?

2012-08-10 Thread Markus Armbruster
Peter Stuge  writes:

> Markus Armbruster wrote:
>> >>> SeaBIOS requires a minimum of 1Meg of ram.  I didn't even know one
>> >>> could request less than 1meg of ram from QEMU.
>> >>
>> >> I'll cook up a QEMU patch to give it at least that much.
>> 
>> > But QEMU may use other firmware/payload than SeaBIOS which might
>> > require less than 1 MB of RAM.
>> 
>> Good point.
>
> I disagree actually. It is not an invalid point, but please optimize
> for the common case and let's deal with microscopic corner cases if
> they actually happen.
>
>
>> Could SeaBIOS fail more cleanly when it detects insufficient RAM?
>
> What would you propose?

Fail POST with panic("Not enough RAM")?

Perfect score if can limit ourselves to just ROM, registers, and
possibly CPU cache, but no RAM, before this check.  It's been done
elsewhere, but it may not be practical for us.

If we can't, we merely reduce the "need this much RAM to avoid silent
failure" limit to something pretty much any conceivable firmware will
require.  QEMU might be more willing to enforce such a low limit.
Making it enforce 1MiB will be a hard sell, I'm afraid...

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] How much RAM is required?

2012-08-10 Thread Peter Stuge
Fred . wrote:
> No, I am not.

Ok, so there's only a hypothesis.


> But I believe QEMU does have the functionality to load an arbitrary
> firmware. So the firmware doesn't necessarily have to be SeaBIOS.

As you may know the 8086 reset vector is at 1MB-16 so it will be
really difficult to run a PC-like machine with less than 1MB of
memory. I don't believe one has ever existed.


> Don't know if its possible to make QEMU use an UEFI or OpenFirmware
> image instead, or if such an image exists.

Sure, but UEFI rather requires 1GB than 1MB.


//Peter

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] How much RAM is required?

2012-08-10 Thread Peter Stuge
Markus Armbruster wrote:
> >>> SeaBIOS requires a minimum of 1Meg of ram.  I didn't even know one
> >>> could request less than 1meg of ram from QEMU.
> >>
> >> I'll cook up a QEMU patch to give it at least that much.
> 
> > But QEMU may use other firmware/payload than SeaBIOS which might
> > require less than 1 MB of RAM.
> 
> Good point.

I disagree actually. It is not an invalid point, but please optimize
for the common case and let's deal with microscopic corner cases if
they actually happen.


> Could SeaBIOS fail more cleanly when it detects insufficient RAM?

What would you propose?


//Peter

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] How much RAM is required?

2012-08-10 Thread Markus Armbruster
"Fred ."  writes:

> On Thu, Aug 9, 2012 at 10:15 AM, Markus Armbruster  wrote:
>> "Kevin O'Connor"  writes:
>>
>>> On Wed, Aug 08, 2012 at 01:50:13PM +0200, Markus Armbruster wrote:
 Watch this:

 $ qemu-system-x86_64 -nodefaults -vnc :0 -monitor stdio -m 16k
 QEMU 1.1.50 monitor - type 'help' for more information
 (qemu) qemu: fatal: Trying to execute code outside RAM or ROM at
 0x4000

 Admittedly a silly thing to try.  I don't really expect SeaBIOS to work
 with 16KiB of RAM.  But I'm curious: how much does it require?
>>>
>>> SeaBIOS requires a minimum of 1Meg of ram.  I didn't even know one
>>> could request less than 1meg of ram from QEMU.
>>
>> I'll cook up a QEMU patch to give it at least that much.

> But QEMU may use other firmware/payload than SeaBIOS which might
> require less than 1 MB of RAM.

Good point.

Could SeaBIOS fail more cleanly when it detects insufficient RAM?

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] How much RAM is required?

2012-08-09 Thread Fred .
No, I am not.
But I believe QEMU does have the functionality to load an arbitrary firmware.
So the firmware doesn't necessarily have to be SeaBIOS.

Don't know if its possible to make QEMU use an UEFI or OpenFirmware
image instead, or if such an image exists.

On Thu, Aug 9, 2012 at 2:59 PM, Peter Stuge  wrote:
> Fred . wrote:
>> But QEMU may use other firmware/payload than SeaBIOS which might
>> require less than 1 MB of RAM.
>
> Really? Are you working on one?
>
>
> //Peter
>
> ___
> SeaBIOS mailing list
> SeaBIOS@seabios.org
> http://www.seabios.org/mailman/listinfo/seabios

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] How much RAM is required?

2012-08-09 Thread Peter Stuge
Fred . wrote:
> But QEMU may use other firmware/payload than SeaBIOS which might
> require less than 1 MB of RAM.

Really? Are you working on one?


//Peter

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] How much RAM is required?

2012-08-09 Thread Fred .
But QEMU may use other firmware/payload than SeaBIOS which might
require less than 1 MB of RAM.

On Thu, Aug 9, 2012 at 10:15 AM, Markus Armbruster  wrote:
> "Kevin O'Connor"  writes:
>
>> On Wed, Aug 08, 2012 at 01:50:13PM +0200, Markus Armbruster wrote:
>>> Watch this:
>>>
>>> $ qemu-system-x86_64 -nodefaults -vnc :0 -monitor stdio -m 16k
>>> QEMU 1.1.50 monitor - type 'help' for more information
>>> (qemu) qemu: fatal: Trying to execute code outside RAM or ROM at
>>> 0x4000
>>>
>>> Admittedly a silly thing to try.  I don't really expect SeaBIOS to work
>>> with 16KiB of RAM.  But I'm curious: how much does it require?
>>
>> SeaBIOS requires a minimum of 1Meg of ram.  I didn't even know one
>> could request less than 1meg of ram from QEMU.
>
> I'll cook up a QEMU patch to give it at least that much.
>
> Thanks!
>
> ___
> SeaBIOS mailing list
> SeaBIOS@seabios.org
> http://www.seabios.org/mailman/listinfo/seabios

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] How much RAM is required?

2012-08-09 Thread Markus Armbruster
"Kevin O'Connor"  writes:

> On Wed, Aug 08, 2012 at 01:50:13PM +0200, Markus Armbruster wrote:
>> Watch this:
>> 
>> $ qemu-system-x86_64 -nodefaults -vnc :0 -monitor stdio -m 16k
>> QEMU 1.1.50 monitor - type 'help' for more information
>> (qemu) qemu: fatal: Trying to execute code outside RAM or ROM at
>> 0x4000
>> 
>> Admittedly a silly thing to try.  I don't really expect SeaBIOS to work
>> with 16KiB of RAM.  But I'm curious: how much does it require?
>
> SeaBIOS requires a minimum of 1Meg of ram.  I didn't even know one
> could request less than 1meg of ram from QEMU.

I'll cook up a QEMU patch to give it at least that much.

Thanks!

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] How much RAM is required?

2012-08-08 Thread Kevin O'Connor
On Wed, Aug 08, 2012 at 01:50:13PM +0200, Markus Armbruster wrote:
> Watch this:
> 
> $ qemu-system-x86_64 -nodefaults -vnc :0 -monitor stdio -m 16k
> QEMU 1.1.50 monitor - type 'help' for more information
> (qemu) qemu: fatal: Trying to execute code outside RAM or ROM at 
> 0x4000
> 
> Admittedly a silly thing to try.  I don't really expect SeaBIOS to work
> with 16KiB of RAM.  But I'm curious: how much does it require?

SeaBIOS requires a minimum of 1Meg of ram.  I didn't even know one
could request less than 1meg of ram from QEMU.

-Kevin

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] How much RAM is required?

2012-08-08 Thread Fred .
Interesting question.
No idea.
Try giving it more memory until it doesn't crash then you'll
eventually find out. :)

On Wed, Aug 8, 2012 at 1:50 PM, Markus Armbruster  wrote:
> Watch this:
>
> $ qemu-system-x86_64 -nodefaults -vnc :0 -monitor stdio -m 16k
> QEMU 1.1.50 monitor - type 'help' for more information
> (qemu) qemu: fatal: Trying to execute code outside RAM or ROM at 
> 0x4000
>
> Admittedly a silly thing to try.  I don't really expect SeaBIOS to work
> with 16KiB of RAM.  But I'm curious: how much does it require?
>
> ___
> SeaBIOS mailing list
> SeaBIOS@seabios.org
> http://www.seabios.org/mailman/listinfo/seabios

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


[SeaBIOS] How much RAM is required?

2012-08-08 Thread Markus Armbruster
Watch this:

$ qemu-system-x86_64 -nodefaults -vnc :0 -monitor stdio -m 16k
QEMU 1.1.50 monitor - type 'help' for more information
(qemu) qemu: fatal: Trying to execute code outside RAM or ROM at 
0x4000

Admittedly a silly thing to try.  I don't really expect SeaBIOS to work
with 16KiB of RAM.  But I'm curious: how much does it require?

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios