• Jiri Pirko's avatar
    virtio: add debugfs infrastructure to allow to debug virtio features · 96a8326d
    Jiri Pirko authored
    Currently there is no way for user to set what features the driver
    should obey or not, it is hard wired in the code.
    
    In order to be able to debug the device behavior in case some feature is
    disabled, introduce a debugfs infrastructure with couple of files
    allowing user to see what features the device advertises and
    to set filter for features used by driver.
    
    Example:
    $cat /sys/bus/virtio/devices/virtio0/features
    1110010111111111111101010000110010000000100000000000000000000000
    $ echo "5" >/sys/kernel/debug/virtio/virtio0/filter_feature_add
    $ cat /sys/kernel/debug/virtio/virtio0/filter_features
    5
    $ echo "virtio0" > /sys/bus/virtio/drivers/virtio_net/unbind
    $ echo "virtio0" > /sys/bus/virtio/drivers/virtio_net/bind
    $ cat /sys/bus/virtio/devices/virtio0/features
    1110000111111111111101010000110010000000100000000000000000000000
    
    Note that sysfs "features" now already exists, this patch does not
    touch it.
    Signed-off-by: default avatarJiri Pirko <jiri@nvidia.com>
    Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
    96a8326d
virtio.c 14.8 KB