Go Back   nV News Forums > Linux Support Forums > NVIDIA Linux

Newegg Daily Deals

Reply
 
Thread Tools
Old 05-05-12, 04:18 AM   #1
pavlinux
Registered User
 
pavlinux's Avatar
 
Join Date: Feb 2006
Location: Moscow, Russia
Posts: 57
Default [PATCH] 302.07/295.49 patches for linux-3.4.0+




Patch 4-rd version. add mlauss fix.

Code:
diff -ur a/kernel/conftest.sh b/kernel/conftest.sh
--- a/kernel/conftest.sh        2012-04-27 22:50:12.000000000 +0400
+++ b/kernel/conftest.sh        2012-05-09 20:59:52.136000128 +0400
@@ -101,7 +101,7 @@
 
     if [ "$OUTPUT" != "$SOURCES" ]; then
         MACH_CFLAGS="-I$HEADERS/asm-$ARCH/mach-default"
-        if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
+        if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" -o "$ARCH" = "x86" ]; then
             MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/asm-x86/mach-default"
             MACH_CFLAGS="$MACH_CFLAGS -I$SOURCES/arch/x86/include/asm/mach-default"
         elif [ "$ARCH" = "arm" ]; then
@@ -112,7 +112,7 @@
         fi
     else
         MACH_CFLAGS="-I$HEADERS/asm/mach-default"
-        if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
+        if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" -o "$ARCH" = "x86" ]; then
             MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/asm-x86/mach-default"
             MACH_CFLAGS="$MACH_CFLAGS -I$SOURCES/arch/x86/include/asm/mach-default"
         elif [ "$ARCH" = "arm" ]; then
@@ -125,7 +125,7 @@
 
     CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS"
 
-    if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
+    if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" -o "$ARCH" = "x86" ]; then
         CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include -I$OUTPUT/arch/x86/include/generated"
     elif [ "$ARCH" = "arm" ]; then
         CFLAGS="$CFLAGS -I$SOURCES/arch/arm/include -I$OUTPUT/arch/arm/include/generated"
@@ -512,7 +512,6 @@
             # and if it as an 'event' member.
             #
             echo "$CONFTEST_PREAMBLE
