"Fred ." eldmannen@gmail.com writes:
On Thu, Aug 9, 2012 at 10:15 AM, Markus Armbruster armbru@redhat.com wrote:
"Kevin O'Connor" kevin@koconnor.net 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
0x0000000000004000
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?
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
Peter Stuge peter@stuge.se 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...
On Fri, Aug 10, 2012 at 04:54:06PM +0200, Markus Armbruster wrote:
Peter Stuge peter@stuge.se 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
"Kevin O'Connor" kevin@koconnor.net writes:
On Fri, Aug 10, 2012 at 04:54:06PM +0200, Markus Armbruster wrote:
Peter Stuge peter@stuge.se 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 0xa0000..0xfffff 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.
Markus Armbruster armbru@redhat.com writes:
"Kevin O'Connor" kevin@koconnor.net writes:
On Fri, Aug 10, 2012 at 04:54:06PM +0200, Markus Armbruster wrote:
Peter Stuge peter@stuge.se 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 0xa0000..0xfffff 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 armbru@redhat.com 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.
[...]