1 Subchannel passthrough via vfio-ccw
2 ===================================
4 vfio-ccw (based upon the mediated vfio device infrastructure) allows to
5 make certain I/O subchannels and their devices available to a guest. The
6 host will not interact with those subchannels/devices any more.
8 Note that while vfio-ccw should work with most non-QDIO devices, only ECKD
9 DASDs have really been tested.
14 Step 1: configure the host device
15 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17 As every mdev is identified by a uuid, the first step is to obtain one::
19 [root@host ~]# uuidgen
20 7e270a25-e163-4922-af60-757fc8ed48c6
22 Note: it is recommended to use the ``mdevctl`` tool for actually configuring
25 To define the same device as configured below to be started
30 [root@host ~]# driverctl -b css set-override 0.0.0313 vfio_ccw
31 [root@host ~]# mdevctl define -u 7e270a25-e163-4922-af60-757fc8ed48c6 \
32 -p 0.0.0313 -t vfio_ccw-io -a
34 If using ``mdevctl`` is not possible or wanted, follow the manual procedure
37 * Locate the subchannel for the device (in this example, ``0.0.2b09``)::
39 [root@host ~]# lscss | grep 0.0.2b09 | awk '{print $2}'
42 * Unbind the subchannel (in this example, ``0.0.0313``) from the standard
43 I/O subchannel driver and bind it to the vfio-ccw driver::
45 [root@host ~]# echo 0.0.0313 > /sys/bus/css/devices/0.0.0313/driver/unbind
46 [root@host ~]# echo 0.0.0313 > /sys/bus/css/drivers/vfio_ccw/bind
48 * Create the mediated device (identified by the uuid)::
50 [root@host ~]# echo "7e270a25-e163-4922-af60-757fc8ed48c6" > \
51 /sys/bus/css/devices/0.0.0313/mdev_supported_types/vfio_ccw-io/create
53 Step 2: configure QEMU
54 ~~~~~~~~~~~~~~~~~~~~~~
56 * Reference the created mediated device and (optionally) pick a device id to
57 be presented in the guest (here, ``fe.0.1234``, which will end up visible
58 in the guest as ``0.0.1234``::
60 -device vfio-ccw,devno=fe.0.1234,sysfsdev=\
61 /sys/bus/mdev/devices/7e270a25-e163-4922-af60-757fc8ed48c6
63 * Start the guest. The device (here, ``0.0.1234``) should now be usable::
65 [root@guest ~]# lscss -d 0.0.1234
66 Device Subchan. DevType CU Type Use PIM PAM POM CHPID
67 ----------------------------------------------------------------------
68 0.0.1234 0.0.0007 3390/0e 3990/e9 f0 f0 ff 1a2a3a0a 00000000
69 [root@guest ~]# chccwdev -e 0.0.1234
70 Setting device 0.0.1234 online
72 [root@guest ~]# dmesg -t
74 dasd-eckd 0.0.1234: A channel path to the device has become operational
75 dasd-eckd 0.0.1234: New DASD 3390/0E (CU 3990/01) with 10017 cylinders, 15 heads, 224 sectors
76 dasd-eckd 0.0.1234: DASD with 4 KB/block, 7212240 KB total size, 48 KB/track, compatible disk layout
77 dasda:VOL1/ 0X2B09: dasda1