diff options
Diffstat (limited to 'x11-drivers/nvidia-drivers/files')
20 files changed, 2450 insertions, 0 deletions
diff --git a/x11-drivers/nvidia-drivers/files/10nvidia b/x11-drivers/nvidia-drivers/files/10nvidia new file mode 100644 index 00000000..f1bc2fef --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/10nvidia @@ -0,0 +1 @@ +__GL_NO_DSO_FINALIZER="1" diff --git a/x11-drivers/nvidia-drivers/files/256.35-unified-arch.patch b/x11-drivers/nvidia-drivers/files/256.35-unified-arch.patch new file mode 100644 index 00000000..da92b8f0 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/256.35-unified-arch.patch @@ -0,0 +1,30 @@ +diff -NuarpbB NVIDIA-Linux-x86-256.25-ori/kernel/conftest.sh NVIDIA-Linux-x86-256.25/kernel/conftest.sh +--- NVIDIA-Linux-x86-256.25-ori/kernel/conftest.sh 2010-05-19 05:38:57.000000000 +0200 ++++ NVIDIA-Linux-x86-256.25/kernel/conftest.sh 2010-05-22 02:13:56.000000000 +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" + fi +@@ -110,7 +110,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" + fi +@@ -121,7 +121,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" + fi + if [ -n "$BUILD_PARAMS" ]; then diff --git a/x11-drivers/nvidia-drivers/files/eblits/donvidia.eblit b/x11-drivers/nvidia-drivers/files/eblits/donvidia.eblit new file mode 100644 index 00000000..75b39cfb --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/eblits/donvidia.eblit @@ -0,0 +1,21 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/files/eblits/donvidia.eblit,v 1.1 2008/12/18 18:27:35 cardoe Exp $ + +# Install nvidia library: +# the first parameter is the place where to install it +# the second parameter is the base name of the library +# the third parameter is the provided soversion +donvidia() { + dodir $1 + exeinto $1 + + libname=$(basename $2) + + # libnvidia-cfg.so is no longer supplied in lib32; step over it gracefully + if [ -e $2.$3 ] ; then + doexe $2.$3 + dosym ${libname}.$3 $1/${libname} + [[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1 + fi +} diff --git a/x11-drivers/nvidia-drivers/files/eblits/mtrr_check.eblit b/x11-drivers/nvidia-drivers/files/eblits/mtrr_check.eblit new file mode 100644 index 00000000..b14df34b --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/eblits/mtrr_check.eblit @@ -0,0 +1,19 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/files/eblits/mtrr_check.eblit,v 1.1 2008/12/18 18:27:35 cardoe Exp $ + +mtrr_check() { + ebegin "Checking for MTRR support" + linux_chkconfig_present MTRR + eend $? + + if [[ $? -ne 0 ]] ; then + eerror "Please enable MTRR support in your kernel config, found at:" + eerror + eerror " Processor type and features" + eerror " [*] MTRR (Memory Type Range Register) support" + eerror + eerror "and recompile your kernel ..." + die "MTRR support not detected!" + fi +} diff --git a/x11-drivers/nvidia-drivers/files/eblits/src_install-libs.eblit b/x11-drivers/nvidia-drivers/files/eblits/src_install-libs.eblit new file mode 100644 index 00000000..e48d11ce --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/eblits/src_install-libs.eblit @@ -0,0 +1,116 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distribnuted under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/files/eblits/src_install-libs.eblit,v 1.1 2008/12/18 18:27:35 cardoe Exp $ +# +src_install-libs() { + local pkglibdir=lib + local inslibdir=$(get_libdir) + + if [[ ${#} -eq 2 ]] ; then + pkglibdir=${1} + inslibdir=${2} + elif has_multilib_profile && [[ ${ABI} == "x86" ]] ; then + pkglibdir=lib32 + fi + + local usrpkglibdir=usr/${pkglibdir} + local libdir=usr/X11R6/${pkglibdir} + local drvdir=${libdir}/modules/drivers + local extdir=${libdir}/modules/extensions + local incdir=usr/include/GL + local sover=${PV} + local NV_ROOT="/usr/${inslibdir}/opengl/nvidia" + local NO_TLS_ROOT="${NV_ROOT}/no-tls" + local TLS_ROOT="${NV_ROOT}/tls" + local X11_LIB_DIR="/usr/${inslibdir}/xorg" + + if use x86-fbsd; then + # on FreeBSD everything is on obj/ + pkglibdir=obj + usrpkglibdir=obj + x11pkglibdir=obj + drvdir=obj + extdir=obj + + # don't ask me why the headers are there.. glxext.h is missing + incdir=doc + + # on FreeBSD it has just .1 suffix + sover=1 + fi + + # The GLX libraries + donvidia ${NV_ROOT}/lib ${usrpkglibdir}/libGL.so ${sover} + donvidia ${NV_ROOT}/lib ${usrpkglibdir}/libGLcore.so ${sover} + + donvidia ${NV_ROOT}/lib ${usrpkglibdir}/libnvidia-cfg.so ${sover} + + dodir ${NO_TLS_ROOT} + donvidia ${NO_TLS_ROOT} ${usrpkglibdir}/libnvidia-tls.so ${sover} + + if ! use x86-fbsd; then + donvidia ${TLS_ROOT} ${usrpkglibdir}/tls/libnvidia-tls.so ${sover} + fi + + if want_tls ; then + dosym ../tls/libnvidia-tls.so ${NV_ROOT}/lib + dosym ../tls/libnvidia-tls.so.1 ${NV_ROOT}/lib + dosym ../tls/libnvidia-tls.so.${sover} ${NV_ROOT}/lib + else + dosym ../no-tls/libnvidia-tls.so ${NV_ROOT}/lib + dosym ../no-tls/libnvidia-tls.so.1 ${NV_ROOT}/lib + dosym ../no-tls/libnvidia-tls.so.${sover} ${NV_ROOT}/lib + fi + + if ! use x86-fbsd; then + # Install the .la file for libtool, to prevent e.g. bug #176423 + [ -f "${FILESDIR}/libGL.la-r2" ] || die "libGL.la-r2 missing in FILESDIR" + local ver1=$(get_version_component_range 1) + local ver2=$(get_version_component_range 2) + local ver3=$(get_version_component_range 3) + sed -e "s:\${PV}:${PV}:" \ + -e "s:\${ver1}:${ver1}:" \ + -e "s:\${ver2}:${ver2}:" \ + -e "s:\${ver3}:${ver3}:" \ + -e "s:\${libdir}:${inslibdir}:" \ + "${FILESDIR}"/libGL.la-r2 > "${D}"/${NV_ROOT}/lib/libGL.la + fi + + exeinto ${X11_LIB_DIR}/modules/drivers + + [[ -f ${drvdir}/nvidia_drv.so ]] && \ + doexe ${drvdir}/nvidia_drv.so + + insinto /usr/${inslibdir} + [[ -f ${libdir}/libXvMCNVIDIA.a ]] && \ + doins ${libdir}/libXvMCNVIDIA.a + exeinto /usr/${inslibdir} + # fix Bug 131315 + [[ -f ${libdir}/libXvMCNVIDIA.so.${PV} ]] && \ + doexe ${libdir}/libXvMCNVIDIA.so.${PV} && \ + dosym libXvMCNVIDIA.so.${PV} \ + /usr/${inslibdir}/libXvMCNVIDIA.so + + exeinto ${NV_ROOT}/extensions + [[ -f ${libdir}/modules/libnvidia-wfb.so.${sover} ]] && \ + newexe ${libdir}/modules/libnvidia-wfb.so.${sover} libwfb.so + [[ -f ${extdir}/libglx.so.${sover} ]] && \ + newexe ${extdir}/libglx.so.${sover} libglx.so + + # Includes + insinto ${NV_ROOT}/include + doins ${incdir}/*.h + + #cuda + if [[ -f usr/include/cuda/cuda.h ]]; then + dodir /usr/include/cuda + insinto /usr/include/cuda + doins usr/include/cuda/*.h + + if [[ -f usr/${pkglibdir}/libcuda.so.${PV} ]]; then + dolib.so usr/${pkglibdir}/libcuda.so.${PV} + dosym libcuda.so.${PV} /usr/${inslibdir}/libcuda.so.1 + dosym libcuda.so.1 /usr/${inslibdir}/libcuda.so + fi + fi +} diff --git a/x11-drivers/nvidia-drivers/files/eblits/want_tls.eblit b/x11-drivers/nvidia-drivers/files/eblits/want_tls.eblit new file mode 100644 index 00000000..4debb85d --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/eblits/want_tls.eblit @@ -0,0 +1,33 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/files/eblits/want_tls.eblit,v 1.1 2008/12/18 18:27:35 cardoe Exp $ + +want_tls() { + # For uclibc or anything non glibc, return false + has_version sys-libs/glibc || return 1 + + # Old versions of glibc were lt/no-tls only + has_version '<sys-libs/glibc-2.3.2' && return 1 + + if use x86 ; then + case ${CHOST/-*} in + i486|i586|i686) ;; + *) return 1 ;; + esac + fi + + # If we've got nptl, we've got tls + built_with_use --missing true sys-libs/glibc nptl && return 0 + + # 2.3.5 turned off tls for linuxthreads glibc on i486 and i586 + if use x86 && has_version '>=sys-libs/glibc-2.3.5' ; then + case ${CHOST/-*} in + i486|i586) return 1 ;; + esac + fi + + # These versions built linuxthreads version to support tls, too + has_version '>=sys-libs/glibc-2.3.4.20040619-r2' && return 0 + + return 1 +} diff --git a/x11-drivers/nvidia-drivers/files/libGL.la-r2 b/x11-drivers/nvidia-drivers/files/libGL.la-r2 new file mode 100644 index 00000000..863d1844 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/libGL.la-r2 @@ -0,0 +1,32 @@ +# libGL.la - a libtool library file +# Generated by ltmain.sh - GNU libtool 1.4 (1.920 2001/04/24 23:26:18) +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='libGL.so.1' + +# Names of this library. +library_names='libGL.so.${PV} libGL.so.1 libGL.so' + +# The name of the static archive. +old_library='' + +# Libraries that this one depends upon. +dependency_libs='-L/usr/${libdir} -lm -lX11 -lXext -ldl' + +# Version information for libGL. +current=${ver1} +age=${ver2} +revision=${ver3} + +# Is this an already installed library? +installed=yes + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/usr/${libdir}' diff --git a/x11-drivers/nvidia-drivers/files/make-use-of-the-new-uapi-framework.patch b/x11-drivers/nvidia-drivers/files/make-use-of-the-new-uapi-framework.patch new file mode 100644 index 00000000..b408b6ae --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/make-use-of-the-new-uapi-framework.patch @@ -0,0 +1,46 @@ +From 1e3d34ce7d8c4912c08386589843fcc4ba4d38bf Mon Sep 17 00:00:00 2001 +From: Alberto Milone <alberto.milone@canonical.com> +Date: Wed, 7 Nov 2012 12:03:46 +0100 +Subject: [PATCH 1/2] Make use of the new uapi framework + +--- + conftest.sh | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/conftest.sh b/conftest.sh +index 388e268..8eff4d7 100755 +--- a/conftest.sh ++++ b/conftest.sh +@@ -20,6 +20,7 @@ ARCH=$3 + ISYSTEM=`$CC -print-file-name=include 2> /dev/null` + SOURCES=$4 + HEADERS=$SOURCES/include ++HEADERSA=$SOURCES/include/uapi + OUTPUT=$5 + XEN_PRESENT=1 + +@@ -118,7 +119,7 @@ build_cflags() { + fi + fi + +- CFLAGS="$CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS" ++ CFLAGS="$CFLAGS $OUTPUT_CFLAGS -I$HEADERS -I$HEADERSA $AUTOCONF_CFLAGS" + + test_xen + +@@ -146,10 +147,10 @@ build_cflags() { + fi + fi + +- CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS" ++ CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS -I$HEADERS -I$HEADERSA $AUTOCONF_CFLAGS" + + if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then +- CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include -I$OUTPUT/arch/x86/include/generated" ++ CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include -I$SOURCES/arch/x86/include/uapi -I$OUTPUT/arch/x86/include/generated -I$OUTPUT/arch/x86/include/generated/uapi" + elif [ "$ARCH" = "arm" ]; then + CFLAGS="$CFLAGS -I$SOURCES/arch/arm/include -I$OUTPUT/arch/arm/include/generated" + fi +-- +1.7.9.5 + diff --git a/x11-drivers/nvidia-drivers/files/nvidia b/x11-drivers/nvidia-drivers/files/nvidia new file mode 100644 index 00000000..7cf0f7c0 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia @@ -0,0 +1,40 @@ +# Nvidia drivers support +alias char-major-195 nvidia +alias /dev/nvidiactl char-major-195 + +# To tweak the driver the following options can be used, note that +# you should be careful, as it could cause instability!! For more +# options see /usr/share/doc/PACKAGE/README +# +# To enable Side Band Adressing: NVreg_EnableAGPSBA=1 +# +# To enable Fast Writes: NVreg_EnableAGPFW=1 +# +# To enable both for instance, uncomment following line: +# +#options nvidia NVreg_EnableAGPSBA=1 NVreg_EnableAGPFW=1 +# If you have a mobile chip, you may need to enable this option +# if you have hard lockups when starting X. +# +# See: Appendix I. Configuring your laptop +# In /usr/share/doc/PACKAGE/README for full details +# +# Choose the appropriate value for NVreg_Mobile from the table: +# Value Meaning +# ---------- -------------------------------------------------- +# 0xFFFFFFFF let the kernel module autodetect the correct value +# 1 Dell laptops +# 2 non-Compal Toshiba laptops +# 3 all other laptops +# 4 Compal Toshiba laptops +# 5 Gateway laptops +# +#options nvidia NVreg_SoftEDIDs=0 NVreg_Mobile=3 + + +# !!! SECURITY WARNING !!! +# DO NOT MODIFY OR REMOVE THE DEVICE FILE RELATED OPTIONS UNLESS YOU KNOW +# WHAT YOU ARE DOING. +# ONLY ADD TRUSTED USERS TO THE VIDEO GROUP, THESE USERS MAY BE ABLE TO CRASH, +# COMPROMISE, OR IRREPARABLY DAMAGE THE MACHINE. +options nvidia NVreg_DeviceFileMode=432 NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=VIDEOGID NVreg_ModifyDeviceFiles=1 diff --git a/x11-drivers/nvidia-drivers/files/nvidia-169.07 b/x11-drivers/nvidia-drivers/files/nvidia-169.07 new file mode 100644 index 00000000..a96b0cd1 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-169.07 @@ -0,0 +1,14 @@ +# Nvidia drivers support +alias char-major-195 nvidia +alias /dev/nvidiactl char-major-195 + +# To tweak the driver the following options can be used, note that +# you should be careful, as it could cause instability!! For more +# options see /usr/share/doc/PACKAGE/README +# +# !!! SECURITY WARNING !!! +# DO NOT MODIFY OR REMOVE THE DEVICE FILE RELATED OPTIONS UNLESS YOU KNOW +# WHAT YOU ARE DOING. +# ONLY ADD TRUSTED USERS TO THE VIDEO GROUP, THESE USERS MAY BE ABLE TO CRASH, +# COMPROMISE, OR IRREPARABLY DAMAGE THE MACHINE. +options nvidia NVreg_DeviceFileMode=432 NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=VIDEOGID NVreg_ModifyDeviceFiles=1 diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-173-3.10.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-173-3.10.patch new file mode 100644 index 00000000..9d3016ba --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-173-3.10.patch @@ -0,0 +1,714 @@ +From c3248bb6c976c112e9efa9e8f202590b2f9b40a5 Mon Sep 17 00:00:00 2001 +From: Alberto Milone <alberto.milone@canonical.com> +Date: Tue, 18 Jun 2013 15:16:18 +0200 +Subject: [PATCH 1/1] Add support for Linux 3.10 + +--- + nv-i2c.c | 13 +-- + nv-linux.h | 1 + + nv.c | 375 ++++++++++++++++++++++++++++++++++++++---------------------- + 3 files changed, 241 insertions(+), 148 deletions(-) + +diff --git a/nv-i2c.c b/nv-i2c.c +index 143f9e4..aaee787 100644 +--- a/usr/src/nv/nv-i2c.c ++++ b/usr/src/nv/nv-i2c.c +@@ -307,8 +307,6 @@ void* NV_API_CALL nv_i2c_add_adapter(nv_state_t *nv, U032 port) + BOOL NV_API_CALL nv_i2c_del_adapter(nv_state_t *nv, void *data) + { + struct i2c_adapter *pI2cAdapter = (struct i2c_adapter *)data; +- int osstatus = 0; +- BOOL wasReleased = FALSE; + + #if defined(KERNEL_2_4) + if (!NV_WEAK_SYMBOL_PRESENT(i2c_add_adapter)) +@@ -320,15 +318,10 @@ BOOL NV_API_CALL nv_i2c_del_adapter(nv_state_t *nv, void *data) + if (!pI2cAdapter) return FALSE; + + // attempt release with the OS +- osstatus = i2c_del_adapter(pI2cAdapter); +- +- if (!osstatus) +- { +- os_free_mem(pI2cAdapter); +- wasReleased = TRUE; +- } ++ i2c_del_adapter(pI2cAdapter); ++ os_free_mem(pI2cAdapter); + +- return wasReleased; ++ return TRUE; + } + + #else // (defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)) +diff --git a/nv-linux.h b/nv-linux.h +index 963e059..9aac81a 100644 +--- a/usr/src/nv/nv-linux.h ++++ b/usr/src/nv/nv-linux.h +@@ -163,6 +163,7 @@ + + #ifdef CONFIG_PROC_FS + #include <linux/proc_fs.h> ++#include <linux/seq_file.h> + #endif + + #ifdef CONFIG_MTRR +diff --git a/nv.c b/nv.c +index f82e46f..570c266 100644 +--- a/usr/src/nv/nv.c ++++ b/usr/src/nv/nv.c +@@ -291,7 +291,6 @@ void NV_API_CALL nv_verify_pci_config(nv_state_t *nv, BOOL check_the_bars) + + /* nvos_ functions.. do not take a state device parameter */ + static void nvos_proc_create(void); +-static void nvos_proc_remove_all(struct proc_dir_entry *); + static void nvos_proc_remove(void); + static int nvos_count_devices(nv_stack_t *); + +@@ -333,12 +332,34 @@ void nv_kern_rc_timer(unsigned long); + static int nv_kern_apm_event(struct pm_dev *, pm_request_t, void *); + #endif + +-static int nv_kern_read_cardinfo(char *, char **, off_t off, int, int *, void *); +-static int nv_kern_read_status(char *, char **, off_t off, int, int *, void *); +-static int nv_kern_read_registry(char *, char **, off_t off, int, int *, void *); +-static int nv_kern_read_agpinfo(char *, char **, off_t off, int, int *, void *); +-static int nv_kern_read_version(char *, char **, off_t off, int, int *, void *); +-static int nv_kern_read_text_file(char *, char **, off_t off, int, int *, void *); ++static const struct file_operations nv_procfs_text_fops; ++static const struct file_operations nv_procfs_read_card_info_fops; ++static const struct file_operations nv_procfs_version_fops; ++static const struct file_operations nv_procfs_read_agp_info_fops; ++static const struct file_operations nv_procfs_read_agp_info_gpu_fops; ++static const struct file_operations nv_procfs_read_agp_status_fops; ++static const struct file_operations nv_procfs_registry_fops; ++ ++static int nv_procfs_show_text_file(struct seq_file *, void *); ++static int nv_procfs_open_text_file(struct inode *, struct file *); ++static void nvos_proc_add_text_file(struct proc_dir_entry *, const char *, const char *); ++ ++static int nv_procfs_show_card_info(struct seq_file *, void *); ++static int nv_procfs_read_card_info(struct inode *, struct file *); ++ ++static int nv_procfs_show_version(struct seq_file *, void *); ++static int nv_procfs_open_version(struct inode *, struct file *); ++ ++static int nv_procfs_show_agp_info(struct seq_file *, void *); ++static int nv_procfs_read_agp_info(struct inode *, struct file *); ++ ++static int nv_procfs_read_agp_info_gpu(struct inode *, struct file *file); ++static int nv_procfs_show_agp_status(struct seq_file *, void *); ++static int nv_procfs_read_agp_status(struct inode *, struct file *); ++ ++static int nv_procfs_show_registry(struct seq_file *, void *); ++static int nv_procfs_open_registry(struct inode *, struct file *); ++ + + int nv_kern_ctl_open(struct inode *, struct file *); + int nv_kern_ctl_close(struct inode *, struct file *); +@@ -604,6 +625,12 @@ static struct pci_dev* nv_get_pci_device(nv_state_t *nv) + return NULL; + } + ++#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,9,255) ++static inline void *PDE_DATA(const struct inode *inode) { ++ return PDE(inode)->data; ++} ++#endif ++ + static void nvos_proc_create(void) + { + #ifdef CONFIG_PROC_FS +@@ -623,19 +650,19 @@ static void nvos_proc_create(void) + nv_state_t *nv; + nv_linux_state_t *nvl; + +- proc_nvidia = create_proc_entry("driver/nvidia", d_flags, NULL); ++ proc_nvidia = proc_mkdir_mode("driver/nvidia", d_flags, NULL); + if (!proc_nvidia) + goto failed; + +- proc_nvidia_cards = create_proc_entry("cards", d_flags, proc_nvidia); ++ proc_nvidia_cards = proc_mkdir_mode("cards", d_flags, proc_nvidia); + if (!proc_nvidia_cards) + goto failed; + +- proc_nvidia_warnings = create_proc_entry("warnings", d_flags, proc_nvidia); ++ proc_nvidia_warnings = proc_mkdir_mode("warnings", d_flags, proc_nvidia); + if (!proc_nvidia_warnings) + goto failed; + +- proc_nvidia_patches = create_proc_entry("patches", d_flags, proc_nvidia); ++ proc_nvidia_patches = proc_mkdir_mode("patches", d_flags, proc_nvidia); + if (!proc_nvidia_patches) + goto failed; + +@@ -660,24 +687,19 @@ static void nvos_proc_create(void) + break; + + sprintf(name, "%d", i++); +- entry = create_proc_entry(name, flags, proc_nvidia_cards); ++ entry = proc_create_data(name, flags, proc_nvidia_cards, ++ &nv_procfs_read_card_info_fops, nv); + if (!entry) { + NV_PCI_DEV_PUT(dev); + goto failed; + } + +- entry->data = nv; +- entry->read_proc = nv_kern_read_cardinfo; +-#if defined(NV_PROC_DIR_ENTRY_HAS_OWNER) +- entry->owner = THIS_MODULE; +-#endif +- + if (nvos_find_agp_capability(dev)) { + /* + * Create the /proc/driver/nvidia/agp/{status,host-bridge,card} + * entries now that we know there's AGP hardware. + */ +- entry = create_proc_entry("agp", d_flags, proc_nvidia); ++ entry = proc_mkdir_mode("agp", d_flags, proc_nvidia); + if (!entry) { + NV_PCI_DEV_PUT(dev); + goto failed; +@@ -688,72 +710,78 @@ static void nvos_proc_create(void) + #endif + proc_nvidia_agp = entry; + +- entry = create_proc_entry("status", flags, proc_nvidia_agp); ++ entry = proc_create_data("status", flags, proc_nvidia_agp, ++ &nv_procfs_read_agp_status_fops, nv); + if (!entry) { + NV_PCI_DEV_PUT(dev); + goto failed; + } + +- entry->data = nv; +- entry->read_proc = nv_kern_read_status; +-#if defined(NV_PROC_DIR_ENTRY_HAS_OWNER) +- entry->owner = THIS_MODULE; +-#endif ++ entry = proc_create("host-bridge", flags, proc_nvidia_agp, ++ &nv_procfs_read_agp_info_fops); + +- entry = create_proc_entry("host-bridge", flags, proc_nvidia_agp); + if (!entry) { + NV_PCI_DEV_PUT(dev); + goto failed; + } + +- entry->data = NULL; +- entry->read_proc = nv_kern_read_agpinfo; +-#if defined(NV_PROC_DIR_ENTRY_HAS_OWNER) +- entry->owner = THIS_MODULE; +-#endif +- +- entry = create_proc_entry("card", flags, proc_nvidia_agp); ++ entry = proc_create_data("card", flags, proc_nvidia_agp, ++ &nv_procfs_read_agp_info_gpu_fops, nv); + if (!entry) { + NV_PCI_DEV_PUT(dev); + goto failed; + } + +- entry->data = nv; +- entry->read_proc = nv_kern_read_agpinfo; +-#if defined(NV_PROC_DIR_ENTRY_HAS_OWNER) +- entry->owner = THIS_MODULE; +-#endif + } + + NV_PCI_DEV_PUT(dev); + } + +- entry = create_proc_entry("version", flags, proc_nvidia); ++ entry = proc_create("version", flags, proc_nvidia, &nv_procfs_version_fops); + if (!entry) + goto failed; + +- entry->read_proc = nv_kern_read_version; +-#if defined(NV_PROC_DIR_ENTRY_HAS_OWNER) +- entry->owner = THIS_MODULE; +-#endif +- +- entry = create_proc_entry("registry", flags, proc_nvidia); ++ entry = proc_create("registry", flags, proc_nvidia, ++ &nv_procfs_registry_fops); + if (!entry) + goto failed; + +- entry->read_proc = nv_kern_read_registry; +-#if defined(NV_PROC_DIR_ENTRY_HAS_OWNER) +- entry->owner = THIS_MODULE; +-#endif +- + return; + + failed: + nv_printf(NV_DBG_ERRORS, "NVRM: failed to create /proc entries!\n"); +- nvos_proc_remove_all(proc_nvidia); ++ remove_proc_subtree("nvidia", proc_nvidia); + #endif + } + ++static int ++nv_procfs_show_text_file( ++ struct seq_file *m, ++ void *v ++) ++{ ++ seq_printf(m, "%s", (char *)m->private); ++ ++ return 0; ++} ++ ++static int ++nv_procfs_open_text_file( ++ struct inode *inode, ++ struct file *file ++) ++{ ++ return single_open(file, nv_procfs_show_text_file, PDE_DATA(inode)); ++} ++ ++static const struct file_operations nv_procfs_text_fops = { ++ .owner = THIS_MODULE, ++ .open = nv_procfs_open_text_file, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ + static void + nvos_proc_add_text_file( + struct proc_dir_entry *parent, +@@ -762,41 +790,18 @@ nvos_proc_add_text_file( + ) + { + #ifdef CONFIG_PROC_FS +- struct proc_dir_entry *entry; +- + /* world readable file */ + int flags = S_IFREG | S_IRUGO; + +- entry = create_proc_entry(filename, flags, parent); +- if (!entry) return; +- +- entry->data = (void *)text; +- entry->read_proc = nv_kern_read_text_file; +-#if defined(NV_PROC_DIR_ENTRY_HAS_OWNER) +- entry->owner = THIS_MODULE; +-#endif ++ proc_create_data(filename, flags, parent, &nv_procfs_text_fops, ++ (void *)text); + #endif + } + +-#ifdef CONFIG_PROC_FS +-static void nvos_proc_remove_all(struct proc_dir_entry *entry) +-{ +- while (entry) { +- struct proc_dir_entry *next = entry->next; +- if (entry->subdir) +- nvos_proc_remove_all(entry->subdir); +- remove_proc_entry(entry->name, entry->parent); +- if (entry == proc_nvidia) +- break; +- entry = next; +- } +-} +-#endif +- + static void nvos_proc_remove(void) + { + #ifdef CONFIG_PROC_FS +- nvos_proc_remove_all(proc_nvidia); ++ remove_proc_subtree("nvidia", proc_nvidia); + #endif + } + +@@ -3065,18 +3070,19 @@ void NV_API_CALL nv_set_dma_address_size( + } + + static int +-nv_kern_read_cardinfo(char *page, char **start, off_t off, +- int count, int *eof, void *data) ++nv_procfs_show_card_info( ++ struct seq_file *m, ++ void *v ++) + { + struct pci_dev *dev; + char *type, *fmt, tmpstr[NV_DEVICE_NAME_LENGTH]; +- int len = 0, status; ++ int status; + U032 vbios_rev1, vbios_rev2, vbios_rev3, vbios_rev4, vbios_rev5; + nv_stack_t *sp = NULL; + + nv_state_t *nv; +- nv = (nv_state_t *) data; +- *eof = 1; ++ nv = (nv_state_t *) m->private; + + dev = nv_get_pci_device(nv); + if (!dev) +@@ -3094,38 +3100,38 @@ nv_kern_read_cardinfo(char *page, char **start, off_t off, + strcpy (tmpstr, "Unknown"); + } + +- len += sprintf(page+len, "Model: \t\t %s\n", tmpstr); +- len += sprintf(page+len, "IRQ: \t\t %d\n", nv->interrupt_line); ++ seq_printf(m, "Model: \t\t %s\n", tmpstr); ++ seq_printf(m, "IRQ: \t\t %d\n", nv->interrupt_line); + + status = rm_get_vbios_version(sp, nv, &vbios_rev1, &vbios_rev2, + &vbios_rev3, &vbios_rev4, &vbios_rev5); + + if (status < 0) { + /* before rm_init_adapter */ +- len += sprintf(page+len, "Video BIOS: \t ??.??.??.??.??\n"); ++ seq_printf(m, "Video BIOS: \t ??.??.??.??.??\n"); + } else { + fmt = "Video BIOS: \t %02x.%02x.%02x.%02x.%02x\n"; +- len += sprintf(page+len, fmt, vbios_rev1, vbios_rev2, vbios_rev3, ++ seq_printf(m, fmt, vbios_rev1, vbios_rev2, vbios_rev3, + vbios_rev4, vbios_rev5); + } + + if (nvos_find_agp_capability(dev)) type = "AGP"; + else if (nvos_find_pci_express_capability(dev)) type = "PCI-E"; + else type = "PCI"; +- len += sprintf(page+len, "Card Type: \t %s\n", type); ++ seq_printf(m, "Card Type: \t %s\n", type); + + // Report the number of bits set in dev->dma_mask +- len += sprintf(page+len, "DMA Size: \t %d bits\n", ++ seq_printf(m, "DMA Size: \t %d bits\n", + nv_count_bits(dev->dma_mask)); +- len += sprintf(page+len, "DMA Mask: \t 0x%llx\n", dev->dma_mask); +- len += sprintf(page+len, "Bus Location: \t %02x.%02x.%x\n", ++ seq_printf(m, "DMA Mask: \t 0x%llx\n", dev->dma_mask); ++ seq_printf(m, "Bus Location: \t %02x.%02x.%x\n", + nv->bus, nv->slot, PCI_FUNC(dev->devfn)); + #ifdef DEBUG + do + { + int j; + for (j = 0; j < NV_GPU_NUM_BARS; j++) +- len += sprintf(page+len, "BAR%i: \t\t 0x%08x (%iMB)\n", ++ seq_printf(m, "BAR%i: \t\t 0x%08x (%iMB)\n", + j, nv->bars[j].address, nv->bars[j].size >> 20); + } while(0); + #endif +@@ -3133,35 +3139,68 @@ nv_kern_read_cardinfo(char *page, char **start, off_t off, + NV_KMEM_CACHE_FREE_STACK(sp); + + NV_PCI_DEV_PUT(dev); +- return len; ++ return 0; ++} ++ ++static int ++nv_procfs_read_card_info( ++ struct inode *inode, ++ struct file *file ++) ++{ ++ return single_open(file, nv_procfs_show_card_info, PDE_DATA(inode)); + } + ++static const struct file_operations nv_procfs_read_card_info_fops = { ++ .owner = THIS_MODULE, ++ .open = nv_procfs_read_card_info, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ + static int +-nv_kern_read_version(char *page, char **start, off_t off, +- int count, int *eof, void *data) ++nv_procfs_show_version( ++ struct seq_file *m, ++ void *v ++) + { +- int len = 0; +- *eof = 1; +- +- len += sprintf(page+len, "NVRM version: %s\n", pNVRM_ID); +- len += sprintf(page+len, "GCC version: %s\n", NV_COMPILER); +- +- return len; ++ seq_printf(m, "NVRM version: %s\n", pNVRM_ID); ++ seq_printf(m, "GCC version: %s\n", NV_COMPILER); ++ ++ return 0; ++} ++ ++static int ++nv_procfs_open_version( ++ struct inode *inode, ++ struct file *file ++) ++{ ++ return single_open(file, nv_procfs_show_version, NULL); + } + ++static const struct file_operations nv_procfs_version_fops = { ++ .owner = THIS_MODULE, ++ .open = nv_procfs_open_version, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ + static int +-nv_kern_read_agpinfo(char *page, char **start, off_t off, +- int count, int *eof, void *data) ++nv_procfs_show_agp_info( ++ struct seq_file *m, ++ void *v ++) + { + struct pci_dev *dev; + char *fw, *sba; + u8 cap_ptr; + u32 status, command, agp_rate; +- int len = 0; + + nv_state_t *nv; +- nv = (nv_state_t *) data; +- *eof = 1; ++ nv = (nv_state_t *) m->private; + + if (nv) { + dev = nv_get_pci_device(nv); +@@ -3172,12 +3211,12 @@ nv_kern_read_agpinfo(char *page, char **start, off_t off, + if (!dev) + return 0; + +- len += sprintf(page+len, "Host Bridge: \t "); ++ seq_printf(m, "Host Bridge: \t "); + + #if defined(CONFIG_PCI_NAMES) +- len += sprintf(page+len, "%s\n", NV_PCI_DEVICE_NAME(dev)); ++ seq_printf(m, "%s\n", NV_PCI_DEVICE_NAME(dev)); + #else +- len += sprintf(page+len, "PCI device %04x:%04x\n", ++ seq_printf(m, "PCI device %04x:%04x\n", + dev->vendor, dev->device); + #endif + } +@@ -3191,40 +3230,74 @@ nv_kern_read_agpinfo(char *page, char **start, off_t off, + fw = (status & 0x00000010) ? "Supported" : "Not Supported"; + sba = (status & 0x00000200) ? "Supported" : "Not Supported"; + +- len += sprintf(page+len, "Fast Writes: \t %s\n", fw); +- len += sprintf(page+len, "SBA: \t\t %s\n", sba); ++ seq_printf(m, "Fast Writes: \t %s\n", fw); ++ seq_printf(m, "SBA: \t\t %s\n", sba); + + agp_rate = status & 0x7; + if (status & 0x8) // agp 3.0 + agp_rate <<= 2; + +- len += sprintf(page+len, "AGP Rates: \t %s%s%s%s\n", ++ seq_printf(m, "AGP Rates: \t %s%s%s%s\n", + (agp_rate & 0x00000008) ? "8x " : "", + (agp_rate & 0x00000004) ? "4x " : "", + (agp_rate & 0x00000002) ? "2x " : "", + (agp_rate & 0x00000001) ? "1x " : ""); + +- len += sprintf(page+len, "Registers: \t 0x%08x:0x%08x\n", status, command); ++ seq_printf(m, "Registers: \t 0x%08x:0x%08x\n", status, command); + + NV_PCI_DEV_PUT(dev); +- return len; ++ return 0; ++} ++ ++static int ++nv_procfs_read_agp_info( ++ struct inode *inode, ++ struct file *file ++) ++{ ++ return single_open(file, nv_procfs_show_agp_info, NULL); + } + ++static const struct file_operations nv_procfs_read_agp_info_fops = { ++ .owner = THIS_MODULE, ++ .open = nv_procfs_read_agp_info, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ + static int +-nv_kern_read_status(char *page, char **start, off_t off, +- int count, int *eof, void *data) ++nv_procfs_read_agp_info_gpu( ++ struct inode *inode, ++ struct file *file ++) ++{ ++ return single_open(file, nv_procfs_show_agp_info, PDE_DATA(inode)); ++} ++ ++static const struct file_operations nv_procfs_read_agp_info_gpu_fops = { ++ .owner = THIS_MODULE, ++ .open = nv_procfs_read_agp_info_gpu, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ ++static int ++nv_procfs_show_agp_status( ++ struct seq_file *m, ++ void *v ++) + { + struct pci_dev *dev; + char *fw, *sba, *drv; +- int len = 0; + u8 cap_ptr; + u32 scratch; + u32 status, command, agp_rate; + nv_stack_t *sp = NULL; + + nv_state_t *nv; +- nv = (nv_state_t *) data; +- *eof = 1; ++ nv = (nv_state_t *) m->private; + + dev = nvos_get_agp_device_by_class(PCI_CLASS_BRIDGE_HOST); + if (!dev) +@@ -3246,10 +3319,10 @@ nv_kern_read_status(char *page, char **start, off_t off, + command &= scratch; + + if (NV_AGP_ENABLED(nv) && (command & 0x100)) { +- len += sprintf(page+len, "Status: \t Enabled\n"); ++ seq_printf(m, "Status: \t Enabled\n"); + + drv = NV_OSAGP_ENABLED(nv) ? "AGPGART" : "NVIDIA"; +- len += sprintf(page+len, "Driver: \t %s\n", drv); ++ seq_printf(m, "Driver: \t %s\n", drv); + + // mask off agp rate. + // If this is agp 3.0, we need to shift the value +@@ -3257,13 +3330,13 @@ nv_kern_read_status(char *page, char **start, off_t off, + if (status & 0x8) // agp 3.0 + agp_rate <<= 2; + +- len += sprintf(page+len, "AGP Rate: \t %dx\n", agp_rate); ++ seq_printf(m, "AGP Rate: \t %dx\n", agp_rate); + + fw = (command & 0x00000010) ? "Enabled" : "Disabled"; +- len += sprintf(page+len, "Fast Writes: \t %s\n", fw); ++ seq_printf(m, "Fast Writes: \t %s\n", fw); + + sba = (command & 0x00000200) ? "Enabled" : "Disabled"; +- len += sprintf(page+len, "SBA: \t\t %s\n", sba); ++ seq_printf(m, "SBA: \t\t %s\n", sba); + } else { + int agp_config = 0; + +@@ -3274,7 +3347,7 @@ nv_kern_read_status(char *page, char **start, off_t off, + return 0; + } + +- len += sprintf(page+len, "Status: \t Disabled\n\n"); ++ seq_printf(m, "Status: \t Disabled\n\n"); + + /* + * If we find AGP is disabled, but the RM registry indicates it +@@ -3288,7 +3361,7 @@ nv_kern_read_status(char *page, char **start, off_t off, + rm_read_registry_dword(sp, nv, "NVreg", "XNvAGP", &agp_config); + + if (agp_config != NVOS_AGP_CONFIG_DISABLE_AGP && NV_AGP_FAILED(nv)) { +- len += sprintf(page+len, ++ seq_printf(m, + "AGP initialization failed, please check the ouput \n" + "of the 'dmesg' command and/or your system log file \n" + "for additional information on this problem. \n"); +@@ -3298,37 +3371,63 @@ nv_kern_read_status(char *page, char **start, off_t off, + } + + NV_PCI_DEV_PUT(dev); +- return len; ++ return 0; ++} ++ ++static int ++nv_procfs_read_agp_status( ++ struct inode *inode, ++ struct file *file ++) ++{ ++ return single_open(file, nv_procfs_show_agp_status, PDE_DATA(inode)); + } + ++static const struct file_operations nv_procfs_read_agp_status_fops = { ++ .owner = THIS_MODULE, ++ .open = nv_procfs_read_agp_status, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ + extern nv_parm_t nv_parms[]; + extern char *NVreg_RegistryDwords; + + static int +-nv_kern_read_registry(char *page, char **start, off_t off, +- int count, int *eof, void *data) ++nv_procfs_show_registry( ++ struct seq_file *m, ++ void *v ++) + { +- unsigned int i, len = 0; ++ unsigned int i; + nv_parm_t *entry; +- *eof = 1; + + for (i = 0; (entry = &nv_parms[i])->name != NULL; i++) +- len += sprintf(page+len, "%s: %u\n", entry->name, *entry->data); ++ seq_printf(m, "%s: %u\n", entry->name, *entry->data); + +- len += sprintf(page+len, "RegistryDwords: \"%s\"\n", ++ seq_printf(m, "RegistryDwords: \"%s\"\n", + (NVreg_RegistryDwords != NULL) ? NVreg_RegistryDwords : ""); + +- return len; ++ return 0; + } + + static int +-nv_kern_read_text_file(char *page, char **start, off_t off, +- int count, int *eof, void *data) ++nv_procfs_open_registry( ++ struct inode *inode, ++ struct file *file ++) + { +- *eof = 1; +- return sprintf(page, "%s", (char *)data); ++ return single_open(file, nv_procfs_show_registry, NULL); + } + ++static const struct file_operations nv_procfs_registry_fops = { ++ .open = nv_procfs_open_registry, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ + /*** + *** EXPORTS to rest of resman + ***/ +-- +1.7.9.5 + diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-260.19.44-2.6.39.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-260.19.44-2.6.39.patch new file mode 100644 index 00000000..32efbf12 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-260.19.44-2.6.39.patch @@ -0,0 +1,10 @@ +--- kernel.orig/nv-linux.h ++++ kernel/nv-linux.h +@@ -87,7 +87,6 @@ + #if !defined(KERNEL_2_4) + #include <linux/sched.h> /* suser(), capable() replacement */ + #include <linux/moduleparam.h> /* module_param() */ +-#include <linux/smp_lock.h> /* kernel_locked */ + #include <asm/tlbflush.h> /* flush_tlb(), flush_tlb_all() */ + #include <asm/kmap_types.h> /* page table entry lookup */ + #endif diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-290.10-3.2.8+.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-290.10-3.2.8+.patch new file mode 100644 index 00000000..4834f7b8 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-290.10-3.2.8+.patch @@ -0,0 +1,11 @@ +--- a/kernel/conftest.sh ++++ b/kernel/conftest.sh +@@ -122,7 +122,7 @@ build_cflags() { + CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS" + + if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" -o "$ARCH" = "x86" ]; then +- CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include" ++ CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include -I$SOURCES/arch/x86/include/generated" + fi + if [ -n "$BUILD_PARAMS" ]; then + CFLAGS="$CFLAGS -D$BUILD_PARAMS" diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-304-3.10.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-304-3.10.patch new file mode 100644 index 00000000..514e671e --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-304-3.10.patch @@ -0,0 +1,626 @@ +diff -Nurp work.orig/kernel/nv-i2c.c work/kernel/nv-i2c.c +--- work.orig/kernel/nv-i2c.c 2013-07-04 13:19:12.255911539 +0000 ++++ work/kernel/nv-i2c.c 2013-07-04 13:08:08.479793566 +0000 +@@ -311,8 +311,6 @@ void* NV_API_CALL nv_i2c_add_adapter(nv_ + BOOL NV_API_CALL nv_i2c_del_adapter(nv_state_t *nv, void *data) + { + struct i2c_adapter *pI2cAdapter = (struct i2c_adapter *)data; +- int osstatus = 0; +- BOOL wasReleased = FALSE; + + #if defined(KERNEL_2_4) + if (!NV_WEAK_SYMBOL_PRESENT(i2c_add_adapter)) +@@ -324,15 +322,10 @@ BOOL NV_API_CALL nv_i2c_del_adapter(nv_s + if (!pI2cAdapter) return FALSE; + + // attempt release with the OS +- osstatus = i2c_del_adapter(pI2cAdapter); ++ i2c_del_adapter(pI2cAdapter); ++ os_free_mem(pI2cAdapter); + +- if (!osstatus) +- { +- os_free_mem(pI2cAdapter); +- wasReleased = TRUE; +- } +- +- return wasReleased; ++ return TRUE; + } + + #else // (defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)) +diff -Nurp work.orig/kernel/nv-procfs.c work/kernel/nv-procfs.c +--- work.orig/kernel/nv-procfs.c 2013-07-04 13:19:12.259244771 +0000 ++++ work/kernel/nv-procfs.c 2013-07-04 13:17:31.246205962 +0000 +@@ -60,60 +60,41 @@ static char nv_registry_keys[NV_MAX_REGI + __entry; \ + }) + +-#define NV_CREATE_PROC_FILE(name,parent,__read_proc, \ +- __write_proc,__fops,__data) \ +- ({ \ +- struct proc_dir_entry *__entry; \ +- int __mode = (S_IFREG | S_IRUGO); \ +- if ((NvUPtr)(__write_proc) != 0) \ +- __mode |= S_IWUSR; \ +- __entry = NV_CREATE_PROC_ENTRY(name, __mode, parent); \ +- if (__entry != NULL) \ +- { \ +- if ((NvUPtr)(__read_proc) != 0) \ +- __entry->read_proc = (__read_proc); \ +- if ((NvUPtr)(__write_proc) != 0) \ +- { \ +- __entry->write_proc = (__write_proc); \ +- __entry->proc_fops = (__fops); \ +- } \ +- __entry->data = (__data); \ +- } \ +- __entry; \ +- }) ++#define NV_PROC_RW (S_IFREG|S_IRUGO|S_IWUSR) ++#define NV_PROC_RO (S_IFREG|S_IRUGO) + + #define NV_CREATE_PROC_DIR(name,parent) \ + ({ \ + struct proc_dir_entry *__entry; \ + int __mode = (S_IFDIR | S_IRUGO | S_IXUGO); \ +- __entry = NV_CREATE_PROC_ENTRY(name, __mode, parent); \ ++ __entry = proc_mkdir_mode(name, __mode, parent); \ + __entry; \ + }) + ++//#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,9,255) ++//static inline void *PDE_DATA(const struct inode *inode) { ++// return PDE(inode)->data; ++//} ++//#endif ++ + #define NV_PROC_WRITE_BUFFER_SIZE (64 * RM_PAGE_SIZE) + + static int +-nv_procfs_read_gpu_info( +- char *page, +- char **start, +- off_t off, +- int count, +- int *eof, +- void *data ++nv_procfs_show_gpu_info( ++ struct seq_file *m, ++ void *v + ) + { +- nv_state_t *nv = data; ++ nv_state_t *nv = m->private; + nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); + struct pci_dev *dev = nvl->dev; + char *type, *fmt, tmpstr[NV_DEVICE_NAME_LENGTH]; +- int len = 0, status; ++ int status; + NvU8 *uuid; + NvU32 vbios_rev1, vbios_rev2, vbios_rev3, vbios_rev4, vbios_rev5; + NvU32 fpga_rev1, fpga_rev2, fpga_rev3; + nv_stack_t *sp = NULL; + +- *eof = 1; +- + NV_KMEM_CACHE_ALLOC_STACK(sp); + if (sp == NULL) + { +@@ -134,31 +115,31 @@ nv_procfs_read_gpu_info( + if (rm_get_device_name(sp, nv, dev->device, dev->subsystem_vendor, + dev->subsystem_device, NV_DEVICE_NAME_LENGTH, + tmpstr) != RM_OK) +- { ++ { + strcpy (tmpstr, "Unknown"); + } + } + +- len += sprintf(page+len, "Model: \t\t %s\n", tmpstr); +- len += sprintf(page+len, "IRQ: \t\t %d\n", nv->interrupt_line); ++ seq_printf(m, "Model: \t\t %s\n", tmpstr); ++ seq_printf(m, "IRQ: \t\t %d\n", nv->interrupt_line); + + if (NV_IS_GVI_DEVICE(nv)) + { + status = rm_gvi_get_firmware_version(sp, nv, &fpga_rev1, &fpga_rev2, + &fpga_rev3); + if (status != RM_OK) +- len += sprintf(page+len, "Firmware: \t ????.??.??\n"); ++ seq_printf(m, "Firmware: \t ????.??.??\n"); + else + { + fmt = "Firmware: \t %x.%x.%x\n"; +- len += sprintf(page+len, fmt, fpga_rev1, fpga_rev2, fpga_rev3); ++ seq_printf(m, fmt, fpga_rev1, fpga_rev2, fpga_rev3); + } + } + else + { + if (rm_get_gpu_uuid(sp, nv, &uuid, NULL) == RM_OK) + { +- len += sprintf(page+len, "GPU UUID: \t %s\n", (char *)uuid); ++ seq_printf(m, "GPU UUID: \t %s\n", (char *)uuid); + os_free_mem(uuid); + } + +@@ -166,12 +147,12 @@ nv_procfs_read_gpu_info( + &vbios_rev3, &vbios_rev4, + &vbios_rev5) != RM_OK) + { +- len += sprintf(page+len, "Video BIOS: \t ??.??.??.??.??\n"); ++ seq_printf(m, "Video BIOS: \t ??.??.??.??.??\n"); + } + else + { + fmt = "Video BIOS: \t %02x.%02x.%02x.%02x.%02x\n"; +- len += sprintf(page+len, fmt, vbios_rev1, vbios_rev2, vbios_rev3, ++ seq_printf(m, fmt, vbios_rev1, vbios_rev2, vbios_rev3, + vbios_rev4, vbios_rev5); + } + } +@@ -182,12 +163,12 @@ nv_procfs_read_gpu_info( + type = "PCI-E"; + else + type = "PCI"; +- len += sprintf(page+len, "Bus Type: \t %s\n", type); ++ seq_printf(m, "Bus Type: \t %s\n", type); + +- len += sprintf(page+len, "DMA Size: \t %d bits\n", ++ seq_printf(m, "DMA Size: \t %d bits\n", + nv_count_bits(dev->dma_mask)); +- len += sprintf(page+len, "DMA Mask: \t 0x%llx\n", dev->dma_mask); +- len += sprintf(page+len, "Bus Location: \t %04x:%02x.%02x.%x\n", ++ seq_printf(m, "DMA Mask: \t 0x%llx\n", dev->dma_mask); ++ seq_printf(m, "Bus Location: \t %04x:%02x.%02x.%x\n", + nv->domain, nv->bus, nv->slot, PCI_FUNC(dev->devfn)); + #if defined(DEBUG) + do +@@ -195,7 +176,7 @@ nv_procfs_read_gpu_info( + int j; + for (j = 0; j < NV_GPU_NUM_BARS; j++) + { +- len += sprintf(page+len, "BAR%u: \t\t 0x%llx (%lluMB)\n", ++ seq_printf(m, "BAR%u: \t\t 0x%llx (%lluMB)\n", + j, nv->bars[j].address, (nv->bars[j].size >> 20)); + } + } while (0); +@@ -203,26 +184,120 @@ nv_procfs_read_gpu_info( + + NV_KMEM_CACHE_FREE_STACK(sp); + +- return len; ++ return 0; + } + + static int +-nv_procfs_read_version( +- char *page, +- char **start, +- off_t off, +- int count, +- int *eof, +- void *data ++nv_procfs_open_gpu_info( ++ struct inode *inode, ++ struct file *file + ) + { +- int len = 0; +- *eof = 1; ++ return single_open(file, nv_procfs_show_gpu_info, PDE_DATA(inode)); ++} + +- len += sprintf(page+len, "NVRM version: %s\n", pNVRM_ID); +- len += sprintf(page+len, "GCC version: %s\n", NV_COMPILER); ++static const struct file_operations nv_procfs_gpu_info_fops = { ++ .owner = THIS_MODULE, ++ .open = nv_procfs_open_gpu_info, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; + +- return len; ++static int ++nv_procfs_show_version( ++ struct seq_file *m, ++ void *v ++) ++{ ++ seq_printf(m, "NVRM version: %s\n", pNVRM_ID); ++ seq_printf(m, "GCC version: %s\n", NV_COMPILER); ++ ++ return 0; ++} ++ ++static int ++nv_procfs_open_version( ++ struct inode *inode, ++ struct file *file ++) ++{ ++ return single_open(file, nv_procfs_show_version, NULL); ++} ++ ++static const struct file_operations nv_procfs_version_fops = { ++ .owner = THIS_MODULE, ++ .open = nv_procfs_open_version, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ ++static int ++nv_procfs_show_registry( ++ struct seq_file *m, ++ void *v ++) ++{ ++ nv_state_t *nv = m->private; ++ nv_linux_state_t *nvl = NULL; ++ char *registry_keys; ++ ++ if (nv != NULL) ++ nvl = NV_GET_NVL_FROM_NV_STATE(nv); ++ registry_keys = ((nvl != NULL) ? ++ nvl->registry_keys : nv_registry_keys); ++ ++ seq_printf(m, "Binary: \"%s\"\n", registry_keys); ++ ++ return 0; ++} ++ ++static ssize_t ++nv_procfs_write_registry( ++ struct file *file, ++ const char __user *buffer, ++ size_t count, ++ loff_t *pos ++) ++{ ++ int status = 0; ++ nv_file_private_t *nvfp = NV_GET_FILE_PRIVATE(file); ++ char *proc_buffer; ++ unsigned long bytes_left; ++ ++ down(&nvfp->fops_sp_lock[NV_FOPS_STACK_INDEX_PROCFS]); ++ ++ bytes_left = (NV_PROC_WRITE_BUFFER_SIZE - nvfp->off - 1); ++ ++ if (count == 0) ++ { ++ status = -EINVAL; ++ goto done; ++ } ++ else if ((bytes_left == 0) || (count > bytes_left)) ++ { ++ status = -ENOSPC; ++ goto done; ++ } ++ ++ proc_buffer = &((char *)nvfp->data)[nvfp->off]; ++ ++ if (copy_from_user(proc_buffer, buffer, count)) ++ { ++ nv_printf(NV_DBG_ERRORS, "NVRM: failed to copy in proc data!\n"); ++ status = -EFAULT; ++ } ++ else ++ { ++ nvfp->proc_data = PDE_DATA(file->f_inode); ++ nvfp->off += count; ++ } ++ ++done: ++ up(&nvfp->fops_sp_lock[NV_FOPS_STACK_INDEX_PROCFS]); ++ ++ return ((status < 0) ? status : count); + } + + static struct pci_dev *nv_get_agp_device_by_class(unsigned int class) +@@ -432,7 +507,7 @@ nv_procfs_open_registry( + nv_stack_t *sp = NULL; + + if (0 == (file->f_mode & FMODE_WRITE)) +- return 0; ++ return single_open(file, nv_procfs_show_registry, PDE_DATA(inode)); + + nvfp = nv_alloc_file_private(); + if (nvfp == NULL) +@@ -481,6 +556,9 @@ nv_procfs_close_registry( + RM_STATUS rm_status; + int rc = 0; + ++ if (0 == (file->f_mode & FMODE_WRITE)) ++ return single_release(inode, file); ++ + nvfp = NV_GET_FILE_PRIVATE(file); + if (nvfp == NULL) + return 0; +@@ -545,122 +623,81 @@ done: + return rc; + } + +-static struct file_operations nv_procfs_registry_fops = { ++static const struct file_operations nv_procfs_registry_fops = { + .open = nv_procfs_open_registry, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .write = nv_procfs_write_registry, + .release = nv_procfs_close_registry, + }; + + static int +-nv_procfs_read_params( +- char *page, +- char **start, +- off_t off, +- int count, +- int *eof, +- void *data ++nv_procfs_show_params( ++ struct seq_file *m, ++ void *v + ) + { + unsigned int i; +- int len = 0; + nv_parm_t *entry; + +- *eof = 1; + + for (i = 0; (entry = &nv_parms[i])->name != NULL; i++) +- len += sprintf(page+len, "%s: %u\n", entry->name, *entry->data); ++ seq_printf(m, "%s: %u\n", entry->name, *entry->data); + +- len += sprintf(page+len, "RegistryDwords: \"%s\"\n", ++ seq_printf(m, "RegistryDwords: \"%s\"\n", + (NVreg_RegistryDwords != NULL) ? NVreg_RegistryDwords : ""); +- len += sprintf(page+len, "RmMsg: \"%s\"\n", ++ seq_printf(m, "RmMsg: \"%s\"\n", + (NVreg_RmMsg != NULL) ? NVreg_RmMsg : ""); + +- return len; ++ return 0; + } + + static int +-nv_procfs_read_registry( +- char *page, +- char **start, +- off_t off, +- int count, +- int *eof, +- void *data +-) ++nv_procfs_open_params( ++ struct inode *inode, ++ struct file *file ++) + { +- nv_state_t *nv = data; +- nv_linux_state_t *nvl = NULL; +- char *registry_keys; ++ return single_open(file, nv_procfs_show_params, NULL); ++} + +- if (nv != NULL) +- nvl = NV_GET_NVL_FROM_NV_STATE(nv); +- registry_keys = ((nvl != NULL) ? +- nvl->registry_keys : nv_registry_keys); ++static const struct file_operations nv_procfs_params_fops = { ++ .owner = THIS_MODULE, ++ .open = nv_procfs_open_params, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; + +- *eof = 1; +- return sprintf(page, "Binary: \"%s\"\n", registry_keys); +-} + + static int +-nv_procfs_write_registry( +- struct file *file, +- const char *buffer, +- unsigned long count, +- void *data ++nv_procfs_show_text_file( ++ struct seq_file *m, ++ void *v + ) + { +- int status = 0; +- nv_file_private_t *nvfp = NV_GET_FILE_PRIVATE(file); +- char *proc_buffer; +- unsigned long bytes_left; +- +- down(&nvfp->fops_sp_lock[NV_FOPS_STACK_INDEX_PROCFS]); ++ seq_printf(m, "%s", (char *)m->private); + +- bytes_left = (NV_PROC_WRITE_BUFFER_SIZE - nvfp->off - 1); +- +- if (count == 0) +- { +- status = -EINVAL; +- goto done; +- } +- else if ((bytes_left == 0) || (count > bytes_left)) +- { +- status = -ENOSPC; +- goto done; +- } +- +- proc_buffer = &((char *)nvfp->data)[nvfp->off]; +- +- if (copy_from_user(proc_buffer, buffer, count)) +- { +- nv_printf(NV_DBG_ERRORS, "NVRM: failed to copy in proc data!\n"); +- status = -EFAULT; +- } +- else +- { +- nvfp->proc_data = data; +- nvfp->off += count; +- } +- +-done: +- up(&nvfp->fops_sp_lock[NV_FOPS_STACK_INDEX_PROCFS]); +- +- return ((status < 0) ? status : (int)count); ++ return 0; + } + + static int +-nv_procfs_read_text_file( +- char *page, +- char **start, +- off_t off, +- int count, +- int *eof, +- void *data ++nv_procfs_open_text_file( ++ struct inode *inode, ++ struct file *file + ) + { +- *eof = 1; +- return sprintf(page, "%s", (char *)data); ++ return single_open(file, nv_procfs_show_text_file, PDE_DATA(inode)); + } + ++static const struct file_operations nv_procfs_text_fops = { ++ .owner = THIS_MODULE, ++ .open = nv_procfs_open_text_file, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ + static void + nv_procfs_add_text_file( + struct proc_dir_entry *parent, +@@ -668,22 +705,7 @@ nv_procfs_add_text_file( + const char *text + ) + { +- NV_CREATE_PROC_FILE(filename, parent, +- nv_procfs_read_text_file, NULL, NULL, (void *)text); +-} +- +-static void nv_procfs_unregister_all(struct proc_dir_entry *entry) +-{ +- while (entry) +- { +- struct proc_dir_entry *next = entry->next; +- if (entry->subdir) +- nv_procfs_unregister_all(entry->subdir); +- remove_proc_entry(entry->name, entry->parent); +- if (entry == proc_nvidia) +- break; +- entry = next; +- } ++ proc_create_data(filename, NV_PROC_RO, parent, &nv_procfs_text_fops, (void *)text); + } + #endif + +@@ -713,26 +735,11 @@ int nv_register_procfs(void) + if (!proc_nvidia) + goto failed; + +- entry = NV_CREATE_PROC_FILE("params", proc_nvidia, +- nv_procfs_read_params, NULL, NULL, NULL); ++ entry = proc_create("params", NV_PROC_RO, proc_nvidia, &nv_procfs_params_fops); + if (!entry) + goto failed; + +- /* +- * entry->proc_fops originally points to a constant +- * structure, so to add more methods for the +- * binary registry write path, we need to replace the +- * said entry->proc_fops with a new fops structure. +- * However, in preparation for this, we need to preserve +- * the procfs read() and write() operations. +- */ +- nv_procfs_registry_fops.read = entry->proc_fops->read; +- nv_procfs_registry_fops.write = entry->proc_fops->write; +- +- entry = NV_CREATE_PROC_FILE("registry", proc_nvidia, +- nv_procfs_read_registry, +- nv_procfs_write_registry, +- &nv_procfs_registry_fops, NULL); ++ entry = proc_create("registry", NV_PROC_RW, proc_nvidia, &nv_procfs_registry_fops); + if (!entry) + goto failed; + +@@ -753,8 +760,7 @@ int nv_register_procfs(void) + + nv_procfs_add_text_file(proc_nvidia_patches, "README", __README_patches); + +- entry = NV_CREATE_PROC_FILE("version", proc_nvidia, +- nv_procfs_read_version, NULL, NULL, NULL); ++ entry = proc_create("version", NV_PROC_RO, proc_nvidia, &nv_procfs_version_fops); + if (!entry) + goto failed; + +@@ -771,15 +777,11 @@ int nv_register_procfs(void) + if (!proc_nvidia_gpu) + goto failed; + +- entry = NV_CREATE_PROC_FILE("information", proc_nvidia_gpu, +- nv_procfs_read_gpu_info, NULL, NULL, nv); ++ entry = proc_create_data("information", NV_PROC_RO, proc_nvidia_gpu, &nv_procfs_gpu_info_fops, nv); + if (!entry) + goto failed; + +- entry = NV_CREATE_PROC_FILE("registry", proc_nvidia_gpu, +- nv_procfs_read_registry, +- nv_procfs_write_registry, +- &nv_procfs_registry_fops, nv); ++ entry = proc_create_data("registry", NV_PROC_RW, proc_nvidia_gpu, &nv_procfs_registry_fops, nv); + if (!entry) + goto failed; + +@@ -789,18 +791,15 @@ int nv_register_procfs(void) + if (!proc_nvidia_agp) + goto failed; + +- entry = NV_CREATE_PROC_FILE("status", proc_nvidia_agp, +- nv_procfs_read_agp_status, NULL, NULL, nv); ++ entry = proc_create("status", NV_PROC_RO, proc_nvidia_agp, &nv_procfs_read_agp_status); + if (!entry) + goto failed; + +- entry = NV_CREATE_PROC_FILE("host-bridge", proc_nvidia_agp, +- nv_procfs_read_agp_info, NULL, NULL, NULL); ++ entry = proc_create("host-bridge", NV_PROC_RO, proc_nvidia_agp, &nv_procfs_read_agp_info); + if (!entry) + goto failed; + +- entry = NV_CREATE_PROC_FILE("gpu", proc_nvidia_agp, +- nv_procfs_read_agp_info, NULL, NULL, nv); ++ entry = proc_create("gpu", NV_PROC_RO, proc_nvidia_agp, &nv_procfs_read_agp_info); + if (!entry) + goto failed; + } +@@ -809,7 +808,7 @@ int nv_register_procfs(void) + return 0; + #if defined(CONFIG_PROC_FS) + failed: +- nv_procfs_unregister_all(proc_nvidia); ++ remove_proc_subtree("nvidia", proc_nvidia); + return -1; + #endif + } +@@ -817,6 +816,6 @@ failed: + void nv_unregister_procfs(void) + { + #if defined(CONFIG_PROC_FS) +- nv_procfs_unregister_all(proc_nvidia); ++ remove_proc_subtree("nvidia", proc_nvidia); + #endif + } + diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-313.18-3.8.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-313.18-3.8.patch new file mode 100644 index 00000000..bf2f95e6 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-313.18-3.8.patch @@ -0,0 +1,24 @@ +From 9100c380c0a8c15b658b3153c107cd99e7110a7b Mon Sep 17 00:00:00 2001 +From: Alberto Milone <alberto.milone@canonical.com> +Date: Wed, 9 Jan 2013 11:42:03 +0100 +Subject: [PATCH 1/1] Add support for Linux 3.8 + +--- + conftest.sh | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/conftest.sh b/conftest.sh +index 9720cab..1bfbe6f 100755 +--- a/kernel/conftest.sh ++++ b/kernel/conftest.sh +@@ -160,6 +160,7 @@ build_cflags() { + + if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then + CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include" ++ CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include/uapi" + CFLAGS="$CFLAGS -I$OUTPUT/arch/x86/include/generated" + CFLAGS="$CFLAGS -I$OUTPUT/arch/x86/include/generated/uapi" + elif [ "$ARCH" = "arm" ]; then +-- +1.7.9.5 + diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-319.23-3.10.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-319.23-3.10.patch new file mode 100644 index 00000000..b81967bb --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-319.23-3.10.patch @@ -0,0 +1,604 @@ +diff -ur -X - NVIDIA-Linux-x86_64-319.17-no-compat32.orig/kernel/nv-i2c.c NVIDIA-Linux-x86_64-319.17-no-compat32/kernel/nv-i2c.c +--- NVIDIA-Linux-x86_64-319.17-no-compat32.orig/kernel/nv-i2c.c 2013-04-26 00:22:30.000000000 -0400 ++++ NVIDIA-Linux-x86_64-319.17-no-compat32/kernel/nv-i2c.c 2013-05-13 05:20:55.571981365 -0400 +@@ -311,8 +311,6 @@ + BOOL NV_API_CALL nv_i2c_del_adapter(nv_state_t *nv, void *data) + { + struct i2c_adapter *pI2cAdapter = (struct i2c_adapter *)data; +- int osstatus = 0; +- BOOL wasReleased = FALSE; + + #if defined(KERNEL_2_4) + if (!NV_WEAK_SYMBOL_PRESENT(i2c_add_adapter)) +@@ -324,15 +322,10 @@ + if (!pI2cAdapter) return FALSE; + + // attempt release with the OS +- osstatus = i2c_del_adapter(pI2cAdapter); ++ i2c_del_adapter(pI2cAdapter); ++ os_free_mem(pI2cAdapter); + +- if (!osstatus) +- { +- os_free_mem(pI2cAdapter); +- wasReleased = TRUE; +- } +- +- return wasReleased; ++ return TRUE; + } + + #else // (defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)) +diff -ur -X - NVIDIA-Linux-x86_64-319.17-no-compat32.orig/kernel/nv-procfs.c NVIDIA-Linux-x86_64-319.17-no-compat32/kernel/nv-procfs.c +--- NVIDIA-Linux-x86_64-319.17-no-compat32.orig/kernel/nv-procfs.c 2013-04-26 00:22:30.000000000 -0400 ++++ NVIDIA-Linux-x86_64-319.17-no-compat32/kernel/nv-procfs.c 2013-05-22 04:52:45.229495748 -0400 +@@ -60,60 +60,41 @@ + __entry; \ + }) + +-#define NV_CREATE_PROC_FILE(name,parent,__read_proc, \ +- __write_proc,__fops,__data) \ +- ({ \ +- struct proc_dir_entry *__entry; \ +- int __mode = (S_IFREG | S_IRUGO); \ +- if ((NvUPtr)(__write_proc) != 0) \ +- __mode |= S_IWUSR; \ +- __entry = NV_CREATE_PROC_ENTRY(name, __mode, parent); \ +- if (__entry != NULL) \ +- { \ +- if ((NvUPtr)(__read_proc) != 0) \ +- __entry->read_proc = (__read_proc); \ +- if ((NvUPtr)(__write_proc) != 0) \ +- { \ +- __entry->write_proc = (__write_proc); \ +- __entry->proc_fops = (__fops); \ +- } \ +- __entry->data = (__data); \ +- } \ +- __entry; \ +- }) ++#define NV_PROC_RW (S_IFREG|S_IRUGO|S_IWUSR) ++#define NV_PROC_RO (S_IFREG|S_IRUGO) + + #define NV_CREATE_PROC_DIR(name,parent) \ + ({ \ + struct proc_dir_entry *__entry; \ + int __mode = (S_IFDIR | S_IRUGO | S_IXUGO); \ +- __entry = NV_CREATE_PROC_ENTRY(name, __mode, parent); \ ++ __entry = proc_mkdir_mode(name, __mode, parent); \ + __entry; \ + }) + ++//#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,9,255) ++//static inline void *PDE_DATA(const struct inode *inode) { ++// return PDE(inode)->data; ++//} ++//#endif ++ + #define NV_PROC_WRITE_BUFFER_SIZE (64 * RM_PAGE_SIZE) + + static int +-nv_procfs_read_gpu_info( +- char *page, +- char **start, +- off_t off, +- int count, +- int *eof, +- void *data ++nv_procfs_show_gpu_info( ++ struct seq_file *m, ++ void *v + ) + { +- nv_state_t *nv = data; ++ nv_state_t *nv = m->private; + nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv); + struct pci_dev *dev = nvl->dev; + char *type, *fmt, tmpstr[NV_DEVICE_NAME_LENGTH]; +- int len = 0, status; ++ int status; + NvU8 *uuid; + NvU32 vbios_rev1, vbios_rev2, vbios_rev3, vbios_rev4, vbios_rev5; + NvU32 fpga_rev1, fpga_rev2, fpga_rev3; + nv_stack_t *sp = NULL; + +- *eof = 1; +- + NV_KMEM_CACHE_ALLOC_STACK(sp); + if (sp == NULL) + { +@@ -134,31 +115,31 @@ + if (rm_get_device_name(sp, nv, dev->device, dev->subsystem_vendor, + dev->subsystem_device, NV_DEVICE_NAME_LENGTH, + tmpstr) != RM_OK) +- { ++ { + strcpy (tmpstr, "Unknown"); + } + } + +- len += sprintf(page+len, "Model: \t\t %s\n", tmpstr); +- len += sprintf(page+len, "IRQ: \t\t %d\n", nv->interrupt_line); ++ seq_printf(m, "Model: \t\t %s\n", tmpstr); ++ seq_printf(m, "IRQ: \t\t %d\n", nv->interrupt_line); + + if (NV_IS_GVI_DEVICE(nv)) + { + status = rm_gvi_get_firmware_version(sp, nv, &fpga_rev1, &fpga_rev2, + &fpga_rev3); + if (status != RM_OK) +- len += sprintf(page+len, "Firmware: \t ????.??.??\n"); ++ seq_printf(m, "Firmware: \t ????.??.??\n"); + else + { + fmt = "Firmware: \t %x.%x.%x\n"; +- len += sprintf(page+len, fmt, fpga_rev1, fpga_rev2, fpga_rev3); ++ seq_printf(m, fmt, fpga_rev1, fpga_rev2, fpga_rev3); + } + } + else + { + if (rm_get_gpu_uuid(sp, nv, &uuid, NULL) == RM_OK) + { +- len += sprintf(page+len, "GPU UUID: \t %s\n", (char *)uuid); ++ seq_printf(m, "GPU UUID: \t %s\n", (char *)uuid); + os_free_mem(uuid); + } + +@@ -166,12 +147,12 @@ + &vbios_rev3, &vbios_rev4, + &vbios_rev5) != RM_OK) + { +- len += sprintf(page+len, "Video BIOS: \t ??.??.??.??.??\n"); ++ seq_printf(m, "Video BIOS: \t ??.??.??.??.??\n"); + } + else + { + fmt = "Video BIOS: \t %02x.%02x.%02x.%02x.%02x\n"; +- len += sprintf(page+len, fmt, vbios_rev1, vbios_rev2, vbios_rev3, ++ seq_printf(m, fmt, vbios_rev1, vbios_rev2, vbios_rev3, + vbios_rev4, vbios_rev5); + } + } +@@ -180,12 +161,12 @@ + type = "PCI-E"; + else + type = "PCI"; +- len += sprintf(page+len, "Bus Type: \t %s\n", type); ++ seq_printf(m, "Bus Type: \t %s\n", type); + +- len += sprintf(page+len, "DMA Size: \t %d bits\n", ++ seq_printf(m, "DMA Size: \t %d bits\n", + nv_count_bits(dev->dma_mask)); +- len += sprintf(page+len, "DMA Mask: \t 0x%llx\n", dev->dma_mask); +- len += sprintf(page+len, "Bus Location: \t %04x:%02x.%02x.%x\n", ++ seq_printf(m, "DMA Mask: \t 0x%llx\n", dev->dma_mask); ++ seq_printf(m, "Bus Location: \t %04x:%02x.%02x.%x\n", + nv->domain, nv->bus, nv->slot, PCI_FUNC(dev->devfn)); + #if defined(DEBUG) + do +@@ -193,7 +174,7 @@ + int j; + for (j = 0; j < NV_GPU_NUM_BARS; j++) + { +- len += sprintf(page+len, "BAR%u: \t\t 0x%llx (%lluMB)\n", ++ seq_printf(m, "BAR%u: \t\t 0x%llx (%lluMB)\n", + j, nv->bars[j].address, (nv->bars[j].size >> 20)); + } + } while (0); +@@ -201,26 +182,120 @@ + + NV_KMEM_CACHE_FREE_STACK(sp); + +- return len; ++ return 0; + } + + static int +-nv_procfs_read_version( +- char *page, +- char **start, +- off_t off, +- int count, +- int *eof, +- void *data ++nv_procfs_open_gpu_info( ++ struct inode *inode, ++ struct file *file ++) ++{ ++ return single_open(file, nv_procfs_show_gpu_info, PDE_DATA(inode)); ++} ++ ++static const struct file_operations nv_procfs_gpu_info_fops = { ++ .owner = THIS_MODULE, ++ .open = nv_procfs_open_gpu_info, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ ++static int ++nv_procfs_show_version( ++ struct seq_file *m, ++ void *v ++) ++{ ++ seq_printf(m, "NVRM version: %s\n", pNVRM_ID); ++ seq_printf(m, "GCC version: %s\n", NV_COMPILER); ++ ++ return 0; ++} ++ ++static int ++nv_procfs_open_version( ++ struct inode *inode, ++ struct file *file ++) ++{ ++ return single_open(file, nv_procfs_show_version, NULL); ++} ++ ++static const struct file_operations nv_procfs_version_fops = { ++ .owner = THIS_MODULE, ++ .open = nv_procfs_open_version, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ ++static int ++nv_procfs_show_registry( ++ struct seq_file *m, ++ void *v ++) ++{ ++ nv_state_t *nv = m->private; ++ nv_linux_state_t *nvl = NULL; ++ char *registry_keys; ++ ++ if (nv != NULL) ++ nvl = NV_GET_NVL_FROM_NV_STATE(nv); ++ registry_keys = ((nvl != NULL) ? ++ nvl->registry_keys : nv_registry_keys); ++ ++ seq_printf(m, "Binary: \"%s\"\n", registry_keys); ++ ++ return 0; ++} ++ ++static ssize_t ++nv_procfs_write_registry( ++ struct file *file, ++ const char __user *buffer, ++ size_t count, ++ loff_t *pos + ) + { +- int len = 0; +- *eof = 1; ++ int status = 0; ++ nv_file_private_t *nvfp = NV_GET_FILE_PRIVATE(file); ++ char *proc_buffer; ++ unsigned long bytes_left; ++ ++ down(&nvfp->fops_sp_lock[NV_FOPS_STACK_INDEX_PROCFS]); ++ ++ bytes_left = (NV_PROC_WRITE_BUFFER_SIZE - nvfp->off - 1); ++ ++ if (count == 0) ++ { ++ status = -EINVAL; ++ goto done; ++ } ++ else if ((bytes_left == 0) || (count > bytes_left)) ++ { ++ status = -ENOSPC; ++ goto done; ++ } ++ ++ proc_buffer = &((char *)nvfp->data)[nvfp->off]; ++ ++ if (copy_from_user(proc_buffer, buffer, count)) ++ { ++ nv_printf(NV_DBG_ERRORS, "NVRM: failed to copy in proc data!\n"); ++ status = -EFAULT; ++ } ++ else ++ { ++ nvfp->proc_data = PDE_DATA(file->f_inode); ++ nvfp->off += count; ++ } + +- len += sprintf(page+len, "NVRM version: %s\n", pNVRM_ID); +- len += sprintf(page+len, "GCC version: %s\n", NV_COMPILER); ++done: ++ up(&nvfp->fops_sp_lock[NV_FOPS_STACK_INDEX_PROCFS]); + +- return len; ++ return ((status < 0) ? status : count); + } + + static int +@@ -233,7 +308,7 @@ + nv_stack_t *sp = NULL; + + if (0 == (file->f_mode & FMODE_WRITE)) +- return 0; ++ return single_open(file, nv_procfs_show_registry, PDE_DATA(inode)); + + nvfp = nv_alloc_file_private(); + if (nvfp == NULL) +@@ -282,6 +357,9 @@ + RM_STATUS rm_status; + int rc = 0; + ++ if (0 == (file->f_mode & FMODE_WRITE)) ++ return single_release(inode, file); ++ + nvfp = NV_GET_FILE_PRIVATE(file); + if (nvfp == NULL) + return 0; +@@ -346,122 +424,81 @@ + return rc; + } + +-static struct file_operations nv_procfs_registry_fops = { ++static const struct file_operations nv_procfs_registry_fops = { + .open = nv_procfs_open_registry, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .write = nv_procfs_write_registry, + .release = nv_procfs_close_registry, + }; + + static int +-nv_procfs_read_params( +- char *page, +- char **start, +- off_t off, +- int count, +- int *eof, +- void *data ++nv_procfs_show_params( ++ struct seq_file *m, ++ void *v + ) + { + unsigned int i; +- int len = 0; + nv_parm_t *entry; + +- *eof = 1; + + for (i = 0; (entry = &nv_parms[i])->name != NULL; i++) +- len += sprintf(page+len, "%s: %u\n", entry->name, *entry->data); ++ seq_printf(m, "%s: %u\n", entry->name, *entry->data); + +- len += sprintf(page+len, "RegistryDwords: \"%s\"\n", ++ seq_printf(m, "RegistryDwords: \"%s\"\n", + (NVreg_RegistryDwords != NULL) ? NVreg_RegistryDwords : ""); +- len += sprintf(page+len, "RmMsg: \"%s\"\n", ++ seq_printf(m, "RmMsg: \"%s\"\n", + (NVreg_RmMsg != NULL) ? NVreg_RmMsg : ""); + +- return len; ++ return 0; + } + + static int +-nv_procfs_read_registry( +- char *page, +- char **start, +- off_t off, +- int count, +- int *eof, +- void *data +-) ++nv_procfs_open_params( ++ struct inode *inode, ++ struct file *file ++) + { +- nv_state_t *nv = data; +- nv_linux_state_t *nvl = NULL; +- char *registry_keys; ++ return single_open(file, nv_procfs_show_params, NULL); ++} + +- if (nv != NULL) +- nvl = NV_GET_NVL_FROM_NV_STATE(nv); +- registry_keys = ((nvl != NULL) ? +- nvl->registry_keys : nv_registry_keys); ++static const struct file_operations nv_procfs_params_fops = { ++ .owner = THIS_MODULE, ++ .open = nv_procfs_open_params, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; + +- *eof = 1; +- return sprintf(page, "Binary: \"%s\"\n", registry_keys); +-} + + static int +-nv_procfs_write_registry( +- struct file *file, +- const char *buffer, +- unsigned long count, +- void *data ++nv_procfs_show_text_file( ++ struct seq_file *m, ++ void *v + ) + { +- int status = 0; +- nv_file_private_t *nvfp = NV_GET_FILE_PRIVATE(file); +- char *proc_buffer; +- unsigned long bytes_left; +- +- down(&nvfp->fops_sp_lock[NV_FOPS_STACK_INDEX_PROCFS]); +- +- bytes_left = (NV_PROC_WRITE_BUFFER_SIZE - nvfp->off - 1); ++ seq_printf(m, "%s", (char *)m->private); + +- if (count == 0) +- { +- status = -EINVAL; +- goto done; +- } +- else if ((bytes_left == 0) || (count > bytes_left)) +- { +- status = -ENOSPC; +- goto done; +- } +- +- proc_buffer = &((char *)nvfp->data)[nvfp->off]; +- +- if (copy_from_user(proc_buffer, buffer, count)) +- { +- nv_printf(NV_DBG_ERRORS, "NVRM: failed to copy in proc data!\n"); +- status = -EFAULT; +- } +- else +- { +- nvfp->proc_data = data; +- nvfp->off += count; +- } +- +-done: +- up(&nvfp->fops_sp_lock[NV_FOPS_STACK_INDEX_PROCFS]); +- +- return ((status < 0) ? status : (int)count); ++ return 0; + } + + static int +-nv_procfs_read_text_file( +- char *page, +- char **start, +- off_t off, +- int count, +- int *eof, +- void *data ++nv_procfs_open_text_file( ++ struct inode *inode, ++ struct file *file + ) + { +- *eof = 1; +- return sprintf(page, "%s", (char *)data); ++ return single_open(file, nv_procfs_show_text_file, PDE_DATA(inode)); + } + ++static const struct file_operations nv_procfs_text_fops = { ++ .owner = THIS_MODULE, ++ .open = nv_procfs_open_text_file, ++ .read = seq_read, ++ .llseek = seq_lseek, ++ .release = single_release, ++}; ++ + static void + nv_procfs_add_text_file( + struct proc_dir_entry *parent, +@@ -469,22 +506,7 @@ + const char *text + ) + { +- NV_CREATE_PROC_FILE(filename, parent, +- nv_procfs_read_text_file, NULL, NULL, (void *)text); +-} +- +-static void nv_procfs_unregister_all(struct proc_dir_entry *entry) +-{ +- while (entry) +- { +- struct proc_dir_entry *next = entry->next; +- if (entry->subdir) +- nv_procfs_unregister_all(entry->subdir); +- remove_proc_entry(entry->name, entry->parent); +- if (entry == proc_nvidia) +- break; +- entry = next; +- } ++ proc_create_data(filename, NV_PROC_RO, parent, &nv_procfs_text_fops, (void *)text); + } + #endif + +@@ -513,26 +535,11 @@ + if (!proc_nvidia) + goto failed; + +- entry = NV_CREATE_PROC_FILE("params", proc_nvidia, +- nv_procfs_read_params, NULL, NULL, NULL); ++ entry = proc_create("params", NV_PROC_RO, proc_nvidia, &nv_procfs_params_fops); + if (!entry) + goto failed; + +- /* +- * entry->proc_fops originally points to a constant +- * structure, so to add more methods for the +- * binary registry write path, we need to replace the +- * said entry->proc_fops with a new fops structure. +- * However, in preparation for this, we need to preserve +- * the procfs read() and write() operations. +- */ +- nv_procfs_registry_fops.read = entry->proc_fops->read; +- nv_procfs_registry_fops.write = entry->proc_fops->write; +- +- entry = NV_CREATE_PROC_FILE("registry", proc_nvidia, +- nv_procfs_read_registry, +- nv_procfs_write_registry, +- &nv_procfs_registry_fops, NULL); ++ entry = proc_create("registry", NV_PROC_RW, proc_nvidia, &nv_procfs_registry_fops); + if (!entry) + goto failed; + +@@ -553,8 +560,7 @@ + + nv_procfs_add_text_file(proc_nvidia_patches, "README", __README_patches); + +- entry = NV_CREATE_PROC_FILE("version", proc_nvidia, +- nv_procfs_read_version, NULL, NULL, NULL); ++ entry = proc_create("version", NV_PROC_RO, proc_nvidia, &nv_procfs_version_fops); + if (!entry) + goto failed; + +@@ -571,15 +577,11 @@ + if (!proc_nvidia_gpu) + goto failed; + +- entry = NV_CREATE_PROC_FILE("information", proc_nvidia_gpu, +- nv_procfs_read_gpu_info, NULL, NULL, nv); ++ entry = proc_create_data("information", NV_PROC_RO, proc_nvidia_gpu, &nv_procfs_gpu_info_fops, nv); + if (!entry) + goto failed; + +- entry = NV_CREATE_PROC_FILE("registry", proc_nvidia_gpu, +- nv_procfs_read_registry, +- nv_procfs_write_registry, +- &nv_procfs_registry_fops, nv); ++ entry = proc_create_data("registry", NV_PROC_RW, proc_nvidia_gpu, &nv_procfs_registry_fops, nv); + if (!entry) + goto failed; + } +@@ -587,7 +589,7 @@ + return 0; + #if defined(CONFIG_PROC_FS) + failed: +- nv_procfs_unregister_all(proc_nvidia); ++ remove_proc_subtree("nvidia", proc_nvidia); + return -1; + #endif + } +@@ -595,6 +597,6 @@ + void nv_unregister_procfs(void) + { + #if defined(CONFIG_PROC_FS) +- nv_procfs_unregister_all(proc_nvidia); ++ remove_proc_subtree("nvidia", proc_nvidia); + #endif + } + diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-96.43.19-2.6.39.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-96.43.19-2.6.39.patch new file mode 100644 index 00000000..4ee8ba60 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-96.43.19-2.6.39.patch @@ -0,0 +1,10 @@ +--- usr/src/nv/nv-linux.h.orig 2010-10-28 04:23:04.000000000 +0200 ++++ usr/src/nv/nv-linux.h 2011-05-21 08:58:35.714633248 +0200 +@@ -80,7 +80,6 @@ + #if !defined(KERNEL_2_4) + #include <linux/sched.h> /* suser(), capable() replacement */ + #include <linux/moduleparam.h> /* module_param() */ +-#include <linux/smp_lock.h> /* kernel_locked */ + #include <asm/tlbflush.h> /* flush_tlb(), flush_tlb_all() */ + #include <asm/kmap_types.h> /* page table entry lookup */ + #endif diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-const.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-const.patch new file mode 100644 index 00000000..f3b82593 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-const.patch @@ -0,0 +1,17 @@ +Binary files kernel.orig/.nv-procfs.c.swp and kernel/.nv-procfs.c.swp differ +diff -urp kernel.orig/nv-procfs.c kernel/nv-procfs.c +--- kernel.orig/nv-procfs.c 2011-07-13 03:29:30.000000000 +0200 ++++ kernel/nv-procfs.c 2011-07-19 15:45:27.982993911 +0200 +@@ -707,8 +707,10 @@ int nv_register_procfs(void) + * However, in preparation for this, we need to preserve + * the procfs read() and write() operations. + */ +- nv_procfs_registry_fops.read = entry->proc_fops->read; +- nv_procfs_registry_fops.write = entry->proc_fops->write; ++ pax_open_kernel(); ++ *(void **)&nv_procfs_registry_fops.read = entry->proc_fops->read; ++ *(void **)&nv_procfs_registry_fops.write = entry->proc_fops->write; ++ pax_close_kernel(); + + entry = NV_CREATE_PROC_FILE("registry", proc_nvidia, + nv_procfs_read_registry, diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-usercopy.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-usercopy.patch new file mode 100644 index 00000000..ce8c201b --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-usercopy.patch @@ -0,0 +1,54 @@ +diff -urp kernel.orig/nv.c kernel/nv.c +--- kernel.orig/nv.c 2011-09-24 02:32:09.000000000 +0200 ++++ kernel/nv.c 2011-10-05 19:13:41.474242252 +0200 +@@ -1105,7 +1105,7 @@ static int __init nvidia_init_module(voi + NV_SPIN_LOCK_INIT(&km_lock); + #endif + +- NV_KMEM_CACHE_CREATE(nv_stack_t_cache, "nv_stack_t", nv_stack_t); ++ NV_KMEM_CACHE_CREATE(nv_stack_t_cache, "nv_stack_t", nv_stack_t, SLAB_USERCOPY); + if (nv_stack_t_cache == NULL) + { + nv_printf(NV_DBG_ERRORS, "NVRM: stack cache allocation failed!\n"); +@@ -1220,7 +1220,7 @@ static int __init nvidia_init_module(voi + } + #endif + +- NV_KMEM_CACHE_CREATE(nv_pte_t_cache, "nv_pte_t", nv_pte_t); ++ NV_KMEM_CACHE_CREATE(nv_pte_t_cache, "nv_pte_t", nv_pte_t, 0); + if (nv_pte_t_cache == NULL) + { + rc = -ENOMEM; +@@ -1229,7 +1229,7 @@ static int __init nvidia_init_module(voi + } + + NV_KMEM_CACHE_CREATE(nvidia_p2p_page_t_cache, "nvidia_p2p_page_t", +- nvidia_p2p_page_t); ++ nvidia_p2p_page_t, 0); + if (nvidia_p2p_page_t_cache == NULL) + { + rc = -ENOMEM; +diff -urp kernel.orig/nv-linux.h kernel/nv-linux.h +--- kernel.orig/nv-linux.h 2011-09-24 02:32:09.000000000 +0200 ++++ kernel/nv-linux.h 2011-10-05 19:14:42.522238996 +0200 +@@ -695,16 +695,16 @@ extern nv_spinlock_t km_lock; + + #if defined(NV_KMEM_CACHE_CREATE_PRESENT) + #if (NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT == 6) +-#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type) \ ++#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type, flags) \ + { \ + kmem_cache = kmem_cache_create(name, sizeof(type), \ +- 0, 0, NULL, NULL); \ ++ 0, flags, NULL, NULL); \ + } + #elif (NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT == 5) +-#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type) \ ++#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type, flags) \ + { \ + kmem_cache = kmem_cache_create(name, sizeof(type), \ +- 0, 0, NULL); \ ++ 0, flags, NULL); \ + } + #else + #error "NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT value unrecognized!" diff --git a/x11-drivers/nvidia-drivers/files/replace-VM_RESERVED-with-VM_DONTEXPAND-and-VM_DONTDU.patch b/x11-drivers/nvidia-drivers/files/replace-VM_RESERVED-with-VM_DONTEXPAND-and-VM_DONTDU.patch new file mode 100644 index 00000000..51aa2851 --- /dev/null +++ b/x11-drivers/nvidia-drivers/files/replace-VM_RESERVED-with-VM_DONTEXPAND-and-VM_DONTDU.patch @@ -0,0 +1,28 @@ +From fed1fa17202cf13bf80bbbad3bf0ffdfd192df42 Mon Sep 17 00:00:00 2001 +From: Alberto Milone <alberto.milone@canonical.com> +Date: Wed, 7 Nov 2012 12:11:02 +0100 +Subject: [PATCH 1/1] Replace VM_RESERVED with VM_DONTEXPAND and VM_DONTDUMP + +--- + nv-mmap.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/nv-mmap.c b/nv-mmap.c +index acc02ec..b2d5cdb 100644 +--- a/nv-mmap.c ++++ b/nv-mmap.c +@@ -463,7 +463,11 @@ int nv_kern_mmap( + NV_PRINT_AT(NV_DBG_MEMINFO, at); + nv_vm_list_page_count(&at->page_table[i], pages); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0) ++ vma->vm_flags |= (VM_IO | VM_LOCKED | (VM_DONTEXPAND | VM_DONTDUMP)); ++#else + vma->vm_flags |= (VM_IO | VM_LOCKED | VM_RESERVED); ++#endif + + #if defined(VM_DRIVER_PAGES) + vma->vm_flags |= VM_DRIVER_PAGES; +-- +1.7.9.5 + |