| 1672 | } |
| 1673 | |
| 1674 | func (v *VfioPCI) runValidation() error { |
| 1675 | nvpci := nvpci.New() |
| 1676 | nvdevices, err := nvpci.GetGPUs() |
| 1677 | if err != nil { |
| 1678 | return fmt.Errorf("error getting NVIDIA PCI devices: %w", err) |
| 1679 | } |
| 1680 | |
| 1681 | for _, dev := range nvdevices { |
| 1682 | // TODO: Do not hardcode a list of VFIO driver names. This would be possible if we |
| 1683 | // added an API to go-nvlib which returns the most suitable VFIO driver for a GPU, |
| 1684 | // using logic similar to https://github.com/NVIDIA/k8s-driver-manager/commit/874c8cd26d775db437f16a42c3e44e74301b3a35 |
| 1685 | if dev.Driver != "vfio-pci" && dev.Driver != "nvgrace_gpu_vfio_pci" { |
| 1686 | return fmt.Errorf("device not bound to 'vfio-pci'; device: %s driver: '%s'", dev.Address, dev.Driver) |
| 1687 | } |
| 1688 | } |
| 1689 | |
| 1690 | return nil |
| 1691 | } |
| 1692 | |
| 1693 | func (v *VGPUManager) validate() error { |
| 1694 | ctx := v.ctx |