From 54663362908244aee371c561ac0a478bec64bb49 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 4 Dec 2025 08:17:27 +0000 Subject: [PATCH] Bump github.com/NVIDIA/go-nvlib from 0.8.1 to 0.9.0 Bumps [github.com/NVIDIA/go-nvlib](https://github.com/NVIDIA/go-nvlib) from 0.8.1 to 0.9.0. - [Release notes](https://github.com/NVIDIA/go-nvlib/releases) - [Commits](https://github.com/NVIDIA/go-nvlib/compare/v0.8.1...v0.9.0) --- updated-dependencies: - dependency-name: github.com/NVIDIA/go-nvlib dependency-version: 0.9.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +-- .../go-nvlib/pkg/nvlib/device/device.go | 27 +++++++++++++++++++ .../pkg/nvlib/info/property-extractor.go | 1 + .../NVIDIA/go-nvlib/pkg/nvpci/mock.go | 7 +++++ .../NVIDIA/go-nvlib/pkg/nvpci/nvpci.go | 24 +++++++++++++++++ vendor/modules.txt | 2 +- 7 files changed, 63 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 3e3b1e91e..2b87cc0c4 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/NVIDIA/nvidia-container-toolkit go 1.25.0 require ( - github.com/NVIDIA/go-nvlib v0.8.1 + github.com/NVIDIA/go-nvlib v0.9.0 github.com/NVIDIA/go-nvml v0.13.0-1 github.com/google/uuid v1.6.0 github.com/moby/sys/mountinfo v0.7.2 diff --git a/go.sum b/go.sum index dc2afbda1..faa60c2d3 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ cyphar.com/go-pathrs v0.2.1 h1:9nx1vOgwVvX1mNBWDu93+vaceedpbsDqo+XuBGL40b8= cyphar.com/go-pathrs v0.2.1/go.mod h1:y8f1EMG7r+hCuFf/rXsKqMJrJAUoADZGNh5/vZPKcGc= -github.com/NVIDIA/go-nvlib v0.8.1 h1:OPEHVvn3zcV5OXB68A7WRpeCnYMRSPl7LdeJH/d3gZI= -github.com/NVIDIA/go-nvlib v0.8.1/go.mod h1:7mzx9FSdO9fXWP9NKuZmWkCwhkEcSWQFe2tmFwtLb9c= +github.com/NVIDIA/go-nvlib v0.9.0 h1:GKLIvLJ0uhCtTLLZp2Q8QIDRxOYH45MM4Y5OO3U5Rho= +github.com/NVIDIA/go-nvlib v0.9.0/go.mod h1:7mzx9FSdO9fXWP9NKuZmWkCwhkEcSWQFe2tmFwtLb9c= github.com/NVIDIA/go-nvml v0.13.0-1 h1:OLX8Jq3dONuPOQPC7rndB6+iDmDakw0XTYgzMxObkEw= github.com/NVIDIA/go-nvml v0.13.0-1/go.mod h1:+KNA7c7gIBH7SKSJ1ntlwkfN80zdx8ovl4hrK3LmPt4= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= diff --git a/vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/device.go b/vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/device.go index e2089f7d3..a67ce3c1b 100644 --- a/vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/device.go +++ b/vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/device/device.go @@ -29,6 +29,7 @@ type Device interface { GetArchitectureAsString() (string, error) GetBrandAsString() (string, error) GetCudaComputeCapabilityAsString() (string, error) + GetAddressingModeAsString() (string, error) GetMigDevices() ([]MigDevice, error) GetMigProfiles() ([]MigProfile, error) GetPCIBusID() (string, error) @@ -146,6 +147,32 @@ func (d *device) GetBrandAsString() (string, error) { return "", fmt.Errorf("error interpreting device brand as string: %v", brand) } +// GetAddressingModeAsString returns the Device addressing mode as a string. +func (d *device) GetAddressingModeAsString() (string, error) { + mode, ret := d.GetAddressingMode() + + switch ret { + case nvml.SUCCESS: + // continue + case nvml.ERROR_NOT_SUPPORTED: + // Addressing mode is not supported on the current platform. + return "", nil + default: + return "", fmt.Errorf("error getting device addressing mode: %v", ret) + } + + switch nvml.DeviceAddressingModeType(mode.Value) { + case nvml.DEVICE_ADDRESSING_MODE_ATS: + return "ATS", nil + case nvml.DEVICE_ADDRESSING_MODE_HMM: + return "HMM", nil + case nvml.DEVICE_ADDRESSING_MODE_NONE: + return "None", nil + } + + return "", fmt.Errorf("error interpreting addressing mode as string: %v", mode) +} + // GetPCIBusID returns the string representation of the bus ID. func (d *device) GetPCIBusID() (string, error) { info, ret := d.GetPciInfo() diff --git a/vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/info/property-extractor.go b/vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/info/property-extractor.go index 202047133..9d8e6defd 100644 --- a/vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/info/property-extractor.go +++ b/vendor/github.com/NVIDIA/go-nvlib/pkg/nvlib/info/property-extractor.go @@ -59,6 +59,7 @@ func (i *propertyExtractor) HasNvml() (bool, string) { } // IsTegraSystem returns true if the system is detected as a Tegra-based system. +// // Deprecated: Use HasTegraFiles instead. func (i *propertyExtractor) IsTegraSystem() (bool, string) { return i.HasTegraFiles() diff --git a/vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/mock.go b/vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/mock.go index f7b4bb186..375cfb584 100644 --- a/vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/mock.go +++ b/vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/mock.go @@ -84,6 +84,13 @@ func (m *MockNvpci) AddMockA100(address string, numaNode int, sriov *SriovInfo) return err } + vfioDev := filepath.Join(deviceDir, "vfio-dev") + vfioFD := filepath.Join(vfioDev, "vfio8") + err = os.MkdirAll(vfioFD, 0755) + if err != nil { + return err + } + iommuGroup := 20 _, err = os.Create(filepath.Join(deviceDir, strconv.Itoa(iommuGroup))) if err != nil { diff --git a/vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/nvpci.go b/vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/nvpci.go index 1165ab138..f41d0f246 100644 --- a/vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/nvpci.go +++ b/vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/nvpci.go @@ -115,6 +115,7 @@ type NvidiaPCIDevice struct { DeviceName string Driver string IommuGroup int + IommuFD string NumaNode int Config *ConfigSpace Resources MemoryResources @@ -292,6 +293,12 @@ func (p *nvpci) getGPUByPciBusID(address string, cache map[string]*NvidiaPCIDevi return nil, fmt.Errorf("unable to detect IOMMU group for %s: %w", address, err) } + iommuFD, err := getIOMMUFD(devicePath) + if err != nil { + // log a warning, do not return an error as this host may not have iommufd configured/supported + p.logger.Warningf("unable to detect IOMMU FD for %s: %v", address, err) + } + numa, err := os.ReadFile(path.Join(devicePath, "numa_node")) if err != nil { return nil, fmt.Errorf("unable to read PCI NUMA node for %s: %v", address, err) @@ -376,6 +383,7 @@ func (p *nvpci) getGPUByPciBusID(address string, cache map[string]*NvidiaPCIDevi Device: uint16(deviceID), Driver: driver, IommuGroup: int(iommuGroup), + IommuFD: iommuFD, NumaNode: int(numaNode), Config: config, Resources: resources, @@ -523,6 +531,22 @@ func getDriver(devicePath string) (string, error) { return "", err } +func getIOMMUFD(devicePath string) (string, error) { + content, err := os.ReadDir(path.Join(devicePath, "vfio-dev")) + if err != nil { + return "", err + } + for _, c := range content { + if !c.IsDir() { + continue + } + if strings.HasPrefix(c.Name(), "vfio") { + return c.Name(), nil + } + } + return "", fmt.Errorf("no iommufd device found") +} + func getIOMMUGroup(devicePath string) (int64, error) { var iommuGroup int64 iommu, err := filepath.EvalSymlinks(path.Join(devicePath, "iommu_group")) diff --git a/vendor/modules.txt b/vendor/modules.txt index e405cc0df..078e30511 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -4,7 +4,7 @@ cyphar.com/go-pathrs cyphar.com/go-pathrs/internal/fdutils cyphar.com/go-pathrs/internal/libpathrs cyphar.com/go-pathrs/procfs -# github.com/NVIDIA/go-nvlib v0.8.1 +# github.com/NVIDIA/go-nvlib v0.9.0 ## explicit; go 1.20 github.com/NVIDIA/go-nvlib/pkg/nvlib/device github.com/NVIDIA/go-nvlib/pkg/nvlib/info