diff options
Diffstat (limited to 'media-video')
9 files changed, 569 insertions, 1 deletions
diff --git a/media-video/nvidia-kernel/ChangeLog b/media-video/nvidia-kernel/ChangeLog index 810381838edb..c1adc15d2fc4 100644 --- a/media-video/nvidia-kernel/ChangeLog +++ b/media-video/nvidia-kernel/ChangeLog @@ -1,6 +1,18 @@ # ChangeLog for media-video/nvidia-kernel # Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/ChangeLog,v 1.129 2006/01/12 14:24:24 augustus Exp $ +# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/ChangeLog,v 1.130 2006/01/22 21:27:54 augustus Exp $ + +*nvidia-kernel-1.0.7174-r1 (22 Jan 2006) + + 22 Jan 2006; Kristopher Kersey <augustus@gentoo.org> + +files/1.0.7174/NVIDIA_kernel-1.0-7174-1258475.diff, + +files/1.0.7174/NVIDIA_kernel-1.0-7174-1296092.diff, + +files/1.0.7174/NVIDIA_kernel-1.0-7174-1321905.diff, + +files/1.0.7174/NVIDIA_kernel-1.0-7174-1361053.diff, + +files/1.0.7174/NVIDIA_kernel-1.0-7174-1386866.diff, + +nvidia-kernel-1.0.7174-r1.ebuild: + Added all 1.0.7174 provided by Zander for people still using 7174. Bug + #118835. *nvidia-kernel-1.0.8178-r2 (12 Jan 2006) diff --git a/media-video/nvidia-kernel/Manifest b/media-video/nvidia-kernel/Manifest index 60b7333ec531..fe80ab25b921 100644 --- a/media-video/nvidia-kernel/Manifest +++ b/media-video/nvidia-kernel/Manifest @@ -30,6 +30,11 @@ MD5 82d99e72fddbc1b0447708afd84dc8c5 files/1.0.7167/NVIDIA_kernel-1.0-7167-amd64 MD5 7ae487fba8a81fb91d53f35b9066512f files/1.0.7167/NVIDIA_kernel-1.0-7167-conftest-koutput-includes.patch 1082 MD5 9df3fbed7af6fcb4ad13b1b5c3851381 files/1.0.7167/NVIDIA_kernel-1.0-7167-disable-preempt-on-smp_processor_id.patch 419 MD5 6c6bd7d2e4589cf3f4725082bb413a43 files/1.0.7167/NVIDIA_kernel-1.0-7167-x86-shutup-warnings.patch 742 +MD5 fea578e529e3261412ebbf622e05531a files/1.0.7174/NVIDIA_kernel-1.0-7174-1258475.diff 3971 +MD5 0983a2cbdacbaa3ae1a9ac1759a37706 files/1.0.7174/NVIDIA_kernel-1.0-7174-1296092.diff 3663 +MD5 74e4852ca3a04b90ce5a5993e99a6e2d files/1.0.7174/NVIDIA_kernel-1.0-7174-1321905.diff 1047 +MD5 4861c4a22bbe788d544560996cd5d190 files/1.0.7174/NVIDIA_kernel-1.0-7174-1361053.diff 3049 +MD5 d02cf5097f4ca4f1cd2e0209f0338b0e files/1.0.7174/NVIDIA_kernel-1.0-7174-1386866.diff 2491 MD5 e1718c0414288a04c27b70a124947613 files/1.0.7667/NVIDIA_kernel-1.0-7667-KERNEL_VERSION-moved.patch 1764 MD5 99b630e5a1d4b732e930781f25187194 files/1.0.7676/NVIDIA_kernel-1.0-7676-1321905.diff 1047 MD5 c0495ec827a938afcb807dd618e03945 files/1.0.7676/NVIDIA_kernel-1.0-7676-1359015.diff 3294 @@ -44,6 +49,7 @@ MD5 8a4687b0fc3e7cc0b36c247697d94701 files/digest-nvidia-kernel-1.0.6629-r4 163 MD5 8a4687b0fc3e7cc0b36c247697d94701 files/digest-nvidia-kernel-1.0.6629-r5 163 MD5 97b3ec5488fb7f7f6cdde31ee42e45af files/digest-nvidia-kernel-1.0.7167-r1 163 MD5 61c3ebdd8604c971bf969ea03040d170 files/digest-nvidia-kernel-1.0.7174 163 +MD5 61c3ebdd8604c971bf969ea03040d170 files/digest-nvidia-kernel-1.0.7174-r1 163 MD5 ef2c4ecedb45b67d79b43ffe58c660cf files/digest-nvidia-kernel-1.0.7667 163 MD5 4ea42a34abde5c81fe828b09afab7651 files/digest-nvidia-kernel-1.0.7676 163 MD5 4ea42a34abde5c81fe828b09afab7651 files/digest-nvidia-kernel-1.0.7676-r1 163 @@ -58,6 +64,7 @@ MD5 6912838fee04de491aa184c309e274a9 nvidia-kernel-1.0.6111-r3.ebuild 4523 MD5 29777a7a6934d750d1f2743d384267d2 nvidia-kernel-1.0.6629-r4.ebuild 4600 MD5 8aac41beeb1f441bb1dc5fe1aaabbd84 nvidia-kernel-1.0.6629-r5.ebuild 4772 MD5 b44523732e779c46cebed035eb62cbfc nvidia-kernel-1.0.7167-r1.ebuild 3982 +MD5 0b2b3d9e53fb986403153508cb669d4e nvidia-kernel-1.0.7174-r1.ebuild 4225 MD5 2e12cd6f21aaabd1424b51b10d2c0c34 nvidia-kernel-1.0.7174.ebuild 4025 MD5 0da986517ab8d7beb13c5d1fe5a4c1c6 nvidia-kernel-1.0.7667.ebuild 4538 MD5 6e28642fae4a75a66584dd04910cbac4 nvidia-kernel-1.0.7676-r1.ebuild 4669 diff --git a/media-video/nvidia-kernel/files/1.0.7174/NVIDIA_kernel-1.0-7174-1258475.diff b/media-video/nvidia-kernel/files/1.0.7174/NVIDIA_kernel-1.0-7174-1258475.diff new file mode 100644 index 000000000000..a6468094ea13 --- /dev/null +++ b/media-video/nvidia-kernel/files/1.0.7174/NVIDIA_kernel-1.0-7174-1258475.diff @@ -0,0 +1,121 @@ +diff -ru usr/src/nv/nv-linux.h usr/src/nv.1258475/nv-linux.h +--- usr/src/nv/nv-linux.h 2005-03-22 16:19:09.000000000 +0100 ++++ usr/src/nv.1258475/nv-linux.h 2005-05-05 19:06:45.237118320 +0200 +@@ -200,7 +200,6 @@ + */ + #if defined(CONFIG_SWIOTLB) + #define NV_SWIOTLB 1 +-#define NV_SWIOTLB_MAX_RETRIES 16 + extern int nv_swiotlb; + #endif + +@@ -1053,6 +1052,31 @@ + } + + #if defined(NV_SG_MAP_BUFFERS) ++ ++static inline int nv_map_sg(struct pci_dev *dev, struct scatterlist *sg) ++ { ++ int ret; ++#if defined(KERNEL_2_6) && defined(CONFIG_SWIOTLB) ++ if (swiotlb) ++ ret = swiotlb_map_sg(&dev->dev, sg, 1, PCI_DMA_BIDIRECTIONAL); ++ else ++#endif ++ ret = pci_map_sg(dev, sg, 1, PCI_DMA_BIDIRECTIONAL); ++ return ret; ++ } ++ ++static inline void nv_unmap_sg(struct pci_dev *dev, struct scatterlist *sg) ++ { ++#if defined(KERNEL_2_6) && defined(CONFIG_SWIOTLB) ++ if (swiotlb) ++ swiotlb_unmap_sg(&dev->dev, sg, 1, PCI_DMA_BIDIRECTIONAL); ++ else ++#endif ++ pci_unmap_sg(dev, sg, 1, PCI_DMA_BIDIRECTIONAL); ++ } ++ ++#define NV_MAP_SG_MAX_RETRIES 16 ++ + static inline int nv_sg_map_buffer( + struct pci_dev *dev, + nv_pte_t **page_list, +@@ -1067,50 +1091,42 @@ + sg_ptr->offset = (unsigned long)base & ~PAGE_MASK; + sg_ptr->length = num_pages * PAGE_SIZE; + +-#if defined(NV_SWIOTLB) +- i = NV_SWIOTLB_MAX_RETRIES; ++ i = NV_MAP_SG_MAX_RETRIES; + do { +- if (pci_map_sg(dev, sg_ptr, 1, PCI_DMA_BIDIRECTIONAL) == 0) ++ if (nv_map_sg(dev, sg_ptr) == 0) + return 1; + + if (sg_ptr->dma_address & ~PAGE_MASK) + { + struct scatterlist sg_tmp; +- pci_unmap_sg(dev, sg_ptr, num_pages, PCI_DMA_BIDIRECTIONAL); ++ nv_unmap_sg(dev, sg_ptr); + + memset(&sg_tmp, 0, sizeof(struct scatterlist)); + sg_tmp.page = sg_ptr->page; + sg_tmp.offset = sg_ptr->offset; + sg_tmp.length = 2048; + +- if (pci_map_sg(dev, &sg_tmp, 1, PCI_DMA_BIDIRECTIONAL) == 0) ++ if (nv_map_sg(dev, &sg_tmp) == 0) + return 1; + +- if (pci_map_sg(dev, sg_ptr, 1, PCI_DMA_BIDIRECTIONAL) == 0) ++ if (nv_map_sg(dev, sg_ptr) == 0) + { +- pci_unmap_sg(dev, &sg_tmp, num_pages, PCI_DMA_BIDIRECTIONAL); ++ nv_unmap_sg(dev, &sg_tmp); + return 1; + } + +- pci_unmap_sg(dev, &sg_tmp, num_pages, PCI_DMA_BIDIRECTIONAL); ++ nv_unmap_sg(dev, &sg_tmp); + } + } while (i-- && sg_ptr->dma_address & ~PAGE_MASK); +-#else +- if (pci_map_sg(dev, sg_ptr, 1, PCI_DMA_BIDIRECTIONAL) == 0) +- { +- 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); ++ nv_unmap_sg(dev, sg_ptr); + return 1; + } + +- NV_FIXUP_SWIOTLB_VIRT_ADDR_BUG(sg_ptr->dma_address); + + // this is a bit of a hack to make contiguous allocations easier to handle + // nv_sg_load below relies on the page_ptr addresses being filed in, as +@@ -1139,6 +1155,9 @@ + // wire in the new page's addresses, but save the original off to free later + if (nv_swiotlb) + { ++ // note that we modify our local version, not the sg_ptr version that ++ // will be returned to the swiotlb pool ++ NV_FIXUP_SWIOTLB_VIRT_ADDR_BUG(page_ptr->dma_addr); + page_ptr->orig_phys_addr = page_ptr->phys_addr; + page_ptr->phys_addr = page_ptr->dma_addr; + page_ptr->orig_virt_addr = page_ptr->virt_addr; +@@ -1171,7 +1190,7 @@ + + if (page_ptr->dma_addr != page_ptr->phys_addr) + { +- pci_unmap_sg(dev, sg_ptr, 1, PCI_DMA_BIDIRECTIONAL); ++ nv_unmap_sg(dev, sg_ptr); + page_ptr->dma_addr = 0; + } + } diff --git a/media-video/nvidia-kernel/files/1.0.7174/NVIDIA_kernel-1.0-7174-1296092.diff b/media-video/nvidia-kernel/files/1.0.7174/NVIDIA_kernel-1.0-7174-1296092.diff new file mode 100644 index 000000000000..049c954383bf --- /dev/null +++ b/media-video/nvidia-kernel/files/1.0.7174/NVIDIA_kernel-1.0-7174-1296092.diff @@ -0,0 +1,97 @@ +diff -ru usr/src/nv/nv-linux.h usr/src/nv.1296092/nv-linux.h +--- usr/src/nv/nv-linux.h 2005-03-22 16:19:09.000000000 +0100 ++++ usr/src/nv.1296092/nv-linux.h 2005-06-14 16:55:30.416687848 +0200 +@@ -76,7 +76,7 @@ + #include <asm/page.h> /* PAGE_OFFSET */ + #include <asm/pgtable.h> /* pte bit definitions */ + +-#if defined(NVCPU_X86_64) && defined(KERNEL_2_6) ++#if defined(NVCPU_X86_64) && defined(KERNEL_2_6) && !defined(HAVE_COMPAT_IOCTL) + #include <linux/syscalls.h> /* sys_ioctl() */ + #include <linux/ioctl32.h> /* register_ioctl32_conversion() */ + #endif +diff -ru usr/src/nv/nv.c usr/src/nv.1296092/nv.c +--- usr/src/nv/nv.c 2005-03-22 16:19:09.000000000 +0100 ++++ usr/src/nv.1296092/nv.c 2005-06-14 16:55:16.745766144 +0200 +@@ -153,6 +153,7 @@ + int nv_kern_mmap(struct file *, struct vm_area_struct *); + unsigned int nv_kern_poll(struct file *, poll_table *); + int nv_kern_ioctl(struct inode *, struct file *, unsigned int, unsigned long); ++long nv_kern_compat_ioctl(struct file *, unsigned int, unsigned long); + void nv_kern_isr_bh(unsigned long); + irqreturn_t nv_kern_isr(int, void *, struct pt_regs *); + void nv_kern_rc_timer(unsigned long); +@@ -209,6 +210,9 @@ + .owner = THIS_MODULE, + .poll = nv_kern_poll, + .ioctl = nv_kern_ioctl, ++#if defined(NVCPU_X86_64) && defined(HAVE_COMPAT_IOCTL) ++ .compat_ioctl = nv_kern_compat_ioctl, ++#endif + .mmap = nv_kern_mmap, + .open = nv_kern_open, + .release = nv_kern_close, +@@ -993,8 +997,10 @@ + inter_module_register("nv_linux_devices", THIS_MODULE, nv_linux_devices); + #endif + ++#if defined(NVCPU_X86_64) && defined(CONFIG_IA32_EMULATION) && !defined(HAVE_COMPAT_IOCTL) + /* Register ioctl conversions for 32 bit clients */ + rm_register_ioctl_conversions(); ++#endif + + #ifdef NV_SWIOTLB + // may need a better test than this eventually +@@ -1154,8 +1160,10 @@ + #endif + } + ++#if defined(NVCPU_X86_64) && defined(CONFIG_IA32_EMULATION) && !defined(HAVE_COMPAT_IOCTL) + /* Unregister ioctl conversions for 32 bit clients */ + rm_unregister_ioctl_conversions(); ++#endif + + #if defined(NV_BUILD_NV_PAT_SUPPORT) + if (nv_pat_enabled) +@@ -1930,6 +1938,15 @@ + return status; + } + ++long nv_kern_compat_ioctl( ++ struct file *file, ++ unsigned int cmd, ++ unsigned long i_arg ++) ++{ ++ return nv_kern_ioctl(file->f_dentry->d_inode, file, cmd, i_arg); ++} ++ + /* + * driver receives an interrupt + * if someone waiting, then hand it off. +diff -ru usr/src/nv/os-interface.c usr/src/nv.1296092/os-interface.c +--- usr/src/nv/os-interface.c 2005-03-22 16:19:09.000000000 +0100 ++++ usr/src/nv.1296092/os-interface.c 2005-06-14 16:55:21.366063752 +0200 +@@ -1227,18 +1227,18 @@ + + void NV_API_CALL os_register_ioctl32_conversion(U032 cmd, U032 size) + { +-#if defined(NVCPU_X86_64) && defined(CONFIG_IA32_EMULATION) ++#if defined(NVCPU_X86_64) && defined(CONFIG_IA32_EMULATION) && !defined(HAVE_COMPAT_IOCTL) + unsigned int request = _IOWR(NV_IOCTL_MAGIC, cmd, char[size]); + register_ioctl32_conversion(request, (void *)sys_ioctl); +-#endif /* NVCPU_X86_64 */ ++#endif + } + + void NV_API_CALL os_unregister_ioctl32_conversion(U032 cmd, U032 size) + { +-#if defined(NVCPU_X86_64) && defined(CONFIG_IA32_EMULATION) ++#if defined(NVCPU_X86_64) && defined(CONFIG_IA32_EMULATION) && !defined(HAVE_COMPAT_IOCTL) + unsigned int request = _IOWR(NV_IOCTL_MAGIC, cmd, char[size]); + unregister_ioctl32_conversion(request); +-#endif /* NVCPU_X86_64 */ ++#endif + } + + BOOL NV_API_CALL os_pat_supported(void) diff --git a/media-video/nvidia-kernel/files/1.0.7174/NVIDIA_kernel-1.0-7174-1321905.diff b/media-video/nvidia-kernel/files/1.0.7174/NVIDIA_kernel-1.0-7174-1321905.diff new file mode 100644 index 000000000000..67a1c0af8c33 --- /dev/null +++ b/media-video/nvidia-kernel/files/1.0.7174/NVIDIA_kernel-1.0-7174-1321905.diff @@ -0,0 +1,24 @@ +diff -ru usr/src/nv/nv-vm.c usr/src/nv.1321905/nv-vm.c +--- usr/src/nv/nv-vm.c 2005-03-22 16:19:09.000000000 +0100 ++++ usr/src/nv.1321905/nv-vm.c 2005-10-23 15:43:12.860170440 +0200 +@@ -248,6 +248,20 @@ + /* lock the page for dma purposes */ + SetPageReserved(NV_GET_PAGE_STRUCT(phys_addr)); + ++#if defined(_PAGE_NX) ++ if ((_PAGE_NX & pgprot_val(PAGE_KERNEL)) != 0 && phys_addr < 0x400000) { ++ // Until a bug in change_page_attr() is fixed ++ // we avoid pages with physaddr < 0x400000, ++ // since splitting "jumbo" mappings results ++ // in kernel pages being mapped as PAGE_KERNEL, which ++ // may include _PAGE_NX, effectively making much of the ++ // kernel code non-executable. ++ nv_printf(NV_DBG_MEMINFO, "NVRM: nv_vm_malloc discarding page @%08x\n", phys_addr); ++ --i; ++ continue; ++ } ++#endif ++ + page_ptr = at->page_table[i]; + page_ptr->phys_addr = phys_addr; + page_ptr->virt_addr = virt_addr; diff --git a/media-video/nvidia-kernel/files/1.0.7174/NVIDIA_kernel-1.0-7174-1361053.diff b/media-video/nvidia-kernel/files/1.0.7174/NVIDIA_kernel-1.0-7174-1361053.diff new file mode 100644 index 000000000000..5ab3fdbf780c --- /dev/null +++ b/media-video/nvidia-kernel/files/1.0.7174/NVIDIA_kernel-1.0-7174-1361053.diff @@ -0,0 +1,98 @@ +diff -ru usr/src/nv/nv-linux.h usr/src/nv.1361053/nv-linux.h +--- usr/src/nv/nv-linux.h 2005-03-22 16:19:09.000000000 +0100 ++++ usr/src/nv.1361053/nv-linux.h 2005-10-11 19:01:57.647002680 +0200 +@@ -1018,15 +1018,50 @@ + #define NV_CHANGE_PAGE_ATTR_BUG_PRESENT 1 + #endif + ++#if defined(NVCPU_X86) || defined(NVCPU_X86_64) ++/* ++ * On Linux/x86-64 (and recent Linux/x86) kernels, the PAGE_KERNEL ++ * and PAGE_KERNEL_NOCACHE protection bit masks include _PAGE_NX ++ * to indicate that the no-execute protection page feature is used ++ * for the page in question. ++ * ++ * We need to be careful to mask out _PAGE_NX when the host system ++ * doesn't support this feature or when it's disabled: the kernel ++ * may not do this in its implementation of the change_page_attr() ++ * interface. ++ */ ++#ifndef X86_FEATURE_NX ++#define X86_FEATURE_NX (1*32+20) ++#endif ++#ifndef boot_cpu_has ++#define boot_cpu_has(x) test_bit(x, boot_cpu_data.x86_capability) ++#endif ++#ifndef MSR_EFER ++#define MSR_EFER 0xc0000080 ++#endif ++#ifndef EFER_NX ++#define EFER_NX (1 << 11) ++#endif ++#ifndef _PAGE_NX ++#define _PAGE_NX ((NvU64)1 << 63) ++#endif ++extern NvU64 __nv_supported_pte_mask; ++#endif ++ + #if defined(NV_CHANGE_PAGE_ATTR_PRESENT) && !defined(NV_CHANGE_PAGE_ATTR_BUG_PRESENT) + static inline void NV_SET_PAGE_ATTRIB_UNCACHED(nv_pte_t *page_ptr) + { + struct page *page = virt_to_page(__va(page_ptr->phys_addr)); +- change_page_attr(page, 1, PAGE_KERNEL_NOCACHE); ++ pgprot_t prot = PAGE_KERNEL_NOCACHE; ++#if defined(NVCPU_X86) || defined(NVCPU_X86_64) ++ pgprot_val(prot) &= __nv_supported_pte_mask; ++#endif ++ change_page_attr(page, 1, prot); + } + static inline void NV_SET_PAGE_ATTRIB_CACHED(nv_pte_t *page_ptr) + { + struct page *page = virt_to_page(__va(page_ptr->phys_addr)); ++ pgprot_t prot = PAGE_KERNEL; + #ifdef CONFIG_SWIOTLB + if (page_ptr->orig_phys_addr) + { +@@ -1034,7 +1069,10 @@ + os_dbg_breakpoint(); + } + #endif +- change_page_attr(page, 1, PAGE_KERNEL); ++#if defined(NVCPU_X86) || defined(NVCPU_X86_64) ++ pgprot_val(prot) &= __nv_supported_pte_mask; ++#endif ++ change_page_attr(page, 1, prot); + } + #else + #define NV_SET_PAGE_ATTRIB_UNCACHED(page_list) +diff -ru usr/src/nv/nv.c usr/src/nv.1361053/nv.c +--- usr/src/nv/nv.c 2005-03-22 16:19:09.000000000 +0100 ++++ usr/src/nv.1361053/nv.c 2005-10-11 18:59:20.347915776 +0200 +@@ -38,6 +38,10 @@ + static int nv_disable_pat = 0; + NV_MODULE_PARAMETER(nv_disable_pat); + ++#if defined(NVCPU_X86) || defined(NVCPU_X86_64) ++NvU64 __nv_supported_pte_mask = ~_PAGE_NX; ++#endif ++ + /* + * And one for the control device + */ +@@ -1024,6 +1028,16 @@ + __nv_enable_pat_support(); + } + #endif ++ ++#if defined(NVCPU_X86_64) || (defined(NVCPU_X86) && defined(CONFIG_X86_PAE)) ++ if (boot_cpu_has(X86_FEATURE_NX)) ++ { ++ U032 __eax, __edx; ++ rdmsr(MSR_EFER, __eax, __edx); ++ if ((__eax & EFER_NX) != 0) ++ __nv_supported_pte_mask |= _PAGE_NX; ++ } ++#endif + + return 0; + diff --git a/media-video/nvidia-kernel/files/1.0.7174/NVIDIA_kernel-1.0-7174-1386866.diff b/media-video/nvidia-kernel/files/1.0.7174/NVIDIA_kernel-1.0-7174-1386866.diff new file mode 100644 index 000000000000..0a6263f81c0e --- /dev/null +++ b/media-video/nvidia-kernel/files/1.0.7174/NVIDIA_kernel-1.0-7174-1386866.diff @@ -0,0 +1,72 @@ +diff -ru usr/src/nv/nv-vm.c usr/src/nv.1386866/nv-vm.c +--- usr/src/nv/nv-vm.c 2005-03-22 16:19:09.000000000 +0100 ++++ usr/src/nv.1386866/nv-vm.c 2005-10-11 19:33:24.821108608 +0200 +@@ -58,26 +58,57 @@ + * conflicts. we try to rely on the kernel's provided interfaces when possible, + * but need additional flushing on earlier kernels. + */ +-#if defined(KERNEL_2_4) +-/* wrap CACHE_FLUSH so we can pass it to smp_call_function */ +-static void cache_flush(void *p) +-{ +- CACHE_FLUSH(); +-} +-#endif +- + /* + * 2.4 kernels handle flushing in the change_page_attr() call, but kernels + * earlier than 2.4.27 don't flush on cpus that support Self Snoop, so we + * manually flush on these kernels (actually, we go ahead and flush on all + * 2.4 kernels, as it's possible some others may be missing this fix and + * we'd prefer to be a little slower flushing caches than hanging the +- * system. 2.6 kernels split the flushing out to a seperate call, +- * global_flush_tlb(), so we rely on that. ++ * system. ++ * 2.6 kernels split the flushing out to a seperate call, ++ * global_flush_tlb(), so we rely on that. however, there are some 2.6 ++ * x86_64 kernels that do not properly flush. for now, we'll flush on all ++ * potential kernels, as it's slightly slower, but safer. + */ ++#if defined(KERNEL_2_4) || (defined(KERNEL_2_6) && defined(NVCPU_X86_64)) ++#define NV_CPA_NEEDS_FLUSHING 1 ++#endif ++ ++#if defined(NV_CPA_NEEDS_FLUSHING) ++static void cache_flush(void *p) ++{ ++ unsigned long reg0, reg1; ++ ++ CACHE_FLUSH(); ++ ++ // flush global TLBs ++#if defined (NVCPU_X86) ++ asm volatile("movl %%cr4, %0; \n" ++ "andl $~0x80, %0; \n" ++ "movl %0, %%cr4; \n" ++ "movl %%cr3, %1; \n" ++ "movl %1, %%cr3; \n" ++ "orl $0x80, %0; \n" ++ "movl %0, %%cr4; \n" ++ : "=&r" (reg0), "=&r" (reg1) ++ : : "memory"); ++#else ++ asm volatile("movq %%cr4, %0; \n" ++ "andq $~0x80, %0; \n" ++ "movq %0, %%cr4; \n" ++ "movq %%cr3, %1; \n" ++ "movq %1, %%cr3; \n" ++ "orq $0x80, %0; \n" ++ "movq %0, %%cr4; \n" ++ : "=&r" (reg0), "=&r" (reg1) ++ : : "memory"); ++#endif ++} ++#endif ++ + static void nv_flush_caches(void) + { +-#if defined(KERNEL_2_4) ++#if defined(NV_CPA_NEEDS_FLUSHING) + #ifdef CONFIG_SMP + smp_call_function(cache_flush, NULL, 1, 1); + #endif diff --git a/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.7174-r1 b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.7174-r1 new file mode 100644 index 000000000000..c09b689e40ca --- /dev/null +++ b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.7174-r1 @@ -0,0 +1,2 @@ +MD5 71e56aa82021c5b0c1e34944f88c6432 NVIDIA-Linux-x86-1.0-7174-pkg0.run 5547644 +MD5 125ec3ecc64202c6c27ef762a438d0f0 NVIDIA-Linux-x86_64-1.0-7174-pkg2.run 8729038 diff --git a/media-video/nvidia-kernel/nvidia-kernel-1.0.7174-r1.ebuild b/media-video/nvidia-kernel/nvidia-kernel-1.0.7174-r1.ebuild new file mode 100644 index 000000000000..fa11b2b67784 --- /dev/null +++ b/media-video/nvidia-kernel/nvidia-kernel-1.0.7174-r1.ebuild @@ -0,0 +1,135 @@ +# Copyright 1999-2006 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.7174-r1.ebuild,v 1.1 2006/01/22 21:27:54 augustus Exp $ + +inherit eutils linux-mod + +X86_PKG_V="pkg0" +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="" + +RDEPEND="virtual/modutils" +DEPEND="virtual/linux-sources" +export _POSIX2_VERSION="199209" + +mtrr_check() { + ebegin "Checking for MTRR support" + linux_chkconfig_present MTRR + eend $? + + if [[ $? -ne 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 + MODULE_NAMES="nvidia(video:${S})" + BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} SYSOUT=${KV_OUT_DIR}" + mtrr_check +} + +src_unpack() { + local NV_PATCH_PREFIX="${FILESDIR}/${PV}/NVIDIA_kernel-1.0-${PV##*.}" + + if [[ ${KV_MINOR} -eq 6 && ${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 ${NV_PATCH_PREFIX//7174/7167}-x86-shutup-warnings.patch + use amd64 && epatch ${NV_PATCH_PREFIX//7174/7167}-amd64-shutup-warnings.patch + + # Patches from Zander goes here + # (http://www.nvnews.net/vbulletin/forumdisplay.php?f=14, or possibly + # archived here: http://www.minion.de/files/1.0-7167/) + #epatch ${NV_PATCH_PREFIX}-1233959.patch + #epatch ${NV_PATCH_PREFIX}-1237815.patch + epatch ${NV_PATCH_PREFIX}-1258475.diff + epatch ${NV_PATCH_PREFIX}-1296092.diff + epatch ${NV_PATCH_PREFIX}-1321905.diff + epatch ${NV_PATCH_PREFIX}-1361053.diff + epatch ${NV_PATCH_PREFIX}-1386866.diff + + # 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 ${NV_PATCH_PREFIX//7174/7167}-conftest-koutput-includes.patch + # Fix calling of smp_processor_id() when preempt is enabled + epatch ${NV_PATCH_PREFIX//7174/7167}-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= + cd ${S}; convert_to_m 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 +} |