Assign the DASD's subchannel to the vfio_ccw device driver

To make a DASD device eligible as a VFIO pass-through device, you must bring its subchannel under control of the vfio_ccw device driver.

Before you begin

Ensure that the driverctl command is available on your KVM host.

Procedure

  1. Load the vfio_ccw device driver.
    # modprobe vfio_ccw
  2. Find out the subchannel bus-ID of your DASD.
    # lscss -d <device_bus_id>
    Example:
    # lscss -d 0.0.3000
    Device   Subchan. DevType CU Type Use PIM PAM POM CHPIDs
    -------------------------------------------------------------------
    0.0.3000 0.0.0004 3390/0A 3990/E9 YES C0  C0  FF  34400000 00000000
  3. Reassign the subchannel from the io_subchannel device driver to the vfio_ccw device driver.
    # driverctl --bus css set-override <subchannel_bus_id> vfio_ccw
    This command frees the DASD from the dasd device driver and reassigns its subchannel from the io_subchannel device driver to the vfio_ccw device driver.

    By default, these configuration changes persist across reboots of the KVM host. For changes that apply only to the active configuration, specify the --nosave option with the command.

    Example: The following command persistently frees a DASD with subchannel bus ID 0.0.0004 from the dasd device driver and to assign subchannel 0.0.0004 to the vfio_ccw device driver.
    # driverctl --bus css set-override 0.0.0004 vfio_ccw
  4. Optional: Confirm that the subchannel is controlled by the vfio_ccw device driver. Issue the following command:
    # driverctl --bus css list-devices
    Example: The sample output shows that subchannel 0.0.0004 is controlled by the vfio_ccw device driver. The [*] indicates that this is not the default device driver for the subchannel.
    # driverctl --bus css list-devices
    ...
    0.0.0003 io_subchannel
    0.0.0004 vfio_ccw [*]
    0.0.0005 io_subchannel
    ...
    Confirm that the reassignment is persistent by examining the contents of /etc/driverctl.d.
    # ls /etc/driverctl.d
    Subchannels with persistent overrides are listed as files in the command output. The entry for the subchannel of interest must contain vfio_ccw as the persisted device driver.
    Example: In the example, subchannel 0.0.0004 is persistently controlled by the vfio_ccw device driver.
    # ls /etc/driverctl.d
    css-0.0.0004
    # cat /etc/driverctl.d/css-0.0.0004
    vfio_ccw

What to do next

Create mediated devices for your pass-through DASDs, see Creating a mediated device for a DASD pass-through device.