VM configuration syntax

A VM configuration file is a human-readable, plain-text file.

When you start a qvm process to create a VM and run a guest, the qvm process reads the configuration information to the end to know how to assemble and configure the VM.

General rules

General rules are:

Rules for options

The rules for options are:

Rules for arguments

An argument must:

Contexts

When the qvm process reads through its configuration file (from top to bottom) to assemble the components of the VM it is creating, everything that follows an option that establishes a context is in this option's context. All further options apply to this option, until either a new option that establishes a context is encountered, or the end of file is reached.

For example, in the following snippet each sched option applies to the preceding cpu option:

cpu
    sched 8 ram 32m
cpu
    sched 6

Since cpu establishes a context, the context changes each time this option is encountered; what follows each cpu entry will either apply to that option, or create a new context.

If an option is repeated in a context, the qvm process uses the last instance of the option. For example: cpu sched 8 cpu sched 6 creates one vCPU with scheduling priority 8, and one vCPU with scheduling priority 6. However, the following: cpu sched 8 sched 6 cpu creates one vCPU with scheduling priority 6 (sched 8 is discarded), and one vCPU with scheduling priority 10 (the default).

The order of the different options that follow the cpu option isn't significant, though. For example:

cpu sched 8 ram 32m

is equivalent to:

cpu ram 32m sched 8
Note: The line breaks are to improve human readability and are ignored by the qvm process when it parses the configuration file.

Exceptions

There are some exceptions to the above rule that option sequence isn't important. These exceptions apply to the following components:

system
If the system option is specified, it must be the first entry in a qvm configuration file (see system under Configuring VM components).
ram

Memory must be allocated before any option specifying a component that will use the memory: the ram and rom options must be specified before any options that refer to the guest memory. For example:

ram 32m
load /qnx7.ifs

is valid because the ram 32m has allocated 32 MB, into which the qvm process can load the IFS file. However, the following will fail:

load /qnx7.ifs
ram 32m

because no memory has been allocated, so the qvm process has nowhere to load the IFS file.

rom
Same as ram. Must be specified before any option refers to it.
PIC vdevs

vdevs for Programmable Interrupt Controllers (PICs) must be specified before any other vdevs that reference them. For example:

vdev 8259 name master
vdev ser8250 intr master:4

is valid because vdev 8259 is specified before vdev ser8250, which references it. However, the following will fail:

vdev ser8250 intr master:4
vdev 8259 name master

because vdev ser8250 references vdev 8259 before this vdev has been specified.

Note: You should always name your system, then allocate RAM and ROM right at the beginning of your qvm configuration.

Textual substitutions

As it reads through its configuration information, a qvm process instance performs textual substitutions when it encounters the following character sequences:

$env{envvar}
Replace the text string with the value of the envvar environment variable.
$asinfo_start{asinfo_name}
Replace the text string with the start address of the system page asinfo entry specified by asinfo_name.
$asinfo_length{asinfo_name}
Replace the text string with the length of the system page asinfo entry specified by asinfo_name.

You can use this textual substitution to make your configuration more robust. For example, you can pass a region of memory to the guest without specifying the host address for the memory in the VM configuration, as follows:

  1. Have the startup for the hypervisor host allocate the memory and record its location with a system page asinfo entry (e.g., guestmem1).
  2. Use textual substitution to place the information from the system page asinfo entry called guestmem1 into the qvm configuration:

    pass loc 0x10000000,$asinfo_length{guestmem1},rw=$asinfo_start{guestmem1}

With this configuration, no matter where the reserved memory actually ends up in the host, the configuration will work.

Similarly, you can use $env to put parameters in a configuration file. For example, with the following in a qvm configuration file (e.g., myconfig.qvmconf):

vdev ser8250 hostdev $env{HOST_DEV}

you could then set the vdev ser8250 hostdev option to whatever value you enter for HOST_DEV, then start the qvm process instance, as follows:

export HOST_DEV=/dev/ser3
qvm @myconfig.qvmconf

For more information about pass-through, see Configuring pass-through in this chapter. For more information about the ser8250 virtual device, see vdev ser8250 in this chapter.

For more information about the system page asinfo data structure array, see the “System Page ” chapter in Building Embedded Systems.