pass
Configure physical devices or data blob types passed through from the host to a guest
Synopsis:
[blob_type] pass [loc options] [intr guest_intr[=vector_number]]
Options:
- blob_type
- The blob_type setting affects only the loc option. If blob_type is specified, then all locations specified by the loc options that follow (until the next context) provide data of the type blob_type to the guest that will be hosted in the VM being configured.
- intr guest_intr[,{t|u}][=vector_number]
- The guest_intr argument is associated with a host vector number, either vector_number if this value is specified, or the value specified by the hostvector option for the PIC identified by guest_intr.
- loc location_spec[,length][,(+|-|r|w|x|c|e|m|d|n|s|t)*]|[=host_address]
- The guest system is allowed pass-through access to the host-physical memory
address. The
locoption supports the following arguments:- location_spec:
- The device type and information required to locate it.
The table below presents supported device types, and the
location information each type requires:
Device Location io:Location in the x86 I/O space. This location is a port number. For example:
io:4specifies an x86 I/O device on port 4.
The host_address argument is not used.
mem:Guest-physical address of the pass-through device (the address in memory as seen by the guest). For example:
pass loc mem:0x2000,r=0x1000specifies a read-only location at guest-physical address of
0x2000and a host-physical address (address seen by the host) of0x1000.This is the default device type.
pci:The BDF (bus/device/function) where the pass-through PCI device should appear in the guest. Here, host_address refers to the host device (vendor ID, device ID) being passed through. For example:
pass loc pci:0:12.0=pci:0x8086/0x1234passes a device with vendor ID
0x8086and device ID0x1234to the guest at bus0, device12, and function0(multi-function).At present, you may choose the device and function numbers in the guest, but the bus number must be
0.Per the PCI specification, some multi-function device must implement function
0. If you want to make your PCI devices enumerable with non-zero function numbers, you can use the vdev-pci-dummy instance as a placeholder at function0.The length argument and the flags are not used.
You can also specify PCI devices with just the Vendor ID and Device ID:
pci:vendor_id/device_id; for example:pass loc pci:0x8086/0x1234See
Example (graphics device)
for some configuration examples. - length
- The number of bytes allocated. The value specified for this
argument must be a 32-bit value (i.e., not greater than
4294967295 or
0xFFFFFFFF). - access type
- The access type specifies the types of access permitted to
the guest. This argument must follow the
length argument and precede the
address, and may be a combination of the following:
Argument Description +Attributes following are added to the region (this is the initial state). -Attributes following are removed from the region. rRead wWrite xExecute cCachable eReport exception mUsable as system memory (implicitly specifies +rwxcstn). If you are using the QHS, you must not also specifyd.dDevice uses DMA. If you are using the QHS, you must specify either this argument or n.nDevice doesn't use DMA. If you are using the QHS, you must specify either this argument or d.sRegion can be the source of a DMA request. tRegion can be the target of a DMA request. - host_address
The physical address of the device on the system (i.e., as seen by the hypervisor host). For some location types (e.g.,
mem:), you can use location_spec to provide the guest with an address different from the host-physical address of the device on the system; the device is at location A, but the guest sees it at location B.Note:Not all device types (e.g., IO devices) can be relocated to different locations between the guest and the host.
- sched priority
- Set the priority of the pulses the host system uses to inform the qvm processs instance of the pass-through interrupts for the current pass-through device (i.e., the one specified after this option in the current pass context).
Description:
The pass option specifies that one of the following should be passed through from the hypervisor host domain to the guest:
- a physical device, such as a PCI audio device
- a data blob, such as an initial RAM disk (initrd) for a Linux guest
Until the next pass, vdev, or reserve option is encountered in the configuration, all intr and loc options that follow a pass option specify interrupts and locations for this pass-through device or component.
In general, only one OS may have direct control over a physical hardware resource such as a device or region of memory. In a system that supports virtualization, this means either the host OS or a guest OS (but not both) and requires important considerations when passing physical devices or memory through to a guest.
If the host owns a device that a guest requires pass-through access to, the host must terminate its driver for the device before the guest can start a driver for the device in its virtual environment. Similarly, if one guest owns a device as a pass-through device, it must terminate the device driver in its virtualized space before another guest can use the device in its space.
In short, you should never pass a DMA device through to more that one guest, and only in exceptional designs should you pass a non-DMA device through to more than one guest. If you believe that your design requires the use of a non-DMA device in this way, contact your QNX representative.
The same restriction applies to RAM. When you pass through host-physical memory to a guest, the host must have been configured, via options passed to the startup bootstrap program, to not allocate from that same memory region. Otherwise, it might try to use this memory and, thus, the host and guest OSs might end up corrupting each other's memory, leading to bad behavior or system crashes.
The qvm process recognizes the following data types (blob_type) specified before a pass option:
- acpi
acpi pass- data
- Recognized, but not relevant for pass-through.
- fdt
fdt pass- guest
guest pass- initrd
initrd pass- raw
- Recognized, but not relevant for pass-through.
For general information about pass-through devices, see Pass-through devices
in the Understanding QNX Virtual Environments
chapter.
Passing through clock-dependent devicesin the same chapter).
DMA pass-through devices
d (DMA device) or
n (not DMA device) in the access type following the
length argument. For example:
pass loc mem:0x2000,0x1000,rn=0x1000
specifies that the device isn't a DMA device.If you specify neither d nor n for the access type
(or if you specify both), the qvm process instance assembling the
VM will turn off the system's safety status indicator and respond as specified by
the safety option in the VM's
configuration.
Example (Linux RAM disk image)
initrd pass loc 0xB1234000,0x4000000,rc=0xB7654000The above creates a RAM disk of 0x4000000 bytes located in the
host-physical memory at address 0xB1234000, accessible by the guest
at address 0xB7654000 in guest-physical memory. This region is
cacheable (c) and read-only (r).
It is your responsibility to locate the data in the guest system in accordance with the guest OS's rules.
You may prefer to use the load option to pass a Linux
initrd RAM disk to a guest domain. For example:
initrd load ./myinitrd.gz (see load
in this chapter).
Example (audio device):
pass pci:0:14.0 pass pci:0:23.0Since these are PCI devices, the configuration uses BDF (bus/device/function) numbers rather than memory addresses. The example assumes a board with the specified physical devices at the specified locations.
Example (graphics device)
Assuming that you have a screen driver and the other components you need to run graphics on the board, you could do the following to pass through a graphics device:
- Modify your VM configuration file to create a PCI pass-through device:
pass loc pci:0:2.0=pci:0:2.0 vdev pci-dummy clone pci:0:31.0 - Start the guest with the new VM configuration.
-
From your desktop host, start QNX Screen in the guest, using the
-c option to point screen to the DRM manager:
screen -c /usr/lib/graphics/intel-drm/graphics.conf
In this example we use the 0:2.0 BDF location,
which Intel has designated for integrated graphics:
- The value to the left of the equals sign passes the host BDF through to the guest.
- The value to the right of the equals sign ensures that the device will appear at the specified location on the guest's PCI bus.
We specify the BDF value in both places to ensure that the qvm
process instance presents the same location
(0:2.0) to the guest, in case code in the guest assumes this
is an Intel-designated BDF.
The dummy vdev is not strictly required. However, the device driver usually uses this vdev to identify the display adapter, so using the dummy vdev allows us to expose the correct vendor and device IDs without providing any further (and unneeded) functionality.
The example assumes a board with the specified physical devices at the specified locations.
See also loc above, and
vdev pci-dummy in the Virtual Device Reference
chapter.
