nvidia-drivers: Improve match for NVIDIA GPUs

The logic for checking if we need to probe depends on the device showing up
with the product type in lspci output, which doesn't hold for all sorts of
GPUs. The NVIDIA_PRODUCT_TYPE is used for fetching the drivers and is "tesla"
across datacenter GPUs.

Switch to matching on vendor id and device class. The values are the same
ones that the nvidia driver binds to.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
This commit is contained in:
Jeremi Piotrowski 2024-02-22 15:19:16 +01:00
parent bf4b088cb8
commit 2cbd78091e
2 changed files with 8 additions and 3 deletions

View File

@ -136,10 +136,15 @@ function verify_installation() {
} }
function is_nvidia_probe_required() { function is_nvidia_probe_required() {
if [[ -z "$(lspci | grep -i "${NVIDIA_PRODUCT_TYPE}")" ]]; then # Vendor: NVIDIA, Class: VGA compatible controller
return 1 if [[ -n "$(lspci -d 10de:*:0300)" ]]; then
fi
return 0 return 0
fi
# Vendor: NVIDIA, Class: 3D controller
if [[ -n "$(lspci -d 10de:*:0302)" ]]; then
return 0
fi
return 1
} }
function is_nvidia_installation_required() { function is_nvidia_installation_required() {