-            #include <asm/system.h>
             #include <linux/pm.h>
             void conftest_pm_message_t(pm_message_t state) {
                 pm_message_t *p = &state;
diff -ur a/kernel/nv-linux.h b/kernel/nv-linux.h
--- a/kernel/nv-linux.h 2012-04-27 22:50:12.000000000 +0400
+++ b/kernel/nv-linux.h 2012-05-08 05:41:51.366000256 +0400
@@ -111,7 +111,6 @@
 #include <linux/timer.h>
 
 #include <asm/div64.h>              /* do_div()                         */
-#include <asm/system.h>             /* cli, sli, save_flags             */
 #include <asm/io.h>                 /* ioremap, virt_to_phys            */
 #include <asm/uaccess.h>            /* access_ok                        */
 #include <asm/page.h>               /* PAGE_OFFSET                      */
@@ -992,9 +991,19 @@
 #  define NV_IS_SUSER()                 capable(CAP_SYS_ADMIN)
 #  define NV_PCI_DEVICE_NAME(dev)       ((dev)->pretty_name)
 #  define NV_NUM_CPUS()                 num_online_cpus()
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
+# include <asm/system.h>
 #  define NV_CLI()                      local_irq_disable()
 #  define NV_SAVE_FLAGS(eflags)         local_save_flags(eflags)
 #  define NV_RESTORE_FLAGS(eflags)      local_irq_restore(eflags)
+#else
+# include <asm/irqflags.h>
+# define NV_CLI()                       arch_local_irq_disable()
+# define NV_SAVE_FLAGS(eflags)          eflags = arch_local_save_flags()
+# define NV_RESTORE_FLAGS(eflags)       arch_local_irq_restore(eflags)
+#endif
+
 #  define NV_MAY_SLEEP()                (!irqs_disabled() && !in_interrupt() && !NV_IN_ATOMIC())
 #  define NV_MODULE_PARAMETER(x)        module_param(x, int, 0)
 #  define NV_MODULE_STRING_PARAMETER(x) module_param(x, charp, 0)

Last edited by pavlinux; 05-09-12 at 12:06 PM.
pavlinux is offline   Reply With Quote
Old 05-07-12, 07:37 AM   #2
Milos_SD
Registered User
 
Join Date: Jan 2009
Posts: 19
Default Re: 302.07/295.49 patches for linux-3.4.0+

This patch doesn't work.
Code:
patching file kernel/conftest.sh
patching file kernel/nv-linux.h
/usr/bin/patch: **** malformed patch at line 20: @@ -994,9 +993,19 @@

Failed to apply patch file "/home/$USER/3.4.patch".
Milos_SD is offline   Reply With Quote
Old 05-07-12, 10:26 AM   #3
Gusar
Registered User
 
Join Date: Apr 2006
Posts: 277
Default Re: 302.07/295.49 patches for linux-3.4.0+

I applied it manually, then created a diff

Edit: See bellow for newer version
Gusar is offline   Reply With Quote
Old 05-07-12, 06:24 PM   #4
pavlinux
Registered User
 
pavlinux's Avatar
 
Join Date: Feb 2006
Location: Moscow, Russia
Posts: 57
Default Re: 302.07/295.49 patches for linux-3.4.0+

Quote:
Originally Posted by Milos_SD View Post
This patch doesn't work.


Oops, the patch is the same for both versions, the number of lines may vary.

---
Bug: Must be saved eflags in nv-pat.c

Code:
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
    NV_SAVE_FLAGS(eflags);
#else
    eflags = NV_SAVE_FLAGS(); 
#endif
Patch 3-rd version.

Code:
diff -ur a/kernel/conftest.sh b/kernel/conftest.sh
--- a/kernel/conftest.sh        2012-04-27 22:50:12.000000000 +0400
+++ b/kernel/conftest.sh        2012-05-08 05:15:24.042000162 +0400
@@ -512,7 +512,6 @@
             # and if it as an 'event' member.
             #
             echo "$CONFTEST_PREAMBLE
-            #include <asm/system.h>
             #include <linux/pm.h>
             void conftest_pm_message_t(pm_message_t state) {
                 pm_message_t *p = &state;
Только в b/kernel/: Makefile
diff -ur a/kernel/nv-linux.h b/kernel/nv-linux.h
--- a/kernel/nv-linux.h 2012-04-27 22:50:12.000000000 +0400
+++ b/kernel/nv-linux.h 2012-05-08 05:37:30.129000164 +0400
@@ -111,7 +111,6 @@
 #include <linux/timer.h>
 
 #include <asm/div64.h>              /* do_div()                         */
-#include <asm/system.h>             /* cli, sli, save_flags             */
 #include <asm/io.h>                 /* ioremap, virt_to_phys            */
 #include <asm/uaccess.h>            /* access_ok                        */
 #include <asm/page.h>               /* PAGE_OFFSET                      */
@@ -992,9 +991,19 @@
 #  define NV_IS_SUSER()                 capable(CAP_SYS_ADMIN)
 #  define NV_PCI_DEVICE_NAME(dev)       ((dev)->pretty_name)
 #  define NV_NUM_CPUS()                 num_online_cpus()
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
+# include <asm/system.h>
 #  define NV_CLI()                      local_irq_disable()
 #  define NV_SAVE_FLAGS(eflags)         local_save_flags(eflags)
 #  define NV_RESTORE_FLAGS(eflags)      local_irq_restore(eflags)
+#else
+# include <asm/irqflags.h>
+# define NV_CLI()                       arch_local_irq_disable()
+# define NV_SAVE_FLAGS(eflags)          eflags = arch_local_save_flags()
+# define NV_RESTORE_FLAGS(eflags)       arch_local_irq_restore(eflags)
+#endif
+
 #  define NV_MAY_SLEEP()                (!irqs_disabled() && !in_interrupt() && !NV_IN_ATOMIC())
 #  define NV_MODULE_PARAMETER(x)        module_param(x, int, 0)
 #  define NV_MODULE_STRING_PARAMETER(x) module_param(x, charp, 0)
pavlinux is offline   Reply With Quote
Old 05-08-12, 12:59 AM   #5
Gusar
Registered User
 
Join Date: Apr 2006
Posts: 277
Default Re: 302.07/295.49 patches for linux-3.4.0+

That one is incomplete, the nv-pat.c part is missing. This should do it:
Code:
--- kernel/conftest.sh.orig
+++ kernel/conftest.sh
@@ -512,7 +512,6 @@
             # and if it as an 'event' member.
             #
             echo "$CONFTEST_PREAMBLE
-            #include <asm/system.h>
             #include <linux/pm.h>
             void conftest_pm_message_t(pm_message_t state) {
                 pm_message_t *p = &state;
--- kernel/nv-linux.h.orig
+++ kernel/nv-linux.h
@@ -111,7 +111,6 @@
 #include <linux/timer.h>
 
 #include <asm/div64.h>              /* do_div()                         */
-#include <asm/system.h>             /* cli, sli, save_flags             */
 #include <asm/io.h>                 /* ioremap, virt_to_phys            */
 #include <asm/uaccess.h>            /* access_ok                        */
 #include <asm/page.h>               /* PAGE_OFFSET                      */
@@ -992,9 +991,19 @@
 #  define NV_IS_SUSER()                 capable(CAP_SYS_ADMIN)
 #  define NV_PCI_DEVICE_NAME(dev)       ((dev)->pretty_name)
 #  define NV_NUM_CPUS()                 num_online_cpus()
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
+# include <asm/system.h>
 #  define NV_CLI()                      local_irq_disable()
 #  define NV_SAVE_FLAGS(eflags)         local_save_flags(eflags)
 #  define NV_RESTORE_FLAGS(eflags)      local_irq_restore(eflags)
+#else
+# include <asm/irqflags.h>
+# define NV_CLI()                       arch_local_irq_disable()
+# define NV_SAVE_FLAGS()                arch_local_save_flags()
+# define NV_RESTORE_FLAGS(eflags)       arch_local_irq_restore(eflags)
+#endif
+
 #  define NV_MAY_SLEEP()                (!irqs_disabled() && !in_interrupt() && !NV_IN_ATOMIC())
 #  define NV_MODULE_PARAMETER(x)        module_param(x, int, 0)
 #  define NV_MODULE_STRING_PARAMETER(x) module_param(x, charp, 0)
--- kernel/nv-pat.c.orig
+++ kernel/nv-pat.c
@@ -109,7 +109,11 @@
         return;
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
     NV_SAVE_FLAGS(eflags);
+#else
+    eflags = NV_SAVE_FLAGS();
+#endif
     NV_CLI();
     nv_disable_caches(&cr4);
 
@@ -135,7 +139,11 @@
         return;
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
     NV_SAVE_FLAGS(eflags);
+#else
+    eflags = NV_SAVE_FLAGS();
+#endif
     NV_CLI();
     nv_disable_caches(&cr4);
Gusar is offline   Reply With Quote
Old 05-08-12, 09:12 AM   #6
pavlinux
Registered User
 
pavlinux's Avatar
 
Join Date: Feb 2006
Location: Moscow, Russia
Posts: 57
Default Re: 302.07/295.49 patches for linux-3.4.0+

Quote:
Originally Posted by Gusar View Post
That one is incomplete, the nv-pat.c part is missing. This should do it:
Do not, see nv-linux.h

Code:
+# define NV_SAVE_FLAGS(eflags)   eflags = arch_local_save_flags()
But your version is also possible.
pavlinux is offline   Reply With Quote
Old 05-08-12, 09:44 AM   #7
mlauss
Registered User
 
Join Date: Aug 2007
Posts: 43
Default Re: 302.07/295.49 patches for linux-3.4.0+

For some reason I need this hunk as well, please add it.

Code:
--- NVIDIA-Linux-x86_64-295.40/kernel/conftest.sh~      2012-04-06 06:37:05.000000000 +0200
+++ NVIDIA-Linux-x86_64-295.40/kernel/conftest.sh       2012-04-13 08:42:13.618750616 +0200
@@ -101,7 +101,7 @@ build_cflags() {

     if [ "$OUTPUT" != "$SOURCES" ]; then
         MACH_CFLAGS="-I$HEADERS/asm-$ARCH/mach-default"
-        if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
+        if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" -o "$ARCH" = "x86" ]; then
             MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/asm-x86/mach-default"        
             MACH_CFLAGS="$MACH_CFLAGS -I$SOURCES/arch/x86/include/asm/mach-default"
         elif [ "$ARCH" = "ARMv7" ]; then                                           
@@ -112,7 +112,7 @@ build_cflags() {
         fi                         
     else  
         MACH_CFLAGS="-I$HEADERS/asm/mach-default"
-        if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
+        if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" -o "$ARCH" = "x86" ]; then
             MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/asm-x86/mach-default"        
             MACH_CFLAGS="$MACH_CFLAGS -I$SOURCES/arch/x86/include/asm/mach-default"
         elif [ "$ARCH" = "ARMv7" ]; then                                           
@@ -125,7 +125,7 @@ build_cflags() {
     
     CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS"

-    if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
+    if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" -o "$ARCH" = "x86" ]; then
         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$OUTPUT/arch/arm/include/generated"
mlauss is offline   Reply With Quote
Old 05-09-12, 12:07 PM   #8
pavlinux
Registered User
 
pavlinux's Avatar
 
Join Date: Feb 2006
Location: Moscow, Russia
Posts: 57
Default Re: 302.07/295.49 patches for linux-3.4.0+

Quote:
Originally Posted by mlauss View Post
For some reason I need this hunk as well, please add it.
Add in first msg.
pavlinux is offline   Reply With Quote

Old 05-09-12, 12:58 PM   #9
artem
Registered User
 
Join Date: Jun 2006
Posts: 710
Default Re: 302.07/295.49 patches for linux-3.4.0+

Guys can you just post a patch as an attachment?

Copy pasting a patch almost never works because tabs and spaces all get messed up.
artem is offline   Reply With Quote
Old 05-17-12, 04:33 AM   #10
pavlinux
Registered User
 
pavlinux's Avatar
 
Join Date: Feb 2006
Location: Moscow, Russia
Posts: 57
Default Re: 302.07/295.49 patches for linux-3.4.0+

Quote:
Originally Posted by artem View Post
Guys can you just post a patch as an attachment?
Copy pasting a patch almost never works because tabs and spaces all get messed up.
http://pavlinux.ru/nv/nvidia-295-302.pavlinux.patch
pavlinux is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 03:27 PM.


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