Skip to content

QEMU Virt build fails when allocating >512 MiB of contiguous memory #332

@rsmith-ssc

Description

@rsmith-ssc

Good afternoon,

Just started testing around with SEL4, so this could likely be user error rather than an issue with Microkit (ver 2.0.1). I am currently able to build a system using the simple example in LIBVMM as a base with my custom Linux kernel and initrd images with a few tweaks to dts and system files. However, if I try to define a memory region > 512 MiB in the system configuration I get the following error:

ERROR: failed to allocate objects for 'Page(2 MiB): MR=guest_ram #0' of object type 'SEL4_LARGE_PAGE_OBJECT'
ERROR: allocation size (768 MiB) is greater than current maximum size for a single allocation (512 MiB)

I get the same error when attempting to create two 512 MiB memory regions that are contiguous. Is this a bug or is there any configuration to enable memory regions > 512 MiB? The research I've done points toward potential solutions in CAmkES, but I would very much prefer to stick with Microkit.

See following configs to make sure I am not missing something obvious. I am updating these and also the VMM.c GUEST_RAM_SIZE definition to match total ram size:

dts.overlay:

/*
 * Copyright 2024, UNSW
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */
/ {
    /* Need to specify how much RAM the guest will have */
    memory@40000000 {
        device_type = "memory";
        reg = <0x00 0x40000000 0x00 0x30000000>;
    };

    flash@0 {
        status = "disabled";
    };

    chosen {
        stdout-path = "/pl011@9000000";
        bootargs = "earlycon=pl011,0x9000000 earlyprintk=serial debug loglevel=8 root=/dev/vda";
        linux,stdout-path = "/pl011@9000000";
        linux,initrd-start = <0x4f000830>;
        linux,initrd-end = <0x60000000>;
    };
};

system file:

<?xml version="1.0" encoding="UTF-8"?>
<system>
    <memory_region name="guest_ram" size="0x30_000_000" page_size="0x1000" />
    <memory_region name="serial" size="0x1_000" phys_addr="0x9000000" />
    <memory_region name="gic_vcpu" size="0x1_000" phys_addr="0x8040000" />
    <protection_domain name="VMM" priority="254">
        <program_image path="vmm.elf" />
        <map mr="guest_ram" vaddr="0x40000000" perms="rw" setvar_vaddr="guest_ram_vaddr" />
        <virtual_machine name="linux" >
            <vcpu id="0" />
            <map mr="guest_ram" vaddr="0x40000000" perms="rwx" />
            <map mr="serial" vaddr="0x9000000" perms="rw" cached="false" />
            <map mr="gic_vcpu" vaddr="0x8010000" perms="rw" cached="false" />
        </virtual_machine>
        <irq irq="33" id="1" />
    </protection_domain>
</system>

run command:

make MICROKIT_BOARD=qemu_virt_aarch64 MICROKIT_SDK=~/microkit-sdk-2.0.1/ LINUX=kernel.bin  INITRD=rootfs.cpio.gz qemu

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions