1########################################################################### 2# Kbuild fragment for nvidia-uvm.ko 3########################################################################### 4 5UVM_BUILD_TYPE = release 6 7# 8# Define NVIDIA_UVM_{SOURCES,OBJECTS} 9# 10 11NVIDIA_UVM_OBJECTS = 12 13include $(src)/nvidia-uvm/nvidia-uvm-sources.Kbuild 14NVIDIA_UVM_OBJECTS += $(patsubst %.c,%.o,$(NVIDIA_UVM_SOURCES)) 15 16# Some linux kernel functions rely on being built with optimizations on and 17# to work around this we put wrappers for them in a separate file that's built 18# with optimizations on in debug builds and skipped in other builds. 19# Notably gcc 4.4 supports per function optimization attributes that would be 20# easier to use, but is too recent to rely on for now. 21NVIDIA_UVM_DEBUG_OPTIMIZED_SOURCE := nvidia-uvm/uvm_debug_optimized.c 22NVIDIA_UVM_DEBUG_OPTIMIZED_OBJECT := $(patsubst %.c,%.o,$(NVIDIA_UVM_DEBUG_OPTIMIZED_SOURCE)) 23 24ifneq ($(UVM_BUILD_TYPE),debug) 25 # Only build the wrappers on debug builds 26 NVIDIA_UVM_OBJECTS := $(filter-out $(NVIDIA_UVM_DEBUG_OPTIMIZED_OBJECT), $(NVIDIA_UVM_OBJECTS)) 27endif 28 29obj-m += nvidia-uvm.o 30nvidia-uvm-y := $(NVIDIA_UVM_OBJECTS) 31 32NVIDIA_UVM_KO = nvidia-uvm/nvidia-uvm.ko 33 34# 35# Define nvidia-uvm.ko-specific CFLAGS. 36# 37 38ifeq ($(UVM_BUILD_TYPE),debug) 39 NVIDIA_UVM_CFLAGS += -DDEBUG -O1 -g 40else 41 ifeq ($(UVM_BUILD_TYPE),develop) 42 # -DDEBUG is required, in order to allow pr_devel() print statements to 43 # work: 44 NVIDIA_UVM_CFLAGS += -DDEBUG 45 NVIDIA_UVM_CFLAGS += -DNVIDIA_UVM_DEVELOP 46 endif 47 NVIDIA_UVM_CFLAGS += -O2 48endif 49 50NVIDIA_UVM_CFLAGS += -DNVIDIA_UVM_ENABLED 51NVIDIA_UVM_CFLAGS += -DNVIDIA_UNDEF_LEGACY_BIT_MACROS 52 53NVIDIA_UVM_CFLAGS += -DLinux 54NVIDIA_UVM_CFLAGS += -D__linux__ 55NVIDIA_UVM_CFLAGS += -I$(src)/nvidia-uvm 56 57$(call ASSIGN_PER_OBJ_CFLAGS, $(NVIDIA_UVM_OBJECTS), $(NVIDIA_UVM_CFLAGS)) 58 59ifeq ($(UVM_BUILD_TYPE),debug) 60 # Force optimizations on for the wrappers 61 $(call ASSIGN_PER_OBJ_CFLAGS, $(NVIDIA_UVM_DEBUG_OPTIMIZED_OBJECT), $(NVIDIA_UVM_CFLAGS) -O2) 62endif 63 64# 65# Register the conftests needed by nvidia-uvm.ko 66# 67 68NV_OBJECTS_DEPEND_ON_CONFTEST += $(NVIDIA_UVM_OBJECTS) 69 70NV_CONFTEST_FUNCTION_COMPILE_TESTS += wait_on_bit_lock_argument_count 71NV_CONFTEST_FUNCTION_COMPILE_TESTS += pde_data 72NV_CONFTEST_FUNCTION_COMPILE_TESTS += radix_tree_empty 73NV_CONFTEST_FUNCTION_COMPILE_TESTS += radix_tree_replace_slot 74NV_CONFTEST_FUNCTION_COMPILE_TESTS += pnv_npu2_init_context 75NV_CONFTEST_FUNCTION_COMPILE_TESTS += vmf_insert_pfn 76NV_CONFTEST_FUNCTION_COMPILE_TESTS += cpumask_of_node 77NV_CONFTEST_FUNCTION_COMPILE_TESTS += list_is_first 78NV_CONFTEST_FUNCTION_COMPILE_TESTS += timer_setup 79NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_bus_address 80NV_CONFTEST_FUNCTION_COMPILE_TESTS += set_memory_uc 81NV_CONFTEST_FUNCTION_COMPILE_TESTS += set_pages_uc 82NV_CONFTEST_FUNCTION_COMPILE_TESTS += ktime_get_raw_ts64 83NV_CONFTEST_FUNCTION_COMPILE_TESTS += ioasid_get 84NV_CONFTEST_FUNCTION_COMPILE_TESTS += mm_pasid_set 85NV_CONFTEST_FUNCTION_COMPILE_TESTS += migrate_vma_setup 86NV_CONFTEST_FUNCTION_COMPILE_TESTS += mmget_not_zero 87NV_CONFTEST_FUNCTION_COMPILE_TESTS += iommu_sva_bind_device_has_drvdata_arg 88 89NV_CONFTEST_TYPE_COMPILE_TESTS += backing_dev_info 90NV_CONFTEST_TYPE_COMPILE_TESTS += mm_context_t 91NV_CONFTEST_TYPE_COMPILE_TESTS += get_user_pages_remote 92NV_CONFTEST_TYPE_COMPILE_TESTS += get_user_pages 93NV_CONFTEST_TYPE_COMPILE_TESTS += pin_user_pages_remote 94NV_CONFTEST_TYPE_COMPILE_TESTS += pin_user_pages 95NV_CONFTEST_TYPE_COMPILE_TESTS += vm_fault_has_address 96NV_CONFTEST_TYPE_COMPILE_TESTS += vm_ops_fault_removed_vma_arg 97NV_CONFTEST_TYPE_COMPILE_TESTS += kmem_cache_has_kobj_remove_work 98NV_CONFTEST_TYPE_COMPILE_TESTS += sysfs_slab_unlink 99NV_CONFTEST_TYPE_COMPILE_TESTS += vm_fault_t 100NV_CONFTEST_TYPE_COMPILE_TESTS += mmu_notifier_ops_invalidate_range 101NV_CONFTEST_TYPE_COMPILE_TESTS += proc_ops 102NV_CONFTEST_TYPE_COMPILE_TESTS += timespec64 103NV_CONFTEST_TYPE_COMPILE_TESTS += mm_has_mmap_lock 104NV_CONFTEST_TYPE_COMPILE_TESTS += migrate_vma_added_flags 105NV_CONFTEST_TYPE_COMPILE_TESTS += migrate_device_range 106NV_CONFTEST_TYPE_COMPILE_TESTS += vm_area_struct_has_const_vm_flags 107 108NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_int_active_memcg 109