]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
vfio: selftests: Add helper to set/override a vf_token
authorRaghavendra Rao Ananta <rananta@google.com>
Tue, 5 May 2026 21:28:36 +0000 (21:28 +0000)
committerAlex Williamson <alex@shazbot.org>
Wed, 20 May 2026 17:54:10 +0000 (11:54 -0600)
commit20face8c75ffb3dd7e8d6743498b47403e57ebda
tree1b2b89cfcce7e859002f8d30d3aedc32c23f9307
parent60ab36e5d02a8e50e1edce24bff58507b514b94e
vfio: selftests: Add helper to set/override a vf_token

Add a helper function, vfio_device_set_vf_token(), to set or override a
vf_token. Not only at init, but a vf_token can also be set via the
VFIO_DEVICE_FEATURE ioctl, by setting the
VFIO_DEVICE_FEATURE_PCI_VF_TOKEN flag. Hence, add an API to utilize this
functionality from the test code. The subsequent commit will use this to
test the functionality of this method to set the vf_token.

Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
Reviewed-by: David Matlack <dmatlack@google.com>
Reviewed-by: Vipin Sharma <vipinsh@google.com>
Tested-by: David Matlack <dmatlack@google.com>
Link: https://lore.kernel.org/r/20260505212838.1698034-7-rananta@google.com
Signed-off-by: Alex Williamson <alex@shazbot.org>
tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_device.h
tools/testing/selftests/vfio/lib/vfio_pci_device.c