Features/Channel I/O Passthrough
Notice: this page is still under construction
The patch series introduce a basic channel I/O passthrough infrastructure based on vfio.
- Focus on supporting dasd-eckd(cu_type/dev_type = 0x3990/0x3390) as the target device.
- Support new qemu parameters in the style of:
-machine s390-ccw-virtio(,s390-squash-mcss=on|off) \ -device vfio-ccw,sysfsdev=$MDEV_PATH
We want to support real (i.e. not virtual) channel devices even for guests that do not support MCSS-E (where guests may see devices from any channel subsystem image at once). As all virtio-ccw devices are in css 0xfe (and show up in the default css 0 for guests not activating MCSS-E), we need an option to squash e.g. passed-through channel devices from their real css (0-3, or 0 for hosts not activating MCSS-E) into the default css, that is what the new machine option s390-squash-css is added.
Setup
This example setup is done with a Linux guest running in an s390x-ccw-virtio machine.
Prereqs
Kernel Configuration
CONFIG_S390_CCW_IOMMU=m CONFIG_VFIO=m CONFIG_VFIO_MDEV=m CONFIG_VFIO_MDEV_DEVICE=m CONFIG_VFIO_CCW=m
Modules Required
modprobe vfio.ko modprobe mdev.ko modprobe vfio_mdev.ko modprobe vfio_iommu_type1.ko modprobe vfio_ccw.ko
Prepare a Subchannel
Find a subchannel(0.0."%schid") of a DASD-ECKD device and bind it to vfio_ccw driver.
#find the dasd you can use with lsdasd on your host. e.g.: devno="7e52" schid="16ca" #unbind the ccw device from the subchannel echo 0.0."$devno" > /sys/bus/ccw/devices/0.0."$devno"/driver/unbind #unbind the subchannel from io_subchannel driver echo 0.0."$schid" > /sys/bus/css/devices/0.0."$schid"/driver/unbind #bind the subchannel with vfio_ccw driver echo 0.0."$schid" > /sys/bus/css/drivers/vfio_ccw/bind
Create a Mediated Device
#generate a uuid with uuidgen. e.g.: uuid="6dfd3ec5-e8b3-4e18-a6fe-57bc9eceb920" echo "$uuid" > \ /sys/bus/css/devices/0.0."$schid"/mdev_supported_types/vfio_ccw-io/create
Starting QEMU
Pass-through this device to a vm:
-M s390-ccw-virtio,s390-squash-css=on \ -device vfio-ccw,sysfsdev=/sys/bus/mdev/devices/$uuid \ ... ...