nV News Forums

 
 

nV News Forums (http://www.nvnews.net/vbulletin/index.php)
-   NVIDIA Linux (http://www.nvnews.net/vbulletin/forumdisplay.php?f=14)
-   -   help nvidia driver for linux rt series 3.4-rcX-rtX (http://www.nvnews.net/vbulletin/showthread.php?t=178261)

eskuai 04-13-12 05:04 PM

help nvidia driver for linux rt series 3.4-rcX-rtX
 
Hello,

can help anyone (from nvidia better?) to linux rt community and spend 5 minutes
explaining them and us --users/consumers/clients---, how can we do to use nvidia drivers in a linux rt series, from example, lastest 3.4-rc2 ?

thank you

chloris 04-16-12 07:58 AM

Re: help nvidia driver for linux rt series 3.4-rcX-rtX
 
Well, I'm not from NVidia, but this worked for me:

You can apply this patch ->

ATTENTION!! Please read "Please do not use 295.40 or the security patch with GeForce 6, 7 or 8800GTX/GTS cards" thread here ->

http://www.nvnews.net/vbulletin/showthread.php?t=178460

This patch has actually the security patch included. So if you are the owner of one of the above mentioned cards DON'T USE this patch, or remove the security patches (which is no good idea)

Code:

Index: kernel/conftest.sh
===================================================================
--- kernel/conftest.sh.orig
+++ kernel/conftest.sh
@@ -95,7 +95,7 @@
        fi
    fi
 
-    CFLAGS="$CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS"
+    CFLAGS="$CFLAGS $OUTPUT_CFLAGS -I$HEADERS -I$OUTPUT/arch/x86/include/generated $AUTOCONF_CFLAGS"
 
    test_xen
 
@@ -126,7 +126,7 @@
    CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS"
 
    if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
-        CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include -I$SOURCES/arch/x86/include/generated"
+        CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include -I$OUTPUT/arch/x86/include/generated"
    elif [ "$ARCH" = "ARMv7" ]; then
        CFLAGS="$CFLAGS -I$SOURCES/arch/arm/include -I$SOURCES/arch/arm/include/generated"
    fi
@@ -512,7 +512,12 @@
            # and if it as an 'event' member.
            #
            echo "$CONFTEST_PREAMBLE
-            #include <asm/system.h>
+            #include <linux/version.h>
+            #if LINUX_VERSION_CODE > KERNEL_VERSION(3, 3, 0)
+              #include <asm/switch_to.h>
+            #else
+              #include <asm/system.h>
+            #endif
            #include <linux/pm.h>
            void conftest_pm_message_t(pm_message_t state) {
                pm_message_t *p = &state;
@@ -965,11 +970,12 @@
            #
            echo "$CONFTEST_PREAMBLE
            #include <linux/acpi.h>
+            #include <acpi/acpixf.h>
            void conftest_acpi_walk_namespace(void) {
                acpi_walk_namespace();
            }" > conftest$$.c
 
-            $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
+            #CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
            rm -f conftest$$.c
 
            if [ -f conftest$$.o ]; then
@@ -980,6 +986,7 @@
 
            echo "$CONFTEST_PREAMBLE
            #include <linux/acpi.h>
+            #include <acpi/acpixf.h>
            void conftest_acpi_walk_namespace(void) {
                acpi_walk_namespace(0, NULL, 0, NULL, NULL, NULL, NULL);
            }" > conftest$$.c
@@ -996,6 +1003,7 @@
 
            echo "$CONFTEST_PREAMBLE
            #include <linux/acpi.h>
+            #include <acpi/acpixf.h>
            void conftest_acpi_walk_namespace(void) {
                acpi_walk_namespace(0, NULL, 0, NULL, NULL, NULL);
            }" > conftest$$.c
@@ -1603,6 +1611,9 @@
                fi
            fi
        fi
+
+        RET=0
+        SELECTED_MAKEFILE=Makefile.kbuild
 
        if [ "$RET" = "0" ]; then
            ln -s $SELECTED_MAKEFILE Makefile
Index: kernel/nv-linux.h
===================================================================
--- kernel/nv-linux.h.orig
+++ kernel/nv-linux.h
@@ -111,7 +111,11 @@
 #include <linux/timer.h>
 
 #include <asm/div64.h>              /* do_div()                        */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 3, 0)
+#include <asm/switch_to.h>
+#else
 #include <asm/system.h>            /* cli, sli, save_flags            */
+#endif
 #include <asm/io.h>                /* ioremap, virt_to_phys            */
 #include <asm/uaccess.h>            /* access_ok                        */
 #include <asm/page.h>              /* PAGE_OFFSET                      */
@@ -291,17 +295,17 @@
 #endif
 #endif
 
-#if defined(CONFIG_PREEMPT_RT)
-typedef atomic_spinlock_t        nv_spinlock_t;
-#define NV_SPIN_LOCK_INIT(lock)  atomic_spin_lock_init(lock)
-#define NV_SPIN_LOCK_IRQ(lock)    atomic_spin_lock_irq(lock)
-#define NV_SPIN_UNLOCK_IRQ(lock)  atomic_spin_unlock_irq(lock)
-#define NV_SPIN_LOCK_IRQSAVE(lock,flags) atomic_spin_lock_irqsave(lock,flags)
+#if defined(CONFIG_PREEMPT_RT_FULL)
+typedef raw_spinlock_t            nv_spinlock_t;
+#define NV_SPIN_LOCK_INIT(lock)  raw_spin_lock_init(lock)
+#define NV_SPIN_LOCK_IRQ(lock)    raw_spin_lock_irq(lock)
+#define NV_SPIN_UNLOCK_IRQ(lock)  raw_spin_unlock_irq(lock)
+#define NV_SPIN_LOCK_IRQSAVE(lock,flags) raw_spin_lock_irqsave(lock,flags)
 #define NV_SPIN_UNLOCK_IRQRESTORE(lock,flags) \
-  atomic_spin_unlock_irqrestore(lock,flags)
-#define NV_SPIN_LOCK(lock)        atomic_spin_lock(lock)
-#define NV_SPIN_UNLOCK(lock)      atomic_spin_unlock(lock)
-#define NV_SPIN_UNLOCK_WAIT(lock) atomic_spin_unlock_wait(lock)
+  raw_spin_unlock_irqrestore(lock,flags)
+#define NV_SPIN_LOCK(lock)        raw_spin_lock(lock)
+#define NV_SPIN_UNLOCK(lock)      raw_spin_unlock(lock)
+#define NV_SPIN_UNLOCK_WAIT(lock) raw_spin_unlock_wait(lock)
 #else
 typedef spinlock_t                nv_spinlock_t;
 #define NV_SPIN_LOCK_INIT(lock)  spin_lock_init(lock)
@@ -956,8 +960,8 @@
    return ret;
 }
 
-#if defined(CONFIG_PREEMPT_RT)
-#define NV_INIT_MUTEX(mutex) semaphore_init(mutex)
+#if defined(CONFIG_PREEMPT_RT_FULL)
+#define NV_INIT_MUTEX(mutex) sema_init(mutex,1)
 #else
 #if !defined(__SEMAPHORE_INITIALIZER) && defined(__COMPAT_SEMAPHORE_INITIALIZER)
 #define __SEMAPHORE_INITIALIZER __COMPAT_SEMAPHORE_INITIALIZER
Index: kernel/nv-mmap.c
===================================================================
--- kernel/nv-mmap.c.orig
+++ kernel/nv-mmap.c
@@ -257,6 +257,12 @@
 
    if (IS_REG_OFFSET(nv, NV_VMA_OFFSET(vma), NV_VMA_SIZE(vma)))
    {
+        if (IS_BLACKLISTED_REG_OFFSET(nv, NV_VMA_OFFSET(vma), NV_VMA_SIZE(vma)))
+        {
+            status = -EINVAL;
+            goto done;
+        }
+
        if (nv_encode_caching(&vma->vm_page_prot,
                              NV_MEMORY_UNCACHED,
                              NV_MEMORY_TYPE_REGISTERS))
Index: kernel/nv.h
===================================================================
--- kernel/nv.h.orig
+++ kernel/nv.h
@@ -442,6 +442,14 @@
              ((offset) >= (nv)->agp.address) &&                                \
              (((offset) + ((length)-1)) <= (nv)->agp.address + ((nv)->agp.size-1)))
 
+#define IS_REG_RANGE_WITHIN_MAPPING(nv, roffset, rlength, moffset, mlength)    \
+            (((moffset) <= ((nv)->regs->address + ((roffset) + (rlength)-1))) &&\
+            (((moffset) + (mlength)-1) >= ((nv)->regs->address + (roffset))))
+
+#define IS_BLACKLISTED_REG_OFFSET(nv, offset, length)                          \
+            ((IS_REG_RANGE_WITHIN_MAPPING(nv, 0x1000, 0x1000, offset, length)) ||\
+            (IS_REG_RANGE_WITHIN_MAPPING(nv, 0x700000, 0x100000, offset, length)))
+
 /* duplicated from nvos.h for external builds */
 #ifndef NVOS_AGP_CONFIG_DISABLE_AGP
 #  define NVOS_AGP_CONFIG_DISABLE_AGP (0x00000000)

Save it as e.g. "nv295.33_for_3.3+_rt.patch"

Apply the patch->

Code:

sh NVIDIA-Linux-x86_64-295.33.run --apply-patch nv295.33_for_3.3+_rt.patch
This will build a new nvidia binary installer called "NVIDIA-Linux-x86_64-295.33-custom.run".

Run the installer with

Code:

sh NVIDIA-Linux-x86_64-295.33-custom.run
This patch comes with no garantee or warranty! Use it on your own risk.

Reboot and have fun.

eskuai 04-16-12 02:24 PM

Re: help nvidia driver for linux rt series 3.4-rcX-rtX
 
Thank you for your help, ... testing with lastest linux 3.4-rc3-rt5

um, bad news .. it is NOT working with 295.33 for me ... black screen ..

how to do for working with 295.40 serie ?

i got the following problem ...

[root@darkstar ~]# sh NVIDIA-Linux-x86-295.40.run --apply-patch nv295.33_for_3.3+_rt.patch
Verifying archive integrity... OK
Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86 295.40............................................ .................................................. ............................................
patching file kernel/conftest.sh
Hunk #2 FAILED at 126.
1 out of 7 hunks FAILED -- saving rejects to file kernel/conftest.sh.rej
patching file kernel/nv-linux.h
Failed to apply patch file "/root/nv295.33_for_3.3+_rt.patch".

jdmcdaniel3 04-16-12 08:52 PM

Re: help nvidia driver for linux rt series 3.4-rcX-rtX
 
It seems to me that even though nVIDIA has joined the Linux Foundation, the Linux Kernel developers and the nVIDIA corporation have become divergent in what they are doing. While I am not sure who is responsible for the mess, and even as several people have tried to help, but nVIDIA and kernel.org continue to put out incomparable code with each other and at present. Only nVIDIA is going to really be ably to help with this problem. Without external and valid help from nVIDIA users and even a kernel developer, The last kernel version supported by nVIDIA drivers was kernel 3.2 even as we are seeing kernel 3.4-rc3 on release. nVIDIA needs to get on board and release compatible code for at least kernel 3.3 if not getting a handle to the divergent kernel code releases between the two. Who else but nVIDIA can get a handle on this resulting mess? I hope someone in there is listening.

Thank You,

chloris 04-17-12 02:21 AM

Re: help nvidia driver for linux rt series 3.4-rcX-rtX
 
added the original security patches from nvidia for the 2.95.33 series

chloris 04-17-12 04:08 AM

Re: help nvidia driver for linux rt series 3.4-rcX-rtX
 
And here is a patch which should be o.k. for the 295.40 series.

ATTENTION!! Please read "Please do not use 295.40 or the security patch with GeForce 6, 7 or 8800GTX/GTS cards" thread here ->

http://www.nvnews.net/vbulletin/showthread.php?t=178460

Code:

Index: kernel/conftest.sh
===================================================================
--- kernel/conftest.sh.orig
+++ kernel/conftest.sh
@@ -95,7 +95,7 @@
        fi
    fi
 
-    CFLAGS="$CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS"
+    CFLAGS="$CFLAGS $OUTPUT_CFLAGS -I$HEADERS -I$OUTPUT/arch/x86/include/generated $AUTOCONF_CFLAGS"
 
    test_xen
 
@@ -512,7 +512,12 @@
            # and if it as an 'event' member.
            #
            echo "$CONFTEST_PREAMBLE
-            #include <asm/system.h>
+            #include <linux/version.h>
+            #if LINUX_VERSION_CODE > KERNEL_VERSION(3, 3, 0)
+              #include <asm/switch_to.h>
+            #else
+              #include <asm/system.h>
+            #endif
            #include <linux/pm.h>
            void conftest_pm_message_t(pm_message_t state) {
                pm_message_t *p = &state;
@@ -965,11 +970,12 @@
            #
            echo "$CONFTEST_PREAMBLE
            #include <linux/acpi.h>
+            #include <acpi/acpixf.h>
            void conftest_acpi_walk_namespace(void) {
                acpi_walk_namespace();
            }" > conftest$$.c
 
-            $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
+            #CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
            rm -f conftest$$.c
 
            if [ -f conftest$$.o ]; then
@@ -980,6 +986,7 @@
 
            echo "$CONFTEST_PREAMBLE
            #include <linux/acpi.h>
+            #include <acpi/acpixf.h>
            void conftest_acpi_walk_namespace(void) {
                acpi_walk_namespace(0, NULL, 0, NULL, NULL, NULL, NULL);
            }" > conftest$$.c
@@ -996,6 +1003,7 @@
 
            echo "$CONFTEST_PREAMBLE
            #include <linux/acpi.h>
+            #include <acpi/acpixf.h>
            void conftest_acpi_walk_namespace(void) {
                acpi_walk_namespace(0, NULL, 0, NULL, NULL, NULL);
            }" > conftest$$.c
@@ -1603,6 +1611,9 @@
                fi
            fi
        fi
+
+        RET=0
+        SELECTED_MAKEFILE=Makefile.kbuild
 
        if [ "$RET" = "0" ]; then
            ln -s $SELECTED_MAKEFILE Makefile
Index: kernel/nv-linux.h
===================================================================
--- kernel/nv-linux.h.orig
+++ kernel/nv-linux.h
@@ -111,7 +111,11 @@
 #include <linux/timer.h>
 
 #include <asm/div64.h>              /* do_div()                        */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 3, 0)
+#include <asm/switch_to.h>
+#else
 #include <asm/system.h>            /* cli, sli, save_flags            */
+#endif
 #include <asm/io.h>                /* ioremap, virt_to_phys            */
 #include <asm/uaccess.h>            /* access_ok                        */
 #include <asm/page.h>              /* PAGE_OFFSET                      */
@@ -291,17 +295,17 @@
 #endif
 #endif
 
-#if defined(CONFIG_PREEMPT_RT)
-typedef atomic_spinlock_t        nv_spinlock_t;
-#define NV_SPIN_LOCK_INIT(lock)  atomic_spin_lock_init(lock)
-#define NV_SPIN_LOCK_IRQ(lock)    atomic_spin_lock_irq(lock)
-#define NV_SPIN_UNLOCK_IRQ(lock)  atomic_spin_unlock_irq(lock)
-#define NV_SPIN_LOCK_IRQSAVE(lock,flags) atomic_spin_lock_irqsave(lock,flags)
+#if defined(CONFIG_PREEMPT_RT_FULL)
+typedef raw_spinlock_t            nv_spinlock_t;
+#define NV_SPIN_LOCK_INIT(lock)  raw_spin_lock_init(lock)
+#define NV_SPIN_LOCK_IRQ(lock)    raw_spin_lock_irq(lock)
+#define NV_SPIN_UNLOCK_IRQ(lock)  raw_spin_unlock_irq(lock)
+#define NV_SPIN_LOCK_IRQSAVE(lock,flags) raw_spin_lock_irqsave(lock,flags)
 #define NV_SPIN_UNLOCK_IRQRESTORE(lock,flags) \
-  atomic_spin_unlock_irqrestore(lock,flags)
-#define NV_SPIN_LOCK(lock)        atomic_spin_lock(lock)
-#define NV_SPIN_UNLOCK(lock)      atomic_spin_unlock(lock)
-#define NV_SPIN_UNLOCK_WAIT(lock) atomic_spin_unlock_wait(lock)
+  raw_spin_unlock_irqrestore(lock,flags)
+#define NV_SPIN_LOCK(lock)        raw_spin_lock(lock)
+#define NV_SPIN_UNLOCK(lock)      raw_spin_unlock(lock)
+#define NV_SPIN_UNLOCK_WAIT(lock) raw_spin_unlock_wait(lock)
 #else
 typedef spinlock_t                nv_spinlock_t;
 #define NV_SPIN_LOCK_INIT(lock)  spin_lock_init(lock)
@@ -956,8 +960,8 @@
    return ret;
 }
 
-#if defined(CONFIG_PREEMPT_RT)
-#define NV_INIT_MUTEX(mutex) semaphore_init(mutex)
+#if defined(CONFIG_PREEMPT_RT_FULL)
+#define NV_INIT_MUTEX(mutex) sema_init(mutex,1)
 #else
 #if !defined(__SEMAPHORE_INITIALIZER) && defined(__COMPAT_SEMAPHORE_INITIALIZER)
 #define __SEMAPHORE_INITIALIZER __COMPAT_SEMAPHORE_INITIALIZER

The security patches for the earlier version doesn't need to be aplied, because it is already included in the original 290.40 driver.

chloris 04-17-12 06:06 AM

Re: help nvidia driver for linux rt series 3.4-rcX-rtX
 
@eskuai
cannot reproduce your error (black screen) on linux 3.4-rc3-rt5. For me it works with both
295.33 and 295.40 nvidia binary drivers.

eskuai 04-19-12 10:10 AM

Re: help nvidia driver for linux rt series 3.4-rcX-rtX
 
you right,

i've compiled 3.4-rc3-rt5 again, using 295.40 and thank you so much, it works ok !

something i made wrong before install, sorry ...

testing, waiting for "stable" days ...


All times are GMT -5. The time now is 04:44 PM.

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.