やるきなし

2019/05/07 19:43 / Linux 5.0.9 -> 5.1.0

5.1が出たので.configがどう変更されるのか見てみた.以下 - は削除されたもの,+ は追加されたもの.

その他

DKMS

案の定 nvidia-kernel-dkms (410.104-1~bpo9+1) と nvidia-legacy-340xx-kernel-dkms (340.107-2~bpo9+1) が compile できない.broadcom-sta-dkms は今回試さず.エラーは以下のようなもの(抜粋).

/var/lib/dkms/nvidia-current/410.104/build/common/inc/nv-list-helpers.h:94:19: error: redefinition of ‘list_is_first’
 static inline int list_is_first(const struct list_head *list,
                   ^~~~~~~~~~~~~
In file included from /var/lib/dkms/nvidia-current/410.104/build/common/inc/nv-kthread-q.h:28:0,
                 from /var/lib/dkms/nvidia-current/410.104/build/nvidia/nv-kthread-q.c:24:
./include/linux/list.h:214:19: note: previous definition of ‘list_is_first’ was here
 static inline int list_is_first(const struct list_head *list,
                   ^~~~~~~~~~~~~
/var/lib/dkms/nvidia-current/410.104/build/nvidia-uvm/uvm8.c:187:14: error: initialization from incompatible pointer type [-Werror=incompatible-po
inter-types]
     .fault = uvm_vm_fault_sigbus_wrapper
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/lib/dkms/nvidia-current/410.104/build/nvidia-drm/nvidia-drm-encoder.c:293:5: error: implicit declaration of function ‘drm_kms_helper_hotplug_event’ [-Werror=implicit-function-declaration]
     drm_kms_helper_hotplug_event(dev);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

list_is_first については mm, compaction: use free lists to quickly locate a migration sourcelist_is_firstdrivers/gpu/drm/i915/i915_utils.h から include/linux/list.h に移動したことによるもの./usr/src/nvidia-current/410.104/build/common/inc/nv-list-helpers.h でも全く同じコードなので,/usr/src/nvidia-current/410.104/build/common/inc/nv-list-helpers.h から削除してしまう.

vm_operations_struct.faultincompatible pointer type の件については,mm: change return type to vm_fault_t で返り値がvm_fault_tに変更になったため.返り値をvm_fault_tにする.

最後のimplicit declaration of functionについては drm: Split out drm_probe_helper.h で drm probe helper が drm_crtc_helper.h から drm_probe_helper.h に分離されたことによるもの.drm_crtc_helper.h ではなく drm_probe_helper.hinclude するようにする.

以下 nvidia-kernel-dkms (410.104-1~bpo9+1) 向け patch.

diff --git a/common/inc/nv-list-helpers.h b/common/inc/nv-list-helpers.h
index 0aed851..81c2d4e 100644
--- a/common/inc/nv-list-helpers.h
+++ b/common/inc/nv-list-helpers.h
@@ -91,10 +91,12 @@
         list_entry((pos)->member.next, typeof(*(pos)), member)
 #endif
 
+/*
 static inline int list_is_first(const struct list_head *list,
                                 const struct list_head *head)
 {
     return list->prev == head;
 }
+*/
 
 #endif // __NV_LIST_HELPERS_H__
diff --git a/nvidia-drm/nvidia-drm-connector.c b/nvidia-drm/nvidia-drm-connector.c
index 4dd12d1..723d35f 100644
--- a/nvidia-drm/nvidia-drm-connector.c
+++ b/nvidia-drm/nvidia-drm-connector.c
@@ -30,7 +30,7 @@
 #include "nvidia-drm-utils.h"
 #include "nvidia-drm-encoder.h"
 
-#include <drm/drm_crtc_helper.h>
+#include <drm/drm_probe_helper.h>
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
diff --git a/nvidia-drm/nvidia-drm-drv.c b/nvidia-drm/nvidia-drm-drv.c
index 49f099f..ca714c2 100644
--- a/nvidia-drm/nvidia-drm-drv.c
+++ b/nvidia-drm/nvidia-drm-drv.c
@@ -41,7 +41,7 @@
 
 #include <drm/drmP.h>
 
-#include <drm/drm_crtc_helper.h>
+#include <drm/drm_probe_helper.h>
 
 #if defined(NV_DRM_DRM_GEM_H_PRESENT)
 #include <drm/drm_gem.h>
diff --git a/nvidia-drm/nvidia-drm-encoder.c b/nvidia-drm/nvidia-drm-encoder.c
index f66bbd7..0e5e2a8 100644
--- a/nvidia-drm/nvidia-drm-encoder.c
+++ b/nvidia-drm/nvidia-drm-encoder.c
@@ -31,7 +31,7 @@
 #include "nvidia-drm-crtc.h"
 #include "nvidia-drm-helper.h"
 
-#include <drm/drm_crtc_helper.h>
+#include <drm/drm_probe_helper.h>
 
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
diff --git a/nvidia-drm/nvidia-drm-gem-nvkms-memory.c b/nvidia-drm/nvidia-drm-gem-nvkms-memory.c
index 998fcc2..1f2d974 100644
--- a/nvidia-drm/nvidia-drm-gem-nvkms-memory.c
+++ b/nvidia-drm/nvidia-drm-gem-nvkms-memory.c
@@ -330,7 +330,7 @@ done:
 
 /* XXX Move these vma operations to os layer */
 
-static int __nv_drm_vma_fault(struct vm_area_struct *vma,
+static vm_fault_t __nv_drm_vma_fault(struct vm_area_struct *vma,
                               struct vm_fault *vmf)
 {
     unsigned long address = nv_page_fault_va(vmf);
@@ -377,7 +377,7 @@ static int __nv_drm_vma_fault(struct vm_area_struct *vma,
  */
 
 #if defined(NV_VM_OPS_FAULT_REMOVED_VMA_ARG)
-static int nv_drm_vma_fault(struct vm_fault *vmf)
+static vm_fault_t nv_drm_vma_fault(struct vm_fault *vmf)
 {
     return __nv_drm_vma_fault(vmf->vma, vmf);
 }
diff --git a/nvidia-uvm/uvm8.c b/nvidia-uvm/uvm8.c
index 70ed244..9f3d107 100644
--- a/nvidia-uvm/uvm8.c
+++ b/nvidia-uvm/uvm8.c
@@ -166,13 +166,13 @@ static void uvm_destroy_vma_semaphore_pool(struct vm_area_struct *vma)
 // If a fault handler is not set, paths like handle_pte_fault in older kernels
 // assume the memory is anonymous. That would make debugging this failure harder
 // so we force it to fail instead.
-static int uvm_vm_fault_sigbus(struct vm_area_struct *vma, struct vm_fault *vmf)
+static vm_fault_t uvm_vm_fault_sigbus(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
     UVM_DBG_PRINT_RL("Fault to address 0x%lx in disabled vma\n", nv_page_fault_va(vmf));
     return VM_FAULT_SIGBUS;
 }
 
-static int uvm_vm_fault_sigbus_wrapper(struct vm_fault *vmf)
+static vm_fault_t uvm_vm_fault_sigbus_wrapper(struct vm_fault *vmf)
 {
 #if defined(NV_VM_OPS_FAULT_REMOVED_VMA_ARG)
     return uvm_vm_fault_sigbus(vmf->vma, vmf);
@@ -390,7 +390,7 @@ static void uvm_vm_close_managed(struct vm_area_struct *vma)
         uvm_record_unlock_mmap_sem_write(&current->mm->mmap_sem);
 }
 
-static int uvm_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
+static vm_fault_t uvm_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
     uvm_va_space_t *va_space = uvm_va_space_get(vma->vm_file);
     uvm_va_block_t *va_block;
@@ -507,7 +507,7 @@ convert_error:
     }
 }
 
-static int uvm_vm_fault_wrapper(struct vm_fault *vmf)
+static vm_fault_t uvm_vm_fault_wrapper(struct vm_fault *vmf)
 {
 #if defined(NV_VM_OPS_FAULT_REMOVED_VMA_ARG)
     return uvm_vm_fault(vmf->vma, vmf);

以下 nvidia-legacy-340xx-kernel-dkms (340.107-2~bpo9+1) 向け patch.Linux 5.0 向け patchがあたっていることが前提.

diff --git a/uvm/nvidia_uvm_lite.c b/uvm/nvidia_uvm_lite.c
index 9f1a479..7d6a99a 100644
--- a/uvm/nvidia_uvm_lite.c
+++ b/uvm/nvidia_uvm_lite.c
@@ -828,7 +828,7 @@ done:
 
 #if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
-int _fault(struct vm_fault *vmf)
+vm_fault_t _fault(struct vm_fault *vmf)
 #else
 int _fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 #endif
@@ -884,7 +884,7 @@ 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)
-int _sigbus_fault(struct vm_fault *vmf)
+vm_fault_t _sigbus_fault(struct vm_fault *vmf)
 #else
 int _sigbus_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 #endif

ともに Linux 5.1 より前の version で動かすことは考えていない.

追記 (2019/5/9)

nvidia-kernel-418.56 では list_is_first が存在するかのチェックが行われるので,コメントアウト不要.

Related articles