535.43.02

This commit is contained in:
Andy Ritger
2023-05-30 10:11:36 -07:00
parent 6dd092ddb7
commit eb5c7665a1
1403 changed files with 295367 additions and 86235 deletions

View File

@@ -919,9 +919,42 @@ compile_test() {
compile_check_conftest "$CODE" "NV_VFIO_MIGRATION_OPS_PRESENT" "" "types"
;;
mdev_parent)
vfio_log_ops)
#
# Determine if the struct mdev_parent type is present.
# Determine if vfio_log_ops struct is present or not
#
# Added by commit 80c4b92a2dc48 ("vfio: Introduce the DMA
# logging feature support") in v6.1
#
CODE="
#include <linux/pci.h>
#include <linux/vfio.h>
struct vfio_log_ops log_ops;
"
compile_check_conftest "$CODE" "NV_VFIO_LOG_OPS_PRESENT" "" "types"
;;
vfio_migration_ops_has_migration_get_data_size)
#
# Determine if vfio_migration_ops struct has .migration_get_data_size field.
#
# Added by commit in 4e016f969529f ("vfio: Add an option to get migration
# data size") in v6.2 kernel.
#
CODE="
#include <linux/pci.h>
#include <linux/vfio.h>
int conftest_mdev_vfio_migration_ops_has_migration_get_data_size(void) {
return offsetof(struct vfio_migration_ops, migration_get_data_size);
}"
compile_check_conftest "$CODE" "NV_VFIO_MIGRATION_OPS_HAS_MIGRATION_GET_DATA_SIZE" "" "types"
;;
mdev_parent_ops)
#
# Determine if the struct mdev_parent_ops type is present.
#
# Added by commit 42930553a7c1 ("vfio-mdev: de-polute the
# namespace, rename parent_device & parent_ops") in v4.10
@@ -929,12 +962,28 @@ compile_test() {
CODE="
#include <linux/pci.h>
#include <linux/mdev.h>
struct mdev_parent_ops conftest_mdev_parent;
struct mdev_parent_ops conftest_mdev_parent_ops;
"
compile_check_conftest "$CODE" "NV_MDEV_PARENT_OPS_STRUCT_PRESENT" "" "types"
;;
mdev_parent)
#
# Determine if the struct mdev_parent type is present.
#
# Added by commit 89345d5177aa ("vfio/mdev: embedd struct mdev_parent in
# the parent data structure") in v6.1
#
CODE="
#include <linux/pci.h>
#include <linux/mdev.h>
struct mdev_parent conftest_mdev_parent;
"
compile_check_conftest "$CODE" "NV_MDEV_PARENT_STRUCT_PRESENT" "" "types"
;;
mdev_parent_dev)
#
# Determine if mdev_parent_dev() function is present or not
@@ -952,6 +1001,23 @@ compile_test() {
compile_check_conftest "$CODE" "NV_MDEV_PARENT_DEV_PRESENT" "" "functions"
;;
vfio_free_device)
#
# Determine if vfio_free_device() function is present or not
#
# Removed by commit 913447d06f03 ("vfio: Remove vfio_free_device")
# in v6.2
#
CODE="
#include <linux/pci.h>
#include <linux/vfio.h>
void conftest_vfio_free_device() {
vfio_free_device();
}"
compile_check_conftest "$CODE" "NV_VFIO_FREE_DEVICE_PRESENT" "" "functions"
;;
mdev_from_dev)
#
# Determine if mdev_from_dev() function is present or not.
@@ -1124,7 +1190,6 @@ compile_test() {
compile_check_conftest "$CODE" "NV_VFIO_UNINIT_GROUP_DEV_PRESENT" "" "functions"
;;
vfio_pci_core_available)
# Determine if VFIO_PCI_CORE is available
#
@@ -1147,6 +1212,44 @@ compile_test() {
compile_check_conftest "$CODE" "NV_VFIO_PCI_CORE_PRESENT" "" "generic"
;;
mdev_available)
# Determine if MDEV is available
#
# Added by commit 7b96953bc640 ("vfio: Mediated device Core driver")
# in v4.10
#
CODE="
#if defined(NV_LINUX_MDEV_H_PRESENT)
#include <linux/pci.h>
#include <linux/mdev.h>
#endif
#if !defined(CONFIG_VFIO_MDEV) && !defined(CONFIG_VFIO_MDEV_MODULE)
#error MDEV not enabled
#endif
void conftest_mdev_available(void) {
struct mdev_device *mdev;
}"
compile_check_conftest "$CODE" "NV_MDEV_PRESENT" "" "generic"
;;
vfio_alloc_device)
#
# Determine if vfio_alloc_device() function is present or not.
#
# Added by commit cb9ff3f3b84c (vfio: Add helpers for unifying vfio_device
# life cycle) in v6.1
#
CODE="
#include <linux/vfio.h>
void conftest_vfio_alloc_device() {
vfio_alloc_device();
}"
compile_check_conftest "$CODE" "NV_VFIO_ALLOC_DEVICE_PRESENT" "" "functions"
;;
vfio_register_emulated_iommu_dev)
#
# Determine if vfio_register_emulated_iommu_dev() function is present or not.
@@ -2039,6 +2142,84 @@ compile_test() {
compile_check_conftest "$CODE" "NV_DRM_REINIT_PRIMARY_MODE_GROUP_PRESENT" "" "functions"
;;
drm_helper_crtc_enable_color_mgmt)
#
# Determine if the function drm_helper_crtc_enable_color_mgmt() is
# present.
#
# Added by commit 5488dc16fde7 ("drm: introduce pipe color
# correction properties") in v4.6 (2016-03-08).
#
# Removed by commit f8ed34ac7b45 ("drm: drm_helper_crtc_enable_color_mgmt()
# => drm_crtc_enable_color_mgmt()") in v4.8-rc1 (2016-06-07).
#
CODE="
#include <drm/drm_crtc_helper.h>
void conftest_drm_helper_crtc_enable_color_mgmt(void) {
drm_helper_crtc_enable_color_mgmt();
}"
compile_check_conftest "$CODE" "NV_DRM_HELPER_CRTC_ENABLE_COLOR_MGMT_PRESENT" "" "functions"
;;
drm_crtc_enable_color_mgmt)
#
# Determine if the function drm_crtc_enable_color_mgmt() is
# present.
#
# Added by commit f8ed34ac7b45 ("drm: drm_helper_crtc_enable_color_mgmt()
# => drm_crtc_enable_color_mgmt()") in v4.8-rc1 (2016-06-07), replacing
# drm_helper_crtc_enable_color_mgmt().
#
# Moved to drm_color_mgmt.[ch] by commit f1e2f66ce2d9 ("drm: Extract
# drm_color_mgmt.[hc]") in v4.9-rc1 (2016-09-22)
#
CODE="
#if defined(NV_DRM_DRM_CRTC_H_PRESENT)
#include <drm/drm_crtc.h>
#endif
#if defined(NV_DRM_DRM_COLOR_MGMT_H_PRESENT)
#include <drm/drm_color_mgmt.h>
#endif
void conftest_drm_crtc_enable_color_mgmt(void) {
drm_crtc_enable_color_mgmt();
}"
compile_check_conftest "$CODE" "NV_DRM_CRTC_ENABLE_COLOR_MGMT_PRESENT" "" "functions"
;;
drm_atomic_helper_legacy_gamma_set)
#
# Determine if the function drm_atomic_helper_legacy_gamma_set() is
# present.
#
# Added by commit 5488dc16fde7 ("drm: introduce pipe color
# correction properties") in v4.6 (2016-03-08)
#
# Accidentally moved to drm_atomic_state_helper.[ch] by commit
# 9ef8a9dc4b21 ("drm: Extract drm_atomic_state_helper.[ch]")
# and moved back to drm_atomic_helper.[ch] by commit 1d8224e790c7
# ("drm: Fix up drm_atomic_state_helper.[hc] extraction") in
# v5.0-rc1
#
# Removed by commit 6ca2ab8086af ("drm: automatic legacy gamma
# support") in v5.12 (2020-12-15)
#
CODE="
#if defined(NV_DRM_DRM_ATOMIC_HELPER_H_PRESENT)
#include <drm/drm_atomic_helper.h>
#endif
#if defined(NV_DRM_DRM_ATOMIC_STATE_HELPER_H_PRESENT)
#include <drm/drm_atomic_state_helper.h>
#endif
void conftest_drm_atomic_helper_legacy_gamma_set(void) {
drm_atomic_helper_legacy_gamma_set();
}"
compile_check_conftest "$CODE" "NV_DRM_ATOMIC_HELPER_LEGACY_GAMMA_SET_PRESENT" "" "functions"
;;
wait_on_bit_lock_argument_count)
#
# Determine how many arguments wait_on_bit_lock takes.
@@ -5501,6 +5682,28 @@ compile_test() {
compile_check_conftest "$CODE" "NV_MMGET_NOT_ZERO_PRESENT" "" "functions"
;;
mmgrab)
#
# Determine if mmgrab() function is present
#
# mmgrab() function was added by commit
# f1f1007644ffc8051a4c11427d58b1967ae7b75a ("mm: add new
# mmgrab() helper") in v4.11 (2017-02-01). See comment for
# mmget_not_zero for a description of how the headers have
# changed.
CODE="
#if defined(NV_LINUX_SCHED_MM_H_PRESENT)
#include <linux/sched/mm.h>
#elif defined(NV_LINUX_SCHED_H_PRESENT)
#include <linux/sched.h>
#endif
void conftest_mmgrab(void) {
mmgrab();
}"
compile_check_conftest "$CODE" "NV_MMGRAB_PRESENT" "" "functions"
;;
dma_resv_add_fence)
#
# Determine if the dma_resv_add_fence() function is present.
@@ -5621,6 +5824,80 @@ compile_test() {
compile_check_conftest "$CODE" "NV_ACPI_VIDEO_BACKLIGHT_USE_NATIVE" "" "functions"
;;
vm_fault_to_errno)
#
# Determine if the vm_fault_to_errno() function is present.
#
# vm_fault_to_errno() was added by commit 9a291a7c94281 (mm/hugetlb:
# report -EHWPOISON not -EFAULT when FOLL_HWPOISON is specified) in
# v4.12 (2017-06-02).
#
CODE="
#include <linux/mm_types.h>
void conftest_vm_fault_to_errno(void) {
vm_fault_to_errno();
}"
compile_check_conftest "$CODE" "NV_VM_FAULT_TO_ERRNO_PRESENT" "" "functions"
;;
handle_mm_fault_has_mm_arg)
#
# Determine if handle_mm_fault() has mm argument.
#
# mm argument was removed from handle_mm_fault() by commit
# dcddffd41d3f1d3bdcc1dce3f1cd142779b6d4c1 (07/26/2016) ("mm: do not
# pass mm_struct into handle_mm_fault") in v4.8.
#
# To test if handle_mm_fault() has mm argument, define a function
# with the expected signature and then define the corresponding
# function implementation with the expected signature. Successful
# compilation indicates that handle_mm_fault has the mm argument.
#
CODE="
#include <linux/mm.h>
#include <linux/mm_types.h>
typeof(handle_mm_fault) conftest_handle_mm_fault_has_mm_arg;
int conftest_handle_mm_fault_has_mm_arg(struct mm_struct *mm,
struct vm_area_struct *vma,
unsigned long address,
unsigned int flags) {
return 0;
}"
compile_check_conftest "$CODE" "NV_HANDLE_MM_FAULT_HAS_MM_ARG" "" "types"
;;
handle_mm_fault_has_pt_regs_arg)
#
# Determine if handle_mm_fault() has pt_regs argument.
#
# pt_regs argument was added to handle_mm_fault by commit
# bce617edecada007aee8610fbe2c14d10b8de2f6 (08/12/2020) ("mm: do
# page fault accounting in handle_mm_fault") in v5.9.
#
# To test if handle_mm_fault() has pt_regs argument, define a
# function with the expected signature and then define the
# corresponding function implementation with the expected signature.
# Successful compilation indicates that handle_mm_fault has the
# pt_regs argument.
#
CODE="
#include <linux/mm.h>
#include <linux/mm_types.h>
typeof(handle_mm_fault) conftest_handle_mm_fault_has_pt_regs_arg;
vm_fault_t conftest_handle_mm_fault_has_pt_regs_arg(struct vm_area_struct *vma,
unsigned long address,
unsigned int flags,
struct pt_regs *regs) {
return 0;
}"
compile_check_conftest "$CODE" "NV_HANDLE_MM_FAULT_HAS_PT_REGS_ARG" "" "types"
;;
pci_rebar_get_possible_sizes)
#
# Determine if the pci_rebar_get_possible_sizes() function is present.
@@ -5637,6 +5914,22 @@ compile_test() {
compile_check_conftest "$CODE" "NV_PCI_REBAR_GET_POSSIBLE_SIZES_PRESENT" "" "functions"
;;
wait_for_random_bytes)
#
# Determine if the wait_for_random_bytes() function is present.
#
# Added by commit e297a783e4156 ("random: add wait_for_random_bytes
# API") in v4.13
#
CODE="
#include <linux/random.h>
int conftest_wait_for_random_bytes(void) {
return wait_for_random_bytes(0);
}"
compile_check_conftest "$CODE" "NV_WAIT_FOR_RANDOM_BYTES_PRESENT" "" "functions"
;;
drm_connector_has_override_edid)
#
# Determine if 'struct drm_connector' has an 'override_edid' member.
@@ -5663,9 +5956,9 @@ compile_test() {
#
# Check if iommu_sva_bind_device() has drvdata parameter.
#
# Removed by commit be51b1d6bbff48c7d1943a8ff1e5a55777807f6e
# ("iommu/sva: Refactoring iommu_sva_bind/unbind_device()")
# in v6.2 (2022-10-31)
# drvdata argument was removed by commit
# 942fd5435dccb273f90176b046ae6bbba60cfbd8 ("iommu: Remove
# SVM_FLAG_SUPERVISOR_MODE support") in v6.2 (2022-10-31)
#
CODE="
#include <linux/iommu.h>
@@ -5699,6 +5992,66 @@ compile_test() {
compile_check_conftest "$CODE" "NV_VM_AREA_STRUCT_HAS_CONST_VM_FLAGS" "" "types"
;;
drm_driver_has_dumb_destroy)
#
# Determine if the 'drm_driver' structure has a 'dumb_destroy'
# function pointer.
#
# Removed by commit 96a7b60f6ddb2 ("drm: remove dumb_destroy
# callback") in v6.3 linux-next (2023-02-10).
#
CODE="
#if defined(NV_DRM_DRMP_H_PRESENT)
#include <drm/drmP.h>
#endif
#if defined(NV_DRM_DRM_DRV_H_PRESENT)
#include <drm/drm_drv.h>
#endif
int conftest_drm_driver_has_dumb_destroy(void) {
return offsetof(struct drm_driver, dumb_destroy);
}"
compile_check_conftest "$CODE" "NV_DRM_DRIVER_HAS_DUMB_DESTROY" "" "types"
;;
memory_failure_has_trapno_arg)
#
# Check if memory_failure() has trapno parameter.
#
# trapno argument was removed by commit
# 83b57531c58f4173d1c0d0b2c0bc88c853c32ea5 ("mm/memory_failure:
# Remove unused trapno from memory_failure") in v4.15.0 (2017-7-9)
#
CODE="
#include <linux/mm.h>
void conftest_memory_failure_has_trapno_arg(unsigned long pfn,
int trapno,
int flags) {
(void) memory_failure(pfn, trapno, flags);
}"
compile_check_conftest "$CODE" "NV_MEMORY_FAILURE_HAS_TRAPNO_ARG" "" "types"
;;
memory_failure_mf_sw_simulated_defined)
#
# Check if memory_failure() flag MF_SW_SIMULATED is defined.
#
# MF_SW_SIMULATED was added by commit
# 67f22ba7750f940bcd7e1b12720896c505c2d63f ("mm/hwpoison:
# fix unpoison_memory()") in v5.19.0-rc2 (2022-6-16)
#
CODE="
#include <linux/mm.h>
int conftest_memory_failure_mf_sw_simulated_defined(void) {
return MF_SW_SIMULATED;
}"
compile_check_conftest "$CODE" "NV_MEMORY_FAILURE_MF_SW_SIMULATED_DEFINED" "" "types"
;;
# When adding a new conftest entry, please use the correct format for
# specifying the relevant upstream Linux kernel commit.
#
@@ -6000,9 +6353,11 @@ case "$5" in
iommu=CONFIG_VFIO_IOMMU_TYPE1
mdev=CONFIG_VFIO_MDEV
kvm=CONFIG_KVM_VFIO
vfio_pci_core=CONFIG_VFIO_PCI_CORE
VFIO_IOMMU_PRESENT=0
VFIO_MDEV_PRESENT=0
KVM_PRESENT=0
VFIO_PCI_CORE_PRESENT=0
if [ -n "$VGX_KVM_BUILD" ]; then
if (test_configuration_option ${iommu} || test_configuration_option ${iommu}_MODULE); then
@@ -6017,32 +6372,50 @@ case "$5" in
KVM_PRESENT=1
fi
if [ "$VFIO_IOMMU_PRESENT" != "0" ] &&
[ "$VFIO_MDEV_PRESENT" != "0" ] &&
[ "$KVM_PRESENT" != "0" ] ; then
if (test_configuration_option ${vfio_pci_core} || test_configuration_option ${vfio_pci_core}_MODULE); then
VFIO_PCI_CORE_PRESENT=1
fi
# When this sanity check is run via nvidia-installer, it sets ARCH as aarch64.
# But, when it is run via Kbuild, ARCH is set as arm64
if [ "$ARCH" = "aarch64" ]; then
ARCH="arm64"
fi
if [ "$VFIO_IOMMU_PRESENT" != "0" ] && [ "$KVM_PRESENT" != "0" ] ; then
# On x86_64, vGPU requires MDEV framework to be present.
# On aarch64, vGPU requires vfio-pci-core framework to be present.
if ([ "$ARCH" = "arm64" ] && [ "$VFIO_PCI_CORE_PRESENT" != "0" ]) ||
([ "$ARCH" = "x86_64" ] && [ "$VFIO_MDEV_PRESENT" != "0" ];) then
exit 0
else
echo "Below CONFIG options are missing on the kernel for installing";
echo "NVIDIA vGPU driver on KVM host";
if [ "$VFIO_IOMMU_PRESENT" = "0" ]; then
echo "CONFIG_VFIO_IOMMU_TYPE1";
fi
fi
if [ "$VFIO_MDEV_PRESENT" = "0" ]; then
echo "CONFIG_VFIO_MDEV";
fi
echo "Below CONFIG options are missing on the kernel for installing";
echo "NVIDIA vGPU driver on KVM host";
if [ "$VFIO_IOMMU_PRESENT" = "0" ]; then
echo "CONFIG_VFIO_IOMMU_TYPE1";
fi
if [ "$KVM_PRESENT" = "0" ]; then
echo "CONFIG_KVM";
fi
echo "Please install the kernel with above CONFIG options set, then";
echo "try installing again";
if [ "$ARCH" = "arm64" ] && [ "$VFIO_PCI_CORE_PRESENT" = "0" ]; then
echo "CONFIG_VFIO_PCI_CORE";
fi
if [ "$ARCH" = "x86_64" ] && [ "$VFIO_MDEV_PRESENT" = "0" ]; then
echo "CONFIG_VFIO_MDEV";
fi
if [ "$KVM_PRESENT" = "0" ]; then
echo "CONFIG_KVM";
fi
echo "Please install the kernel with above CONFIG options set, then";
echo "try installing again";
echo "";
if [ "$VERBOSE" = "full_output" ]; then
echo "*** Failed vGPU on KVM sanity check. Bailing out! ***";
echo "";
if [ "$VERBOSE" = "full_output" ]; then
echo "*** Failed vGPU on KVM sanity check. Bailing out! ***";
echo "";
fi
fi
exit 1
else