On Wed, 2018-12-05 at 10:18 +0100, Gerd Hoffmann wrote:
On Thu, Nov 29, 2018 at 05:37:45PM +0000, Rob Bradford wrote:
If there is a QEMU FW CFG variable for memory available then always use it instead of CMOS. We cannot extract the values from E820 tables yet as that code assumes a working malloc.
Failed in testing.
Thanks for trying it out.
Try a guest with 4G RAM, seabios falls back to cmos.
Try a guest with q35 and 7G RAM, seabios thinks it has 3G of low mem even though it actually has 2G only.
Ah, that is a really big problem I missed. I played around with various size combinations but I was only interested in what was happening in the booted kernel.
Another problem is that you only get the total amout of memory here, not the mapping.
I think there is no way around scanning the e820 table (etc/e830 fw_cfg file) for the ram entry with the zero start address to figure the amout of ram you have below 4G.
The two options I see are: either modify the E820 code to make it usable without the assumption that malloc is avalable or alternatively add another FW config variable that has the low mem size - which is all you care about in terms of early firmware as you're going to get all the fine detail from the E820 table.
I'll take a look at the former as I think that would be preferable.
Cheers,
Rob
cheers, Gerd