Setting CCW devices offline or online

Red Hat Enterprise Linux 9.2 KVM guest

By default, all virtio CCW devices are online after an instance of Linux as a KVM guest on IBM Z is booted.

About this task

If the KVM hypervisor defines unnecessary devices to your Linux instance, you can set them offline.
Tip: You can also use the cio_ignore= kernel parameter to prevent unnecessary devices from being sensed in the first place.

Procedure

Use the chzdev or chccwdev command to set CCW devices offline or online.

Alternatively, write 0 to the device's sysfs online attribute to set it offline or 1 to set it online. In contrast to the commands, writing to the sysfs attribute does not trigger a cio_settle for you.

Use the cio_ignore= kernel parameter to persistently set a CCW device offline. Setting a device offline with chzdev and the --persistent option does not prevent the device from being set online with the next start of the virtual server.
For example, to set a device with bus ID 0.0.0815 offline, issue:
# chzdev -d 0.0.0815
To set this device back online, issue:
# chzdev -e 0.0.0815
To set the device offline by writing to sysfs, issue:
# echo 0 > /sys/bus/ccw/drivers/virtio_ccw/0.0.0815/online