# ChangeLog for media-video/nvidia-kernel
# Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/ChangeLog,v 1.105 2004/12/21 00:59:42 cyfred Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/ChangeLog,v 1.106 2004/12/27 00:46:54 cyfred Exp $
+
+ 27 Dec 2004; Andrew Bevitt <cyfred@gentoo.org>
+ files/1.0.6629/NVIDIA_kernel-1.0-6629-1175225.patch,
+ +files/1.0.6629/NVIDIA_kernel-1.0-6629-1182399.patch,
+ -files/1.0.6629/nv-disable-preempt-on-smp_processor_id-2.patch,
+ files/1.0.6629/nv-disable-preempt-on-smp_processor_id.patch,
+ nvidia-kernel-1.0.6629-r1.ebuild, -nvidia-kernel-1.0.6629.ebuild:
+ Some more patches from Zander
21 Dec 2004; Andrew Bevitt <cyfred@gentoo.org>
nvidia-kernel-1.0.6629-r1.ebuild:
diff -ru usr/src/nv/nv-linux.h usr/src/nv.1175225/nv-linux.h
--- usr/src/nv/nv-linux.h 2004-11-03 22:53:00.000000000 +0100
-+++ usr/src/nv.1175225/nv-linux.h 2004-12-08 22:13:42.000000000 +0100
++++ usr/src/nv.1175225/nv-linux.h 2004-12-21 21:03:33.000000000 +0100
@@ -533,6 +533,7 @@
*/
#if defined(CONFIG_SWIOTLB)
extern int nv_swiotlb;
#endif
-@@ -950,10 +951,40 @@
+@@ -950,10 +951,48 @@
sg_ptr->offset = (unsigned long)base & ~PAGE_MASK;
sg_ptr->length = num_pages * PAGE_SIZE;
return 1;
}
+#endif
++
++ if (sg_ptr->dma_address & ~PAGE_MASK)
++ {
++ nv_printf(NV_DBG_ERRORS,
++ "NVRM: VM: nv_sg_map_buffer: failed to obtain aligned mapping\n");
++ pci_unmap_sg(dev, sg_ptr, num_pages, PCI_DMA_BIDIRECTIONAL);
++ return 1;
++ }
NV_FIXUP_SWIOTLB_VIRT_ADDR_BUG(sg_ptr->dma_address);
--- /dev/null
+diff -ru usr/src/nv/nv-linux.h usr/src/nv.1182399/nv-linux.h
+--- usr/src/nv/nv-linux.h 2004-11-03 22:53:00.000000000 +0100
++++ usr/src/nv.1182399/nv-linux.h 2004-12-21 18:58:41.000000000 +0100
+@@ -155,6 +155,10 @@
+ #endif
+ #endif /* defined(NVCPU_X86) */
+
++#ifndef get_cpu
++#define get_cpu() smp_processor_id()
++#define put_cpu()
++#endif
+
+ #if !defined (list_for_each)
+ #define list_for_each(pos, head) \
+diff -ru usr/src/nv/nv.c usr/src/nv.1182399/nv.c
+--- usr/src/nv/nv.c 2004-11-03 22:53:00.000000000 +0100
++++ usr/src/nv.1182399/nv.c 2004-12-21 18:58:55.000000000 +0100
+@@ -2769,21 +2769,13 @@
+ }
+
+
+-/* avoid compiler warnings on UP kernels,
+- * when spinlock macros are defined away
+- */
+-#define NO_COMPILER_WARNINGS(nvl) \
+- if (nvl == NULL) return
+-
+-
+ static void nv_lock_init_locks
+ (
+ nv_state_t *nv
+ )
+ {
+- nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);
+-
+- NO_COMPILER_WARNINGS(nvl);
++ nv_linux_state_t *nvl;
++ nvl = NV_GET_NVL_FROM_NV_STATE(nv);
+
+ spin_lock_init(&nvl->rm_lock);
+
+@@ -2799,28 +2791,33 @@
+ nv_state_t *nv
+ )
+ {
+- nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);
+- NO_COMPILER_WARNINGS(nvl);
++ nv_linux_state_t *nvl;
++ int cpu;
++
++ nvl = NV_GET_NVL_FROM_NV_STATE(nv);
++ cpu = get_cpu();
+
+- if (nvl->rm_lock_cpu == smp_processor_id())
++ if (nvl->rm_lock_cpu == cpu)
+ {
+ nvl->rm_lock_count++;
++ put_cpu();
+ return;
+ }
+
++ put_cpu();
+ spin_unlock_wait(&nvl->rm_lock);
+ spin_lock_irq(&nvl->rm_lock);
+
+- nvl->rm_lock_cpu = smp_processor_id();
+- nvl->rm_lock_count = 1;
++ nvl->rm_lock_cpu = smp_processor_id();
++ nvl->rm_lock_count = 1;
+ }
+
+ void NV_API_CALL nv_unlock_rm(
+ nv_state_t *nv
+ )
+ {
+- nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);
+- NO_COMPILER_WARNINGS(nvl);
++ nv_linux_state_t *nvl;
++ nvl = NV_GET_NVL_FROM_NV_STATE(nv);
+
+ if (--nvl->rm_lock_count)
+ return;
+diff -ru usr/src/nv/os-interface.c usr/src/nv.1182399/os-interface.c
+--- usr/src/nv/os-interface.c 2004-11-03 22:53:00.000000000 +0100
++++ usr/src/nv.1182399/os-interface.c 2004-12-21 18:58:47.000000000 +0100
+@@ -732,10 +732,17 @@
+ //
+ inline void NV_API_CALL out_string(const char *str)
+ {
++#if DEBUG
+ static int was_newline = 0;
+
+- if (was_newline) printk("%d: %s", smp_processor_id(), str);
+- else printk("%s", str);
++ if (NV_NUM_CPUS() > 1 && was_newline)
++ {
++ printk("%d: %s", get_cpu(), str);
++ put_cpu();
++ }
++ else
++#endif
++ printk("%s", str);
+
+ #if DEBUG
+ if (NV_NUM_CPUS() > 1)
+++ /dev/null
---- 1/nv/nv.c 2004-12-19 17:08:46.000000000 +0200
-+++ 2/nv/nv.c 2004-12-19 17:09:07.000000000 +0200
-@@ -2821,7 +2821,7 @@ void NV_API_CALL nv_lock_rm(
- nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);
- NO_COMPILER_WARNINGS(nvl);
-
-- if (nvl->rm_lock_cpu == smp_processor_id())
-+ if (nvl->rm_lock_cpu == _smp_processor_id())
- {
- nvl->rm_lock_count++;
- return;
-@@ -2830,7 +2830,7 @@ void NV_API_CALL nv_lock_rm(
- spin_unlock_wait(&nvl->rm_lock);
- spin_lock_irq(&nvl->rm_lock);
-
-- nvl->rm_lock_cpu = smp_processor_id();
-+ nvl->rm_lock_cpu = _smp_processor_id();
- nvl->rm_lock_count = 1;
- }
-
---- 1/nv/nv.c 2004-11-07 16:11:33.593487328 +0200
-+++ 2/nv/nv.c 2004-11-07 16:12:12.473576656 +0200
-@@ -3156,6 +3156,8 @@ void NV_API_CALL nv_lock_rm(
- nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);
- NO_COMPILER_WARNINGS(nvl);
+--- usr/src/nv/nv.c.orig 2004-12-27 11:38:13.298374416 +1100
++++ usr/src/nv/nv.c 2004-12-27 11:42:48.876480176 +1100
+@@ -2814,6 +2814,7 @@
+ int cpu;
+ nvl = NV_GET_NVL_FROM_NV_STATE(nv);
+ preempt_disable();
-+
- if (nvl->rm_lock_cpu == smp_processor_id())
- {
- nvl->rm_lock_count++;
-@@ -3167,6 +3169,8 @@ void NV_API_CALL nv_lock_rm(
+ cpu = get_cpu();
- nvl->rm_lock_cpu = smp_processor_id();
- nvl->rm_lock_count = 1;
-+
-+ preempt_enable();
+ if (nvl->rm_lock_cpu == cpu)
+@@ -2829,6 +2830,7 @@
+
+ nvl->rm_lock_cpu = smp_processor_id();
+ nvl->rm_lock_count = 1;
++ preempt_enable();
}
void NV_API_CALL nv_unlock_rm(
+++ /dev/null
-MD5 f7737c1e95371f37a4fd30da2f11e72c NVIDIA-Linux-x86-1.0-6629-pkg1.run 8725221
-MD5 652e69f549c81a7a3f2806daa74b9c36 NVIDIA-Linux-x86_64-1.0-6629-pkg2.run 7777882
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/nvidia-kernel-1.0.6629-r1.ebuild,v 1.3 2004/12/21 00:59:42 cyfred Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/nvidia-kernel-1.0.6629-r1.ebuild,v 1.4 2004/12/27 00:46:54 cyfred Exp $
inherit eutils linux-mod
# Patches from Zander (http://www.minion.de/files/1.0-6629/)
epatch ${FILESDIR}/${PV}/NVIDIA_kernel-1.0-6629-1155389.patch
- # Fix a limitation on available video memory bug #71684
- epatch ${FILESDIR}/${PV}/NVIDIA_kernel-1.0-6629-1161283.patch
epatch ${FILESDIR}/${PV}/NVIDIA_kernel-1.0-6629-1162524.patch
epatch ${FILESDIR}/${PV}/NVIDIA_kernel-1.0-6629-1165235.patch
epatch ${FILESDIR}/${PV}/NVIDIA_kernel-1.0-6629-1171869.patch
epatch ${FILESDIR}/${PV}/NVIDIA_kernel-1.0-6629-1175225.patch
+ epatch ${FILESDIR}/${PV}/NVIDIA_kernel-1.0-6629-1182399.patch
# Now any patches specific to the 2.6 kernel should go here
if kernel_is 2 6
epatch ${FILESDIR}/${PV}/conftest_koutput_includes.patch
# Fix calling of smp_processor_id() when preempt is enabled
epatch ${FILESDIR}/${PV}/nv-disable-preempt-on-smp_processor_id.patch
+ # Fix a limitation on available video memory bug #71684
+ epatch ${FILESDIR}/${PV}/NVIDIA_kernel-1.0-6629-1161283.patch
fi
# if you set this then it's your own fault when stuff breaks :)
+++ /dev/null
-# Copyright 1999-2004 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/nvidia-kernel-1.0.6629.ebuild,v 1.10 2004/12/05 12:45:35 johnm Exp $
-
-inherit eutils linux-mod
-
-X86_PKG_V="pkg1"
-AMD64_PKG_V="pkg2"
-NV_V="${PV/1.0./1.0-}"
-X86_NV_PACKAGE="NVIDIA-Linux-x86-${NV_V}"
-AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${NV_V}"
-
-DESCRIPTION="Linux kernel module for the NVIDIA X11 driver"
-HOMEPAGE="http://www.nvidia.com/"
-SRC_URI="x86? (ftp://download.nvidia.com/XFree86/Linux-x86/${NV_V}/${X86_NV_PACKAGE}-${X86_PKG_V}.run)
- amd64? (http://download.nvidia.com/XFree86/Linux-x86_64/${NV_V}/${AMD64_NV_PACKAGE}-${AMD64_PKG_V}.run)"
-
-if use x86; then
- PKG_V="${X86_PKG_V}"
- NV_PACKAGE="${X86_NV_PACKAGE}"
-elif use amd64; then
- PKG_V="${AMD64_PKG_V}"
- NV_PACKAGE="${AMD64_NV_PACKAGE}"
-fi
-
-S="${WORKDIR}/${NV_PACKAGE}-${PKG_V}/usr/src/nv"
-
-LICENSE="NVIDIA"
-SLOT="0"
-KEYWORDS="-* ~x86 ~amd64"
-RESTRICT="nostrip"
-IUSE=""
-
-DEPEND="virtual/linux-sources"
-export _POSIX2_VERSION="199209"
-
-MODULE_NAMES="nvidia(video:${S})"
-BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} SYSOUT=${KV_OUT_DIR}"
-
-mtrr_check() {
- ebegin "Checking for MTRR support"
- linux_chkconfig_present MTRR
- eend $?
-
- if [ "$?" != 0 ]
- then
- eerror "This version needs MTRR support for most chipsets!"
- 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
-}
-
-pkg_setup() {
- linux-mod_pkg_setup
- mtrr_check;
-}
-
-src_unpack() {
- # 2.6.10_rc1-mm{1,2,3} all EXPORT_SYMBOL_GPL the udev functions, this breaks loading
- CS="$(grep -c EXPORT_SYMBOL\(class_simple_create\)\; ${KV_DIR}/drivers/base/class_simple.c)"
- if [ "${CS}" == "0" ]
- then
- ewarn "Your current kernel uses EXPORT_SYMBOL_GPL() on some methods required by nvidia-kernel."
- ewarn "This probably means you are using 2.6.10_rc1-mm*. Please change away from mm-sources until this is"
- ewarn "revised and a solution released into the mm branch, development-sources will work."
- die "Incompatible kernel export."
- fi
-
- if [ ${KV_MINOR} -ge 6 -a ${KV_PATCH} -lt 7 ]
- then
- echo
- ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
- ewarn "This is not officially supported for ${P}. It is likely you"
- ewarn "will not be able to compile or use the kernel module."
- ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
- echo
- ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
- fi
-
- cd ${WORKDIR}
- bash ${DISTDIR}/${NV_PACKAGE}-${PKG_V}.run --extract-only
-
- # Add patches below, with a breif description.
- cd ${S}
- # Any general patches should go here
- # Shutup pointer arith warnings
- use x86 && epatch ${FILESDIR}/${PV}/nv-shutup-warnings.patch
- use amd64 && epatch ${FILESDIR}/${PV}/nv-amd64-shutup-warnings.patch
- # Fix a limitation on available video memory bug #71684
- epatch ${FILESDIR}/${PV}/nv-fix-memory-limit.patch
- # Fix the vm_flags to only have VM_IO, and not VM_LOCKED as well
- epatch ${FILESDIR}/${PV}/nv-vm_flags-no-VM_LOCKED.patch
-
- # Now any patches specific to the 2.6 kernel should go here
- if kernel_is 2 6
- then
- einfo "Applying 2.6 kernel patches"
- # Fix the /usr/src/linux/include/asm not existing on koutput issue #58294
- epatch ${FILESDIR}/${PV}/conftest_koutput_includes.patch
- # Fix pgd_offset() -> pml4_pgd_offset() for >=2.6.10-rc1-mm3
- epatch ${FILESDIR}/${PV}/nv-pgd_offset.patch
- # Speedup driver for 2.6 kernel to be on par with 2.4 kernel
- epatch ${FILESDIR}/${PV}/nv-pgprot-speedup.patch
- # Fix calling of smp_processor_id() when preempt is enabled
- epatch ${FILESDIR}/${PV}/nv-disable-preempt-on-smp_processor_id.patch
- fi
-
- # if you set this then it's your own fault when stuff breaks :)
- [ -n "${USE_CRAZY_OPTS}" ] && sed -i "s:-O:${CFLAGS}:" Makefile.*
-
- # if greater than 2.6.5 use M= instead of SUBDIR=
- convert_to_m ${S}/Makefile.kbuild
-}
-
-src_install() {
- linux-mod_src_install
-
- # Add the aliases
- sed -e 's:\${PACKAGE}:'${PF}':g' ${FILESDIR}/nvidia > ${WORKDIR}/nvidia
- insinto /etc/modules.d
- newins ${WORKDIR}/nvidia nvidia
-
- # Docs
- dodoc ${S}/../../share/doc/README
-
- # The device creation script
- into /
- newsbin ${S}/makedevices.sh NVmakedevices.sh
-}
-
-pkg_postinst() {
- if [ "${ROOT}" = "/" ] && \
- [ ! -e /dev/.devfsd ] && \
- [ ! -e /dev/.udev ] && \
- [ -x /sbin/NVmakedevices.sh ]
- then
- /sbin/NVmakedevices.sh >/dev/null 2>&1
- fi
-
- linux-mod_pkg_postinst
-}