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