├── .gitignore ├── README.md ├── bench ├── cugraph │ ├── bfs.py │ ├── louvain.py │ ├── pagerank.py │ └── wcc.py ├── microbench │ ├── common │ │ ├── GL │ │ │ ├── freeglut.h │ │ │ ├── freeglut_ext.h │ │ │ ├── freeglut_std.h │ │ │ ├── glew.h │ │ │ ├── glext.h │ │ │ ├── glut.h │ │ │ ├── glxew.h │ │ │ ├── glxext.h │ │ │ ├── wglew.h │ │ │ └── wglext.h │ │ ├── UtilNPP │ │ │ ├── Exceptions.h │ │ │ ├── Image.h │ │ │ ├── ImageAllocatorsCPU.h │ │ │ ├── ImageAllocatorsNPP.h │ │ │ ├── ImageIO.h │ │ │ ├── ImagePacked.h │ │ │ ├── ImagesCPU.h │ │ │ ├── ImagesNPP.h │ │ │ ├── Pixel.h │ │ │ ├── Signal.h │ │ │ ├── SignalAllocatorsCPU.h │ │ │ ├── SignalAllocatorsNPP.h │ │ │ ├── SignalsCPU.h │ │ │ └── SignalsNPP.h │ │ ├── data │ │ │ ├── CT_skull_512x512_8u.raw │ │ │ ├── CT_skull_512x512_8u_Gray.raw │ │ │ ├── PCB2_1024x683_8u.raw │ │ │ ├── PCB_1280x720_8u.raw │ │ │ ├── PCB_METAL_509x335_8u.raw │ │ │ ├── Rocks_512x512_8u_Gray.raw │ │ │ ├── teapot512.pgm │ │ │ ├── teapot_512x512_8u.raw │ │ │ └── teapot_512x512_8u_Gray.raw │ │ ├── drvapi_error_string.h │ │ ├── dynlink_d3d10.h │ │ ├── dynlink_d3d11.h │ │ ├── exception.h │ │ ├── helper_cuda.h │ │ ├── helper_cuda_drvapi.h │ │ ├── helper_cusolver.h │ │ ├── helper_functions.h │ │ ├── helper_gl.h │ │ ├── helper_image.h │ │ ├── helper_math.h │ │ ├── helper_multiprocess.cpp │ │ ├── helper_multiprocess.h │ │ ├── helper_nvJPEG.hxx │ │ ├── helper_string.h │ │ ├── helper_timer.h │ │ ├── multithreading.cpp │ │ ├── multithreading.h │ │ ├── nvMath.h │ │ ├── nvMatrix.h │ │ ├── nvQuaternion.h │ │ ├── nvShaderUtils.h │ │ ├── nvVector.h │ │ ├── nvrtc_helper.h │ │ ├── param.h │ │ ├── paramgl.h │ │ ├── rendercheck_d3d10.cpp │ │ ├── rendercheck_d3d10.h │ │ ├── rendercheck_d3d11.cpp │ │ ├── rendercheck_d3d11.h │ │ ├── rendercheck_d3d9.cpp │ │ ├── rendercheck_d3d9.h │ │ ├── rendercheck_gl.h │ │ └── rendercheck_gles.h │ └── vectorAdd │ │ ├── Makefile │ │ ├── README.md │ │ ├── common.h │ │ ├── vectorAdd │ │ └── vectorAdd.cu └── pytorch │ ├── README.md │ ├── main.py │ └── requirements.txt ├── docs ├── README-parameters.md └── README.md ├── driver ├── .gitignore ├── Kbuild ├── Makefile ├── common │ └── inc │ │ ├── conftest.h │ │ ├── cpuopsys.h │ │ ├── nv-caps.h │ │ ├── nv-gpu-info.h │ │ ├── nv-hash.h │ │ ├── nv-hypervisor.h │ │ ├── nv-ioctl-numa.h │ │ ├── nv-ioctl-numbers.h │ │ ├── nv-ioctl.h │ │ ├── nv-kernel-interface-api.h │ │ ├── nv-kref.h │ │ ├── nv-kthread-q.h │ │ ├── nv-linux.h │ │ ├── nv-list-helpers.h │ │ ├── nv-lock.h │ │ ├── nv-memdbg.h │ │ ├── nv-misc.h │ │ ├── nv-mm.h │ │ ├── nv-modeset-interface.h │ │ ├── nv-msi.h │ │ ├── nv-pci-types.h │ │ ├── nv-pci.h │ │ ├── nv-pgprot.h │ │ ├── nv-procfs.h │ │ ├── nv-proto.h │ │ ├── nv-register-module.h │ │ ├── nv-retpoline.h │ │ ├── nv-time.h │ │ ├── nv-timer.h │ │ ├── nv.h │ │ ├── nvCpuUuid.h │ │ ├── nv_speculation_barrier.h │ │ ├── nv_uvm_interface.h │ │ ├── nv_uvm_types.h │ │ ├── nvgputypes.h │ │ ├── nvkms-api-types.h │ │ ├── nvkms-format.h │ │ ├── nvkms-kapi.h │ │ ├── nvlimits.h │ │ ├── nvmisc.h │ │ ├── nvstatus.h │ │ ├── nvstatuscodes.h │ │ ├── nvtypes.h │ │ ├── os-interface.h │ │ ├── os │ │ └── nv_memory_type.h │ │ └── xapi-sdk.h ├── conftest.sh ├── dkms.conf ├── nvidia-drm │ ├── nv-pci-table.c │ ├── nv-pci-table.h │ ├── nvidia-dma-fence-helper.h │ ├── nvidia-dma-resv-helper.h │ ├── nvidia-drm-conftest.h │ ├── nvidia-drm-connector.c │ ├── nvidia-drm-connector.h │ ├── nvidia-drm-crtc.c │ ├── nvidia-drm-crtc.h │ ├── nvidia-drm-drv.c │ ├── nvidia-drm-drv.h │ ├── nvidia-drm-encoder.c │ ├── nvidia-drm-encoder.h │ ├── nvidia-drm-fb.c │ ├── nvidia-drm-fb.h │ ├── nvidia-drm-format.c │ ├── nvidia-drm-format.h │ ├── nvidia-drm-gem-dma-buf.c │ ├── nvidia-drm-gem-dma-buf.h │ ├── nvidia-drm-gem-nvkms-memory.c │ ├── nvidia-drm-gem-nvkms-memory.h │ ├── nvidia-drm-gem-user-memory.c │ ├── nvidia-drm-gem-user-memory.h │ ├── nvidia-drm-gem.c │ ├── nvidia-drm-gem.h │ ├── nvidia-drm-helper.c │ ├── nvidia-drm-helper.h │ ├── nvidia-drm-ioctl.h │ ├── nvidia-drm-linux.c │ ├── nvidia-drm-modeset.c │ ├── nvidia-drm-modeset.h │ ├── nvidia-drm-os-interface.h │ ├── nvidia-drm-prime-fence.c │ ├── nvidia-drm-prime-fence.h │ ├── nvidia-drm-priv.h │ ├── nvidia-drm-utils.c │ ├── nvidia-drm-utils.h │ ├── nvidia-drm.Kbuild │ ├── nvidia-drm.c │ └── nvidia-drm.h ├── nvidia-modeset │ ├── nv-kthread-q.c │ ├── nv-modeset-kernel.o_binary │ ├── nvidia-modeset-linux.c │ ├── nvidia-modeset-os-interface.h │ ├── nvidia-modeset.Kbuild │ ├── nvkms-ioctl.h │ └── nvkms.h ├── nvidia-uvm │ ├── cla06f.h │ ├── cla06fsubch.h │ ├── cla0b5.h │ ├── cla16f.h │ ├── clb069.h │ ├── clb06f.h │ ├── clb0b5.h │ ├── clc06f.h │ ├── clc076.h │ ├── clc0b5.h │ ├── clc1b5.h │ ├── clc365.h │ ├── clc369.h │ ├── clc36f.h │ ├── clc3b5.h │ ├── clc46f.h │ ├── clc56f.h │ ├── clc5b5.h │ ├── clc6b5.h │ ├── clc7b5.h │ ├── cscope.files │ ├── ctrl2080mc.h │ ├── hwref │ │ ├── ampere │ │ │ └── ga100 │ │ │ │ ├── dev_fault.h │ │ │ │ └── dev_runlist.h │ │ ├── kepler │ │ │ └── gk104 │ │ │ │ └── dev_mmu.h │ │ ├── pascal │ │ │ └── gp100 │ │ │ │ ├── dev_fault.h │ │ │ │ ├── dev_fb.h │ │ │ │ └── dev_mmu.h │ │ ├── turing │ │ │ └── tu102 │ │ │ │ ├── dev_fault.h │ │ │ │ └── dev_mmu.h │ │ └── volta │ │ │ └── gv100 │ │ │ ├── dev_fault.h │ │ │ ├── dev_fb.h │ │ │ └── dev_mmu.h │ ├── nv-kthread-q-selftest.c │ ├── nv-kthread-q.c │ ├── nvCpuUuid.c │ ├── nvidia-uvm-sources.Kbuild │ ├── nvidia-uvm.Kbuild │ ├── nvstatus.c │ ├── uvm.c │ ├── uvm.h │ ├── uvm_ampere.c │ ├── uvm_ampere_ce.c │ ├── uvm_ampere_fault_buffer.h │ ├── uvm_ampere_host.c │ ├── uvm_ampere_mmu.c │ ├── uvm_api.h │ ├── uvm_ats_faults.c │ ├── uvm_ats_faults.h │ ├── uvm_ats_ibm.c │ ├── uvm_ats_ibm.h │ ├── uvm_ce_test.c │ ├── uvm_channel.c │ ├── uvm_channel.h │ ├── uvm_channel_test.c │ ├── uvm_common.c │ ├── uvm_common.h │ ├── uvm_debug_optimized.c │ ├── uvm_extern_decl.h │ ├── uvm_fault_buffer_flush_test.c │ ├── uvm_forward_decl.h │ ├── uvm_get_rm_ptes_test.c │ ├── uvm_global.c │ ├── uvm_global.h │ ├── uvm_gpu.c │ ├── uvm_gpu.h │ ├── uvm_gpu_access_counters.c │ ├── uvm_gpu_access_counters.h │ ├── uvm_gpu_isr.c │ ├── uvm_gpu_isr.h │ ├── uvm_gpu_non_replayable_faults.c │ ├── uvm_gpu_non_replayable_faults.h │ ├── uvm_gpu_replayable_faults.c │ ├── uvm_gpu_replayable_faults.h │ ├── uvm_gpu_semaphore.c │ ├── uvm_gpu_semaphore.h │ ├── uvm_gpu_semaphore_test.c │ ├── uvm_hal.c │ ├── uvm_hal.h │ ├── uvm_hal_types.h │ ├── uvm_hmm.c │ ├── uvm_hmm.h │ ├── uvm_ioctl.h │ ├── uvm_kepler.c │ ├── uvm_kepler_ce.c │ ├── uvm_kepler_host.c │ ├── uvm_kepler_mmu.c │ ├── uvm_kvmalloc.c │ ├── uvm_kvmalloc.h │ ├── uvm_kvmalloc_test.c │ ├── uvm_linux.c │ ├── uvm_linux.h │ ├── uvm_linux_ioctl.h │ ├── uvm_lock.c │ ├── uvm_lock.h │ ├── uvm_lock_test.c │ ├── uvm_map_external.c │ ├── uvm_map_external.h │ ├── uvm_maxwell.c │ ├── uvm_maxwell_host.c │ ├── uvm_mem.c │ ├── uvm_mem.h │ ├── uvm_mem_test.c │ ├── uvm_migrate.c │ ├── uvm_migrate.h │ ├── uvm_migrate_pageable.c │ ├── uvm_migrate_pageable.h │ ├── uvm_mmu.c │ ├── uvm_mmu.h │ ├── uvm_mmu_test.c │ ├── uvm_page_tree_test.c │ ├── uvm_pascal.c │ ├── uvm_pascal_ce.c │ ├── uvm_pascal_fault_buffer.c │ ├── uvm_pascal_fault_buffer.h │ ├── uvm_pascal_host.c │ ├── uvm_pascal_mmu.c │ ├── uvm_peer_identity_mappings_test.c │ ├── uvm_perf_events.c │ ├── uvm_perf_events.h │ ├── uvm_perf_events_test.c │ ├── uvm_perf_heuristics.c │ ├── uvm_perf_heuristics.h │ ├── uvm_perf_module.c │ ├── uvm_perf_module.h │ ├── uvm_perf_module_test.c │ ├── uvm_perf_prefetch.c │ ├── uvm_perf_prefetch.h │ ├── uvm_perf_thrashing.c │ ├── uvm_perf_thrashing.h │ ├── uvm_perf_utils.c │ ├── uvm_perf_utils.h │ ├── uvm_perf_utils_test.c │ ├── uvm_pmm_gpu.c │ ├── uvm_pmm_gpu.h │ ├── uvm_pmm_sysmem.c │ ├── uvm_pmm_sysmem.h │ ├── uvm_pmm_sysmem_test.c │ ├── uvm_pmm_test.c │ ├── uvm_policy.c │ ├── uvm_populate_pageable.c │ ├── uvm_populate_pageable.h │ ├── uvm_processors.h │ ├── uvm_procfs.c │ ├── uvm_procfs.h │ ├── uvm_pte_batch.c │ ├── uvm_pte_batch.h │ ├── uvm_push.c │ ├── uvm_push.h │ ├── uvm_push_macros.h │ ├── uvm_push_test.c │ ├── uvm_pushbuffer.c │ ├── uvm_pushbuffer.h │ ├── uvm_range_allocator.c │ ├── uvm_range_allocator.h │ ├── uvm_range_allocator_test.c │ ├── uvm_range_group.c │ ├── uvm_range_group.h │ ├── uvm_range_group_tree_test.c │ ├── uvm_range_tree.c │ ├── uvm_range_tree.h │ ├── uvm_range_tree_test.c │ ├── uvm_rb_tree.c │ ├── uvm_rb_tree.h │ ├── uvm_rb_tree_test.c │ ├── uvm_rm_mem.c │ ├── uvm_rm_mem.h │ ├── uvm_rm_mem_test.c │ ├── uvm_test.c │ ├── uvm_test.h │ ├── uvm_test_ioctl.h │ ├── uvm_test_rng.c │ ├── uvm_test_rng.h │ ├── uvm_thread_context.c │ ├── uvm_thread_context.h │ ├── uvm_thread_context_test.c │ ├── uvm_tlb_batch.c │ ├── uvm_tlb_batch.h │ ├── uvm_tools.c │ ├── uvm_tools.h │ ├── uvm_tools_init.h │ ├── uvm_tracker.c │ ├── uvm_tracker.h │ ├── uvm_tracker_test.c │ ├── uvm_turing.c │ ├── uvm_turing_fault_buffer.h │ ├── uvm_turing_host.c │ ├── uvm_turing_mmu.c │ ├── uvm_types.h │ ├── uvm_unit_test.h │ ├── uvm_user_channel.c │ ├── uvm_user_channel.h │ ├── uvm_va_block.c │ ├── uvm_va_block.h │ ├── uvm_va_block_.c │ ├── uvm_va_block_test.c │ ├── uvm_va_block_types.h │ ├── uvm_va_range.c │ ├── uvm_va_range.h │ ├── uvm_va_space.c │ ├── uvm_va_space.h │ ├── uvm_va_space_mm.c │ ├── uvm_va_space_mm.h │ ├── uvm_volta.c │ ├── uvm_volta_access_counter_buffer.c │ ├── uvm_volta_fault_buffer.c │ ├── uvm_volta_fault_buffer.h │ ├── uvm_volta_host.c │ └── uvm_volta_mmu.c └── nvidia │ ├── export_nvswitch.h │ ├── ioctl_common_nvswitch.h │ ├── ioctl_nvswitch.h │ ├── linux_nvswitch.c │ ├── linux_nvswitch.h │ ├── nv-acpi.c │ ├── nv-caps.c │ ├── nv-cray.c │ ├── nv-dma.c │ ├── nv-frontend.c │ ├── nv-frontend.h │ ├── nv-i2c.c │ ├── nv-ibmnpu.c │ ├── nv-ibmnpu.h │ ├── nv-kernel.o_binary │ ├── nv-kthread-q.c │ ├── nv-memdbg.c │ ├── nv-mmap.c │ ├── nv-modeset-interface.c │ ├── nv-msi.c │ ├── nv-p2p.c │ ├── nv-p2p.h │ ├── nv-pat.c │ ├── nv-pat.h │ ├── nv-pci-table.c │ ├── nv-pci-table.h │ ├── nv-pci.c │ ├── nv-procfs.c │ ├── nv-reg.h │ ├── nv-report-err.c │ ├── nv-report-err.h │ ├── nv-rsync.c │ ├── nv-rsync.h │ ├── nv-usermap.c │ ├── nv-vm.c │ ├── nv-vtophys.c │ ├── nv.c │ ├── nv_gpu_ops.h │ ├── nv_uvm_interface.c │ ├── nvidia-sources.Kbuild │ ├── nvidia.Kbuild │ ├── nvlink_caps.c │ ├── nvlink_caps.h │ ├── nvlink_common.h │ ├── nvlink_errors.h │ ├── nvlink_export.h │ ├── nvlink_linux.c │ ├── nvlink_linux.h │ ├── nvlink_os.h │ ├── nvlink_pci.h │ ├── nvlink_proto.h │ ├── os-interface.c │ ├── os-mlock.c │ ├── os-pci.c │ ├── os-registry.c │ ├── os-usermap.c │ ├── procfs_nvswitch.c │ └── rmp2pdefines.h ├── driver_base ├── Kbuild ├── Makefile ├── common │ └── inc │ │ ├── conftest.h │ │ ├── cpuopsys.h │ │ ├── nv-caps.h │ │ ├── nv-gpu-info.h │ │ ├── nv-hash.h │ │ ├── nv-hypervisor.h │ │ ├── nv-ioctl-numa.h │ │ ├── nv-ioctl-numbers.h │ │ ├── nv-ioctl.h │ │ ├── nv-kernel-interface-api.h │ │ ├── nv-kref.h │ │ ├── nv-kthread-q.h │ │ ├── nv-linux.h │ │ ├── nv-list-helpers.h │ │ ├── nv-lock.h │ │ ├── nv-memdbg.h │ │ ├── nv-misc.h │ │ ├── nv-mm.h │ │ ├── nv-modeset-interface.h │ │ ├── nv-msi.h │ │ ├── nv-pci-types.h │ │ ├── nv-pci.h │ │ ├── nv-pgprot.h │ │ ├── nv-procfs.h │ │ ├── nv-proto.h │ │ ├── nv-register-module.h │ │ ├── nv-retpoline.h │ │ ├── nv-time.h │ │ ├── nv-timer.h │ │ ├── nv.h │ │ ├── nvCpuUuid.h │ │ ├── nv_speculation_barrier.h │ │ ├── nv_uvm_interface.h │ │ ├── nv_uvm_types.h │ │ ├── nvgputypes.h │ │ ├── nvkms-api-types.h │ │ ├── nvkms-format.h │ │ ├── nvkms-kapi.h │ │ ├── nvlimits.h │ │ ├── nvmisc.h │ │ ├── nvstatus.h │ │ ├── nvstatuscodes.h │ │ ├── nvtypes.h │ │ ├── os-interface.h │ │ ├── os │ │ └── nv_memory_type.h │ │ └── xapi-sdk.h ├── conftest.sh ├── dkms.conf ├── nvidia-drm │ ├── nv-pci-table.c │ ├── nv-pci-table.h │ ├── nvidia-dma-fence-helper.h │ ├── nvidia-dma-resv-helper.h │ ├── nvidia-drm-conftest.h │ ├── nvidia-drm-connector.c │ ├── nvidia-drm-connector.h │ ├── nvidia-drm-crtc.c │ ├── nvidia-drm-crtc.h │ ├── nvidia-drm-drv.c │ ├── nvidia-drm-drv.h │ ├── nvidia-drm-encoder.c │ ├── nvidia-drm-encoder.h │ ├── nvidia-drm-fb.c │ ├── nvidia-drm-fb.h │ ├── nvidia-drm-format.c │ ├── nvidia-drm-format.h │ ├── nvidia-drm-gem-dma-buf.c │ ├── nvidia-drm-gem-dma-buf.h │ ├── nvidia-drm-gem-nvkms-memory.c │ ├── nvidia-drm-gem-nvkms-memory.h │ ├── nvidia-drm-gem-user-memory.c │ ├── nvidia-drm-gem-user-memory.h │ ├── nvidia-drm-gem.c │ ├── nvidia-drm-gem.h │ ├── nvidia-drm-helper.c │ ├── nvidia-drm-helper.h │ ├── nvidia-drm-ioctl.h │ ├── nvidia-drm-linux.c │ ├── nvidia-drm-modeset.c │ ├── nvidia-drm-modeset.h │ ├── nvidia-drm-modeset.o.ur-safe │ ├── nvidia-drm-os-interface.h │ ├── nvidia-drm-prime-fence.c │ ├── nvidia-drm-prime-fence.h │ ├── nvidia-drm-prime-fence.o.ur-safe │ ├── nvidia-drm-priv.h │ ├── nvidia-drm-utils.c │ ├── nvidia-drm-utils.h │ ├── nvidia-drm.Kbuild │ ├── nvidia-drm.c │ └── nvidia-drm.h ├── nvidia-modeset │ ├── nv-kthread-q.c │ ├── nv-modeset-kernel.o_binary │ ├── nvidia-modeset-linux.c │ ├── nvidia-modeset-os-interface.h │ ├── nvidia-modeset.Kbuild │ ├── nvkms-ioctl.h │ └── nvkms.h ├── nvidia-uvm │ ├── cla06f.h │ ├── cla06fsubch.h │ ├── cla0b5.h │ ├── cla16f.h │ ├── clb069.h │ ├── clb06f.h │ ├── clb0b5.h │ ├── clc06f.h │ ├── clc076.h │ ├── clc0b5.h │ ├── clc1b5.h │ ├── clc365.h │ ├── clc369.h │ ├── clc36f.h │ ├── clc3b5.h │ ├── clc46f.h │ ├── clc56f.h │ ├── clc5b5.h │ ├── clc6b5.h │ ├── clc7b5.h │ ├── ctrl2080mc.h │ ├── hwref │ │ ├── ampere │ │ │ └── ga100 │ │ │ │ ├── dev_fault.h │ │ │ │ └── dev_runlist.h │ │ ├── kepler │ │ │ └── gk104 │ │ │ │ └── dev_mmu.h │ │ ├── pascal │ │ │ └── gp100 │ │ │ │ ├── dev_fault.h │ │ │ │ ├── dev_fb.h │ │ │ │ └── dev_mmu.h │ │ ├── turing │ │ │ └── tu102 │ │ │ │ ├── dev_fault.h │ │ │ │ └── dev_mmu.h │ │ └── volta │ │ │ └── gv100 │ │ │ ├── dev_fault.h │ │ │ ├── dev_fb.h │ │ │ └── dev_mmu.h │ ├── nv-kthread-q-selftest.c │ ├── nv-kthread-q.c │ ├── nvCpuUuid.c │ ├── nvidia-uvm-sources.Kbuild │ ├── nvidia-uvm.Kbuild │ ├── nvstatus.c │ ├── uvm.c │ ├── uvm.h │ ├── uvm.o.ur-safe │ ├── uvm_ampere.c │ ├── uvm_ampere_ce.c │ ├── uvm_ampere_fault_buffer.h │ ├── uvm_ampere_host.c │ ├── uvm_ampere_mmu.c │ ├── uvm_api.h │ ├── uvm_ats_faults.c │ ├── uvm_ats_faults.h │ ├── uvm_ats_ibm.c │ ├── uvm_ats_ibm.h │ ├── uvm_ce_test.c │ ├── uvm_channel.c │ ├── uvm_channel.h │ ├── uvm_channel.o.ur-safe │ ├── uvm_channel_test.c │ ├── uvm_common.c │ ├── uvm_common.h │ ├── uvm_common.o.ur-safe │ ├── uvm_debug_optimized.c │ ├── uvm_extern_decl.h │ ├── uvm_fault_buffer_flush_test.c │ ├── uvm_forward_decl.h │ ├── uvm_get_rm_ptes_test.c │ ├── uvm_global.c │ ├── uvm_global.h │ ├── uvm_gpu.c │ ├── uvm_gpu.h │ ├── uvm_gpu.o.ur-safe │ ├── uvm_gpu_access_counters.c │ ├── uvm_gpu_access_counters.h │ ├── uvm_gpu_isr.c │ ├── uvm_gpu_isr.h │ ├── uvm_gpu_non_replayable_faults.c │ ├── uvm_gpu_non_replayable_faults.h │ ├── uvm_gpu_replayable_faults.c │ ├── uvm_gpu_replayable_faults.h │ ├── uvm_gpu_semaphore.c │ ├── uvm_gpu_semaphore.h │ ├── uvm_gpu_semaphore.o.ur-safe │ ├── uvm_gpu_semaphore_test.c │ ├── uvm_hal.c │ ├── uvm_hal.h │ ├── uvm_hal_types.h │ ├── uvm_hmm.c │ ├── uvm_hmm.h │ ├── uvm_ioctl.h │ ├── uvm_kepler.c │ ├── uvm_kepler_ce.c │ ├── uvm_kepler_host.c │ ├── uvm_kepler_mmu.c │ ├── uvm_kvmalloc.c │ ├── uvm_kvmalloc.h │ ├── uvm_kvmalloc_test.c │ ├── uvm_linux.c │ ├── uvm_linux.h │ ├── uvm_linux_ioctl.h │ ├── uvm_lock.c │ ├── uvm_lock.h │ ├── uvm_lock_test.c │ ├── uvm_map_external.c │ ├── uvm_map_external.h │ ├── uvm_maxwell.c │ ├── uvm_maxwell_host.c │ ├── uvm_mem.c │ ├── uvm_mem.h │ ├── uvm_mem_test.c │ ├── uvm_migrate.c │ ├── uvm_migrate.h │ ├── uvm_migrate_pageable.c │ ├── uvm_migrate_pageable.h │ ├── uvm_mmu.c │ ├── uvm_mmu.h │ ├── uvm_mmu_test.c │ ├── uvm_page_tree_test.c │ ├── uvm_pascal.c │ ├── uvm_pascal_ce.c │ ├── uvm_pascal_fault_buffer.c │ ├── uvm_pascal_fault_buffer.h │ ├── uvm_pascal_host.c │ ├── uvm_pascal_mmu.c │ ├── uvm_peer_identity_mappings_test.c │ ├── uvm_perf_events.c │ ├── uvm_perf_events.h │ ├── uvm_perf_events_test.c │ ├── uvm_perf_heuristics.c │ ├── uvm_perf_heuristics.h │ ├── uvm_perf_module.c │ ├── uvm_perf_module.h │ ├── uvm_perf_module_test.c │ ├── uvm_perf_prefetch.c │ ├── uvm_perf_prefetch.h │ ├── uvm_perf_thrashing.c │ ├── uvm_perf_thrashing.h │ ├── uvm_perf_thrashing.o.ur-safe │ ├── uvm_perf_utils.c │ ├── uvm_perf_utils.h │ ├── uvm_perf_utils_test.c │ ├── uvm_pmm_gpu.c │ ├── uvm_pmm_gpu.h │ ├── uvm_pmm_gpu.o.ur-safe │ ├── uvm_pmm_sysmem.c │ ├── uvm_pmm_sysmem.h │ ├── uvm_pmm_sysmem_test.c │ ├── uvm_pmm_test.c │ ├── uvm_policy.c │ ├── uvm_populate_pageable.c │ ├── uvm_populate_pageable.h │ ├── uvm_processors.h │ ├── uvm_procfs.c │ ├── uvm_procfs.h │ ├── uvm_pte_batch.c │ ├── uvm_pte_batch.h │ ├── uvm_push.c │ ├── uvm_push.h │ ├── uvm_push_macros.h │ ├── uvm_push_test.c │ ├── uvm_pushbuffer.c │ ├── uvm_pushbuffer.h │ ├── uvm_pushbuffer.o.ur-safe │ ├── uvm_range_allocator.c │ ├── uvm_range_allocator.h │ ├── uvm_range_allocator.o.ur-safe │ ├── uvm_range_allocator_test.c │ ├── uvm_range_group.c │ ├── uvm_range_group.h │ ├── uvm_range_group.o.ur-safe │ ├── uvm_range_group_tree_test.c │ ├── uvm_range_tree.c │ ├── uvm_range_tree.h │ ├── uvm_range_tree_test.c │ ├── uvm_rb_tree.c │ ├── uvm_rb_tree.h │ ├── uvm_rb_tree_test.c │ ├── uvm_rm_mem.c │ ├── uvm_rm_mem.h │ ├── uvm_rm_mem_test.c │ ├── uvm_test.c │ ├── uvm_test.h │ ├── uvm_test_ioctl.h │ ├── uvm_test_rng.c │ ├── uvm_test_rng.h │ ├── uvm_thread_context.c │ ├── uvm_thread_context.h │ ├── uvm_thread_context_test.c │ ├── uvm_tlb_batch.c │ ├── uvm_tlb_batch.h │ ├── uvm_tools.c │ ├── uvm_tools.h │ ├── uvm_tools.o.ur-safe │ ├── uvm_tools_init.h │ ├── uvm_tracker.c │ ├── uvm_tracker.h │ ├── uvm_tracker_test.c │ ├── uvm_turing.c │ ├── uvm_turing_fault_buffer.h │ ├── uvm_turing_host.c │ ├── uvm_turing_mmu.c │ ├── uvm_types.h │ ├── uvm_unit_test.h │ ├── uvm_user_channel.c │ ├── uvm_user_channel.h │ ├── uvm_va_block.c │ ├── uvm_va_block.h │ ├── uvm_va_block.o.ur-safe │ ├── uvm_va_block_test.c │ ├── uvm_va_block_types.h │ ├── uvm_va_range.c │ ├── uvm_va_range.h │ ├── uvm_va_range.o.ur-safe │ ├── uvm_va_space.c │ ├── uvm_va_space.h │ ├── uvm_va_space_mm.c │ ├── uvm_va_space_mm.h │ ├── uvm_va_space_mm.o.ur-safe │ ├── uvm_volta.c │ ├── uvm_volta_access_counter_buffer.c │ ├── uvm_volta_fault_buffer.c │ ├── uvm_volta_fault_buffer.h │ ├── uvm_volta_host.c │ └── uvm_volta_mmu.c └── nvidia │ ├── export_nvswitch.h │ ├── ioctl_common_nvswitch.h │ ├── ioctl_nvswitch.h │ ├── linux_nvswitch.c │ ├── linux_nvswitch.h │ ├── linux_nvswitch.o.ur-safe │ ├── nv-acpi.c │ ├── nv-acpi.o.ur-safe │ ├── nv-caps.c │ ├── nv-caps.o.ur-safe │ ├── nv-cray.c │ ├── nv-dma.c │ ├── nv-frontend.c │ ├── nv-frontend.h │ ├── nv-i2c.c │ ├── nv-ibmnpu.c │ ├── nv-ibmnpu.h │ ├── nv-kernel.o_binary │ ├── nv-kthread-q.c │ ├── nv-memdbg.c │ ├── nv-memdbg.o.ur-safe │ ├── nv-mmap.c │ ├── nv-modeset-interface.c │ ├── nv-msi.c │ ├── nv-p2p.c │ ├── nv-p2p.h │ ├── nv-pat.c │ ├── nv-pat.h │ ├── nv-pat.o.ur-safe │ ├── nv-pci-table.c │ ├── nv-pci-table.h │ ├── nv-pci.c │ ├── nv-procfs.c │ ├── nv-reg.h │ ├── nv-report-err.c │ ├── nv-report-err.h │ ├── nv-rsync.c │ ├── nv-rsync.h │ ├── nv-usermap.c │ ├── nv-vm.c │ ├── nv-vm.o.ur-safe │ ├── nv-vtophys.c │ ├── nv.c │ ├── nv.o.ur-safe │ ├── nv_gpu_ops.h │ ├── nv_uvm_interface.c │ ├── nv_uvm_interface.o.ur-safe │ ├── nvidia-sources.Kbuild │ ├── nvidia.Kbuild │ ├── nvlink_caps.c │ ├── nvlink_caps.h │ ├── nvlink_common.h │ ├── nvlink_errors.h │ ├── nvlink_export.h │ ├── nvlink_linux.c │ ├── nvlink_linux.h │ ├── nvlink_linux.o.ur-safe │ ├── nvlink_os.h │ ├── nvlink_pci.h │ ├── nvlink_proto.h │ ├── os-interface.c │ ├── os-interface.o.ur-safe │ ├── os-mlock.c │ ├── os-mlock.o.ur-safe │ ├── os-pci.c │ ├── os-pci.o.ur-safe │ ├── os-registry.c │ ├── os-usermap.c │ ├── procfs_nvswitch.c │ └── rmp2pdefines.h └── scripts ├── download_graph_dataset.sh ├── fig6 ├── case1_pagerank.sh ├── case2_bfs.sh ├── case3_wcc.sh ├── case4_louvain.sh ├── case4_wcc.sh └── run_all.sh ├── fig7 ├── case1_pagerank.sh ├── case2_bfs.sh ├── case3_wcc.sh ├── case4_louvain.sh └── run_all.sh ├── fig8 ├── case1_pagerank.sh ├── case2_bfs.sh ├── case3_wcc.sh ├── case4_louvain.sh └── run_all.sh ├── fig9 ├── bfs.sh ├── default_tasks.sh ├── louvain.sh ├── manual_occupy.run ├── pagerank.sh ├── run_all.sh └── wcc.sh ├── load_driver.sh └── run_all.sh /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Object files 5 | *.o 6 | *.ko 7 | *.obj 8 | *.elf 9 | 10 | # Linker output 11 | *.ilk 12 | *.map 13 | *.exp 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Libraries 20 | *.lib 21 | *.a 22 | *.la 23 | *.lo 24 | 25 | # Shared objects (inc. Windows DLLs) 26 | *.dll 27 | *.so 28 | *.so.* 29 | *.dylib 30 | 31 | # Executables 32 | *.exe 33 | *.out 34 | *.app 35 | *.i*86 36 | *.x86_64 37 | *.hex 38 | 39 | # Debug files 40 | *.dSYM/ 41 | *.su 42 | *.idb 43 | *.pdb 44 | 45 | # Kernel Module Compile Results 46 | *.mod* 47 | *.cmd 48 | .tmp_versions/ 49 | modules.order 50 | Module.symvers 51 | Mkfile.old 52 | #dkms.conf 53 | 54 | # Datasets 55 | dataset/* 56 | !dataset/imagenet 57 | dataset/imagenet/* 58 | !dataset/imagenet/preprocess.sh 59 | 60 | .cache.mk 61 | 62 | # Conftest 63 | driver/nv_compiler.h 64 | driver/conftest/ 65 | driver/conftest*.c 66 | driver_base/nv_compiler.h 67 | driver_base/conftest/ 68 | driver_base/conftest*.c 69 | 70 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | docs/README.md -------------------------------------------------------------------------------- /bench/cugraph/bfs.py: -------------------------------------------------------------------------------- 1 | from dask.distributed import Client, wait 2 | from dask_cuda import LocalCUDACluster 3 | import cugraph.comms as Comms 4 | import cugraph.dask as dask_cugraph 5 | import cugraph 6 | import dask_cudf 7 | import time 8 | import urllib.request 9 | import os 10 | import sys 11 | import rmm 12 | import argparse 13 | 14 | def main(): 15 | parser=argparse.ArgumentParser() 16 | description='''python bfs.py --n_workers 1 --visible_devices 0,1,2,3 17 | --dataset /HUVM/dataset/graph/soc-twitter-2010.csv --loop''' 18 | parser.add_argument('--n_workers', type=int, required=True, help='number of workers') 19 | parser.add_argument('--visible_devices', type=str, required=True, 20 | help='comma seperated CUDA_VISIBLE_DEVICES (e.g. 0,1,2,3)') 21 | parser.add_argument('--dataset', type=str, required=True, help='path to graph dataset') 22 | parser.add_argument('--loop', default=False, action='store_true', help='run one time or in loop') 23 | args=parser.parse_args() 24 | 25 | cluster = LocalCUDACluster(rmm_managed_memory=True, rmm_pool_size="50GB", 26 | CUDA_VISIBLE_DEVICES=args.visible_devices, n_workers=args.n_workers) 27 | client = Client(cluster) 28 | Comms.initialize(p2p=True) 29 | assert(rmm.is_initialized()) 30 | 31 | # Helper function to set the reader chunk size to automatically get one partition per GPU 32 | chunksize = dask_cugraph.get_chunksize(args.dataset) 33 | 34 | # Multi-GPU CSV reader 35 | e_list = dask_cudf.read_csv(args.dataset, chunksize = chunksize, delimiter=' ', 36 | names=['src', 'dst'], dtype=['int32', 'int32']) 37 | 38 | # Create a directed graph using the source (src) and destination (dst) vertex pairs from the Dataframe 39 | G = cugraph.DiGraph() 40 | G.from_dask_cudf_edgelist(e_list, source='src', destination='dst') 41 | 42 | if args.loop: 43 | while True: 44 | t_start = time.time() 45 | df = dask_cugraph.bfs(G, 1) 46 | print("Out: ", time.time()-t_start) 47 | else: 48 | t_start = time.time() 49 | df = dask_cugraph.bfs(G, 1) 50 | print("Out: ", time.time()-t_start) 51 | 52 | Comms.destroy() 53 | client.close() 54 | cluster.close() 55 | 56 | if __name__ == "__main__": 57 | main() 58 | -------------------------------------------------------------------------------- /bench/cugraph/louvain.py: -------------------------------------------------------------------------------- 1 | from dask.distributed import Client, wait 2 | from dask_cuda import LocalCUDACluster 3 | import cugraph.comms as Comms 4 | import cugraph.dask as dask_cugraph 5 | import cugraph 6 | import dask_cudf 7 | import time 8 | import urllib.request 9 | import os 10 | import sys 11 | import rmm 12 | import argparse 13 | 14 | def main(): 15 | parser=argparse.ArgumentParser() 16 | description='''python louvain.py --n_workers 1 --visible_devices 0,1,2,3 17 | --dataset /HUVM/dataset/graph/soc-twitter-2010.csv --loop''' 18 | parser.add_argument('--n_workers', type=int, required=True, help='number of workers') 19 | parser.add_argument('--visible_devices', type=str, required=True, 20 | help='comma seperated CUDA_VISIBLE_DEVICES (e.g. 0,1,2,3)') 21 | parser.add_argument('--dataset', type=str, required=True, help='path to graph dataset') 22 | parser.add_argument('--loop', default=False, action='store_true', help='run one time or in loop') 23 | args=parser.parse_args() 24 | 25 | cluster = LocalCUDACluster(rmm_managed_memory=True, rmm_pool_size="50GB", 26 | CUDA_VISIBLE_DEVICES=args.visible_devices, n_workers=args.n_workers) 27 | client = Client(cluster) 28 | Comms.initialize(p2p=True) 29 | assert(rmm.is_initialized()) 30 | 31 | # Helper function to set the reader chunk size to automatically get one partition per GPU 32 | chunksize = dask_cugraph.get_chunksize(args.dataset) 33 | 34 | # Multi-GPU CSV reader 35 | e_list = dask_cudf.read_csv(args.dataset, chunksize = chunksize, delimiter=' ', 36 | names=['src', 'dst'], dtype=['int32', 'int32']) 37 | 38 | # Create a directed graph using the source (src) and destination (dst) vertex pairs from the Dataframe 39 | G = cugraph.DiGraph() 40 | G.from_dask_cudf_edgelist(e_list, source='src', destination='dst') 41 | 42 | if args.loop: 43 | while True: 44 | t_start = time.time() 45 | df = dask_cugraph.louvain(G) 46 | print("Out: ", time.time()-t_start) 47 | else: 48 | t_start = time.time() 49 | df = dask_cugraph.louvain(G) 50 | print("Out: ", time.time()-t_start) 51 | 52 | Comms.destroy() 53 | client.close() 54 | cluster.close() 55 | 56 | if __name__ == "__main__": 57 | main() 58 | -------------------------------------------------------------------------------- /bench/cugraph/pagerank.py: -------------------------------------------------------------------------------- 1 | from dask.distributed import Client, wait 2 | from dask_cuda import LocalCUDACluster 3 | import cugraph.comms as Comms 4 | import cugraph.dask as dask_cugraph 5 | import cugraph 6 | import dask_cudf 7 | import time 8 | import urllib.request 9 | import rmm 10 | import os 11 | import sys 12 | import argparse 13 | 14 | def main(): 15 | parser=argparse.ArgumentParser() 16 | description='''python pagerank.py --n_workers 1 --visible_devices 0,1,2,3 17 | --dataset /HUVM/dataset/graph/soc-twitter-2010.csv --loop''' 18 | parser.add_argument('--n_workers', type=int, required=True, help='number of workers') 19 | parser.add_argument('--visible_devices', type=str, required=True, 20 | help='comma seperated CUDA_VISIBLE_DEVICES (e.g. 0,1,2,3)') 21 | parser.add_argument('--dataset', type=str, required=True, help='path to graph dataset') 22 | parser.add_argument('--loop', default=False, action='store_true', help='run one time or in loop') 23 | args=parser.parse_args() 24 | 25 | cluster = LocalCUDACluster(rmm_managed_memory=True, rmm_pool_size="50GB", 26 | CUDA_VISIBLE_DEVICES=args.visible_devices, n_workers=args.n_workers) 27 | client = Client(cluster) 28 | Comms.initialize(p2p=True) 29 | assert(rmm.is_initialized()) 30 | 31 | # Helper function to set the reader chunk size to automatically get one partition per GPU 32 | chunksize = dask_cugraph.get_chunksize(args.dataset) 33 | 34 | # Multi-GPU CSV reader 35 | e_list = dask_cudf.read_csv(args.dataset, chunksize = chunksize, delimiter=' ', 36 | names=['src', 'dst'], dtype=['int32', 'int32']) 37 | 38 | # Create a directed graph using the source (src) and destination (dst) vertex pairs from the Dataframe 39 | G = cugraph.DiGraph() 40 | G.from_dask_cudf_edgelist(e_list, source='src', destination='dst') 41 | 42 | if args.loop: 43 | while True: 44 | t_start = time.time() 45 | pr_df = dask_cugraph.pagerank(G, tol=0.01, max_iter=1000) 46 | print("Out: ", time.time()-t_start) 47 | else: 48 | t_start = time.time() 49 | pr_df = dask_cugraph.pagerank(G, tol=1e-4) 50 | print("Out: ", time.time()-t_start) 51 | 52 | Comms.destroy() 53 | client.close() 54 | cluster.close() 55 | 56 | if __name__ == "__main__": 57 | main() 58 | -------------------------------------------------------------------------------- /bench/cugraph/wcc.py: -------------------------------------------------------------------------------- 1 | from dask.distributed import Client, wait 2 | from dask_cuda import LocalCUDACluster 3 | import cugraph.comms as Comms 4 | import cugraph.dask as dask_cugraph 5 | import cugraph 6 | import dask_cudf 7 | import time 8 | import urllib.request 9 | import os 10 | import sys 11 | import rmm 12 | import argparse 13 | 14 | def main(): 15 | parser=argparse.ArgumentParser() 16 | description='''python wcc.py --n_workers 1 --visible_devices 0,1,2,3 17 | --dataset /HUVM/dataset/graph/soc-twitter-2010.csv --loop''' 18 | parser.add_argument('--n_workers', type=int, required=True, help='number of workers') 19 | parser.add_argument('--visible_devices', type=str, required=True, 20 | help='comma seperated CUDA_VISIBLE_DEVICES (e.g. 0,1,2,3)') 21 | parser.add_argument('--dataset', type=str, required=True, help='path to graph dataset') 22 | parser.add_argument('--loop', default=False, action='store_true', help='run one time or in loop') 23 | args=parser.parse_args() 24 | 25 | cluster = LocalCUDACluster(rmm_managed_memory=True, rmm_pool_size="50GB", 26 | CUDA_VISIBLE_DEVICES=args.visible_devices, n_workers=args.n_workers) 27 | client = Client(cluster) 28 | Comms.initialize(p2p=True) 29 | assert(rmm.is_initialized()) 30 | 31 | # Helper function to set the reader chunk size to automatically get one partition per GPU 32 | chunksize = dask_cugraph.get_chunksize(args.dataset) 33 | 34 | # Multi-GPU CSV reader 35 | e_list = dask_cudf.read_csv(args.dataset, chunksize = chunksize, delimiter=' ', 36 | names=['src', 'dst'], dtype=['int32', 'int32']) 37 | 38 | # Create a directed graph using the source (src) and destination (dst) vertex pairs from the Dataframe 39 | G = cugraph.DiGraph() 40 | G.from_dask_cudf_edgelist(e_list, source='src', destination='dst') 41 | 42 | if args.loop: 43 | while True: 44 | t_start = time.time() 45 | df = dask_cugraph.weakly_connected_components(G) 46 | print("Out: ", time.time()-t_start) 47 | else: 48 | t_start = time.time() 49 | df = dask_cugraph.weakly_connected_components(G) 50 | print("Out: ", time.time()-t_start) 51 | 52 | Comms.destroy() 53 | client.close() 54 | cluster.close() 55 | 56 | if __name__ == "__main__": 57 | main() 58 | -------------------------------------------------------------------------------- /bench/microbench/common/GL/freeglut.h: -------------------------------------------------------------------------------- 1 | #ifndef __FREEGLUT_H__ 2 | #define __FREEGLUT_H__ 3 | 4 | /* 5 | * freeglut.h 6 | * 7 | * The freeglut library include file 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 10 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 12 | * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 13 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 14 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | */ 16 | 17 | #include "freeglut_std.h" 18 | #include "freeglut_ext.h" 19 | 20 | /*** END OF FILE ***/ 21 | 22 | #endif /* __FREEGLUT_H__ */ 23 | -------------------------------------------------------------------------------- /bench/microbench/common/data/CT_skull_512x512_8u.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casys-kaist/HUVM/4528f10218bdcfa62128cba87ee566f97fc6cd1b/bench/microbench/common/data/CT_skull_512x512_8u.raw -------------------------------------------------------------------------------- /bench/microbench/common/data/CT_skull_512x512_8u_Gray.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casys-kaist/HUVM/4528f10218bdcfa62128cba87ee566f97fc6cd1b/bench/microbench/common/data/CT_skull_512x512_8u_Gray.raw -------------------------------------------------------------------------------- /bench/microbench/common/data/PCB2_1024x683_8u.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casys-kaist/HUVM/4528f10218bdcfa62128cba87ee566f97fc6cd1b/bench/microbench/common/data/PCB2_1024x683_8u.raw -------------------------------------------------------------------------------- /bench/microbench/common/data/PCB_1280x720_8u.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casys-kaist/HUVM/4528f10218bdcfa62128cba87ee566f97fc6cd1b/bench/microbench/common/data/PCB_1280x720_8u.raw -------------------------------------------------------------------------------- /bench/microbench/common/data/PCB_METAL_509x335_8u.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casys-kaist/HUVM/4528f10218bdcfa62128cba87ee566f97fc6cd1b/bench/microbench/common/data/PCB_METAL_509x335_8u.raw -------------------------------------------------------------------------------- /bench/microbench/common/data/Rocks_512x512_8u_Gray.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casys-kaist/HUVM/4528f10218bdcfa62128cba87ee566f97fc6cd1b/bench/microbench/common/data/Rocks_512x512_8u_Gray.raw -------------------------------------------------------------------------------- /bench/microbench/common/data/teapot512.pgm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casys-kaist/HUVM/4528f10218bdcfa62128cba87ee566f97fc6cd1b/bench/microbench/common/data/teapot512.pgm -------------------------------------------------------------------------------- /bench/microbench/common/data/teapot_512x512_8u.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casys-kaist/HUVM/4528f10218bdcfa62128cba87ee566f97fc6cd1b/bench/microbench/common/data/teapot_512x512_8u.raw -------------------------------------------------------------------------------- /bench/microbench/common/data/teapot_512x512_8u_Gray.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casys-kaist/HUVM/4528f10218bdcfa62128cba87ee566f97fc6cd1b/bench/microbench/common/data/teapot_512x512_8u_Gray.raw -------------------------------------------------------------------------------- /bench/microbench/common/rendercheck_d3d10.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions 5 | * are met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above copyright 9 | * notice, this list of conditions and the following disclaimer in the 10 | * documentation and/or other materials provided with the distribution. 11 | * * Neither the name of NVIDIA CORPORATION nor the names of its 12 | * contributors may be used to endorse or promote products derived 13 | * from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY 16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 19 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #ifndef _RENDERCHECK_D3D10_H_ 31 | #define _RENDERCHECK_D3D10_H_ 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | class CheckRenderD3D10 { 40 | public: 41 | CheckRenderD3D10() {} 42 | 43 | static HRESULT ActiveRenderTargetToPPM(ID3D10Device *pDevice, 44 | const char *zFileName); 45 | static HRESULT ResourceToPPM(ID3D10Device *pDevice, ID3D10Resource *pResource, 46 | const char *zFileName); 47 | 48 | static bool PPMvsPPM(const char *src_file, const char *ref_file, 49 | const char *exec_path, const float epsilon, 50 | const float threshold = 0.0f); 51 | }; 52 | 53 | #endif -------------------------------------------------------------------------------- /bench/microbench/common/rendercheck_d3d11.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions 5 | * are met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above copyright 9 | * notice, this list of conditions and the following disclaimer in the 10 | * documentation and/or other materials provided with the distribution. 11 | * * Neither the name of NVIDIA CORPORATION nor the names of its 12 | * contributors may be used to endorse or promote products derived 13 | * from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY 16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 19 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #ifndef _RENDERCHECK_D3D11_H_ 31 | #define _RENDERCHECK_D3D11_H_ 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | class CheckRenderD3D11 40 | { 41 | public: 42 | 43 | CheckRenderD3D11() {} 44 | 45 | static HRESULT ActiveRenderTargetToPPM(ID3D11Device *pDevice, const char *zFileName); 46 | static HRESULT ResourceToPPM(ID3D11Device *pDevice, ID3D11Resource *pResource, const char *zFileName); 47 | 48 | static bool PPMvsPPM(const char *src_file, const char *ref_file, const char *exec_path, 49 | const float epsilon, const float threshold = 0.0f); 50 | }; 51 | 52 | #endif -------------------------------------------------------------------------------- /bench/microbench/common/rendercheck_d3d9.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions 5 | * are met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above copyright 9 | * notice, this list of conditions and the following disclaimer in the 10 | * documentation and/or other materials provided with the distribution. 11 | * * Neither the name of NVIDIA CORPORATION nor the names of its 12 | * contributors may be used to endorse or promote products derived 13 | * from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY 16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 19 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #ifndef _RENDERCHECK_D3D9_H_ 31 | #define _RENDERCHECK_D3D9_H_ 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | class CheckRenderD3D9 { 40 | public: 41 | CheckRenderD3D9() {} 42 | 43 | static HRESULT BackbufferToPPM(IDirect3DDevice9 *pDevice, 44 | const char *zFileName); 45 | static HRESULT SurfaceToPPM(IDirect3DDevice9 *pDevice, 46 | IDirect3DSurface9 *pSurface, 47 | const char *zFileName); 48 | 49 | static bool PPMvsPPM(const char *src_file, const char *ref_file, 50 | const char *exec_path, const float epsilon, 51 | const float threshold = 0.0f); 52 | }; 53 | 54 | #endif -------------------------------------------------------------------------------- /bench/microbench/vectorAdd/vectorAdd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casys-kaist/HUVM/4528f10218bdcfa62128cba87ee566f97fc6cd1b/bench/microbench/vectorAdd/vectorAdd -------------------------------------------------------------------------------- /bench/pytorch/requirements.txt: -------------------------------------------------------------------------------- 1 | torch==1.10.1 2 | torchvision==0.11.2 3 | -------------------------------------------------------------------------------- /driver/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.o 3 | *.cmd 4 | *.ko 5 | *.swp 6 | *.ur-safe 7 | *.mod.c 8 | *.order 9 | .tmp_versions 10 | Module.symvers 11 | .cache.mk 12 | *.run 13 | *.out 14 | conftest 15 | -------------------------------------------------------------------------------- /driver/common/inc/conftest.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONFTEST_H 2 | #define _CONFTEST_H 3 | 4 | #include "conftest/headers.h" 5 | #include "conftest/functions.h" 6 | #include "conftest/generic.h" 7 | #include "conftest/macros.h" 8 | #include "conftest/symbols.h" 9 | #include "conftest/types.h" 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /driver/common/inc/nv-gpu-info.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2015 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #ifndef _NV_GPU_INFO_H_ 12 | #define _NV_GPU_INFO_H_ 13 | 14 | typedef struct { 15 | NvU32 gpu_id; 16 | 17 | struct { 18 | NvU32 domain; 19 | NvU8 bus, slot, function; 20 | } pci_info; 21 | 22 | /* 23 | * opaque OS-specific pointer; on Linux, this is a pointer to the 24 | * 'struct device' for the GPU. 25 | */ 26 | void *os_device_ptr; 27 | } nv_gpu_info_t; 28 | 29 | #define NV_MAX_GPUS 32 30 | 31 | #endif /* _NV_GPU_INFO_H_ */ 32 | -------------------------------------------------------------------------------- /driver/common/inc/nv-ioctl-numbers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | 24 | #ifndef NV_IOCTL_NUMBERS_H 25 | #define NV_IOCTL_NUMBERS_H 26 | 27 | /* NOTE: using an ioctl() number > 55 will overflow! */ 28 | #define NV_IOCTL_MAGIC 'F' 29 | #define NV_IOCTL_BASE 200 30 | #define NV_ESC_CARD_INFO (NV_IOCTL_BASE + 0) 31 | #define NV_ESC_ALLOC_OS_EVENT (NV_IOCTL_BASE + 6) 32 | #define NV_ESC_FREE_OS_EVENT (NV_IOCTL_BASE + 7) 33 | #define NV_ESC_STATUS_CODE (NV_IOCTL_BASE + 9) 34 | #define NV_ESC_CHECK_VERSION_STR (NV_IOCTL_BASE + 10) 35 | #define NV_ESC_IOCTL_XFER_CMD (NV_IOCTL_BASE + 11) 36 | #define NV_ESC_ATTACH_GPUS_TO_FD (NV_IOCTL_BASE + 12) 37 | #define NV_ESC_QUERY_DEVICE_INTR (NV_IOCTL_BASE + 13) 38 | #define NV_ESC_SYS_PARAMS (NV_IOCTL_BASE + 14) 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /driver/common/inc/nv-kernel-interface-api.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2018 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #ifndef _NV_KERNEL_INTERFACE_API_H 12 | #define _NV_KERNEL_INTERFACE_API_H 13 | /************************************************************************************************************** 14 | * 15 | * File: nv-kernel-interface-api.h 16 | * 17 | * Description: 18 | * Defines the NV API related macros. 19 | * 20 | **************************************************************************************************************/ 21 | 22 | #if NVOS_IS_UNIX && NVCPU_IS_X86_64 && defined(__use_altstack__) 23 | #define NV_API_CALL __attribute__((altstack(0))) 24 | #else 25 | #define NV_API_CALL 26 | #endif 27 | 28 | #endif /* _NV_KERNEL_INTERFACE_API_H */ 29 | -------------------------------------------------------------------------------- /driver/common/inc/nv-kref.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2017 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | 22 | *******************************************************************************/ 23 | #ifndef __NV_KREF_H__ 24 | #define __NV_KREF_H__ 25 | 26 | #include 27 | 28 | typedef struct nv_kref 29 | { 30 | atomic_t refcount; 31 | } nv_kref_t; 32 | 33 | static inline void nv_kref_init(nv_kref_t *nv_kref) 34 | { 35 | atomic_set(&nv_kref->refcount, 1); 36 | } 37 | 38 | static inline void nv_kref_get(nv_kref_t *nv_kref) 39 | { 40 | atomic_inc(&nv_kref->refcount); 41 | } 42 | 43 | static inline int nv_kref_put(nv_kref_t *nv_kref, 44 | void (*release)(nv_kref_t *nv_kref)) 45 | { 46 | if (atomic_dec_and_test(&nv_kref->refcount)) 47 | { 48 | release(nv_kref); 49 | return 1; 50 | } 51 | 52 | return 0; 53 | } 54 | 55 | static inline unsigned int nv_kref_read(const nv_kref_t *nv_kref) 56 | { 57 | return atomic_read(&nv_kref->refcount); 58 | } 59 | 60 | #endif // __NV_KREF_H__ 61 | -------------------------------------------------------------------------------- /driver/common/inc/nv-memdbg.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2017 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #ifndef _NVMEMDBG_H_ 12 | #define _NVMEMDBG_H_ 13 | 14 | #include 15 | 16 | void nv_memdbg_init(void); 17 | void nv_memdbg_add(void *addr, NvU64 size, const char *file, int line); 18 | void nv_memdbg_remove(void *addr, NvU64 size, const char *file, int line); 19 | void nv_memdbg_exit(void); 20 | 21 | #if defined(NV_MEM_LOGGER) 22 | 23 | #define NV_MEMDBG_ADD(ptr, size) \ 24 | nv_memdbg_add(ptr, size, __FILE__, __LINE__) 25 | 26 | #define NV_MEMDBG_REMOVE(ptr, size) \ 27 | nv_memdbg_remove(ptr, size, __FILE__, __LINE__) 28 | 29 | #else 30 | 31 | #define NV_MEMDBG_ADD(ptr, size) 32 | #define NV_MEMDBG_REMOVE(ptr, size) 33 | 34 | #endif /* NV_MEM_LOGGER */ 35 | 36 | #endif /* _NVMEMDBG_H_ */ 37 | -------------------------------------------------------------------------------- /driver/common/inc/nv-misc.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 1993-2015 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #ifndef _NV_MISC_H_ 12 | #define _NV_MISC_H_ 13 | 14 | #include "nvtypes.h" 15 | #include "nvstatus.h" 16 | 17 | #if defined(NV_KERNEL_INTERFACE_LAYER) && defined(__FreeBSD__) 18 | #include // NULL 19 | #else 20 | #include // NULL 21 | #endif 22 | 23 | #endif /* _NV_MISC_H_ */ 24 | -------------------------------------------------------------------------------- /driver/common/inc/nv-pci-types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef _NV_PCI_TYPES_H_ 24 | #define _NV_PCI_TYPES_H_ 25 | 26 | #include 27 | #include "conftest.h" 28 | 29 | #if defined(NV_PCI_CHANNEL_STATE_PRESENT) 30 | typedef enum pci_channel_state nv_pci_channel_state_t; 31 | #else 32 | typedef pci_channel_state_t nv_pci_channel_state_t; 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /driver/common/inc/nv-pci.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2019 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #ifndef _NV_PCI_H_ 12 | #define _NV_PCI_H_ 13 | 14 | #include 15 | #include "nv-linux.h" 16 | 17 | #if defined(NV_DEV_IS_PCI_PRESENT) 18 | #define nv_dev_is_pci(dev) dev_is_pci(dev) 19 | #else 20 | /* 21 | * Non-PCI devices are only supported on kernels which expose the 22 | * dev_is_pci() function. For older kernels, we only support PCI 23 | * devices, hence returning true to take all the PCI code paths. 24 | */ 25 | #define nv_dev_is_pci(dev) (true) 26 | #endif 27 | 28 | int nv_pci_register_driver(void); 29 | void nv_pci_unregister_driver(void); 30 | int nv_pci_count_devices(void); 31 | NvU8 nv_find_pci_capability(struct pci_dev *, NvU8); 32 | int nvidia_dev_get_pci_info(const NvU8 *, struct pci_dev **, NvU64 *, NvU64 *); 33 | nv_linux_state_t * find_pci(NvU32, NvU8, NvU8, NvU8); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /driver/common/inc/nv-register-module.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2012-2013 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | 12 | #ifndef _NV_REGISTER_MODULE_H_ 13 | #define _NV_REGISTER_MODULE_H_ 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #include "nvtypes.h" 20 | 21 | typedef struct nvidia_module_s { 22 | struct module *owner; 23 | 24 | /* nvidia0, nvidia1 ..*/ 25 | const char *module_name; 26 | 27 | /* module instance */ 28 | NvU32 instance; 29 | 30 | /* file operations */ 31 | int (*open)(struct inode *, struct file *filp); 32 | int (*close)(struct inode *, struct file *filp); 33 | int (*mmap)(struct file *filp, struct vm_area_struct *vma); 34 | int (*ioctl)(struct inode *, struct file * file, unsigned int cmd, unsigned long arg); 35 | unsigned int (*poll)(struct file * file, poll_table *wait); 36 | 37 | } nvidia_module_t; 38 | 39 | int nvidia_register_module(nvidia_module_t *); 40 | int nvidia_unregister_module(nvidia_module_t *); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /driver/common/inc/nvCpuUuid.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2015-2018 NVidia Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | #ifndef _NV_CPU_UUID_H_ 24 | #define _NV_CPU_UUID_H_ 25 | 26 | #define NV_UUID_LEN 16 27 | 28 | typedef struct nv_uuid 29 | { 30 | NvU8 uuid[NV_UUID_LEN]; 31 | 32 | } NvUuid; 33 | 34 | typedef NvUuid NvSystemUuid; 35 | 36 | typedef NvUuid NvProcessorUuid; 37 | 38 | extern const NvProcessorUuid NV_PROCESSOR_UUID_CPU_DEFAULT; 39 | 40 | #endif // _NV_CPU_UUID_H_ 41 | -------------------------------------------------------------------------------- /driver/common/inc/nvlimits.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef NVLIMITS_INCLUDED 24 | #define NVLIMITS_INCLUDED 25 | 26 | /* 27 | * This is the maximum number of GPUs supported in a single system. 28 | */ 29 | #define NV_MAX_DEVICES 32 30 | 31 | /* 32 | * This is the maximum number of subdevices within a single device. 33 | */ 34 | #define NV_MAX_SUBDEVICES 8 35 | 36 | /* 37 | * This is the maximum length of the process name string. 38 | */ 39 | #define NV_PROC_NAME_MAX_LENGTH 100 40 | 41 | #endif /* NVLIMITS_INCLUDED */ 42 | -------------------------------------------------------------------------------- /driver/common/inc/os/nv_memory_type.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef NV_MEMORY_TYPE_H 24 | #define NV_MEMORY_TYPE_H 25 | 26 | #define NV_MEMORY_TYPE_SYSTEM 0 /* Memory mapped for ROM, SBIOS and physical RAM. */ 27 | #define NV_MEMORY_TYPE_REGISTERS 2 28 | #define NV_MEMORY_TYPE_FRAMEBUFFER 3 29 | #define NV_MEMORY_TYPE_DEVICE_MMIO 5 /* All kinds of MMIO referred by NVRM e.g. BARs and MCFG of device */ 30 | 31 | #define NV_MEMORY_NONCONTIGUOUS 0 32 | #define NV_MEMORY_CONTIGUOUS 1 33 | 34 | #define NV_MEMORY_CACHED 0 35 | #define NV_MEMORY_UNCACHED 1 36 | #define NV_MEMORY_WRITECOMBINED 2 37 | #define NV_MEMORY_WRITEBACK 5 38 | #define NV_MEMORY_DEFAULT 6 39 | #define NV_MEMORY_UNCACHED_WEAK 7 40 | 41 | #define NV_PROTECT_READABLE 1 42 | #define NV_PROTECT_WRITEABLE 2 43 | #define NV_PROTECT_READ_WRITE (NV_PROTECT_READABLE | NV_PROTECT_WRITEABLE) 44 | 45 | #endif /* NV_MEMORY_TYPE_H */ 46 | -------------------------------------------------------------------------------- /driver/dkms.conf: -------------------------------------------------------------------------------- 1 | PACKAGE_NAME="nvidia" 2 | PACKAGE_VERSION="__VERSION_STRING" 3 | AUTOINSTALL="yes" 4 | 5 | # By default, DKMS will add KERNELRELEASE to the make command line; however, 6 | # this will cause the kernel module build to infer that it was invoked via 7 | # Kbuild directly instead of DKMS. The dkms(8) manual page recommends quoting 8 | # the 'make' command name to suppress this behavior. 9 | MAKE[0]="'make' -j__JOBS NV_EXCLUDE_BUILD_MODULES='__EXCLUDE_MODULES' KERNEL_UNAME=${kernelver} IGNORE_CC_MISMATCH='__IGNORE_CC_MISMATCH' modules" 10 | 11 | # The list of kernel modules will be generated by nvidia-installer at runtime. 12 | __DKMS_MODULES 13 | -------------------------------------------------------------------------------- /driver/nvidia-drm/nv-pci-table.c: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2015 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #include 12 | #include 13 | 14 | #include "nv-pci-table.h" 15 | 16 | struct pci_device_id nv_pci_table[] = { 17 | { 18 | .vendor = PCI_VENDOR_ID_NVIDIA, 19 | .device = PCI_ANY_ID, 20 | .subvendor = PCI_ANY_ID, 21 | .subdevice = PCI_ANY_ID, 22 | .class = (PCI_CLASS_DISPLAY_VGA << 8), 23 | .class_mask = ~0 24 | }, 25 | { 26 | .vendor = PCI_VENDOR_ID_NVIDIA, 27 | .device = PCI_ANY_ID, 28 | .subvendor = PCI_ANY_ID, 29 | .subdevice = PCI_ANY_ID, 30 | .class = (PCI_CLASS_DISPLAY_3D << 8), 31 | .class_mask = ~0 32 | }, 33 | { } 34 | }; 35 | 36 | MODULE_DEVICE_TABLE(pci, nv_pci_table); 37 | -------------------------------------------------------------------------------- /driver/nvidia-drm/nv-pci-table.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2015 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #ifndef _NV_PCI_TABLE_H_ 12 | #define _NV_PCI_TABLE_H_ 13 | 14 | #include 15 | 16 | extern struct pci_device_id nv_pci_table[]; 17 | 18 | #endif /* _NV_PCI_TABLE_H_ */ 19 | -------------------------------------------------------------------------------- /driver/nvidia-drm/nvidia-drm-conftest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __NVIDIA_DRM_CONFTEST_H__ 24 | #define __NVIDIA_DRM_CONFTEST_H__ 25 | 26 | #include "conftest.h" 27 | 28 | /* 29 | * NOTE: This file is expected to get included at the top before including any 30 | * of linux/drm headers. 31 | * 32 | * The goal is to redefine refcount_dec_and_test and refcount_inc before 33 | * including drm header files, so that the drm macro/inline calls to 34 | * refcount_dec_and_test* and refcount_inc get redirected to 35 | * alternate implementation in this file. 36 | */ 37 | 38 | #if NV_IS_EXPORT_SYMBOL_GPL_refcount_inc 39 | 40 | #include 41 | 42 | #define refcount_inc(__ptr) \ 43 | do { \ 44 | atomic_inc(&(__ptr)->refs); \ 45 | } while(0) 46 | 47 | #endif 48 | 49 | #if NV_IS_EXPORT_SYMBOL_GPL_refcount_dec_and_test 50 | 51 | #include 52 | 53 | #define refcount_dec_and_test(__ptr) atomic_dec_and_test(&(__ptr)->refs) 54 | 55 | #endif 56 | 57 | #if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ) || \ 58 | defined(NV_DRM_GEM_OBJECT_HAS_RESV) 59 | #define NV_DRM_FENCE_AVAILABLE 60 | #else 61 | #undef NV_DRM_FENCE_AVAILABLE 62 | #endif 63 | 64 | #endif /* defined(__NVIDIA_DRM_CONFTEST_H__) */ 65 | -------------------------------------------------------------------------------- /driver/nvidia-drm/nvidia-drm-drv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __NVIDIA_DRM_DRV_H__ 24 | #define __NVIDIA_DRM_DRV_H__ 25 | 26 | #include "nvidia-drm-conftest.h" 27 | 28 | #if defined(NV_DRM_AVAILABLE) 29 | 30 | int nv_drm_probe_devices(void); 31 | 32 | void nv_drm_remove_devices(void); 33 | 34 | #endif /* defined(NV_DRM_AVAILABLE) */ 35 | 36 | #endif /* __NVIDIA_DRM_DRV_H__ */ 37 | -------------------------------------------------------------------------------- /driver/nvidia-drm/nvidia-drm-fb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __NVIDIA_DRM_FB_H__ 24 | #define __NVIDIA_DRM_FB_H__ 25 | 26 | #include "nvidia-drm-conftest.h" 27 | 28 | #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE) 29 | 30 | #if defined(NV_DRM_DRMP_H_PRESENT) 31 | #include 32 | #endif 33 | 34 | #if defined(NV_DRM_DRM_FRAMEBUFFER_H_PRESENT) 35 | #include 36 | #endif 37 | 38 | #include "nvidia-drm-gem-nvkms-memory.h" 39 | #include "nvkms-kapi.h" 40 | 41 | struct nv_drm_framebuffer { 42 | struct NvKmsKapiSurface *pSurface; 43 | 44 | struct nv_drm_gem_object* 45 | nv_gem[NVKMS_MAX_PLANES_PER_SURFACE]; 46 | 47 | struct drm_framebuffer base; 48 | }; 49 | 50 | static inline struct nv_drm_framebuffer *to_nv_framebuffer( 51 | struct drm_framebuffer *fb) 52 | { 53 | if (fb == NULL) { 54 | return NULL; 55 | } 56 | return container_of(fb, struct nv_drm_framebuffer, base); 57 | } 58 | 59 | struct drm_framebuffer *nv_drm_internal_framebuffer_create( 60 | struct drm_device *dev, 61 | struct drm_file *file, 62 | struct drm_mode_fb_cmd2 *cmd); 63 | 64 | #endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */ 65 | 66 | #endif /* __NVIDIA_DRM_FB_H__ */ 67 | -------------------------------------------------------------------------------- /driver/nvidia-drm/nvidia-drm-format.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __NVIDIA_DRM_FORMAT_H__ 24 | #define __NVIDIA_DRM_FORMAT_H__ 25 | 26 | #include "nvidia-drm-conftest.h" 27 | 28 | #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE) 29 | 30 | #include 31 | 32 | #include "nvkms-format.h" 33 | 34 | bool nv_drm_format_to_nvkms_format(u32 format, 35 | enum NvKmsSurfaceMemoryFormat *nvkms_format); 36 | 37 | uint32_t *nv_drm_format_array_alloc( 38 | unsigned int *count, 39 | const long unsigned int nvkms_format_mask); 40 | 41 | #endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */ 42 | 43 | #endif /* __NVIDIA_DRM_FORMAT_H__ */ 44 | -------------------------------------------------------------------------------- /driver/nvidia-drm/nvidia-drm-modeset.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __NVIDIA_DRM_MODESET_H__ 24 | #define __NVIDIA_DRM_MODESET_H__ 25 | 26 | #include "nvidia-drm-conftest.h" 27 | 28 | #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE) 29 | 30 | #include "nvkms-kapi.h" 31 | 32 | struct drm_device; 33 | struct drm_atomic_state; 34 | 35 | struct drm_atomic_state *nv_drm_atomic_state_alloc(struct drm_device *dev); 36 | void nv_drm_atomic_state_clear(struct drm_atomic_state *state); 37 | void nv_drm_atomic_state_free(struct drm_atomic_state *state); 38 | 39 | int nv_drm_atomic_check(struct drm_device *dev, 40 | struct drm_atomic_state *state); 41 | 42 | int nv_drm_atomic_commit(struct drm_device *dev, 43 | struct drm_atomic_state *state, bool nonblock); 44 | 45 | 46 | void nv_drm_handle_flip_occurred(struct nv_drm_device *nv_dev, 47 | NvU32 head, 48 | NvKmsKapiLayerType plane); 49 | 50 | int nv_drm_shut_down_all_crtcs(struct drm_device *dev); 51 | 52 | #endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */ 53 | 54 | #endif /* __NVIDIA_DRM_MODESET_H__ */ 55 | -------------------------------------------------------------------------------- /driver/nvidia-drm/nvidia-drm-os-interface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __NVIDIA_DRM_OS_INTERFACE_H__ 24 | #define __NVIDIA_DRM_OS_INTERFACE_H__ 25 | 26 | #include "nvidia-drm-conftest.h" /* NV_DRM_AVAILABLE */ 27 | 28 | #include "nvtypes.h" 29 | 30 | #if defined(NV_DRM_AVAILABLE) 31 | 32 | struct page; 33 | 34 | /* Set to true when the atomic modeset feature is enabled. */ 35 | extern bool nv_drm_modeset_module_param; 36 | 37 | void *nv_drm_calloc(size_t nmemb, size_t size); 38 | 39 | void nv_drm_free(void *ptr); 40 | 41 | char *nv_drm_asprintf(const char *fmt, ...); 42 | 43 | void nv_drm_write_combine_flush(void); 44 | 45 | int nv_drm_lock_user_pages(unsigned long address, 46 | unsigned long pages_count, struct page ***pages); 47 | 48 | void nv_drm_unlock_user_pages(unsigned long pages_count, struct page **pages); 49 | 50 | void *nv_drm_vmap(struct page **pages, unsigned long pages_count); 51 | 52 | void nv_drm_vunmap(void *address); 53 | 54 | #endif 55 | 56 | #endif /* __NVIDIA_DRM_OS_INTERFACE_H__ */ 57 | -------------------------------------------------------------------------------- /driver/nvidia-drm/nvidia-drm-prime-fence.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __NVIDIA_DRM_PRIME_FENCE_H__ 24 | #define __NVIDIA_DRM_PRIME_FENCE_H__ 25 | 26 | #include "nvidia-drm-conftest.h" 27 | 28 | #if defined(NV_DRM_AVAILABLE) 29 | 30 | struct drm_file; 31 | struct drm_device; 32 | 33 | #if defined(NV_DRM_FENCE_AVAILABLE) 34 | 35 | int nv_drm_fence_supported_ioctl(struct drm_device *dev, 36 | void *data, struct drm_file *filep); 37 | 38 | int nv_drm_fence_context_create_ioctl(struct drm_device *dev, 39 | void *data, struct drm_file *filep); 40 | 41 | int nv_drm_gem_fence_attach_ioctl(struct drm_device *dev, 42 | void *data, struct drm_file *filep); 43 | 44 | #endif /* NV_DRM_FENCE_AVAILABLE */ 45 | 46 | #endif /* NV_DRM_AVAILABLE */ 47 | 48 | #endif /* __NVIDIA_DRM_PRIME_FENCE_H__ */ 49 | -------------------------------------------------------------------------------- /driver/nvidia-drm/nvidia-drm-utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __NVIDIA_DRM_UTILS_H__ 24 | #define __NVIDIA_DRM_UTILS_H__ 25 | 26 | #include "nvidia-drm-conftest.h" 27 | 28 | #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE) 29 | 30 | #include "nvkms-kapi.h" 31 | 32 | enum drm_plane_type; 33 | struct drm_display_mode; 34 | 35 | struct NvKmsKapiConnectorInfo* 36 | nvkms_get_connector_info(struct NvKmsKapiDevice *pDevice, 37 | NvKmsKapiConnector hConnector); 38 | 39 | int nvkms_connector_signal_to_drm_encoder_signal( 40 | NvKmsConnectorSignalFormat format); 41 | 42 | int nvkms_connector_type_to_drm_connector_type(NvKmsConnectorType type, 43 | NvBool internal); 44 | 45 | void nvkms_display_mode_to_drm_mode( 46 | const struct NvKmsKapiDisplayMode *displayMode, 47 | struct drm_display_mode *mode); 48 | 49 | void drm_mode_to_nvkms_display_mode(const struct drm_display_mode *src, 50 | struct NvKmsKapiDisplayMode *dst); 51 | 52 | bool drm_plane_type_to_nvkms_plane_type(enum drm_plane_type src, 53 | NvKmsKapiLayerType *type); 54 | 55 | #endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */ 56 | 57 | #endif /* __NVIDIA_DRM_UTILS_H__ */ 58 | -------------------------------------------------------------------------------- /driver/nvidia-drm/nvidia-drm.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include "nvidia-drm.h" 24 | 25 | #if defined(NV_DRM_AVAILABLE) 26 | 27 | #include "nvidia-drm-priv.h" 28 | #include "nvidia-drm-drv.h" 29 | 30 | static struct NvKmsKapiFunctionsTable nvKmsFuncsTable = { 31 | .versionString = NV_VERSION_STRING, 32 | }; 33 | 34 | const struct NvKmsKapiFunctionsTable* const nvKms = &nvKmsFuncsTable; 35 | 36 | #endif 37 | 38 | int nv_drm_init(void) 39 | { 40 | #if defined(NV_DRM_AVAILABLE) 41 | if (!nvKmsKapiGetFunctionsTable(&nvKmsFuncsTable)) { 42 | NV_DRM_LOG_ERR( 43 | "Version mismatch: nvidia-modeset.ko(%s) nvidia-drm.ko(%s)", 44 | nvKmsFuncsTable.versionString, NV_VERSION_STRING); 45 | return -EINVAL; 46 | } 47 | 48 | return nv_drm_probe_devices(); 49 | #else 50 | return 0; 51 | #endif 52 | } 53 | 54 | void nv_drm_exit(void) 55 | { 56 | #if defined(NV_DRM_AVAILABLE) 57 | nv_drm_remove_devices(); 58 | #endif 59 | } 60 | -------------------------------------------------------------------------------- /driver/nvidia-drm/nvidia-drm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __NVIDIA_DRM_H__ 24 | #define __NVIDIA_DRM_H__ 25 | 26 | #include "nvidia-drm-conftest.h" 27 | 28 | int nv_drm_init(void); 29 | void nv_drm_exit(void); 30 | 31 | #endif /* __NVIDIA_DRM_H__ */ 32 | -------------------------------------------------------------------------------- /driver/nvidia-modeset/nv-modeset-kernel.o_binary: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casys-kaist/HUVM/4528f10218bdcfa62128cba87ee566f97fc6cd1b/driver/nvidia-modeset/nv-modeset-kernel.o_binary -------------------------------------------------------------------------------- /driver/nvidia-modeset/nvkms-ioctl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 by NVIDIA Corporation. All rights reserved. All 3 | * information contained herein is proprietary and confidential to NVIDIA 4 | * Corporation. Any use, reproduction, or disclosure without the written 5 | * permission of NVIDIA Corporation is prohibited. 6 | */ 7 | 8 | #if !defined(NVKMS_IOCTL_H) 9 | #define NVKMS_IOCTL_H 10 | 11 | #include "nvtypes.h" 12 | 13 | /*! 14 | * Some of the NVKMS ioctl parameter data structures are quite large 15 | * and would exceed the parameter size constraints on at least SunOS. 16 | * 17 | * Redirect ioctls through a level of indirection: user-space assigns 18 | * NvKmsIoctlParams with the real command, size, and pointer, and 19 | * passes the NvKmsIoctlParams through the ioctl. 20 | */ 21 | 22 | struct NvKmsIoctlParams { 23 | NvU32 cmd; 24 | NvU32 size; 25 | NvU64 address NV_ALIGN_BYTES(8); 26 | }; 27 | 28 | #define NVKMS_IOCTL_MAGIC 'm' 29 | #define NVKMS_IOCTL_CMD 0 30 | 31 | #define NVKMS_IOCTL_IOWR \ 32 | _IOWR(NVKMS_IOCTL_MAGIC, NVKMS_IOCTL_CMD, struct NvKmsIoctlParams) 33 | 34 | /*! 35 | * User-space pointers are always passed to NVKMS in an NvU64. 36 | * This user-space address is eventually passed into the platform's 37 | * copyin/copyout functions, in a void* argument. 38 | * 39 | * This utility function converts from an NvU64 to a pointer. 40 | */ 41 | 42 | static inline void *nvKmsNvU64ToPointer(NvU64 value) 43 | { 44 | return (void *)(NvUPtr)value; 45 | } 46 | 47 | /*! 48 | * Before casting the NvU64 to a void*, check that casting to a pointer 49 | * size within the kernel does not lose any precision in the current 50 | * environment. 51 | */ 52 | static inline NvBool nvKmsNvU64AddressIsSafe(NvU64 address) 53 | { 54 | return address == (NvU64)(NvUPtr)address; 55 | } 56 | 57 | #endif /* NVKMS_IOCTL_H */ 58 | -------------------------------------------------------------------------------- /driver/nvidia-modeset/nvkms.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 by NVIDIA Corporation. All rights reserved. All 3 | * information contained herein is proprietary and confidential to NVIDIA 4 | * Corporation. Any use, reproduction, or disclosure without the written 5 | * permission of NVIDIA Corporation is prohibited. 6 | */ 7 | 8 | #ifndef __NV_KMS_H__ 9 | #define __NV_KMS_H__ 10 | 11 | #include "nvtypes.h" 12 | #include /* size_t */ 13 | 14 | #include "nvkms-kapi.h" 15 | 16 | typedef struct nvkms_per_open nvkms_per_open_handle_t; 17 | 18 | typedef void nvkms_procfs_out_string_func_t(void *data, 19 | const char *str); 20 | 21 | typedef void nvkms_procfs_proc_t(void *data, 22 | char *buffer, size_t size, 23 | nvkms_procfs_out_string_func_t *outString); 24 | 25 | typedef struct { 26 | const char *name; 27 | nvkms_procfs_proc_t *func; 28 | } nvkms_procfs_file_t; 29 | 30 | enum NvKmsClientType { 31 | NVKMS_CLIENT_USER_SPACE, 32 | NVKMS_CLIENT_KERNEL_SPACE, 33 | }; 34 | 35 | NvBool nvKmsIoctl( 36 | void *pOpenVoid, 37 | NvU32 cmd, 38 | NvU64 paramsAddress, 39 | const size_t paramSize); 40 | 41 | void nvKmsClose(void *pOpenVoid); 42 | 43 | void* nvKmsOpen( 44 | NvU32 pid, 45 | enum NvKmsClientType clientType, 46 | nvkms_per_open_handle_t *pOpenKernel); 47 | 48 | NvBool nvKmsModuleLoad(void); 49 | 50 | void nvKmsModuleUnload(void); 51 | 52 | void nvKmsSuspend(NvU32 gpuId); 53 | void nvKmsResume(NvU32 gpuId); 54 | 55 | void nvKmsGetProcFiles(const nvkms_procfs_file_t **ppProcFiles); 56 | 57 | void nvKmsKapiHandleEventQueueChange 58 | ( 59 | struct NvKmsKapiDevice *device 60 | ); 61 | 62 | NvBool nvKmsKapiGetFunctionsTableInternal 63 | ( 64 | struct NvKmsKapiFunctionsTable *funcsTable 65 | ); 66 | 67 | #endif /* __NV_KMS_H__ */ 68 | -------------------------------------------------------------------------------- /driver/nvidia-uvm/cla06fsubch.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2013 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | 22 | *******************************************************************************/ 23 | 24 | #ifndef __cla06fsubch_h__ 25 | #define __cla06fsubch_h__ 26 | 27 | #define NVA06F_SUBCHANNEL_COPY_ENGINE 4 28 | 29 | #endif // {__cla06fsubch_h__} 30 | -------------------------------------------------------------------------------- /driver/nvidia-uvm/cla16f.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2015 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | 22 | *******************************************************************************/ 23 | 24 | #ifndef _cla16f_h_ 25 | #define _cla16f_h_ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | #include "nvtypes.h" 32 | 33 | #define KEPLER_CHANNEL_GPFIFO_B (0x0000A16F) 34 | 35 | #define NVA16F_WFI (0x00000078) 36 | #define NVA16F_WFI_HANDLE 31:0 37 | 38 | #ifdef __cplusplus 39 | }; /* extern "C" */ 40 | #endif 41 | 42 | #endif /* _cla16F_h_ */ 43 | -------------------------------------------------------------------------------- /driver/nvidia-uvm/nvCpuUuid.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2015-2018 NVidia Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | #include "nvtypes.h" 24 | #include "nvCpuUuid.h" 25 | 26 | const NvProcessorUuid NV_PROCESSOR_UUID_CPU_DEFAULT = 27 | { 28 | { 29 | // Produced via uuidgen(1): 73772a14-2c41-4750-a27b-d4d74e0f5ea6: 30 | 0xa6, 0x5e, 0x0f, 0x4e, 0xd7, 0xd4, 0x7b, 0xa2, 31 | 0x50, 0x47, 0x41, 0x2c, 0x14, 0x2a, 0x77, 0x73 32 | } 33 | }; 34 | 35 | -------------------------------------------------------------------------------- /driver/nvidia-uvm/uvm_ats_faults.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2018 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | #include "uvm_linux.h" 24 | #include "uvm_forward_decl.h" 25 | #include "uvm_lock.h" 26 | #include "uvm_global.h" 27 | #include "uvm_va_space.h" 28 | 29 | NV_STATUS uvm_ats_service_fault_entry(uvm_gpu_va_space_t *gpu_va_space, 30 | uvm_fault_buffer_entry_t *current_entry, 31 | uvm_ats_fault_invalidate_t *ats_invalidate); 32 | 33 | // This function performs pending TLB invalidations for ATS and clears the 34 | // ats_invalidate->write_faults_in_batch flag 35 | NV_STATUS uvm_ats_invalidate_tlbs(uvm_gpu_va_space_t *gpu_va_space, 36 | uvm_ats_fault_invalidate_t *ats_invalidate, 37 | uvm_tracker_t *out_tracker); 38 | 39 | static bool uvm_can_ats_service_faults(uvm_gpu_va_space_t *gpu_va_space, struct mm_struct *mm) 40 | { 41 | if (mm) 42 | uvm_assert_mmap_lock_locked(mm); 43 | if (gpu_va_space->ats.enabled) 44 | UVM_ASSERT(g_uvm_global.ats.enabled); 45 | 46 | return gpu_va_space->ats.enabled && mm; 47 | } 48 | -------------------------------------------------------------------------------- /driver/nvidia-uvm/uvm_debug_optimized.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2015 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | 22 | *******************************************************************************/ 23 | 24 | // This file provides simple wrappers that are always built with optimizations 25 | // turned on to WAR issues with functions that don't build correctly otherwise. 26 | 27 | #include "uvm_linux.h" 28 | 29 | int nv_atomic_xchg(atomic_t *val, int new) 30 | { 31 | return atomic_xchg(val, new); 32 | } 33 | 34 | int nv_atomic_cmpxchg(atomic_t *val, int old, int new) 35 | { 36 | return atomic_cmpxchg(val, old, new); 37 | } 38 | 39 | long nv_atomic_long_cmpxchg(atomic_long_t *val, long old, long new) 40 | { 41 | return atomic_long_cmpxchg(val, old, new); 42 | } 43 | 44 | unsigned long nv_copy_from_user(void *to, const void __user *from, unsigned long n) 45 | { 46 | return copy_from_user(to, from, n); 47 | } 48 | 49 | unsigned long nv_copy_to_user(void __user *to, const void *from, unsigned long n) 50 | { 51 | return copy_to_user(to, from, n); 52 | } 53 | 54 | -------------------------------------------------------------------------------- /driver/nvidia-uvm/uvm_extern_decl.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2019 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | 22 | *******************************************************************************/ 23 | 24 | #ifndef __UVM_EXTERN_DECL_H__ 25 | #define __UVM_EXTERN_DECL_H__ 26 | 27 | #include "uvm_linux.h" 28 | #include "uvm_forward_decl.h" 29 | 30 | extern int uvm_enable_debug_procfs; 31 | 32 | extern unsigned uvm_perf_map_remote_on_native_atomics_fault; 33 | 34 | extern uvm_global_t g_uvm_global; 35 | 36 | extern bool uvm_global_is_suspended(void); 37 | 38 | #endif //__UVM_EXTERN_DECL_H__ 39 | -------------------------------------------------------------------------------- /driver/nvidia-uvm/uvm_gpu_non_replayable_faults.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2017 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | #ifndef __UVM_GPU_NON_REPLAYABLE_FAULTS_H__ 24 | #define __UVM_GPU_NON_REPLAYABLE_FAULTS_H__ 25 | 26 | #include 27 | #include "uvm_forward_decl.h" 28 | 29 | bool uvm_gpu_non_replayable_faults_pending(uvm_parent_gpu_t *parent_gpu); 30 | 31 | void uvm_gpu_service_non_replayable_fault_buffer(uvm_gpu_t *gpu); 32 | 33 | NV_STATUS uvm_gpu_fault_buffer_init_non_replayable_faults(uvm_parent_gpu_t *parent_gpu); 34 | 35 | void uvm_gpu_fault_buffer_deinit_non_replayable_faults(uvm_parent_gpu_t *parent_gpu); 36 | 37 | #endif // __UVM_GPU_NON_REPLAYABLE_FAULTS_H__ 38 | -------------------------------------------------------------------------------- /driver/nvidia-uvm/uvm_linux_ioctl.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2013 NVidia Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | #ifndef _UVM_LINUX_IOCTL_H 24 | #define _UVM_LINUX_IOCTL_H 25 | 26 | #include "uvm_ioctl.h" 27 | 28 | // This ioctl must be the first operation performed on the UVM file descriptor 29 | // after opening it. Until this ioctl is made, the UVM file descriptor is 30 | // inoperable: all other ioctls will return NV_ERR_ILLEGAL_ACTION and mmap will 31 | // return EBADFD. 32 | #define UVM_INITIALIZE 0x30000001 33 | 34 | typedef struct 35 | { 36 | NvU64 flags NV_ALIGN_BYTES(8); // IN 37 | NV_STATUS rmStatus; // OUT 38 | } UVM_INITIALIZE_PARAMS; 39 | 40 | #define UVM_DEINITIALIZE 0x30000002 41 | 42 | #endif // _UVM_LINUX_IOCTL_H 43 | -------------------------------------------------------------------------------- /driver/nvidia-uvm/uvm_migrate.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2018 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | 22 | *******************************************************************************/ 23 | 24 | NV_STATUS uvm_migrate_init(void); 25 | void uvm_migrate_exit(void); 26 | -------------------------------------------------------------------------------- /driver/nvidia-uvm/uvm_pascal_ce.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2016 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | 22 | *******************************************************************************/ 23 | 24 | #include "uvm_hal.h" 25 | #include "uvm_push.h" 26 | #include "clc0b5.h" 27 | 28 | void uvm_hal_pascal_ce_offset_out(uvm_push_t *push, NvU64 offset_out) 29 | { 30 | NV_PUSH_2U(C0B5, OFFSET_OUT_UPPER, HWVALUE(C0B5, OFFSET_OUT_UPPER, UPPER, NvOffset_HI32(offset_out)), 31 | OFFSET_OUT_LOWER, HWVALUE(C0B5, OFFSET_OUT_LOWER, VALUE, NvOffset_LO32(offset_out))); 32 | } 33 | 34 | void uvm_hal_pascal_ce_offset_in_out(uvm_push_t *push, NvU64 offset_in, NvU64 offset_out) 35 | { 36 | NV_PUSH_4U(C0B5, OFFSET_IN_UPPER, HWVALUE(C0B5, OFFSET_IN_UPPER, UPPER, NvOffset_HI32(offset_in)), 37 | OFFSET_IN_LOWER, HWVALUE(C0B5, OFFSET_IN_LOWER, VALUE, NvOffset_LO32(offset_in)), 38 | OFFSET_OUT_UPPER, HWVALUE(C0B5, OFFSET_OUT_UPPER, UPPER, NvOffset_HI32(offset_out)), 39 | OFFSET_OUT_LOWER, HWVALUE(C0B5, OFFSET_OUT_LOWER, VALUE, NvOffset_LO32(offset_out))); 40 | } 41 | -------------------------------------------------------------------------------- /driver/nvidia-uvm/uvm_populate_pageable.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2018 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | 22 | *******************************************************************************/ 23 | 24 | #ifndef __UVM_POPULATE_PAGEABLE_H__ 25 | #define __UVM_POPULATE_PAGEABLE_H__ 26 | 27 | // Populate the pages of the given vma that overlap with the 28 | // [start:start+length) range. If any of the pages was not populated, we return 29 | // NV_ERR_NO_MEMORY. 30 | // 31 | // Locking: vma->vm_mm->mmap_lock must be held in read or write mode 32 | NV_STATUS uvm_populate_pageable_vma(struct vm_area_struct *vma, 33 | unsigned long start, 34 | unsigned long length, 35 | int min_prot); 36 | 37 | // Populate all the pages in the given range by calling get_user_pages. The 38 | // range must be fully backed by vmas. If any of the pages was not populated, 39 | // we return NV_ERR_NO_MEMORY. 40 | // 41 | // Locking: mm->mmap_lock must be held in read or write mode 42 | NV_STATUS uvm_populate_pageable(struct mm_struct *mm, 43 | unsigned long start, 44 | unsigned long length, 45 | int min_prot); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /driver/nvidia-uvm/uvm_tools_init.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2016 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | 22 | *******************************************************************************/ 23 | 24 | #ifndef _UVM_TOOLS_INIT_H_ 25 | #define _UVM_TOOLS_INIT_H_ 26 | 27 | #include "uvm_common.h" 28 | 29 | int uvm_tools_init(dev_t uvm_base_dev); 30 | 31 | void uvm_tools_exit(void); 32 | 33 | #endif // _UVM_TOOLS_INIT_H_ 34 | -------------------------------------------------------------------------------- /driver/nvidia/nv-frontend.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2012-2013 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | 12 | #ifndef _NV_FRONTEND_H_ 13 | #define _NV_FRONTEND_H_ 14 | 15 | #include "nvtypes.h" 16 | #include "nv-misc.h" 17 | #include "nv-linux.h" 18 | #include "nv-register-module.h" 19 | 20 | #define NV_MAX_MODULE_INSTANCES 8 21 | 22 | #define NV_FRONTEND_MINOR_NUMBER(x) minor((x)->i_rdev) 23 | 24 | #define NV_FRONTEND_CONTROL_DEVICE_MINOR_MAX 255 25 | #define NV_FRONTEND_CONTROL_DEVICE_MINOR_MIN (NV_FRONTEND_CONTROL_DEVICE_MINOR_MAX - \ 26 | NV_MAX_MODULE_INSTANCES) 27 | 28 | #define NV_FRONTEND_IS_CONTROL_DEVICE(x) ((x <= NV_FRONTEND_CONTROL_DEVICE_MINOR_MAX) && \ 29 | (x > NV_FRONTEND_CONTROL_DEVICE_MINOR_MIN)) 30 | 31 | int nvidia_frontend_add_device(nvidia_module_t *, nv_linux_state_t *); 32 | int nvidia_frontend_remove_device(nvidia_module_t *, nv_linux_state_t *); 33 | 34 | extern nvidia_module_t *nv_minor_num_table[]; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /driver/nvidia/nv-kernel.o_binary: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casys-kaist/HUVM/4528f10218bdcfa62128cba87ee566f97fc6cd1b/driver/nvidia/nv-kernel.o_binary -------------------------------------------------------------------------------- /driver/nvidia/nv-pat.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2017 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | 12 | #ifndef _NV_PAT_H_ 13 | #define _NV_PAT_H_ 14 | 15 | #include "nv-linux.h" 16 | 17 | 18 | #if defined(NV_ENABLE_PAT_SUPPORT) 19 | extern int nv_init_pat_support(nvidia_stack_t *sp); 20 | extern void nv_teardown_pat_support(void); 21 | extern int nv_enable_pat_support(void); 22 | extern void nv_disable_pat_support(void); 23 | #else 24 | static inline int nv_init_pat_support(nvidia_stack_t *sp) 25 | { 26 | (void)sp; 27 | return 0; 28 | } 29 | 30 | static inline void nv_teardown_pat_support(void) 31 | { 32 | return; 33 | } 34 | 35 | static inline int nv_enable_pat_support(void) 36 | { 37 | return 1; 38 | } 39 | 40 | static inline void nv_disable_pat_support(void) 41 | { 42 | return; 43 | } 44 | #endif 45 | 46 | #endif /* _NV_PAT_H_ */ 47 | -------------------------------------------------------------------------------- /driver/nvidia/nv-pci-table.c: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2015 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #include 12 | #include 13 | 14 | #include "nv-pci-table.h" 15 | 16 | struct pci_device_id nv_pci_table[] = { 17 | { 18 | .vendor = PCI_VENDOR_ID_NVIDIA, 19 | .device = PCI_ANY_ID, 20 | .subvendor = PCI_ANY_ID, 21 | .subdevice = PCI_ANY_ID, 22 | .class = (PCI_CLASS_DISPLAY_VGA << 8), 23 | .class_mask = ~0 24 | }, 25 | { 26 | .vendor = PCI_VENDOR_ID_NVIDIA, 27 | .device = PCI_ANY_ID, 28 | .subvendor = PCI_ANY_ID, 29 | .subdevice = PCI_ANY_ID, 30 | .class = (PCI_CLASS_DISPLAY_3D << 8), 31 | .class_mask = ~0 32 | }, 33 | { } 34 | }; 35 | 36 | MODULE_DEVICE_TABLE(pci, nv_pci_table); 37 | -------------------------------------------------------------------------------- /driver/nvidia/nv-pci-table.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2015 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #ifndef _NV_PCI_TABLE_H_ 12 | #define _NV_PCI_TABLE_H_ 13 | 14 | #include 15 | 16 | extern struct pci_device_id nv_pci_table[]; 17 | 18 | #endif /* _NV_PCI_TABLE_H_ */ 19 | -------------------------------------------------------------------------------- /driver/nvidia/nv-vtophys.c: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 1999-2013 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #define __NO_VERSION__ 12 | #include "nv-misc.h" 13 | 14 | #include "os-interface.h" 15 | #include "nv-linux.h" 16 | 17 | NvU64 NV_API_CALL nv_get_kern_phys_address(NvU64 address) 18 | { 19 | /* direct-mapped kernel address */ 20 | if (virt_addr_valid(address)) 21 | return __pa(address); 22 | 23 | nv_printf(NV_DBG_ERRORS, 24 | "NVRM: can't translate address in %s()!\n", __FUNCTION__); 25 | return 0; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /driver/nvidia/nvidia-sources.Kbuild: -------------------------------------------------------------------------------- 1 | NVIDIA_SOURCES += nvidia/nv-frontend.c 2 | NVIDIA_SOURCES += nvidia/nv.c 3 | NVIDIA_SOURCES += nvidia/nv-pci.c 4 | NVIDIA_SOURCES += nvidia/nv-acpi.c 5 | NVIDIA_SOURCES += nvidia/nv-cray.c 6 | NVIDIA_SOURCES += nvidia/nv-dma.c 7 | NVIDIA_SOURCES += nvidia/nv-i2c.c 8 | NVIDIA_SOURCES += nvidia/nv-mmap.c 9 | NVIDIA_SOURCES += nvidia/nv-p2p.c 10 | NVIDIA_SOURCES += nvidia/nv-pat.c 11 | NVIDIA_SOURCES += nvidia/nv-procfs.c 12 | NVIDIA_SOURCES += nvidia/nv-usermap.c 13 | NVIDIA_SOURCES += nvidia/nv-vm.c 14 | NVIDIA_SOURCES += nvidia/nv-vtophys.c 15 | NVIDIA_SOURCES += nvidia/os-interface.c 16 | NVIDIA_SOURCES += nvidia/os-mlock.c 17 | NVIDIA_SOURCES += nvidia/os-pci.c 18 | NVIDIA_SOURCES += nvidia/os-registry.c 19 | NVIDIA_SOURCES += nvidia/os-usermap.c 20 | NVIDIA_SOURCES += nvidia/nv-modeset-interface.c 21 | NVIDIA_SOURCES += nvidia/nv-pci-table.c 22 | NVIDIA_SOURCES += nvidia/nv-kthread-q.c 23 | NVIDIA_SOURCES += nvidia/nv-memdbg.c 24 | NVIDIA_SOURCES += nvidia/nv-ibmnpu.c 25 | NVIDIA_SOURCES += nvidia/nv-report-err.c 26 | NVIDIA_SOURCES += nvidia/nv-rsync.c 27 | NVIDIA_SOURCES += nvidia/nv-msi.c 28 | NVIDIA_SOURCES += nvidia/nv-caps.c 29 | NVIDIA_SOURCES += nvidia/nv_uvm_interface.c 30 | NVIDIA_SOURCES += nvidia/nvlink_linux.c 31 | NVIDIA_SOURCES += nvidia/nvlink_caps.c 32 | NVIDIA_SOURCES += nvidia/linux_nvswitch.c 33 | NVIDIA_SOURCES += nvidia/procfs_nvswitch.c 34 | -------------------------------------------------------------------------------- /driver/nvidia/nvlink_caps.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2019 NVidia Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | #ifndef _NVLINK_CAPS_H_ 24 | #define _NVLINK_CAPS_H_ 25 | 26 | /* List of supported capability type */ 27 | #define NVLINK_CAP_FABRIC_MANAGEMENT 0 28 | 29 | /* Max supported capabilities count */ 30 | #define NVLINK_CAP_COUNT 1 31 | 32 | int nvlink_cap_init(const char *path); 33 | void nvlink_cap_exit(void); 34 | int nvlink_cap_acquire(int fd, NvU32 type); 35 | void nvlink_cap_release(int fd); 36 | 37 | #endif //_NVLINK_CAPS_H_ 38 | -------------------------------------------------------------------------------- /driver/nvidia/nvlink_export.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2015 NVidia Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | 24 | #ifndef _NVLINK_EXPORT_H_ 25 | #define _NVLINK_EXPORT_H_ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | #include "nvlink_common.h" 32 | 33 | /* 34 | * Initializes core lib and does all that is needed 35 | * to access NVLINK functionality on the current platform. 36 | */ 37 | NvlStatus nvlink_lib_initialize(void); 38 | 39 | /* 40 | * Frees any related resources and then unloads core lib. 41 | */ 42 | NvlStatus nvlink_lib_unload(void); 43 | 44 | /* 45 | * Entry point for nvlink ioctl calls. 46 | */ 47 | NvlStatus nvlink_lib_ioctl_ctrl(nvlink_ioctrl_params *ctrl_params); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif //_NVLINK_EXPORT_H_ 54 | -------------------------------------------------------------------------------- /driver/nvidia/nvlink_proto.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2015-2018 NVidia Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | 22 | *******************************************************************************/ 23 | 24 | #ifndef _NVLINK_PROTO_H_ 25 | #define _NVLINK_PROTO_H_ 26 | 27 | #include "nvlink_common.h" 28 | 29 | /* 30 | * Functions defined in nvlink_linux.c 31 | */ 32 | 33 | int nvlink_core_init (void); 34 | void nvlink_core_exit (void); 35 | 36 | 37 | /* 38 | * Functions defined in nvswitch_linux.c 39 | */ 40 | int nvswitch_init (void); 41 | void nvswitch_exit (void); 42 | 43 | 44 | #if defined(NVCPU_AARCH64) 45 | /* 46 | * Functions defined in tegrashim_linux.c (Tegra only) 47 | */ 48 | int tegrashim_init (void); 49 | void tegrashim_exit (void); 50 | NvlStatus tegrashim_init_device (struct pci_dev *); 51 | #endif 52 | 53 | #endif /* _NVLINK_PROTO_H_ */ 54 | -------------------------------------------------------------------------------- /driver/nvidia/os-usermap.c: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 1999-2011 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #define __NO_VERSION__ 12 | #include "nv-misc.h" 13 | 14 | #include "os-interface.h" 15 | #include "nv-linux.h" 16 | 17 | void* NV_API_CALL os_map_user_space( 18 | NvU64 start, 19 | NvU64 size_bytes, 20 | NvU32 mode, 21 | NvU32 protect, 22 | void **priv_data 23 | ) 24 | { 25 | return (void *)(NvUPtr)start; 26 | } 27 | 28 | void NV_API_CALL os_unmap_user_space( 29 | void *address, 30 | NvU64 size, 31 | void *priv_data 32 | ) 33 | { 34 | } 35 | 36 | NV_STATUS NV_API_CALL os_match_mmap_offset( 37 | void *pAllocPrivate, 38 | NvU64 offset, 39 | NvU64 *pPageIndex 40 | ) 41 | { 42 | nv_alloc_t *at = pAllocPrivate; 43 | NvU64 i; 44 | 45 | for (i = 0; i < at->num_pages; i++) 46 | { 47 | if (at->flags.contig) 48 | { 49 | if (offset == (at->page_table[0]->phys_addr + (i * PAGE_SIZE))) 50 | { 51 | *pPageIndex = i; 52 | return NV_OK; 53 | } 54 | } 55 | else 56 | { 57 | if (offset == at->page_table[i]->phys_addr) 58 | { 59 | *pPageIndex = i; 60 | return NV_OK; 61 | } 62 | } 63 | } 64 | 65 | return NV_ERR_OBJECT_NOT_FOUND; 66 | } 67 | -------------------------------------------------------------------------------- /driver/nvidia/rmp2pdefines.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2015 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #ifndef _RMP2PDEFINES_H_ 12 | #define _RMP2PDEFINES_H_ 13 | 14 | #define NVRM_P2P_PAGESIZE_SMALL_4K (4 << 10) 15 | #define NVRM_P2P_PAGESIZE_BIG_64K (64 << 10) 16 | #define NVRM_P2P_PAGESIZE_BIG_128K (128 << 10) 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /driver_base/common/inc/conftest.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONFTEST_H 2 | #define _CONFTEST_H 3 | 4 | #include "conftest/headers.h" 5 | #include "conftest/functions.h" 6 | #include "conftest/generic.h" 7 | #include "conftest/macros.h" 8 | #include "conftest/symbols.h" 9 | #include "conftest/types.h" 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /driver_base/common/inc/nv-gpu-info.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2015 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #ifndef _NV_GPU_INFO_H_ 12 | #define _NV_GPU_INFO_H_ 13 | 14 | typedef struct { 15 | NvU32 gpu_id; 16 | 17 | struct { 18 | NvU32 domain; 19 | NvU8 bus, slot, function; 20 | } pci_info; 21 | 22 | /* 23 | * opaque OS-specific pointer; on Linux, this is a pointer to the 24 | * 'struct device' for the GPU. 25 | */ 26 | void *os_device_ptr; 27 | } nv_gpu_info_t; 28 | 29 | #define NV_MAX_GPUS 32 30 | 31 | #endif /* _NV_GPU_INFO_H_ */ 32 | -------------------------------------------------------------------------------- /driver_base/common/inc/nv-ioctl-numbers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | 24 | #ifndef NV_IOCTL_NUMBERS_H 25 | #define NV_IOCTL_NUMBERS_H 26 | 27 | /* NOTE: using an ioctl() number > 55 will overflow! */ 28 | #define NV_IOCTL_MAGIC 'F' 29 | #define NV_IOCTL_BASE 200 30 | #define NV_ESC_CARD_INFO (NV_IOCTL_BASE + 0) 31 | #define NV_ESC_ALLOC_OS_EVENT (NV_IOCTL_BASE + 6) 32 | #define NV_ESC_FREE_OS_EVENT (NV_IOCTL_BASE + 7) 33 | #define NV_ESC_STATUS_CODE (NV_IOCTL_BASE + 9) 34 | #define NV_ESC_CHECK_VERSION_STR (NV_IOCTL_BASE + 10) 35 | #define NV_ESC_IOCTL_XFER_CMD (NV_IOCTL_BASE + 11) 36 | #define NV_ESC_ATTACH_GPUS_TO_FD (NV_IOCTL_BASE + 12) 37 | #define NV_ESC_QUERY_DEVICE_INTR (NV_IOCTL_BASE + 13) 38 | #define NV_ESC_SYS_PARAMS (NV_IOCTL_BASE + 14) 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /driver_base/common/inc/nv-kernel-interface-api.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2018 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #ifndef _NV_KERNEL_INTERFACE_API_H 12 | #define _NV_KERNEL_INTERFACE_API_H 13 | /************************************************************************************************************** 14 | * 15 | * File: nv-kernel-interface-api.h 16 | * 17 | * Description: 18 | * Defines the NV API related macros. 19 | * 20 | **************************************************************************************************************/ 21 | 22 | #if NVOS_IS_UNIX && NVCPU_IS_X86_64 && defined(__use_altstack__) 23 | #define NV_API_CALL __attribute__((altstack(0))) 24 | #else 25 | #define NV_API_CALL 26 | #endif 27 | 28 | #endif /* _NV_KERNEL_INTERFACE_API_H */ 29 | -------------------------------------------------------------------------------- /driver_base/common/inc/nv-kref.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2017 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | 22 | *******************************************************************************/ 23 | #ifndef __NV_KREF_H__ 24 | #define __NV_KREF_H__ 25 | 26 | #include 27 | 28 | typedef struct nv_kref 29 | { 30 | atomic_t refcount; 31 | } nv_kref_t; 32 | 33 | static inline void nv_kref_init(nv_kref_t *nv_kref) 34 | { 35 | atomic_set(&nv_kref->refcount, 1); 36 | } 37 | 38 | static inline void nv_kref_get(nv_kref_t *nv_kref) 39 | { 40 | atomic_inc(&nv_kref->refcount); 41 | } 42 | 43 | static inline int nv_kref_put(nv_kref_t *nv_kref, 44 | void (*release)(nv_kref_t *nv_kref)) 45 | { 46 | if (atomic_dec_and_test(&nv_kref->refcount)) 47 | { 48 | release(nv_kref); 49 | return 1; 50 | } 51 | 52 | return 0; 53 | } 54 | 55 | static inline unsigned int nv_kref_read(const nv_kref_t *nv_kref) 56 | { 57 | return atomic_read(&nv_kref->refcount); 58 | } 59 | 60 | #endif // __NV_KREF_H__ 61 | -------------------------------------------------------------------------------- /driver_base/common/inc/nv-memdbg.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2017 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #ifndef _NVMEMDBG_H_ 12 | #define _NVMEMDBG_H_ 13 | 14 | #include 15 | 16 | void nv_memdbg_init(void); 17 | void nv_memdbg_add(void *addr, NvU64 size, const char *file, int line); 18 | void nv_memdbg_remove(void *addr, NvU64 size, const char *file, int line); 19 | void nv_memdbg_exit(void); 20 | 21 | #if defined(NV_MEM_LOGGER) 22 | 23 | #define NV_MEMDBG_ADD(ptr, size) \ 24 | nv_memdbg_add(ptr, size, __FILE__, __LINE__) 25 | 26 | #define NV_MEMDBG_REMOVE(ptr, size) \ 27 | nv_memdbg_remove(ptr, size, __FILE__, __LINE__) 28 | 29 | #else 30 | 31 | #define NV_MEMDBG_ADD(ptr, size) 32 | #define NV_MEMDBG_REMOVE(ptr, size) 33 | 34 | #endif /* NV_MEM_LOGGER */ 35 | 36 | #endif /* _NVMEMDBG_H_ */ 37 | -------------------------------------------------------------------------------- /driver_base/common/inc/nv-misc.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 1993-2015 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #ifndef _NV_MISC_H_ 12 | #define _NV_MISC_H_ 13 | 14 | #include "nvtypes.h" 15 | #include "nvstatus.h" 16 | 17 | #if defined(NV_KERNEL_INTERFACE_LAYER) && defined(__FreeBSD__) 18 | #include // NULL 19 | #else 20 | #include // NULL 21 | #endif 22 | 23 | #endif /* _NV_MISC_H_ */ 24 | -------------------------------------------------------------------------------- /driver_base/common/inc/nv-pci-types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef _NV_PCI_TYPES_H_ 24 | #define _NV_PCI_TYPES_H_ 25 | 26 | #include 27 | #include "conftest.h" 28 | 29 | #if defined(NV_PCI_CHANNEL_STATE_PRESENT) 30 | typedef enum pci_channel_state nv_pci_channel_state_t; 31 | #else 32 | typedef pci_channel_state_t nv_pci_channel_state_t; 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /driver_base/common/inc/nv-pci.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2019 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #ifndef _NV_PCI_H_ 12 | #define _NV_PCI_H_ 13 | 14 | #include 15 | #include "nv-linux.h" 16 | 17 | #if defined(NV_DEV_IS_PCI_PRESENT) 18 | #define nv_dev_is_pci(dev) dev_is_pci(dev) 19 | #else 20 | /* 21 | * Non-PCI devices are only supported on kernels which expose the 22 | * dev_is_pci() function. For older kernels, we only support PCI 23 | * devices, hence returning true to take all the PCI code paths. 24 | */ 25 | #define nv_dev_is_pci(dev) (true) 26 | #endif 27 | 28 | int nv_pci_register_driver(void); 29 | void nv_pci_unregister_driver(void); 30 | int nv_pci_count_devices(void); 31 | NvU8 nv_find_pci_capability(struct pci_dev *, NvU8); 32 | int nvidia_dev_get_pci_info(const NvU8 *, struct pci_dev **, NvU64 *, NvU64 *); 33 | nv_linux_state_t * find_pci(NvU32, NvU8, NvU8, NvU8); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /driver_base/common/inc/nv-register-module.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2012-2013 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | 12 | #ifndef _NV_REGISTER_MODULE_H_ 13 | #define _NV_REGISTER_MODULE_H_ 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #include "nvtypes.h" 20 | 21 | typedef struct nvidia_module_s { 22 | struct module *owner; 23 | 24 | /* nvidia0, nvidia1 ..*/ 25 | const char *module_name; 26 | 27 | /* module instance */ 28 | NvU32 instance; 29 | 30 | /* file operations */ 31 | int (*open)(struct inode *, struct file *filp); 32 | int (*close)(struct inode *, struct file *filp); 33 | int (*mmap)(struct file *filp, struct vm_area_struct *vma); 34 | int (*ioctl)(struct inode *, struct file * file, unsigned int cmd, unsigned long arg); 35 | unsigned int (*poll)(struct file * file, poll_table *wait); 36 | 37 | } nvidia_module_t; 38 | 39 | int nvidia_register_module(nvidia_module_t *); 40 | int nvidia_unregister_module(nvidia_module_t *); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /driver_base/common/inc/nvCpuUuid.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2015-2018 NVidia Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | #ifndef _NV_CPU_UUID_H_ 24 | #define _NV_CPU_UUID_H_ 25 | 26 | #define NV_UUID_LEN 16 27 | 28 | typedef struct nv_uuid 29 | { 30 | NvU8 uuid[NV_UUID_LEN]; 31 | 32 | } NvUuid; 33 | 34 | typedef NvUuid NvSystemUuid; 35 | 36 | typedef NvUuid NvProcessorUuid; 37 | 38 | extern const NvProcessorUuid NV_PROCESSOR_UUID_CPU_DEFAULT; 39 | 40 | #endif // _NV_CPU_UUID_H_ 41 | -------------------------------------------------------------------------------- /driver_base/common/inc/nvlimits.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef NVLIMITS_INCLUDED 24 | #define NVLIMITS_INCLUDED 25 | 26 | /* 27 | * This is the maximum number of GPUs supported in a single system. 28 | */ 29 | #define NV_MAX_DEVICES 32 30 | 31 | /* 32 | * This is the maximum number of subdevices within a single device. 33 | */ 34 | #define NV_MAX_SUBDEVICES 8 35 | 36 | /* 37 | * This is the maximum length of the process name string. 38 | */ 39 | #define NV_PROC_NAME_MAX_LENGTH 100 40 | 41 | #endif /* NVLIMITS_INCLUDED */ 42 | -------------------------------------------------------------------------------- /driver_base/common/inc/os/nv_memory_type.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef NV_MEMORY_TYPE_H 24 | #define NV_MEMORY_TYPE_H 25 | 26 | #define NV_MEMORY_TYPE_SYSTEM 0 /* Memory mapped for ROM, SBIOS and physical RAM. */ 27 | #define NV_MEMORY_TYPE_REGISTERS 2 28 | #define NV_MEMORY_TYPE_FRAMEBUFFER 3 29 | #define NV_MEMORY_TYPE_DEVICE_MMIO 5 /* All kinds of MMIO referred by NVRM e.g. BARs and MCFG of device */ 30 | 31 | #define NV_MEMORY_NONCONTIGUOUS 0 32 | #define NV_MEMORY_CONTIGUOUS 1 33 | 34 | #define NV_MEMORY_CACHED 0 35 | #define NV_MEMORY_UNCACHED 1 36 | #define NV_MEMORY_WRITECOMBINED 2 37 | #define NV_MEMORY_WRITEBACK 5 38 | #define NV_MEMORY_DEFAULT 6 39 | #define NV_MEMORY_UNCACHED_WEAK 7 40 | 41 | #define NV_PROTECT_READABLE 1 42 | #define NV_PROTECT_WRITEABLE 2 43 | #define NV_PROTECT_READ_WRITE (NV_PROTECT_READABLE | NV_PROTECT_WRITEABLE) 44 | 45 | #endif /* NV_MEMORY_TYPE_H */ 46 | -------------------------------------------------------------------------------- /driver_base/dkms.conf: -------------------------------------------------------------------------------- 1 | PACKAGE_NAME="nvidia" 2 | PACKAGE_VERSION="__VERSION_STRING" 3 | AUTOINSTALL="yes" 4 | 5 | # By default, DKMS will add KERNELRELEASE to the make command line; however, 6 | # this will cause the kernel module build to infer that it was invoked via 7 | # Kbuild directly instead of DKMS. The dkms(8) manual page recommends quoting 8 | # the 'make' command name to suppress this behavior. 9 | MAKE[0]="'make' -j__JOBS NV_EXCLUDE_BUILD_MODULES='__EXCLUDE_MODULES' KERNEL_UNAME=${kernelver} IGNORE_CC_MISMATCH='__IGNORE_CC_MISMATCH' modules" 10 | 11 | # The list of kernel modules will be generated by nvidia-installer at runtime. 12 | __DKMS_MODULES 13 | -------------------------------------------------------------------------------- /driver_base/nvidia-drm/nv-pci-table.c: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2015 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #include 12 | #include 13 | 14 | #include "nv-pci-table.h" 15 | 16 | struct pci_device_id nv_pci_table[] = { 17 | { 18 | .vendor = PCI_VENDOR_ID_NVIDIA, 19 | .device = PCI_ANY_ID, 20 | .subvendor = PCI_ANY_ID, 21 | .subdevice = PCI_ANY_ID, 22 | .class = (PCI_CLASS_DISPLAY_VGA << 8), 23 | .class_mask = ~0 24 | }, 25 | { 26 | .vendor = PCI_VENDOR_ID_NVIDIA, 27 | .device = PCI_ANY_ID, 28 | .subvendor = PCI_ANY_ID, 29 | .subdevice = PCI_ANY_ID, 30 | .class = (PCI_CLASS_DISPLAY_3D << 8), 31 | .class_mask = ~0 32 | }, 33 | { } 34 | }; 35 | 36 | MODULE_DEVICE_TABLE(pci, nv_pci_table); 37 | -------------------------------------------------------------------------------- /driver_base/nvidia-drm/nv-pci-table.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2015 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #ifndef _NV_PCI_TABLE_H_ 12 | #define _NV_PCI_TABLE_H_ 13 | 14 | #include 15 | 16 | extern struct pci_device_id nv_pci_table[]; 17 | 18 | #endif /* _NV_PCI_TABLE_H_ */ 19 | -------------------------------------------------------------------------------- /driver_base/nvidia-drm/nvidia-drm-conftest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __NVIDIA_DRM_CONFTEST_H__ 24 | #define __NVIDIA_DRM_CONFTEST_H__ 25 | 26 | #include "conftest.h" 27 | 28 | /* 29 | * NOTE: This file is expected to get included at the top before including any 30 | * of linux/drm headers. 31 | * 32 | * The goal is to redefine refcount_dec_and_test and refcount_inc before 33 | * including drm header files, so that the drm macro/inline calls to 34 | * refcount_dec_and_test* and refcount_inc get redirected to 35 | * alternate implementation in this file. 36 | */ 37 | 38 | #if NV_IS_EXPORT_SYMBOL_GPL_refcount_inc 39 | 40 | #include 41 | 42 | #define refcount_inc(__ptr) \ 43 | do { \ 44 | atomic_inc(&(__ptr)->refs); \ 45 | } while(0) 46 | 47 | #endif 48 | 49 | #if NV_IS_EXPORT_SYMBOL_GPL_refcount_dec_and_test 50 | 51 | #include 52 | 53 | #define refcount_dec_and_test(__ptr) atomic_dec_and_test(&(__ptr)->refs) 54 | 55 | #endif 56 | 57 | #if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ) || \ 58 | defined(NV_DRM_GEM_OBJECT_HAS_RESV) 59 | #define NV_DRM_FENCE_AVAILABLE 60 | #else 61 | #undef NV_DRM_FENCE_AVAILABLE 62 | #endif 63 | 64 | #endif /* defined(__NVIDIA_DRM_CONFTEST_H__) */ 65 | -------------------------------------------------------------------------------- /driver_base/nvidia-drm/nvidia-drm-drv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __NVIDIA_DRM_DRV_H__ 24 | #define __NVIDIA_DRM_DRV_H__ 25 | 26 | #include "nvidia-drm-conftest.h" 27 | 28 | #if defined(NV_DRM_AVAILABLE) 29 | 30 | int nv_drm_probe_devices(void); 31 | 32 | void nv_drm_remove_devices(void); 33 | 34 | #endif /* defined(NV_DRM_AVAILABLE) */ 35 | 36 | #endif /* __NVIDIA_DRM_DRV_H__ */ 37 | -------------------------------------------------------------------------------- /driver_base/nvidia-drm/nvidia-drm-fb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __NVIDIA_DRM_FB_H__ 24 | #define __NVIDIA_DRM_FB_H__ 25 | 26 | #include "nvidia-drm-conftest.h" 27 | 28 | #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE) 29 | 30 | #if defined(NV_DRM_DRMP_H_PRESENT) 31 | #include 32 | #endif 33 | 34 | #if defined(NV_DRM_DRM_FRAMEBUFFER_H_PRESENT) 35 | #include 36 | #endif 37 | 38 | #include "nvidia-drm-gem-nvkms-memory.h" 39 | #include "nvkms-kapi.h" 40 | 41 | struct nv_drm_framebuffer { 42 | struct NvKmsKapiSurface *pSurface; 43 | 44 | struct nv_drm_gem_object* 45 | nv_gem[NVKMS_MAX_PLANES_PER_SURFACE]; 46 | 47 | struct drm_framebuffer base; 48 | }; 49 | 50 | static inline struct nv_drm_framebuffer *to_nv_framebuffer( 51 | struct drm_framebuffer *fb) 52 | { 53 | if (fb == NULL) { 54 | return NULL; 55 | } 56 | return container_of(fb, struct nv_drm_framebuffer, base); 57 | } 58 | 59 | struct drm_framebuffer *nv_drm_internal_framebuffer_create( 60 | struct drm_device *dev, 61 | struct drm_file *file, 62 | struct drm_mode_fb_cmd2 *cmd); 63 | 64 | #endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */ 65 | 66 | #endif /* __NVIDIA_DRM_FB_H__ */ 67 | -------------------------------------------------------------------------------- /driver_base/nvidia-drm/nvidia-drm-format.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __NVIDIA_DRM_FORMAT_H__ 24 | #define __NVIDIA_DRM_FORMAT_H__ 25 | 26 | #include "nvidia-drm-conftest.h" 27 | 28 | #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE) 29 | 30 | #include 31 | 32 | #include "nvkms-format.h" 33 | 34 | bool nv_drm_format_to_nvkms_format(u32 format, 35 | enum NvKmsSurfaceMemoryFormat *nvkms_format); 36 | 37 | uint32_t *nv_drm_format_array_alloc( 38 | unsigned int *count, 39 | const long unsigned int nvkms_format_mask); 40 | 41 | #endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */ 42 | 43 | #endif /* __NVIDIA_DRM_FORMAT_H__ */ 44 | -------------------------------------------------------------------------------- /driver_base/nvidia-drm/nvidia-drm-modeset.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __NVIDIA_DRM_MODESET_H__ 24 | #define __NVIDIA_DRM_MODESET_H__ 25 | 26 | #include "nvidia-drm-conftest.h" 27 | 28 | #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE) 29 | 30 | #include "nvkms-kapi.h" 31 | 32 | struct drm_device; 33 | struct drm_atomic_state; 34 | 35 | struct drm_atomic_state *nv_drm_atomic_state_alloc(struct drm_device *dev); 36 | void nv_drm_atomic_state_clear(struct drm_atomic_state *state); 37 | void nv_drm_atomic_state_free(struct drm_atomic_state *state); 38 | 39 | int nv_drm_atomic_check(struct drm_device *dev, 40 | struct drm_atomic_state *state); 41 | 42 | int nv_drm_atomic_commit(struct drm_device *dev, 43 | struct drm_atomic_state *state, bool nonblock); 44 | 45 | 46 | void nv_drm_handle_flip_occurred(struct nv_drm_device *nv_dev, 47 | NvU32 head, 48 | NvKmsKapiLayerType plane); 49 | 50 | int nv_drm_shut_down_all_crtcs(struct drm_device *dev); 51 | 52 | #endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */ 53 | 54 | #endif /* __NVIDIA_DRM_MODESET_H__ */ 55 | -------------------------------------------------------------------------------- /driver_base/nvidia-drm/nvidia-drm-modeset.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia-drm/nvidia-drm-modeset.o-.text-2ce 2 | /home/sjchoi/huvm_tmp/driver_base/nvidia-drm/nvidia-drm-modeset.o-.text-5dc 3 | /home/sjchoi/huvm_tmp/driver_base/nvidia-drm/nvidia-drm-modeset.o-.text-624 4 | /home/sjchoi/huvm_tmp/driver_base/nvidia-drm/nvidia-drm-modeset.o-.text-8ad 5 | /home/sjchoi/huvm_tmp/driver_base/nvidia-drm/nvidia-drm-modeset.o-.text-957 6 | -------------------------------------------------------------------------------- /driver_base/nvidia-drm/nvidia-drm-os-interface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __NVIDIA_DRM_OS_INTERFACE_H__ 24 | #define __NVIDIA_DRM_OS_INTERFACE_H__ 25 | 26 | #include "nvidia-drm-conftest.h" /* NV_DRM_AVAILABLE */ 27 | 28 | #include "nvtypes.h" 29 | 30 | #if defined(NV_DRM_AVAILABLE) 31 | 32 | struct page; 33 | 34 | /* Set to true when the atomic modeset feature is enabled. */ 35 | extern bool nv_drm_modeset_module_param; 36 | 37 | void *nv_drm_calloc(size_t nmemb, size_t size); 38 | 39 | void nv_drm_free(void *ptr); 40 | 41 | char *nv_drm_asprintf(const char *fmt, ...); 42 | 43 | void nv_drm_write_combine_flush(void); 44 | 45 | int nv_drm_lock_user_pages(unsigned long address, 46 | unsigned long pages_count, struct page ***pages); 47 | 48 | void nv_drm_unlock_user_pages(unsigned long pages_count, struct page **pages); 49 | 50 | void *nv_drm_vmap(struct page **pages, unsigned long pages_count); 51 | 52 | void nv_drm_vunmap(void *address); 53 | 54 | #endif 55 | 56 | #endif /* __NVIDIA_DRM_OS_INTERFACE_H__ */ 57 | -------------------------------------------------------------------------------- /driver_base/nvidia-drm/nvidia-drm-prime-fence.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __NVIDIA_DRM_PRIME_FENCE_H__ 24 | #define __NVIDIA_DRM_PRIME_FENCE_H__ 25 | 26 | #include "nvidia-drm-conftest.h" 27 | 28 | #if defined(NV_DRM_AVAILABLE) 29 | 30 | struct drm_file; 31 | struct drm_device; 32 | 33 | #if defined(NV_DRM_FENCE_AVAILABLE) 34 | 35 | int nv_drm_fence_supported_ioctl(struct drm_device *dev, 36 | void *data, struct drm_file *filep); 37 | 38 | int nv_drm_fence_context_create_ioctl(struct drm_device *dev, 39 | void *data, struct drm_file *filep); 40 | 41 | int nv_drm_gem_fence_attach_ioctl(struct drm_device *dev, 42 | void *data, struct drm_file *filep); 43 | 44 | #endif /* NV_DRM_FENCE_AVAILABLE */ 45 | 46 | #endif /* NV_DRM_AVAILABLE */ 47 | 48 | #endif /* __NVIDIA_DRM_PRIME_FENCE_H__ */ 49 | -------------------------------------------------------------------------------- /driver_base/nvidia-drm/nvidia-drm-prime-fence.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia-drm/nvidia-drm-prime-fence.o-.text-14e 2 | /home/sjchoi/huvm_tmp/driver_base/nvidia-drm/nvidia-drm-prime-fence.o-.text-281 3 | /home/sjchoi/huvm_tmp/driver_base/nvidia-drm/nvidia-drm-prime-fence.o-.text-650 4 | -------------------------------------------------------------------------------- /driver_base/nvidia-drm/nvidia-drm-utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __NVIDIA_DRM_UTILS_H__ 24 | #define __NVIDIA_DRM_UTILS_H__ 25 | 26 | #include "nvidia-drm-conftest.h" 27 | 28 | #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE) 29 | 30 | #include "nvkms-kapi.h" 31 | 32 | enum drm_plane_type; 33 | struct drm_display_mode; 34 | 35 | struct NvKmsKapiConnectorInfo* 36 | nvkms_get_connector_info(struct NvKmsKapiDevice *pDevice, 37 | NvKmsKapiConnector hConnector); 38 | 39 | int nvkms_connector_signal_to_drm_encoder_signal( 40 | NvKmsConnectorSignalFormat format); 41 | 42 | int nvkms_connector_type_to_drm_connector_type(NvKmsConnectorType type, 43 | NvBool internal); 44 | 45 | void nvkms_display_mode_to_drm_mode( 46 | const struct NvKmsKapiDisplayMode *displayMode, 47 | struct drm_display_mode *mode); 48 | 49 | void drm_mode_to_nvkms_display_mode(const struct drm_display_mode *src, 50 | struct NvKmsKapiDisplayMode *dst); 51 | 52 | bool drm_plane_type_to_nvkms_plane_type(enum drm_plane_type src, 53 | NvKmsKapiLayerType *type); 54 | 55 | #endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */ 56 | 57 | #endif /* __NVIDIA_DRM_UTILS_H__ */ 58 | -------------------------------------------------------------------------------- /driver_base/nvidia-drm/nvidia-drm.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include "nvidia-drm.h" 24 | 25 | #if defined(NV_DRM_AVAILABLE) 26 | 27 | #include "nvidia-drm-priv.h" 28 | #include "nvidia-drm-drv.h" 29 | 30 | static struct NvKmsKapiFunctionsTable nvKmsFuncsTable = { 31 | .versionString = NV_VERSION_STRING, 32 | }; 33 | 34 | const struct NvKmsKapiFunctionsTable* const nvKms = &nvKmsFuncsTable; 35 | 36 | #endif 37 | 38 | int nv_drm_init(void) 39 | { 40 | #if defined(NV_DRM_AVAILABLE) 41 | if (!nvKmsKapiGetFunctionsTable(&nvKmsFuncsTable)) { 42 | NV_DRM_LOG_ERR( 43 | "Version mismatch: nvidia-modeset.ko(%s) nvidia-drm.ko(%s)", 44 | nvKmsFuncsTable.versionString, NV_VERSION_STRING); 45 | return -EINVAL; 46 | } 47 | 48 | return nv_drm_probe_devices(); 49 | #else 50 | return 0; 51 | #endif 52 | } 53 | 54 | void nv_drm_exit(void) 55 | { 56 | #if defined(NV_DRM_AVAILABLE) 57 | nv_drm_remove_devices(); 58 | #endif 59 | } 60 | -------------------------------------------------------------------------------- /driver_base/nvidia-drm/nvidia-drm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a 5 | * copy of this software and associated documentation files (the "Software"), 6 | * to deal in the Software without restriction, including without limitation 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | * and/or sell copies of the Software, and to permit persons to whom the 9 | * Software is furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __NVIDIA_DRM_H__ 24 | #define __NVIDIA_DRM_H__ 25 | 26 | #include "nvidia-drm-conftest.h" 27 | 28 | int nv_drm_init(void); 29 | void nv_drm_exit(void); 30 | 31 | #endif /* __NVIDIA_DRM_H__ */ 32 | -------------------------------------------------------------------------------- /driver_base/nvidia-modeset/nv-modeset-kernel.o_binary: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casys-kaist/HUVM/4528f10218bdcfa62128cba87ee566f97fc6cd1b/driver_base/nvidia-modeset/nv-modeset-kernel.o_binary -------------------------------------------------------------------------------- /driver_base/nvidia-modeset/nvkms-ioctl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 by NVIDIA Corporation. All rights reserved. All 3 | * information contained herein is proprietary and confidential to NVIDIA 4 | * Corporation. Any use, reproduction, or disclosure without the written 5 | * permission of NVIDIA Corporation is prohibited. 6 | */ 7 | 8 | #if !defined(NVKMS_IOCTL_H) 9 | #define NVKMS_IOCTL_H 10 | 11 | #include "nvtypes.h" 12 | 13 | /*! 14 | * Some of the NVKMS ioctl parameter data structures are quite large 15 | * and would exceed the parameter size constraints on at least SunOS. 16 | * 17 | * Redirect ioctls through a level of indirection: user-space assigns 18 | * NvKmsIoctlParams with the real command, size, and pointer, and 19 | * passes the NvKmsIoctlParams through the ioctl. 20 | */ 21 | 22 | struct NvKmsIoctlParams { 23 | NvU32 cmd; 24 | NvU32 size; 25 | NvU64 address NV_ALIGN_BYTES(8); 26 | }; 27 | 28 | #define NVKMS_IOCTL_MAGIC 'm' 29 | #define NVKMS_IOCTL_CMD 0 30 | 31 | #define NVKMS_IOCTL_IOWR \ 32 | _IOWR(NVKMS_IOCTL_MAGIC, NVKMS_IOCTL_CMD, struct NvKmsIoctlParams) 33 | 34 | /*! 35 | * User-space pointers are always passed to NVKMS in an NvU64. 36 | * This user-space address is eventually passed into the platform's 37 | * copyin/copyout functions, in a void* argument. 38 | * 39 | * This utility function converts from an NvU64 to a pointer. 40 | */ 41 | 42 | static inline void *nvKmsNvU64ToPointer(NvU64 value) 43 | { 44 | return (void *)(NvUPtr)value; 45 | } 46 | 47 | /*! 48 | * Before casting the NvU64 to a void*, check that casting to a pointer 49 | * size within the kernel does not lose any precision in the current 50 | * environment. 51 | */ 52 | static inline NvBool nvKmsNvU64AddressIsSafe(NvU64 address) 53 | { 54 | return address == (NvU64)(NvUPtr)address; 55 | } 56 | 57 | #endif /* NVKMS_IOCTL_H */ 58 | -------------------------------------------------------------------------------- /driver_base/nvidia-modeset/nvkms.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 by NVIDIA Corporation. All rights reserved. All 3 | * information contained herein is proprietary and confidential to NVIDIA 4 | * Corporation. Any use, reproduction, or disclosure without the written 5 | * permission of NVIDIA Corporation is prohibited. 6 | */ 7 | 8 | #ifndef __NV_KMS_H__ 9 | #define __NV_KMS_H__ 10 | 11 | #include "nvtypes.h" 12 | #include /* size_t */ 13 | 14 | #include "nvkms-kapi.h" 15 | 16 | typedef struct nvkms_per_open nvkms_per_open_handle_t; 17 | 18 | typedef void nvkms_procfs_out_string_func_t(void *data, 19 | const char *str); 20 | 21 | typedef void nvkms_procfs_proc_t(void *data, 22 | char *buffer, size_t size, 23 | nvkms_procfs_out_string_func_t *outString); 24 | 25 | typedef struct { 26 | const char *name; 27 | nvkms_procfs_proc_t *func; 28 | } nvkms_procfs_file_t; 29 | 30 | enum NvKmsClientType { 31 | NVKMS_CLIENT_USER_SPACE, 32 | NVKMS_CLIENT_KERNEL_SPACE, 33 | }; 34 | 35 | NvBool nvKmsIoctl( 36 | void *pOpenVoid, 37 | NvU32 cmd, 38 | NvU64 paramsAddress, 39 | const size_t paramSize); 40 | 41 | void nvKmsClose(void *pOpenVoid); 42 | 43 | void* nvKmsOpen( 44 | NvU32 pid, 45 | enum NvKmsClientType clientType, 46 | nvkms_per_open_handle_t *pOpenKernel); 47 | 48 | NvBool nvKmsModuleLoad(void); 49 | 50 | void nvKmsModuleUnload(void); 51 | 52 | void nvKmsSuspend(NvU32 gpuId); 53 | void nvKmsResume(NvU32 gpuId); 54 | 55 | void nvKmsGetProcFiles(const nvkms_procfs_file_t **ppProcFiles); 56 | 57 | void nvKmsKapiHandleEventQueueChange 58 | ( 59 | struct NvKmsKapiDevice *device 60 | ); 61 | 62 | NvBool nvKmsKapiGetFunctionsTableInternal 63 | ( 64 | struct NvKmsKapiFunctionsTable *funcsTable 65 | ); 66 | 67 | #endif /* __NV_KMS_H__ */ 68 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/cla06fsubch.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2013 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | 22 | *******************************************************************************/ 23 | 24 | #ifndef __cla06fsubch_h__ 25 | #define __cla06fsubch_h__ 26 | 27 | #define NVA06F_SUBCHANNEL_COPY_ENGINE 4 28 | 29 | #endif // {__cla06fsubch_h__} 30 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/cla16f.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2015 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | 22 | *******************************************************************************/ 23 | 24 | #ifndef _cla16f_h_ 25 | #define _cla16f_h_ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | #include "nvtypes.h" 32 | 33 | #define KEPLER_CHANNEL_GPFIFO_B (0x0000A16F) 34 | 35 | #define NVA16F_WFI (0x00000078) 36 | #define NVA16F_WFI_HANDLE 31:0 37 | 38 | #ifdef __cplusplus 39 | }; /* extern "C" */ 40 | #endif 41 | 42 | #endif /* _cla16F_h_ */ 43 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/nvCpuUuid.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2015-2018 NVidia Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | #include "nvtypes.h" 24 | #include "nvCpuUuid.h" 25 | 26 | const NvProcessorUuid NV_PROCESSOR_UUID_CPU_DEFAULT = 27 | { 28 | { 29 | // Produced via uuidgen(1): 73772a14-2c41-4750-a27b-d4d74e0f5ea6: 30 | 0xa6, 0x5e, 0x0f, 0x4e, 0xd7, 0xd4, 0x7b, 0xa2, 31 | 0x50, 0x47, 0x41, 0x2c, 0x14, 0x2a, 0x77, 0x73 32 | } 33 | }; 34 | 35 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm.o-.text-27d4 2 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm.o-.text-29e8 3 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_ats_faults.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2018 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | #include "uvm_linux.h" 24 | #include "uvm_forward_decl.h" 25 | #include "uvm_lock.h" 26 | #include "uvm_global.h" 27 | #include "uvm_va_space.h" 28 | 29 | NV_STATUS uvm_ats_service_fault_entry(uvm_gpu_va_space_t *gpu_va_space, 30 | uvm_fault_buffer_entry_t *current_entry, 31 | uvm_ats_fault_invalidate_t *ats_invalidate); 32 | 33 | // This function performs pending TLB invalidations for ATS and clears the 34 | // ats_invalidate->write_faults_in_batch flag 35 | NV_STATUS uvm_ats_invalidate_tlbs(uvm_gpu_va_space_t *gpu_va_space, 36 | uvm_ats_fault_invalidate_t *ats_invalidate, 37 | uvm_tracker_t *out_tracker); 38 | 39 | static bool uvm_can_ats_service_faults(uvm_gpu_va_space_t *gpu_va_space, struct mm_struct *mm) 40 | { 41 | if (mm) 42 | uvm_assert_mmap_lock_locked(mm); 43 | if (gpu_va_space->ats.enabled) 44 | UVM_ASSERT(g_uvm_global.ats.enabled); 45 | 46 | return gpu_va_space->ats.enabled && mm; 47 | } 48 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_channel.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_channel.o-.text-127 2 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_channel.o-.text-15ad 3 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_channel.o-.text-194 4 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_channel.o-.text-1d3b 5 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_channel.o-.text-1eb0 6 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_channel.o-.text-21fb 7 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_channel.o-.text-42 8 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_channel.o-.text-71d 9 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_common.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_common.o-.text-152 2 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_debug_optimized.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2015 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | 22 | *******************************************************************************/ 23 | 24 | // This file provides simple wrappers that are always built with optimizations 25 | // turned on to WAR issues with functions that don't build correctly otherwise. 26 | 27 | #include "uvm_linux.h" 28 | 29 | int nv_atomic_xchg(atomic_t *val, int new) 30 | { 31 | return atomic_xchg(val, new); 32 | } 33 | 34 | int nv_atomic_cmpxchg(atomic_t *val, int old, int new) 35 | { 36 | return atomic_cmpxchg(val, old, new); 37 | } 38 | 39 | long nv_atomic_long_cmpxchg(atomic_long_t *val, long old, long new) 40 | { 41 | return atomic_long_cmpxchg(val, old, new); 42 | } 43 | 44 | unsigned long nv_copy_from_user(void *to, const void __user *from, unsigned long n) 45 | { 46 | return copy_from_user(to, from, n); 47 | } 48 | 49 | unsigned long nv_copy_to_user(void __user *to, const void *from, unsigned long n) 50 | { 51 | return copy_to_user(to, from, n); 52 | } 53 | 54 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_extern_decl.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2019 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | 22 | *******************************************************************************/ 23 | 24 | #ifndef __UVM_EXTERN_DECL_H__ 25 | #define __UVM_EXTERN_DECL_H__ 26 | 27 | #include "uvm_linux.h" 28 | #include "uvm_forward_decl.h" 29 | 30 | extern int uvm_enable_debug_procfs; 31 | 32 | extern unsigned uvm_perf_map_remote_on_native_atomics_fault; 33 | 34 | extern uvm_global_t g_uvm_global; 35 | 36 | extern bool uvm_global_is_suspended(void); 37 | 38 | #endif //__UVM_EXTERN_DECL_H__ 39 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_gpu.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_gpu.o-.text-3c00 2 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_gpu.o-.text-3c34 3 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_gpu.o-.text-66d7 4 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_gpu.o-.text-67b1 5 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_gpu.o-.text-6886 6 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_gpu.o-.text-6a08 7 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_gpu.o-.text-6ad1 8 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_gpu.o-.text-6bc2 9 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_gpu.o-.text-d8d 10 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_gpu.o-.text-dc7 11 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_gpu_non_replayable_faults.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2017 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | #ifndef __UVM_GPU_NON_REPLAYABLE_FAULTS_H__ 24 | #define __UVM_GPU_NON_REPLAYABLE_FAULTS_H__ 25 | 26 | #include 27 | #include "uvm_forward_decl.h" 28 | 29 | bool uvm_gpu_non_replayable_faults_pending(uvm_parent_gpu_t *parent_gpu); 30 | 31 | void uvm_gpu_service_non_replayable_fault_buffer(uvm_gpu_t *gpu); 32 | 33 | NV_STATUS uvm_gpu_fault_buffer_init_non_replayable_faults(uvm_parent_gpu_t *parent_gpu); 34 | 35 | void uvm_gpu_fault_buffer_deinit_non_replayable_faults(uvm_parent_gpu_t *parent_gpu); 36 | 37 | #endif // __UVM_GPU_NON_REPLAYABLE_FAULTS_H__ 38 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_gpu_semaphore.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_gpu_semaphore.o-.text-5bb 2 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_linux_ioctl.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2013 NVidia Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | #ifndef _UVM_LINUX_IOCTL_H 24 | #define _UVM_LINUX_IOCTL_H 25 | 26 | #include "uvm_ioctl.h" 27 | 28 | // This ioctl must be the first operation performed on the UVM file descriptor 29 | // after opening it. Until this ioctl is made, the UVM file descriptor is 30 | // inoperable: all other ioctls will return NV_ERR_ILLEGAL_ACTION and mmap will 31 | // return EBADFD. 32 | #define UVM_INITIALIZE 0x30000001 33 | 34 | typedef struct 35 | { 36 | NvU64 flags NV_ALIGN_BYTES(8); // IN 37 | NV_STATUS rmStatus; // OUT 38 | } UVM_INITIALIZE_PARAMS; 39 | 40 | #define UVM_DEINITIALIZE 0x30000002 41 | 42 | #endif // _UVM_LINUX_IOCTL_H 43 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_migrate.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2018 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | 22 | *******************************************************************************/ 23 | 24 | NV_STATUS uvm_migrate_init(void); 25 | void uvm_migrate_exit(void); 26 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_pascal_ce.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2016 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | 22 | *******************************************************************************/ 23 | 24 | #include "uvm_hal.h" 25 | #include "uvm_push.h" 26 | #include "clc0b5.h" 27 | 28 | void uvm_hal_pascal_ce_offset_out(uvm_push_t *push, NvU64 offset_out) 29 | { 30 | NV_PUSH_2U(C0B5, OFFSET_OUT_UPPER, HWVALUE(C0B5, OFFSET_OUT_UPPER, UPPER, NvOffset_HI32(offset_out)), 31 | OFFSET_OUT_LOWER, HWVALUE(C0B5, OFFSET_OUT_LOWER, VALUE, NvOffset_LO32(offset_out))); 32 | } 33 | 34 | void uvm_hal_pascal_ce_offset_in_out(uvm_push_t *push, NvU64 offset_in, NvU64 offset_out) 35 | { 36 | NV_PUSH_4U(C0B5, OFFSET_IN_UPPER, HWVALUE(C0B5, OFFSET_IN_UPPER, UPPER, NvOffset_HI32(offset_in)), 37 | OFFSET_IN_LOWER, HWVALUE(C0B5, OFFSET_IN_LOWER, VALUE, NvOffset_LO32(offset_in)), 38 | OFFSET_OUT_UPPER, HWVALUE(C0B5, OFFSET_OUT_UPPER, UPPER, NvOffset_HI32(offset_out)), 39 | OFFSET_OUT_LOWER, HWVALUE(C0B5, OFFSET_OUT_LOWER, VALUE, NvOffset_LO32(offset_out))); 40 | } 41 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_perf_thrashing.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_perf_thrashing.o-.text-1bb3 2 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_perf_thrashing.o-.text-622 3 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_perf_thrashing.o-.text-ab1 4 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_perf_thrashing.o-.text-b8e 5 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_pmm_gpu.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-1219 2 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-1399 3 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-1688 4 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-17e4 5 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-18f4 6 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-1c75 7 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-1d77 8 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-1f09 9 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-203 10 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-23dc 11 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-2799 12 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-2c1 13 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-2e6b 14 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-315e 15 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-31fb 16 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-33d4 17 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-39b3 18 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-41 19 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-41a 20 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-4234 21 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-4319 22 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-767 23 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-847 24 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-aa9 25 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-d31 26 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pmm_gpu.o-.text-f5 27 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_populate_pageable.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2018 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | 22 | *******************************************************************************/ 23 | 24 | #ifndef __UVM_POPULATE_PAGEABLE_H__ 25 | #define __UVM_POPULATE_PAGEABLE_H__ 26 | 27 | // Populate the pages of the given vma that overlap with the 28 | // [start:start+length) range. If any of the pages was not populated, we return 29 | // NV_ERR_NO_MEMORY. 30 | // 31 | // Locking: vma->vm_mm->mmap_lock must be held in read or write mode 32 | NV_STATUS uvm_populate_pageable_vma(struct vm_area_struct *vma, 33 | unsigned long start, 34 | unsigned long length, 35 | int min_prot); 36 | 37 | // Populate all the pages in the given range by calling get_user_pages. The 38 | // range must be fully backed by vmas. If any of the pages was not populated, 39 | // we return NV_ERR_NO_MEMORY. 40 | // 41 | // Locking: mm->mmap_lock must be held in read or write mode 42 | NV_STATUS uvm_populate_pageable(struct mm_struct *mm, 43 | unsigned long start, 44 | unsigned long length, 45 | int min_prot); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_pushbuffer.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pushbuffer.o-.text-26f 2 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pushbuffer.o-.text-70b 3 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pushbuffer.o-.text-860 4 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pushbuffer.o-.text-8bc 5 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_pushbuffer.o-.text-a64 6 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_range_allocator.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_range_allocator.o-.text-236 2 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_range_allocator.o-.text-314 3 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_range_group.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_range_group.o-.text-b4a 2 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_range_group.o-.text-b99 3 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_range_group.o-.text-ce8 4 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_range_group.o-.text-f02 5 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_range_group.o-.text-fe3 6 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_tools.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_tools.o-.text-101f 2 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_tools.o-.text-15e 3 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_tools.o-.text-1cc6 4 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_tools.o-.text-1da1 5 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_tools.o-.text-1e40 6 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_tools.o-.text-1ee8 7 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_tools.o-.text-2394 8 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_tools.o-.text-27c7 9 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_tools.o-.text-33aa 10 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_tools.o-.text-364f 11 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_tools.o-.text-ef0 12 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_tools_init.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2016 NVIDIA Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | 22 | *******************************************************************************/ 23 | 24 | #ifndef _UVM_TOOLS_INIT_H_ 25 | #define _UVM_TOOLS_INIT_H_ 26 | 27 | #include "uvm_common.h" 28 | 29 | int uvm_tools_init(dev_t uvm_base_dev); 30 | 31 | void uvm_tools_exit(void); 32 | 33 | #endif // _UVM_TOOLS_INIT_H_ 34 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_va_block.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_va_block.o-.text-350e 2 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_va_block.o-.text-4d73 3 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_va_block.o-.text-a6a2 4 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_va_range.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_va_range.o-.text-1e32 2 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_va_range.o-.text-23de 3 | -------------------------------------------------------------------------------- /driver_base/nvidia-uvm/uvm_va_space_mm.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_va_space_mm.o-.text-345 2 | /home/sjchoi/huvm_tmp/driver_base/nvidia-uvm/uvm_va_space_mm.o-.text-d4 3 | -------------------------------------------------------------------------------- /driver_base/nvidia/linux_nvswitch.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia/linux_nvswitch.o-.text-1bed 2 | /home/sjchoi/huvm_tmp/driver_base/nvidia/linux_nvswitch.o-.text-22a5 3 | -------------------------------------------------------------------------------- /driver_base/nvidia/nv-acpi.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia/nv-acpi.o-.text-143c 2 | /home/sjchoi/huvm_tmp/driver_base/nvidia/nv-acpi.o-.text-1554 3 | /home/sjchoi/huvm_tmp/driver_base/nvidia/nv-acpi.o-.text-17ea 4 | /home/sjchoi/huvm_tmp/driver_base/nvidia/nv-acpi.o-.text-1b1b 5 | /home/sjchoi/huvm_tmp/driver_base/nvidia/nv-acpi.o-.text-1db6 6 | /home/sjchoi/huvm_tmp/driver_base/nvidia/nv-acpi.o-.text-1f2a 7 | /home/sjchoi/huvm_tmp/driver_base/nvidia/nv-acpi.o-.text-2283 8 | /home/sjchoi/huvm_tmp/driver_base/nvidia/nv-acpi.o-.text-27f 9 | /home/sjchoi/huvm_tmp/driver_base/nvidia/nv-acpi.o-.text-41b 10 | -------------------------------------------------------------------------------- /driver_base/nvidia/nv-caps.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia/nv-caps.o-.text-af1 2 | -------------------------------------------------------------------------------- /driver_base/nvidia/nv-frontend.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2012-2013 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | 12 | #ifndef _NV_FRONTEND_H_ 13 | #define _NV_FRONTEND_H_ 14 | 15 | #include "nvtypes.h" 16 | #include "nv-misc.h" 17 | #include "nv-linux.h" 18 | #include "nv-register-module.h" 19 | 20 | #define NV_MAX_MODULE_INSTANCES 8 21 | 22 | #define NV_FRONTEND_MINOR_NUMBER(x) minor((x)->i_rdev) 23 | 24 | #define NV_FRONTEND_CONTROL_DEVICE_MINOR_MAX 255 25 | #define NV_FRONTEND_CONTROL_DEVICE_MINOR_MIN (NV_FRONTEND_CONTROL_DEVICE_MINOR_MAX - \ 26 | NV_MAX_MODULE_INSTANCES) 27 | 28 | #define NV_FRONTEND_IS_CONTROL_DEVICE(x) ((x <= NV_FRONTEND_CONTROL_DEVICE_MINOR_MAX) && \ 29 | (x > NV_FRONTEND_CONTROL_DEVICE_MINOR_MIN)) 30 | 31 | int nvidia_frontend_add_device(nvidia_module_t *, nv_linux_state_t *); 32 | int nvidia_frontend_remove_device(nvidia_module_t *, nv_linux_state_t *); 33 | 34 | extern nvidia_module_t *nv_minor_num_table[]; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /driver_base/nvidia/nv-kernel.o_binary: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casys-kaist/HUVM/4528f10218bdcfa62128cba87ee566f97fc6cd1b/driver_base/nvidia/nv-kernel.o_binary -------------------------------------------------------------------------------- /driver_base/nvidia/nv-memdbg.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia/nv-memdbg.o-.text-47 2 | -------------------------------------------------------------------------------- /driver_base/nvidia/nv-pat.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2017 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | 12 | #ifndef _NV_PAT_H_ 13 | #define _NV_PAT_H_ 14 | 15 | #include "nv-linux.h" 16 | 17 | 18 | #if defined(NV_ENABLE_PAT_SUPPORT) 19 | extern int nv_init_pat_support(nvidia_stack_t *sp); 20 | extern void nv_teardown_pat_support(void); 21 | extern int nv_enable_pat_support(void); 22 | extern void nv_disable_pat_support(void); 23 | #else 24 | static inline int nv_init_pat_support(nvidia_stack_t *sp) 25 | { 26 | (void)sp; 27 | return 0; 28 | } 29 | 30 | static inline void nv_teardown_pat_support(void) 31 | { 32 | return; 33 | } 34 | 35 | static inline int nv_enable_pat_support(void) 36 | { 37 | return 1; 38 | } 39 | 40 | static inline void nv_disable_pat_support(void) 41 | { 42 | return; 43 | } 44 | #endif 45 | 46 | #endif /* _NV_PAT_H_ */ 47 | -------------------------------------------------------------------------------- /driver_base/nvidia/nv-pat.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia/nv-pat.o-.text-5f 2 | /home/sjchoi/huvm_tmp/driver_base/nvidia/nv-pat.o-.text-b5 3 | -------------------------------------------------------------------------------- /driver_base/nvidia/nv-pci-table.c: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2015 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #include 12 | #include 13 | 14 | #include "nv-pci-table.h" 15 | 16 | struct pci_device_id nv_pci_table[] = { 17 | { 18 | .vendor = PCI_VENDOR_ID_NVIDIA, 19 | .device = PCI_ANY_ID, 20 | .subvendor = PCI_ANY_ID, 21 | .subdevice = PCI_ANY_ID, 22 | .class = (PCI_CLASS_DISPLAY_VGA << 8), 23 | .class_mask = ~0 24 | }, 25 | { 26 | .vendor = PCI_VENDOR_ID_NVIDIA, 27 | .device = PCI_ANY_ID, 28 | .subvendor = PCI_ANY_ID, 29 | .subdevice = PCI_ANY_ID, 30 | .class = (PCI_CLASS_DISPLAY_3D << 8), 31 | .class_mask = ~0 32 | }, 33 | { } 34 | }; 35 | 36 | MODULE_DEVICE_TABLE(pci, nv_pci_table); 37 | -------------------------------------------------------------------------------- /driver_base/nvidia/nv-pci-table.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2015 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #ifndef _NV_PCI_TABLE_H_ 12 | #define _NV_PCI_TABLE_H_ 13 | 14 | #include 15 | 16 | extern struct pci_device_id nv_pci_table[]; 17 | 18 | #endif /* _NV_PCI_TABLE_H_ */ 19 | -------------------------------------------------------------------------------- /driver_base/nvidia/nv-vm.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia/nv-vm.o-.text-70a 2 | /home/sjchoi/huvm_tmp/driver_base/nvidia/nv-vm.o-.text-dc9 3 | /home/sjchoi/huvm_tmp/driver_base/nvidia/nv-vm.o-.text-e6c 4 | -------------------------------------------------------------------------------- /driver_base/nvidia/nv-vtophys.c: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 1999-2013 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #define __NO_VERSION__ 12 | #include "nv-misc.h" 13 | 14 | #include "os-interface.h" 15 | #include "nv-linux.h" 16 | 17 | NvU64 NV_API_CALL nv_get_kern_phys_address(NvU64 address) 18 | { 19 | /* direct-mapped kernel address */ 20 | if (virt_addr_valid(address)) 21 | return __pa(address); 22 | 23 | nv_printf(NV_DBG_ERRORS, 24 | "NVRM: can't translate address in %s()!\n", __FUNCTION__); 25 | return 0; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /driver_base/nvidia/nv.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia/nv.o-.text-2763 2 | /home/sjchoi/huvm_tmp/driver_base/nvidia/nv.o-.text-881 3 | /home/sjchoi/huvm_tmp/driver_base/nvidia/nv.o-.text-894 4 | -------------------------------------------------------------------------------- /driver_base/nvidia/nv_uvm_interface.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia/nv_uvm_interface.o-.text-120a 2 | -------------------------------------------------------------------------------- /driver_base/nvidia/nvidia-sources.Kbuild: -------------------------------------------------------------------------------- 1 | NVIDIA_SOURCES += nvidia/nv-frontend.c 2 | NVIDIA_SOURCES += nvidia/nv.c 3 | NVIDIA_SOURCES += nvidia/nv-pci.c 4 | NVIDIA_SOURCES += nvidia/nv-acpi.c 5 | NVIDIA_SOURCES += nvidia/nv-cray.c 6 | NVIDIA_SOURCES += nvidia/nv-dma.c 7 | NVIDIA_SOURCES += nvidia/nv-i2c.c 8 | NVIDIA_SOURCES += nvidia/nv-mmap.c 9 | NVIDIA_SOURCES += nvidia/nv-p2p.c 10 | NVIDIA_SOURCES += nvidia/nv-pat.c 11 | NVIDIA_SOURCES += nvidia/nv-procfs.c 12 | NVIDIA_SOURCES += nvidia/nv-usermap.c 13 | NVIDIA_SOURCES += nvidia/nv-vm.c 14 | NVIDIA_SOURCES += nvidia/nv-vtophys.c 15 | NVIDIA_SOURCES += nvidia/os-interface.c 16 | NVIDIA_SOURCES += nvidia/os-mlock.c 17 | NVIDIA_SOURCES += nvidia/os-pci.c 18 | NVIDIA_SOURCES += nvidia/os-registry.c 19 | NVIDIA_SOURCES += nvidia/os-usermap.c 20 | NVIDIA_SOURCES += nvidia/nv-modeset-interface.c 21 | NVIDIA_SOURCES += nvidia/nv-pci-table.c 22 | NVIDIA_SOURCES += nvidia/nv-kthread-q.c 23 | NVIDIA_SOURCES += nvidia/nv-memdbg.c 24 | NVIDIA_SOURCES += nvidia/nv-ibmnpu.c 25 | NVIDIA_SOURCES += nvidia/nv-report-err.c 26 | NVIDIA_SOURCES += nvidia/nv-rsync.c 27 | NVIDIA_SOURCES += nvidia/nv-msi.c 28 | NVIDIA_SOURCES += nvidia/nv-caps.c 29 | NVIDIA_SOURCES += nvidia/nv_uvm_interface.c 30 | NVIDIA_SOURCES += nvidia/nvlink_linux.c 31 | NVIDIA_SOURCES += nvidia/nvlink_caps.c 32 | NVIDIA_SOURCES += nvidia/linux_nvswitch.c 33 | NVIDIA_SOURCES += nvidia/procfs_nvswitch.c 34 | -------------------------------------------------------------------------------- /driver_base/nvidia/nvlink_caps.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2019 NVidia Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | #ifndef _NVLINK_CAPS_H_ 24 | #define _NVLINK_CAPS_H_ 25 | 26 | /* List of supported capability type */ 27 | #define NVLINK_CAP_FABRIC_MANAGEMENT 0 28 | 29 | /* Max supported capabilities count */ 30 | #define NVLINK_CAP_COUNT 1 31 | 32 | int nvlink_cap_init(const char *path); 33 | void nvlink_cap_exit(void); 34 | int nvlink_cap_acquire(int fd, NvU32 type); 35 | void nvlink_cap_release(int fd); 36 | 37 | #endif //_NVLINK_CAPS_H_ 38 | -------------------------------------------------------------------------------- /driver_base/nvidia/nvlink_export.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2015 NVidia Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | *******************************************************************************/ 22 | 23 | 24 | #ifndef _NVLINK_EXPORT_H_ 25 | #define _NVLINK_EXPORT_H_ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | #include "nvlink_common.h" 32 | 33 | /* 34 | * Initializes core lib and does all that is needed 35 | * to access NVLINK functionality on the current platform. 36 | */ 37 | NvlStatus nvlink_lib_initialize(void); 38 | 39 | /* 40 | * Frees any related resources and then unloads core lib. 41 | */ 42 | NvlStatus nvlink_lib_unload(void); 43 | 44 | /* 45 | * Entry point for nvlink ioctl calls. 46 | */ 47 | NvlStatus nvlink_lib_ioctl_ctrl(nvlink_ioctrl_params *ctrl_params); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif //_NVLINK_EXPORT_H_ 54 | -------------------------------------------------------------------------------- /driver_base/nvidia/nvlink_linux.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia/nvlink_linux.o-.text-6b5 2 | -------------------------------------------------------------------------------- /driver_base/nvidia/nvlink_proto.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Copyright (c) 2015-2018 NVidia Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to 6 | deal in the Software without restriction, including without limitation the 7 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | 22 | *******************************************************************************/ 23 | 24 | #ifndef _NVLINK_PROTO_H_ 25 | #define _NVLINK_PROTO_H_ 26 | 27 | #include "nvlink_common.h" 28 | 29 | /* 30 | * Functions defined in nvlink_linux.c 31 | */ 32 | 33 | int nvlink_core_init (void); 34 | void nvlink_core_exit (void); 35 | 36 | 37 | /* 38 | * Functions defined in nvswitch_linux.c 39 | */ 40 | int nvswitch_init (void); 41 | void nvswitch_exit (void); 42 | 43 | 44 | #if defined(NVCPU_AARCH64) 45 | /* 46 | * Functions defined in tegrashim_linux.c (Tegra only) 47 | */ 48 | int tegrashim_init (void); 49 | void tegrashim_exit (void); 50 | NvlStatus tegrashim_init_device (struct pci_dev *); 51 | #endif 52 | 53 | #endif /* _NVLINK_PROTO_H_ */ 54 | -------------------------------------------------------------------------------- /driver_base/nvidia/os-interface.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia/os-interface.o-.text-11fd 2 | /home/sjchoi/huvm_tmp/driver_base/nvidia/os-interface.o-.text-132b 3 | /home/sjchoi/huvm_tmp/driver_base/nvidia/os-interface.o-.text-199 4 | /home/sjchoi/huvm_tmp/driver_base/nvidia/os-interface.o-.text-487 5 | /home/sjchoi/huvm_tmp/driver_base/nvidia/os-interface.o-.text-80a 6 | /home/sjchoi/huvm_tmp/driver_base/nvidia/os-interface.o-.text-a6e 7 | /home/sjchoi/huvm_tmp/driver_base/nvidia/os-interface.o-.text-a9 8 | /home/sjchoi/huvm_tmp/driver_base/nvidia/os-interface.o-.text-ccd 9 | /home/sjchoi/huvm_tmp/driver_base/nvidia/os-interface.o-.text-f9 10 | -------------------------------------------------------------------------------- /driver_base/nvidia/os-mlock.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia/os-mlock.o-.text-35 2 | /home/sjchoi/huvm_tmp/driver_base/nvidia/os-mlock.o-.text-3f5 3 | -------------------------------------------------------------------------------- /driver_base/nvidia/os-pci.o.ur-safe: -------------------------------------------------------------------------------- 1 | /home/sjchoi/huvm_tmp/driver_base/nvidia/os-pci.o-.text-10 2 | -------------------------------------------------------------------------------- /driver_base/nvidia/os-usermap.c: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 1999-2011 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #define __NO_VERSION__ 12 | #include "nv-misc.h" 13 | 14 | #include "os-interface.h" 15 | #include "nv-linux.h" 16 | 17 | void* NV_API_CALL os_map_user_space( 18 | NvU64 start, 19 | NvU64 size_bytes, 20 | NvU32 mode, 21 | NvU32 protect, 22 | void **priv_data 23 | ) 24 | { 25 | return (void *)(NvUPtr)start; 26 | } 27 | 28 | void NV_API_CALL os_unmap_user_space( 29 | void *address, 30 | NvU64 size, 31 | void *priv_data 32 | ) 33 | { 34 | } 35 | 36 | NV_STATUS NV_API_CALL os_match_mmap_offset( 37 | void *pAllocPrivate, 38 | NvU64 offset, 39 | NvU64 *pPageIndex 40 | ) 41 | { 42 | nv_alloc_t *at = pAllocPrivate; 43 | NvU64 i; 44 | 45 | for (i = 0; i < at->num_pages; i++) 46 | { 47 | if (at->flags.contig) 48 | { 49 | if (offset == (at->page_table[0]->phys_addr + (i * PAGE_SIZE))) 50 | { 51 | *pPageIndex = i; 52 | return NV_OK; 53 | } 54 | } 55 | else 56 | { 57 | if (offset == at->page_table[i]->phys_addr) 58 | { 59 | *pPageIndex = i; 60 | return NV_OK; 61 | } 62 | } 63 | } 64 | 65 | return NV_ERR_OBJECT_NOT_FOUND; 66 | } 67 | -------------------------------------------------------------------------------- /driver_base/nvidia/rmp2pdefines.h: -------------------------------------------------------------------------------- 1 | /* _NVRM_COPYRIGHT_BEGIN_ 2 | * 3 | * Copyright 2015 by NVIDIA Corporation. All rights reserved. All 4 | * information contained herein is proprietary and confidential to NVIDIA 5 | * Corporation. Any use, reproduction, or disclosure without the written 6 | * permission of NVIDIA Corporation is prohibited. 7 | * 8 | * _NVRM_COPYRIGHT_END_ 9 | */ 10 | 11 | #ifndef _RMP2PDEFINES_H_ 12 | #define _RMP2PDEFINES_H_ 13 | 14 | #define NVRM_P2P_PAGESIZE_SMALL_4K (4 << 10) 15 | #define NVRM_P2P_PAGESIZE_BIG_64K (64 << 10) 16 | #define NVRM_P2P_PAGESIZE_BIG_128K (128 << 10) 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /scripts/download_graph_dataset.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mkdir -p ../dataset/graph 3 | cd ../dataset/graph 4 | wget -c https://rapidsai-data.s3.us-east-2.amazonaws.com/cugraph/benchmark/benchmark_csv_data.tgz 5 | tar -xvf benchmark_csv_data.tgz 6 | mv undirected/soc-twitter-2010.csv . 7 | wget -c https://nrvis.com/download/data/soc/soc-sinaweibo.zip 8 | unzip -o soc-sinaweibo.zip 9 | wget -c https://nrvis.com/download/data/massive/web-ClueWeb09-50m.zip 10 | unzip -o web-ClueWeb09-50m.zip 11 | wget -c https://nrvis.com/download/data/massive/web-uk-2005-all.zip 12 | unzip -o web-uk-2005-all.zip 13 | wget -c https://nrvis.com/download/data/massive/web-cc12-PayLevelDomain.zip 14 | unzip -o web-cc12-PayLevelDomain.zip 15 | wget -c https://nrvis.com/download/data/massive/web-wikipedia_link_en13-all.zip 16 | unzip -o web-wikipedia_link_en13-all.zip 17 | -------------------------------------------------------------------------------- /scripts/fig6/run_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./case1_pagerank.sh 3 | ./case2_bfs.sh 4 | ./case3_wcc.sh 5 | ./case4_louvain.sh 6 | ./case4_wcc.sh 7 | -------------------------------------------------------------------------------- /scripts/fig7/run_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./case1_pagerank.sh 3 | ./case2_bfs.sh 4 | ./case3_wcc.sh 5 | ./case4_louvain.sh 6 | -------------------------------------------------------------------------------- /scripts/fig8/run_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./case1_pagerank.sh 3 | ./case2_bfs.sh 4 | ./case3_wcc.sh 5 | ./case4_louvain.sh 6 | -------------------------------------------------------------------------------- /scripts/fig9/bfs.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | project_home="/home/ubuntu/HUVM" 3 | current_date=$(date '+%Y-%m-%d_%H:%M:%S') 4 | output_path="${current_date}_bfs" 5 | output_raw="${output_path}/raw.txt" 6 | output_filename="bfs" 7 | harvestor_command="docker run --gpus all --rm -it --name huvm_harvestor -v ${project_home}:/HUVM sjchoi/huvm:init python /HUVM/bench/cugraph/bfs.py --n_workers 1 --visible_devices 1,2 --dataset /HUVM/dataset/graph/web-ClueWeb09-50m.edges" 8 | harvestee_command="./default_tasks.sh" 9 | 10 | echo ${current_date} 11 | mkdir ${output_path} 12 | 13 | # Write given input to new column in csv file. Gets file in $1, header name in 14 | # $2, and input string in $3. 15 | add_col_to_csv() { 16 | local file=$1 17 | local header=$2 18 | local str=$3 19 | 20 | str=`echo -e "${header}\n${str}"` 21 | 22 | if [ -f ${file} ] 23 | then 24 | str=`paste -d, ${file} <(printf "%s" "${str}")` 25 | fi 26 | echo "${str}" > ${file} 27 | } 28 | 29 | run_benchmark() { 30 | echo "start ${output_header}" 31 | ${harvestee_command} ${mem_occupy} & 32 | sleep 10 33 | local output=`${harvestor_command} 2>&1 | grep "Out:"` 34 | echo "${output_filename}/${output_header}" >> "${output_raw}" 35 | echo "${output}" >> "${output_raw}" 36 | echo >> "${output_raw}" 37 | output=`echo "${output:6:-1}"` 38 | add_col_to_csv "${output_path}/${output_filename}.csv" "${output_header}" "${output}" 39 | pkill default_tasks 40 | sleep 10 41 | } 42 | 43 | echo "Figure 9: BFS" 44 | 45 | output_header="Warmup" 46 | mem_occupy=1000 47 | ${project_home}/scripts/load_driver.sh 48 | run_benchmark 49 | 50 | output_header="Base" 51 | mem_occupy=1000 52 | ${project_home}/scripts/load_driver.sh -b 53 | run_benchmark 54 | 55 | output_header="5%" 56 | mem_occupy=15052 57 | ${project_home}/scripts/load_driver.sh 58 | run_benchmark 59 | 60 | output_header="10%" 61 | mem_occupy=14244 62 | ${project_home}/scripts/load_driver.sh 63 | run_benchmark 64 | 65 | output_header="20%" 66 | mem_occupy=12628 67 | ${project_home}/scripts/load_driver.sh 68 | run_benchmark 69 | 70 | output_header="40%" 71 | mem_occupy=9396 72 | ${project_home}/scripts/load_driver.sh 73 | run_benchmark 74 | 75 | output_header="60%" 76 | mem_occupy=6164 77 | ${project_home}/scripts/load_driver.sh 78 | run_benchmark 79 | 80 | slack "finish" 81 | -------------------------------------------------------------------------------- /scripts/fig9/default_tasks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # ./default_tasks.sh [ (default: 1,3)] 4 | 5 | trap 'kill $(jobs -p) 2> /dev/null' EXIT 6 | 7 | die() { 8 | echo >&2 -e "${1-}" 9 | exit 1 10 | } 11 | 12 | [[ -z "$1" ]] && die "requires memory percentage to occupy" 13 | 14 | mem_occupy="$1" 15 | 16 | CUDA_VISIBLE_DEVICES=2 ./manual_occupy.run ${mem_occupy} 17 | -------------------------------------------------------------------------------- /scripts/fig9/louvain.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | project_home="/home/ubuntu/HUVM" 3 | current_date=$(date '+%Y-%m-%d_%H:%M:%S') 4 | output_path="${current_date}_louvain" 5 | output_raw="${output_path}/raw.txt" 6 | output_filename="louvain" 7 | harvestor_command="docker run --gpus all --rm -it --name huvm_harvestor -v ${project_home}:/HUVM sjchoi/huvm:init python /HUVM/bench/cugraph/louvain.py --n_workers 1 --visible_devices 1,2 --dataset /HUVM/dataset/graph/web-wikipedia_link_en13-all.edges" 8 | harvestee_command="./default_tasks.sh" 9 | 10 | echo ${current_date} 11 | mkdir ${output_path} 12 | 13 | # Write given input to new column in csv file. Gets file in $1, header name in 14 | # $2, and input string in $3. 15 | add_col_to_csv() { 16 | local file=$1 17 | local header=$2 18 | local str=$3 19 | 20 | str=`echo -e "${header}\n${str}"` 21 | 22 | if [ -f ${file} ] 23 | then 24 | str=`paste -d, ${file} <(printf "%s" "${str}")` 25 | fi 26 | echo "${str}" > ${file} 27 | } 28 | 29 | run_benchmark() { 30 | echo "start ${output_header}" 31 | ${harvestee_command} ${mem_occupy} & 32 | sleep 10 33 | local output=`${harvestor_command} 2>&1 | grep "Out:"` 34 | echo "${output_filename}/${output_header}" >> "${output_raw}" 35 | echo "${output}" >> "${output_raw}" 36 | echo >> "${output_raw}" 37 | output=`echo "${output:6:-1}"` 38 | add_col_to_csv "${output_path}/${output_filename}.csv" "${output_header}" "${output}" 39 | pkill default_tasks 40 | sleep 10 41 | } 42 | 43 | echo "Figure 9: Louvain" 44 | 45 | output_header="Warmup" 46 | mem_occupy=1000 47 | ${project_home}/scripts/load_driver.sh 48 | run_benchmark 49 | 50 | output_header="Base" 51 | mem_occupy=1000 52 | ${project_home}/scripts/load_driver.sh -b 53 | run_benchmark 54 | 55 | output_header="5%" 56 | mem_occupy=15052 57 | ${project_home}/scripts/load_driver.sh 58 | run_benchmark 59 | 60 | output_header="10%" 61 | mem_occupy=14244 62 | ${project_home}/scripts/load_driver.sh 63 | run_benchmark 64 | 65 | output_header="20%" 66 | mem_occupy=12628 67 | ${project_home}/scripts/load_driver.sh 68 | run_benchmark 69 | 70 | output_header="40%" 71 | mem_occupy=9396 72 | ${project_home}/scripts/load_driver.sh 73 | run_benchmark 74 | 75 | output_header="60%" 76 | mem_occupy=6164 77 | ${project_home}/scripts/load_driver.sh 78 | run_benchmark 79 | 80 | -------------------------------------------------------------------------------- /scripts/fig9/manual_occupy.run: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/casys-kaist/HUVM/4528f10218bdcfa62128cba87ee566f97fc6cd1b/scripts/fig9/manual_occupy.run -------------------------------------------------------------------------------- /scripts/fig9/pagerank.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | project_home="/home/ubuntu/HUVM" 3 | current_date=$(date '+%Y-%m-%d_%H:%M:%S') 4 | output_path="${current_date}_pagerank" 5 | output_raw="${output_path}/raw.txt" 6 | output_filename="pagerank" 7 | harvestor_command="docker run --gpus all --rm -it --name huvm_harvestor -v ${project_home}:/HUVM sjchoi/huvm:init python /HUVM/bench/cugraph/pagerank.py --n_workers 1 --visible_devices 1,2 --dataset /HUVM/dataset/graph/soc-twitter-2010.csv" 8 | harvestee_command="./default_tasks.sh" 9 | 10 | echo ${current_date} 11 | mkdir ${output_path} 12 | 13 | # Write given input to new column in csv file. Gets file in $1, header name in 14 | # $2, and input string in $3. 15 | add_col_to_csv() { 16 | local file=$1 17 | local header=$2 18 | local str=$3 19 | 20 | str=`echo -e "${header}\n${str}"` 21 | 22 | if [ -f ${file} ] 23 | then 24 | str=`paste -d, ${file} <(printf "%s" "${str}")` 25 | fi 26 | echo "${str}" > ${file} 27 | } 28 | 29 | run_benchmark() { 30 | echo "start ${output_header}" 31 | ${harvestee_command} ${mem_occupy} & 32 | sleep 10 33 | local output=`${harvestor_command} 2>&1 | grep "Out:"` 34 | echo "${output_filename}/${output_header}" >> "${output_raw}" 35 | echo "${output}" >> "${output_raw}" 36 | echo >> "${output_raw}" 37 | output=`echo "${output:6:-1}"` 38 | add_col_to_csv "${output_path}/${output_filename}.csv" "${output_header}" "${output}" 39 | pkill default_tasks 40 | sleep 10 41 | } 42 | 43 | echo "Figure 9: Pagerank" 44 | 45 | #output_header="Warmup" 46 | #mem_occupy=1000 47 | #${project_home}/scripts/load_driver.sh 48 | #run_benchmark 49 | 50 | output_header="Base" 51 | mem_occupy=1000 52 | ${project_home}/scripts/load_driver.sh -b 53 | run_benchmark 54 | 55 | output_header="5%" 56 | mem_occupy=15052 57 | ${project_home}/scripts/load_driver.sh 58 | run_benchmark 59 | 60 | output_header="10%" 61 | mem_occupy=14244 62 | ${project_home}/scripts/load_driver.sh 63 | run_benchmark 64 | 65 | output_header="20%" 66 | mem_occupy=12628 67 | ${project_home}/scripts/load_driver.sh 68 | run_benchmark 69 | 70 | output_header="40%" 71 | mem_occupy=9396 72 | ${project_home}/scripts/load_driver.sh 73 | run_benchmark 74 | 75 | output_header="60%" 76 | mem_occupy=6164 77 | ${project_home}/scripts/load_driver.sh 78 | run_benchmark 79 | 80 | -------------------------------------------------------------------------------- /scripts/fig9/run_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./pagerank.sh 3 | ./bfs.sh 4 | ./wcc.sh 5 | ./louvain.sh 6 | -------------------------------------------------------------------------------- /scripts/fig9/wcc.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | project_home="/home/ubuntu/HUVM" 3 | current_date=$(date '+%Y-%m-%d_%H:%M:%S') 4 | output_path="${current_date}_wcc" 5 | output_raw="${output_path}/raw.txt" 6 | output_filename="wcc" 7 | harvestor_command="docker run --gpus all --rm -it --name huvm_harvestor -v ${project_home}:/HUVM sjchoi/huvm:init python /HUVM/bench/cugraph/wcc.py --n_workers 1 --visible_devices 1,2 --dataset /HUVM/dataset/graph/web-cc12-PayLevelDomain.edges" 8 | harvestee_command="./default_tasks.sh" 9 | 10 | echo ${current_date} 11 | mkdir ${output_path} 12 | 13 | # Write given input to new column in csv file. Gets file in $1, header name in 14 | # $2, and input string in $3. 15 | add_col_to_csv() { 16 | local file=$1 17 | local header=$2 18 | local str=$3 19 | 20 | str=`echo -e "${header}\n${str}"` 21 | 22 | if [ -f ${file} ] 23 | then 24 | str=`paste -d, ${file} <(printf "%s" "${str}")` 25 | fi 26 | echo "${str}" > ${file} 27 | } 28 | 29 | run_benchmark() { 30 | echo "start ${output_header}" 31 | ${harvestee_command} ${mem_occupy} & 32 | sleep 10 33 | local output=`${harvestor_command} 2>&1 | grep "Out:"` 34 | echo "${output_filename}/${output_header}" >> "${output_raw}" 35 | echo "${output}" >> "${output_raw}" 36 | echo >> "${output_raw}" 37 | output=`echo "${output:6:-1}"` 38 | add_col_to_csv "${output_path}/${output_filename}.csv" "${output_header}" "${output}" 39 | pkill default_tasks 40 | sleep 10 41 | } 42 | 43 | echo "Figure 9: WCC" 44 | 45 | output_header="Warmup" 46 | mem_occupy=1000 47 | ${project_home}/scripts/load_driver.sh 48 | run_benchmark 49 | 50 | output_header="Base" 51 | mem_occupy=1000 52 | ${project_home}/scripts/load_driver.sh -b 53 | run_benchmark 54 | 55 | output_header="5%" 56 | mem_occupy=15052 57 | ${project_home}/scripts/load_driver.sh 58 | run_benchmark 59 | 60 | output_header="10%" 61 | mem_occupy=14244 62 | ${project_home}/scripts/load_driver.sh 63 | run_benchmark 64 | 65 | output_header="20%" 66 | mem_occupy=12628 67 | ${project_home}/scripts/load_driver.sh 68 | run_benchmark 69 | 70 | output_header="40%" 71 | mem_occupy=9396 72 | ${project_home}/scripts/load_driver.sh 73 | run_benchmark 74 | 75 | output_header="60%" 76 | mem_occupy=6164 77 | ${project_home}/scripts/load_driver.sh 78 | run_benchmark 79 | 80 | -------------------------------------------------------------------------------- /scripts/load_driver.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # NVIDIA DRIVER LOADER 4 | # 5 | # The project tree shows as below: 6 | # huvm 7 | # ├─ driver 8 | # ├─ driver-base 9 | # └─ scripts 10 | 11 | set -Euo pipefail 12 | 13 | # realpath to get real path when symbolic linked 14 | script_dir=$(cd "$( dirname "$( realpath "${BASH_SOURCE[0]}")")" &>/dev/null && pwd -P) 15 | 16 | usage() { 17 | cat <=] 19 | 20 | Helper for loading nvidia driver. 21 | 22 | Available options: 23 | 24 | -h, --help Print this help and exit 25 | -d Compile with debug configuration 26 | -b Load stock version of UVM (All params are ignored) 27 | -p Pass parameters when inserting the module 28 | EOF 29 | exit 30 | } 31 | 32 | die() { 33 | local msg="${1-}" 34 | local code="${2-1}" 35 | echo >&2 -e "$msg" 36 | exit "$code" 37 | } 38 | 39 | parse_params() { 40 | # default values of variables set from params 41 | debug=0 42 | base_suffix='' 43 | param='' 44 | 45 | while :; do 46 | case "${1-}" in 47 | -h | --help) usage ;; 48 | -d) debug=1 ;; 49 | -b) base_suffix="_base" ;; 50 | -p) 51 | param="${2-}" 52 | [[ -z "${param-}" ]] && die "Missing required module parameters" 53 | shift 54 | ;; 55 | -?*) die "Unknown option: $1" ;; 56 | *) break ;; 57 | esac 58 | shift 59 | done 60 | 61 | return 0 62 | } 63 | 64 | parse_params "$@" 65 | 66 | driver_dir="${script_dir}/../driver${base_suffix}/" 67 | 68 | cd ${driver_dir} 69 | if [ $debug -eq 1 ]; then 70 | sed -i 's/UVM_BUILD_TYPE = release/UVM_BUILD_TYPE = debug/g' nvidia-uvm/nvidia-uvm.Kbuild 71 | else 72 | sed -i 's/UVM_BUILD_TYPE = debug/UVM_BUILD_TYPE = release/g' nvidia-uvm/nvidia-uvm.Kbuild 73 | fi 74 | 75 | IGNORE_CC_MISMATCH=1 make -j40 > /dev/null 76 | status=$? 77 | if [ $status -ne 0 ] 78 | then 79 | die "Compilation failed" 80 | fi 81 | 82 | sudo nvidia-smi -pm 0 > /dev/null 83 | 84 | sudo rmmod nvidia-uvm 85 | sudo insmod nvidia-uvm.ko ${param} 86 | 87 | sudo nvidia-smi -pm 1 > /dev/null 88 | -------------------------------------------------------------------------------- /scripts/run_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd fig6 3 | ./run_all.sh 4 | cd ../fig7 5 | ./run_all.sh 6 | cd ../fig8 7 | ./run_all.sh 8 | cd ../fig9 9 | ./run_all.sh 10 | --------------------------------------------------------------------------------