{"id":2530,"date":"2019-03-19T23:54:48","date_gmt":"2019-03-20T06:54:48","guid":{"rendered":"http:\/\/rglinuxtech.com\/?p=2530"},"modified":"2019-03-19T23:54:48","modified_gmt":"2019-03-20T06:54:48","slug":"nvidia-fix-for-418-43-to-work-with-kernel-5-1-rc1","status":"publish","type":"post","link":"https:\/\/rglinuxtech.com\/?p=2530","title":{"rendered":"NVIDIA &#8211; Fix for 418.43 to Work with Kernel 5.1-rc1.."},"content":{"rendered":"<p>I have done some more investigation into the NVIDIA compile failures with Kernel 5.1-rc1, and now have a &#8211; rather inelegant &#8211; solution.<\/p>\n<p>I found clues to some of the errors in a post relating to nouveau: <a href=\"https:\/\/lkml.org\/lkml\/2019\/2\/20\/50\" target=\"_blank\" rel=\"noopener\">https:\/\/lkml.org\/lkml\/2019\/2\/20\/50<\/a> and the rest were due to content removed from <strong><span style=\"font-family: Courier New, Courier, monospace;\">\/include\/drm\/drm_crtc_helper.h<\/span><\/strong> in Kernel 5.1-rc1: <a href=\"https:\/\/elixir.bootlin.com\/linux\/v5.1-rc1\/source\/include\/drm\/drm_crtc_helper.h\" target=\"_blank\" rel=\"noopener\">https:\/\/elixir.bootlin.com\/linux\/v5.1-rc1\/source\/include\/drm\/drm_crtc_helper.h<\/a> compared to: <a href=\"https:\/\/elixir.bootlin.com\/linux\/v5.0.3\/source\/include\/drm\/drm_crtc_helper.h\" target=\"_blank\" rel=\"noopener\">https:\/\/elixir.bootlin.com\/linux\/v5.0.3\/source\/include\/drm\/drm_crtc_helper.h<\/a>.\u00a0 I also incorporated the name change mentioned in my previous article, from <strong>list_is_first<\/strong> to <strong>nv_list_is_first<\/strong><\/p>\n<p>And from all this, made the following changes:<\/p>\n<p>In <strong>NVIDIA-Linux-x86_64-418.43\/kernel\/nvidia-drm<\/strong>, add <strong><span style=\"font-family: Courier New, Courier, monospace;\">#include &lt;linux\/version.h&gt;<\/span><\/strong>\u00a0\u00a0 to <strong><span style=\"font-family: Courier New, Courier, monospace;\">nvidia-drm-connector.c nvidia-drm-drv.c nvidia-drm-encoder.c<\/span><\/strong> and <strong><span style=\"font-family: Courier New, Courier, monospace;\">nvidia-drm-gem-nvkms-memory.c<\/span><\/strong><\/p>\n<p><strong>NVIDIA-Linux-x86_64-418.43\/kernel\/common\/inc\/nv-list-helpers.h<\/strong><br \/>\nchange line 94<br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">static inline int list_is_first(const struct list_head *list,<\/span><\/strong><br \/>\nto<br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">static inline int nv_list_is_first(const struct list_head *list,<\/span><\/strong><\/p>\n<p><strong>NVIDIA-Linux-x86_64-418.43\/kernel\/nvidia-drm\/nvidia-drm-connector.c<\/strong><br \/>\naround line 203 add<br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">#if LINUX_VERSION_CODE &gt;= KERNEL_VERSION(5, 1, 0)<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">\/* Add header constants missing after 5.1-rc1 *\/<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">int drm_helper_probe_single_connector_modes(struct drm_connector<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">*connector, uint32_t maxX,<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">uint32_t maxY);<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">#endif<\/span><\/strong><\/p>\n<p><strong>NVIDIA-Linux-x86_64-418.43\/kernel\/nvidia-drm\/nvidia-drm-drv.c<\/strong><br \/>\naround line 37 add<br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">#if LINUX_VERSION_CODE &gt;= KERNEL_VERSION(5, 1, 0)<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">\/* Add header constants missing after 5.1-rc1 *\/<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">void drm_kms_helper_poll_init(struct drm_device *dev);<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">void drm_kms_helper_poll_fini(struct drm_device *dev);<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">bool drm_helper_hpd_irq_event(struct drm_device *dev);<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">void drm_kms_helper_poll_disable(struct drm_device *dev);<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">#endif<\/span><\/strong><\/p>\n<p><strong>NVIDIA-Linux-x86_64-418.43\/kernel\/nvidia-drm\/nvidia-drm-encoder.c<\/strong><br \/>\naround line 33 add<br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">#if LINUX_VERSION_CODE &gt;= KERNEL_VERSION(5, 1, 0)<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">\/* Add header constants missing after 5.1-rc1 *\/<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">void drm_kms_helper_hotplug_event(struct drm_device *dev);<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">#endif<\/span><\/strong><\/p>\n<p>around line 161 add<br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">#if LINUX_VERSION_CODE &gt;= KERNEL_VERSION(5, 1, 0)<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">\/* Add header constants missing after 5.1-rc1 *\/<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">int drm_helper_probe_single_connector_modes(struct drm_connector<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">*connector, uint32_t maxX,<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">uint32_t maxY);<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">#endif<\/span><\/strong><\/p>\n<p><strong>NVIDIA-Linux-x86_64-418.43\/kernel\/nvidia-drm\/nvidia-drm-gem-nvkms-memory.c<\/strong><br \/>\nchange line 377<br \/>\nfrom<br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">static int nv_drm_vma_fault(struct vm_fault *vmf)<\/span><\/strong><br \/>\nto<br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">#if LINUX_VERSION_CODE &lt; KERNEL_VERSION(5, 1, 0)<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">static int nv_drm_vma_fault(struct vm_fault *vmf)<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">#else<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">static vm_fault_t nv_drm_vma_fault(struct vm_fault *vmf)<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">#endif<\/span><\/strong><\/p>\n<p><strong>NVIDIA-Linux-x86_64-418.43\/kernel\/nvidia-uvm\/uvm8.c<\/strong><br \/>\nchange line 176<br \/>\nfrom<br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">static int uvm_vm_fault_sigbus_wrapper(struct vm_fault *vmf)<\/span><\/strong><br \/>\nto<br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">#if LINUX_VERSION_CODE &lt; KERNEL_VERSION(5, 1, 0)<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">static int uvm_vm_fault_sigbus_wrapper(struct vm_fault *vmf)<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">#else<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">static vm_fault_t uvm_vm_fault_sigbus_wrapper(struct vm_fault *vmf)<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">#endif<\/span><\/strong><\/p>\n<p>change line 515<br \/>\nfrom<br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">static int uvm_vm_fault_wrapper(struct vm_fault *vmf)<\/span><\/strong><br \/>\nto<br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">#if LINUX_VERSION_CODE &lt; KERNEL_VERSION(5, 1, 0)<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">static int uvm_vm_fault_wrapper(struct vm_fault *vmf)<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">#else<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">static vm_fault_t uvm_vm_fault_wrapper(struct vm_fault *vmf)<\/span><\/strong><br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">#endif<\/span><\/strong><\/p>\n<p><strong>NVIDIA-Linux-x86_64-418.43\/kernel\/nvidia-uvm\/uvm8_range_tree.c<\/strong><br \/>\nchange line 34<br \/>\nfrom<br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">if (list_is_first(&amp;node-&gt;list, &amp;tree-&gt;head))<\/span><\/strong><br \/>\nto<br \/>\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">if (nv_list_is_first(&amp;node-&gt;list, &amp;tree-&gt;head))<\/span><\/strong><\/p>\n<p>I did try to put the &#8216;missing&#8217; kernel header items into a new header within the NVIDIA source code tree, and add references to that, but for some reason this produced more errors, so I left things as above..<\/p>\n<p>I have tested these changes, and the resulting code compiles cleanly:<\/p>\n<pre><strong><span style=\"font-family: Courier New, Courier, monospace;\">...............<\/span><\/strong>\r\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">ld -r -o \/home\/rgadsdon\/kernel\/NVIDIA-Linux-x86_64-418.43-510patched\/kernel\/nvidia-modeset\/nv-modeset-interface.o \/home\/rgadsdon\/kernel\/NVIDIA-Linux-x86_64-418.43-510patched\/kernel\/nvidia-modeset\/nvidia-modeset-linux.o<\/span><\/strong>\r\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">Building modules, stage 2.<\/span><\/strong>\r\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">MODPOST 4 modules<\/span><\/strong>\r\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">CC \/home\/rgadsdon\/kernel\/NVIDIA-Linux-x86_64-418.43-510patched\/kernel\/nvidia-drm.mod.o<\/span><\/strong>\r\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">LD [M] \/home\/rgadsdon\/kernel\/NVIDIA-Linux-x86_64-418.43-510patched\/kernel\/nvidia-drm.ko<\/span><\/strong>\r\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">CC \/home\/rgadsdon\/kernel\/NVIDIA-Linux-x86_64-418.43-510patched\/kernel\/nvidia-modeset.mod.o<\/span><\/strong>\r\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">LD [M] \/home\/rgadsdon\/kernel\/NVIDIA-Linux-x86_64-418.43-510patched\/kernel\/nvidia-modeset.ko<\/span><\/strong>\r\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">CC \/home\/rgadsdon\/kernel\/NVIDIA-Linux-x86_64-418.43-510patched\/kernel\/nvidia-uvm.mod.o<\/span><\/strong>\r\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">LD [M] \/home\/rgadsdon\/kernel\/NVIDIA-Linux-x86_64-418.43-510patched\/kernel\/nvidia-uvm.ko<\/span><\/strong>\r\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">CC \/home\/rgadsdon\/kernel\/NVIDIA-Linux-x86_64-418.43-510patched\/kernel\/nvidia.mod.o<\/span><\/strong>\r\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">LD [M] \/home\/rgadsdon\/kernel\/NVIDIA-Linux-x86_64-418.43-510patched\/kernel\/nvidia.ko<\/span><\/strong>\r\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">make[2]: Leaving directory '\/usr\/src\/linux-5.1-rc1'<\/span><\/strong>\r\n<strong><span style=\"font-family: Courier New, Courier, monospace;\">make[1]: Leaving directory '\/usr\/src\/linux-5.1-rc1'<\/span><\/strong><\/pre>\n<p>&#8211; and the resulting nvidia&#8212;.ko modules load\/run OK (tested with Plasma\/KDE, and with HD video)<\/p>\n<p><em>Robert Gadsdon.\u00a0 March 19, 2019.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have done some more investigation into the NVIDIA compile failures with Kernel 5.1-rc1, and now have a &#8211; rather inelegant &#8211; solution. I found clues to some of the errors in a post relating to nouveau: https:\/\/lkml.org\/lkml\/2019\/2\/20\/50 and the rest were due to content removed from \/include\/drm\/drm_crtc_helper.h in Kernel 5.1-rc1: https:\/\/elixir.bootlin.com\/linux\/v5.1-rc1\/source\/include\/drm\/drm_crtc_helper.h compared to: https:\/\/elixir.bootlin.com\/linux\/v5.0.3\/source\/include\/drm\/drm_crtc_helper.h.\u00a0 I also <span class=\"excerpt-dots\">&hellip;<\/span> <a class=\"more-link\" href=\"https:\/\/rglinuxtech.com\/?p=2530\"><span class=\"more-msg\">Continue reading &rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[5,6,1238,11,14,15,18,19,1533],"tags":[2055,2053,1501,2054],"class_list":["post-2530","post","type-post","status-publish","format-standard","hentry","category-compilation","category-crash-and-burn","category-fix","category-hacks","category-kernel","category-linux-2","category-nvidia","category-opinion","category-patches","tag-fix-for-kernel-5-1-rc1","tag-nvidia-418-43","tag-tested","tag-works"],"_links":{"self":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts\/2530","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2530"}],"version-history":[{"count":2,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts\/2530\/revisions"}],"predecessor-version":[{"id":2532,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts\/2530\/revisions\/2532"}],"wp:attachment":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2530"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2530"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2530"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}