Assigning DASDs to vfio_ccw

Red Hat Enterprise Linux 8.6 LPAR mode KVM guest

Create a VFIO CCW mediated device for the subchannel to which the DASD is attached.

Before you begin

You must know the subchannel bus ID of the DASD and the DASD must be free from control of the default DASD and channel device drivers (see Freeing host resources from the default device drivers).

Procedure

  1. Ensure that the vfio_ccw device driver and the vfio_mdev modules are loaded.
    # modprobe vfio_ccw
    # modprobe vfio_mdev
  2. Assign the DASD's subchannel to the vfio_ccw device driver by writing the subchannel bus-ID to /sys/bus/css/drivers/vfio_ccw/bind.
    Example: This example assigns subchannel 0.0.0004 to vfio_ccw.
    # echo 0.0.0004 > /sys/bus/css/drivers/vfio_ccw/bind
  3. Create a new VFIO CCW mediated device. You can use libvirt or general Linux® commands to create the device.
    Using libvirt
    With libvirt, you can create persistent or transient mediated devices. See KVM Virtual Server Management, SC34-2752.
    Using general Linux commands
    Mediated devices that you create with the commands that follow do not persist across reboots.

    Writing a universally unique identifier (UUID) to /sys/bus/css/devices/<subchannel_bus_id>/mdev_supported_types/vfio_ccw-io/create, where <subchannel_bus_id> is the subchannel of the DASD.

    Tip: Use the uuidgen command to generate a UUID.
    Example: This example creates a CCW mediated device for subchannel 0.0.0004.
    # uuidgen
    18e124fb-b2fc-47f6-a407-f256b6c49767
    # echo 18e124fb-b2fc-47f6-a407-f256b6c49767 > \
    /sys/bus/css/devices/0.0.0004/mdev_supported_types/vfio_ccw-io/create
  4. Optional: Display subchannel information for the mediated device, by issuing lscss with the --vfio option.
    Example:
    $ lscss --vfio
    MDEV                                  Subchan.  PIM PAM POM   CHPIDs
    ------------------------------------------------------------------------------
    18e124fb-b2fc-47f6-a407-f256b6c49767  0.0.0004  c0  c0  ff 0  5020000 00000000