18–20 Sept 2024
Europe/Vienna timezone

Runtime ownership transfer of platform devices

18 Sept 2024, 12:50
20m
"Room 1.15 - 1.16" (Austria Center)

"Room 1.15 - 1.16"

Austria Center

106
VFIO/IOMMU/PCI MC VFIO/IOMMU/PCI MC

Speaker

Srivatsa Vaddagiri (Qualcomm)

Description

Platform devices are those that are discovered via something like a device-tree.
Once discovered, the device is typically available for the life of a VM. IOW
platform devices can't be hotplugged in its typical sense. Qualcomm however is
having usecases where platform device ownership need to be managed at runtime
between VMs. A VM that has ownership of a platform device is required to
temporarily pass ownership of the device to another VM. An example of this is
display and touch screen. Applications like mobile banking handle sensitive
information like password obtained from user via touch screen. It may be
desirable to have a confidential VM processing such sensitive information. That
would require the confidential VM to temporarily gain ownership of touch screen
and display from the main OS.

How can this transfer of ownership for platform devices be best accomplished by
Linux? One naive option is to unload/load drivers or unbind/bind the device from
its native driver, which however leads to increased latency and in some cases
may not be even possible (given dependent drivers). Other option is for platform
drivers on both OS to synchronize access to device, so that a driver in one OS
"stops" accessing device while its "in use" by driver in other OS. The
hypervisor would ensure that an erring VM gets a fault when it tries to access a
device after having relinquished ownership.

Rather than relying on individual platform drivers to synchronize on this
ownership transfer, can the platform bus driver (on receiving VM side) and VFIO
platform driver (on host side) provide a generic mechanism here?

Also what mechanism can the IOMMU driver use to transfer
ownership? For example, hypervisor would need to recognize the ownership
transfer of a platform device using particular SID (stream ID) by switching to
use of different translations tables for transactions related to that device.

Primary author

Presentation materials