mirror of
https://github.com/archlinux-jerry/nvidia-340xx
synced 2024-11-16 12:50:40 +08:00
78 lines
2.4 KiB
Diff
78 lines
2.4 KiB
Diff
|
From d48c28c8f690cd1b7f1a252f3a33c9b536096054 Mon Sep 17 00:00:00 2001
|
||
|
From: Alberto Milone <alberto.milone@canonical.com>
|
||
|
Date: Mon, 10 Jun 2019 13:08:10 +0200
|
||
|
Subject: [PATCH 1/1] Add support for Linux 5.2
|
||
|
V2: make sure to force DRIVER_LEGACY for Linux >= 5.1
|
||
|
---
|
||
|
nv-drm.c | 2 +-
|
||
|
uvm/nvidia_uvm_lite.c | 20 ++++++++++++++++++++
|
||
|
2 files changed, 21 insertions(+), 1 deletion(-)
|
||
|
diff --git a/nv-drm.c b/nv-drm.c
|
||
|
index 1c968de..76719bb 100644
|
||
|
--- a/nv-drm.c
|
||
|
+++ b/nv-drm.c
|
||
|
@@ -156,7 +156,7 @@ static const struct file_operations nv_drm_fops = {
|
||
|
};
|
||
|
|
||
|
static struct drm_driver nv_drm_driver = {
|
||
|
-#if defined(DRIVER_LEGACY)
|
||
|
+#if defined(DRIVER_LEGACY) || LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
|
||
|
.driver_features = DRIVER_GEM | DRIVER_PRIME | DRIVER_LEGACY,
|
||
|
#else
|
||
|
.driver_features = DRIVER_GEM | DRIVER_PRIME,
|
||
|
diff --git a/uvm/nvidia_uvm_lite.c b/uvm/nvidia_uvm_lite.c
|
||
|
index 33b8d4b..8dbe050 100644
|
||
|
--- a/uvm/nvidia_uvm_lite.c
|
||
|
+++ b/uvm/nvidia_uvm_lite.c
|
||
|
@@ -689,7 +689,11 @@ static UvmGpuMigrationTracking * _get_mig_tracker(UvmCommitRecord * pRecord)
|
||
|
// return SIGBUS.
|
||
|
// 3. Otherwise, map in a page from the cache, and allow access.
|
||
|
//
|
||
|
+#ifdef VM_FAULT_OOM
|
||
|
int _fault_common(struct vm_area_struct *vma, unsigned long vaddr,
|
||
|
+#else
|
||
|
+unsigned int _fault_common(struct vm_area_struct *vma, unsigned long vaddr,
|
||
|
+#endif
|
||
|
struct page **ppage, unsigned vmfFlags)
|
||
|
{
|
||
|
int retValue = VM_FAULT_SIGBUS;
|
||
|
@@ -819,9 +823,17 @@ done:
|
||
|
|
||
|
#if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
|
||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
|
||
|
+#ifdef VM_FAULT_OOM
|
||
|
int _fault(struct vm_area_struct *vma, struct vm_fault *vmf)
|
||
|
#else
|
||
|
+unsigned int _fault(struct vm_area_struct *vma, struct vm_fault *vmf)
|
||
|
+#endif
|
||
|
+#else
|
||
|
+#ifdef VM_FAULT_OOM
|
||
|
int _fault(struct vm_fault *vmf)
|
||
|
+#else
|
||
|
+unsigned int _fault(struct vm_fault *vmf)
|
||
|
+#endif
|
||
|
#endif
|
||
|
{
|
||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||
|
@@ -874,9 +886,17 @@ static struct vm_operations_struct uvmlite_vma_ops =
|
||
|
//
|
||
|
#if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
|
||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
|
||
|
+#ifdef VM_FAULT_OOM
|
||
|
int _sigbus_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
|
||
|
#else
|
||
|
+unsigned int _sigbus_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
|
||
|
+#endif
|
||
|
+#else
|
||
|
+#ifdef VM_FAULT_OOM
|
||
|
int _sigbus_fault(struct vm_fault *vmf)
|
||
|
+#else
|
||
|
+unsigned int _sigbus_fault(struct vm_fault *vmf)
|
||
|
+#endif
|
||
|
#endif
|
||
|
{
|
||
|
vmf->page = NULL;
|
||
|
--
|
||
|
2.20.1
|
||
|
|