Malta-be (qemu) limited to 256MB RAM

I've been trying to run a malta-be VM (using qemu 4.0.0 on Ubuntu 19.10) with more than 256MB RAM (e.g. with the -m 1G command line option), but the instance only has access to 256MB.

I've run armvirt and x86 instances with similar options and they are able to access the full amount of memory assigned.

Is this a known limitation? Are there additional qemu options I need to set to get it working?

This page says:

By default QEMU emulates a machine with 128MiB of RAM. You can use the -m option
to increase or decrease the size of the RAM. It is however limited to 256MiB
with a 32-bit kernel. With a 64-bit kernel and QEMU >= 1.7, it is possible to
use up to 2047MiB of RAM, passing the memory map to the kernel, adding a mem=
argument to the append parameters as follow: "mem=256m@0x0 mem=XXXm@0x90000000"
where XXX represents the total memory size minus 256MiB. If you don't want to
start QEMU in graphic mode, you can use the -nographic option. The image is
configured to display a login prompt on the first serial port (ttys0). If you
want to switch the boot messages to the serial port, you need to replace
"console=tty0" by "console=ttyS0".

It can work. Limit is 2GB. But it need to recomile kernel.
Steps to enable highmem:

  1. clone openwrt repository
  2. make kernel_menuconfig
  3. enable Kernel Type->High Memory Support
  4. make
  5. run qemu:
qemu-system-mips -kernel openwrt-malta-be-vmlinux-initramfs.elf -nographic -m 2g

Finaly it shows 2GB:

root@(none):/# free -m
              total        used        free      shared  buff/cache   available
Mem:        2051816       11152     2032936        7728        7728     1874448
Swap:             0           0           0

When i have more time i will create Pull Request :smiley:

Oh, I thought highmem was already enabled by default (I use snapshot builds for testing).

Would be great if you can open a PR or submit a patch. If not I can do so as well.