I'm running a Debian Buster installation on an Ubuntu 24.04 host, using qemu-system-mips.
The machine is started using
qemu-system-mips -M malta \
-m size=2G -hda hda.img \
-kernel vmlinux-4.19.0-21-4kc-malta \
-initrd initrd.img-4.19.0-21-4kc-malta \
-append "root=/dev/sda1 console=ttyS0 nokaslr" \
-nic "user,model=e1000,hostfwd=tcp::5555-:22" \
-nographic
and starts up fine so far. Note that I'm requesting 2GB initial (and total) memory for the guest via "-m size=2G". On the guest, however, only a small fraction becomes available. From /var/log/kern.log:
Oct 10 16:42:04 mipsvm kernel: [ 0.000000] Memory: 223980K/262144K available (7436K kernel code, 547K rwdata, 1616K rodata, 1844K
and from /proc/meminfo:
MemTotal: 248648 kB
MemFree: 19680 kB
MemAvailable: 82624 kB
How can I make the entire 2GB available to the guest OS?
The MIPS Malta board puts its RAM in multiple places in the address map:
The guest log suggests that it's only looking at address 0, and isn't built to work with RAM being at address 0x8000_0000. Your problem isn't on the QEMU side, but with the guest.
I think that "ignore anything above 256MB" is the kernel default. The commit message where the support for 2GB of RAM was added to QEMU's malta emulation says that you can tell Linux explicitly where the RAM is by adding something like this to the 'append' string:
mem=256m@0x0 mem=256m@0x90000000 mem=1536m@0x20000000
I think
mem=256m@0x0 mem=1792m@0x90000000
would also work.
https://people.debian.org/~aurel32/qemu/mips/README.txt says that this will only work with a 64-bit MIPS kernel, though, so it's possible that your 32-bit MIPS kernel will be stuck with 256MB.