-
-
Save joanbm/d702049df1220a77e13175b018ea6bea to your computer and use it in GitHub Desktop.
From 5cadf6866eaf76a87aa4fe39bb7821655d5280f2 Mon Sep 17 00:00:00 2001 | |
From: Joan Bruguera <joanbrugueram@gmail.com> | |
Date: Mon, 29 Aug 2022 15:01:53 +0200 | |
Subject: [PATCH] Tentative fix for NVIDIA 470.141.03 driver for Linux 6.1-rc1 | |
--- | |
nvidia/os-interface.c | 35 ++++++++++++++++++++++++++++++++++- | |
1 file changed, 34 insertions(+), 1 deletion(-) | |
diff --git a/nvidia/os-interface.c b/nvidia/os-interface.c | |
index 89f256f..01b3ffc 100644 | |
--- a/nvidia/os-interface.c | |
+++ b/nvidia/os-interface.c | |
@@ -1105,7 +1105,40 @@ void NV_API_CALL os_get_screen_info( | |
NvU64 consoleBar2Address | |
) | |
{ | |
-#if defined(CONFIG_FB) | |
+#if defined(CONFIG_FB) && LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) | |
+ // Rel. commit "fbdev: Make registered_fb[] private to fbmem.c" (Daniel Vetter, Mon Jul 25) | |
+ // (This works for the usual x86-64 single EFI Framebuffer scenario, at least) | |
+ // The orig_video_isVGA and ext_lfb_base checks are backported from the NVIDIA 520xx driver | |
+ // (which is MIT licensed, copyright NVIDIA CORPORATION & AFFILIATES) | |
+ *pPhysicalAddress = 0; | |
+ *pFbWidth = *pFbHeight = *pFbDepth = *pFbPitch = 0; | |
+ | |
+ /* | |
+ * If there is not a framebuffer console, return 0 size. | |
+ * | |
+ * orig_video_isVGA is set to 1 during early Linux kernel | |
+ * initialization, and then will be set to a value, such as | |
+ * VIDEO_TYPE_VLFB or VIDEO_TYPE_EFI if an fbdev console is used. | |
+ */ | |
+ if (screen_info.orig_video_isVGA > 1) | |
+ { | |
+ NvU64 physAddr = screen_info.lfb_base; | |
+#if defined(VIDEO_CAPABILITY_64BIT_BASE) | |
+ physAddr |= (NvU64)screen_info.ext_lfb_base << 32; | |
+#endif | |
+ | |
+ /* Make sure base address is mapped to GPU BAR */ | |
+ if ((physAddr == consoleBar1Address) || | |
+ (physAddr == consoleBar2Address)) | |
+ { | |
+ *pPhysicalAddress = physAddr; | |
+ *pFbWidth = screen_info.lfb_width; | |
+ *pFbHeight = screen_info.lfb_height; | |
+ *pFbDepth = screen_info.lfb_depth; | |
+ *pFbPitch = screen_info.lfb_linelength; | |
+ } | |
+ } | |
+#elif defined(CONFIG_FB) | |
int i; | |
*pPhysicalAddress = 0; | |
*pFbWidth = *pFbHeight = *pFbDepth = *pFbPitch = 0; | |
-- | |
2.38.1 | |
- whether it also works, I will find out as soon as possible
At least on a GUI-less system, there is text, and computation with CUDA works...
Hi @Fjodor42! I took a look and at first glance, I believe that the latest version of the NVIDIA 520xx driver (i.e. 520.56.06) already supports Linux 6.1-rc1 out of the box. (I publish patches for 470xx because that's the hardware I have).
Also, it looks like they came up with the same approach, but they handle some cases better in their implementation - I'll backport those to the 470xx patch. So thanks for bringing this to my attention!
Thank you @joanbm :-)
If they support 6.1-rc1, then the version that does has not hit the repos yet, as I got compilation errors.
If I get the time, I will try to port your revised patch to 520, but I promise nothing, and other people are most welcome to beat me to it :-)
Thank you immensely!
It would seem that for 520, the patch could be rewritten as below and still compile - whether it also works, I will find out as soon as possible.