]> git.baikalelectronics.ru Git - kernel.git/commit
vfio/pci: Reorganize VFIO_DEVICE_PCI_HOT_RESET to use the device set
authorJason Gunthorpe <jgg@nvidia.com>
Fri, 6 Aug 2021 01:19:06 +0000 (22:19 -0300)
committerAlex Williamson <alex.williamson@redhat.com>
Wed, 11 Aug 2021 15:50:11 +0000 (09:50 -0600)
commitcc5b4fba2329dc9134b714f0f8c4fb9e2eed370f
tree952af97681cbce56ff57d332a6e1b1cddc670e68
parent4eef54d8e8940914f5424ab7d1f3086e51c95399
vfio/pci: Reorganize VFIO_DEVICE_PCI_HOT_RESET to use the device set

Like vfio_pci_dev_set_try_reset() this code wants to reset all of the
devices in the "reset group" which is the same membership as the device
set.

Instead of trying to reconstruct the device set from the PCI list go
directly from the device set's device list to execute the reset.

The same basic structure as vfio_pci_dev_set_try_reset() is used. The
'vfio_devices' struct is replaced with the device set linked list and we
simply sweep it multiple times under the lock.

This eliminates a memory allocation and get/put traffic and another
improperly locked test of pci_dev_driver().

Reviewed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Link: https://lore.kernel.org/r/10-v4-9ea22c5e6afb+1adf-vfio_reflck_jgg@nvidia.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/pci/vfio_pci.c