modules for kernel 4.0.5

This commit is contained in:
AlmAck 2015-06-07 13:59:35 +02:00
parent f713f89799
commit a88acdaebd
15 changed files with 216 additions and 706 deletions

View File

@ -1,13 +1,13 @@
# maintainer tetris4@gmail.com
# contributions from: https://www.archlinux.org/packages/community/x86_64/bbswitch/
_extramodules=extramodules-3.19-CHAKRA
_kver="$(cat /lib/modules/${_extramodules}/version)"
_kernelver=3.19.4
_extramodules=extramodules-4.0-CHAKRA
_kver="$(cat /usr/lib/modules/${_extramodules}/version)"
_kernelver=4.0.5
pkgname=bbswitch
pkgver=0.8
pkgrel=17
pkgrel=18
pkgdesc="kernel module allowing to switch dedicated graphics card on Optimus laptops"
arch=('x86_64')
url=("http://github.com/Bumblebee-Project/bbswitch")

View File

@ -1,15 +1,15 @@
post_install() {
EXTRAMODULES='extramodules-3.19-CHAKRA'
EXTRAMODULES='extramodules-4.0-CHAKRA'
depmod $(cat /lib/modules/$EXTRAMODULES/version)
echo 'In order to use nvidia module, reboot the system.'
}
post_upgrade() {
EXTRAMODULES='extramodules-3.19-CHAKRA'
EXTRAMODULES='extramodules-4.0-CHAKRA'
depmod $(cat /lib/modules/$EXTRAMODULES/version)
}
post_remove() {
EXTRAMODULES='extramodules-3.19-CHAKRA'
EXTRAMODULES='extramodules-4.0-CHAKRA'
depmod $(cat /lib/modules/$EXTRAMODULES/version)
}

View File

@ -2,14 +2,13 @@
# Chakra Packages for Chakra, part of chakra-project.org
#
_extramodules=extramodules-3.19-CHAKRA
_kver=$(cat /usr/lib/modules/${_extramodules}/version)
_kernelver=3.19.4
_extramodules=extramodules-4.0-CHAKRA
_kver="$(cat /usr/lib/modules/${_extramodules}/version)"
_kernelver=4.0.5
pkgname=(catalyst chd-catalyst)
pkgver=14.12
pkgrel=5
_amdver=14.501.1003
pkgver=15.5
pkgrel=1
pkgdesc="AMD/ATI Catalyst drivers for linux. fglrx kernel module only. Radeons HD 2 3 4 xxx ARE NOT SUPPORTED"
screenshot="http://linuxtation3.files.wordpress.com/2007/03/pantallazo.jpg"
arch=('x86_64')
@ -24,17 +23,18 @@ source=(
http://www2.ati.com/drivers/linux/amd-catalyst-omega-${pkgver}-linux-run-installers.zip
# http://archive.ubuntu.com/ubuntu/pool/restricted/f/fglrx-installer/fglrx-installer_14.201.orig.tar.gz
ati_make.sh
makefile_compat.patch
lano1106_fglrx_intel_iommu.patch
lano1106_kcl_agp_13_4.patch
lano1106_fglrx-13.8_proc.patch
cold-fglrx-3.14-current_euid.patch
fglrx_gpl_symbol.patch
fglrx_3.17rc6-no_hotplug.patch
makefile_compat.patch
lano1106_fglrx_intel_iommu.patch
lano1106_kcl_agp_13_4.patch
lano1106_fglrx-13.8_proc.patch
cold-fglrx-3.14-current_euid.patch
fglrx_gpl_symbol.patch
fglrx_3.17rc6-no_hotplug.patch
kolasa-3.19-get_cpu_var.patch
fglrx_supported)
md5sums=('ced4329274a02712406bda678ffbd743'
kolasa_4.0-cr4-strn.patch
kolasa_4.1_remove-IRQF_DISABLED.patch
fglrx_supported)
md5sums=('979f9f2e0948fa6e92ff0125f5c6b575'
'fd98b7e486d7fd4cad8de7b95b5b031e'
'3e1b82bd69774ea808da69c983d6a43b'
'5184b94a2a40216a67996999481dd9ee'
@ -44,16 +44,14 @@ md5sums=('ced4329274a02712406bda678ffbd743'
'ef97fc080ce7e5a275fe0c372bc2a418'
'67a22f624bae95a76638ce269392cb01'
'3aa45013515b724a71bbd8e01f98ad99'
'dee3df1c5d3ed87363f4304da917fc00'
'81a9e38dee025151cccb7e5db2362cfb'
'8bd182de340d6ed8b2dfcedfd3e5a389')
build() {
## Unpack archive
# /bin/sh ./amd-catalyst-${pkgver}-linux-x86.x86_64.run --extract archive_files
/bin/sh ./fglrx-${_amdver}/amd-driver-installer-${_amdver}-x86.x86_64.run --extract archive_files
#mkdir common
#mv etc lib usr common
#mkdir archive_files
#mv arch common xpic xpic_64a archive_files
## Unpack archive
/bin/sh ./amd-catalyst-omega-${pkgver}-linux-run-installers.run --extract archive_files
msg "Setting compilation variables ..."
# include ati_make.sh and use _ati_check function from it
@ -65,7 +63,6 @@ build() {
cd "${srcdir}/archive_files/"
msg "Applying patch(es) ..."
# makefile patch to choose arch_compat_alloc_user_space or older compat_alloc_user_space
# works only in combination with ati_make.sh script
@ -78,6 +75,8 @@ build() {
patch -Np1 -i ../fglrx_3.17rc6-no_hotplug.patch
patch -Np1 -i ../fglrx_gpl_symbol.patch
patch -Np1 -i ../kolasa-3.19-get_cpu_var.patch
patch -Np1 -i ../kolasa_4.0-cr4-strn.patch
#patch -Np1 -i ../kolasa_4.1_remove-IRQF_DISABLED.patch
cd "${srcdir}/archive_files/common/lib/modules/fglrx/build_mod"
cp "${srcdir}/archive_files/arch/${_archdir}/lib/modules/fglrx/build_mod/libfglrx_ip.a" .
@ -85,12 +84,12 @@ build() {
msg "Compiling fglrx module ..."
# Compile module using _ati_check variables
CFLAGS_MODULE="-DMODULE -DATI -DFGL -DPAGE_ATTR_FIX=$PAGE_ATTR_FIX -DCOMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE $def_smp $def_modversions"
CFLAGS_MODULE="-DMODULE -DATI -DFGL -DPAGE_ATTR_FIX=$PAGE_ATTR_FIX $def_smp $def_modversions"
make -C /usr/lib/modules/${_kver}/build SUBDIRS="`pwd`" ARCH=${BUILDARCH} \
MODFLAGS="$CFLAGS_MODULE" \
CFLAGS_MODULE="$CFLAGS_MODULE" \
PAGE_ATTR_FIX=$PAGE_ATTR_FIX COMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE modules
PAGE_ATTR_FIX=$PAGE_ATTR_FIX modules
}
package_catalyst() {
@ -102,19 +101,14 @@ package_catalyst() {
# here we are checking kernel's extramodules dir
for r in /usr/lib/modules/*; do
s=${r:17}
if [[ ${s:0:3} = "ext" ]]; then
if [[ `cat ${r}/version | grep -c ${_kver}` != 0 ]]; then
_destidir=${s}
sed -i -e "s/EXTRAMODULES=.*/EXTRAMODULES=${s}/" $startdir/catalyst.install
fi
elif [[ ${s} = ${_kver} ]] && [[ ! -e ${r}/extramodules ]]; then
_destidir=${_kver}/video
sed -i -e "s/EXTRAMODULES=.*/EXTRAMODULES=null/" $startdir/catalyst.install
fi
if [[ ${r:17:3} = "ext" ]]; then
if [[ `cat ${r}/version | grep -c ${_kernver}` != 0 ]]; then
_destidir=${r}
sed -i -e "s/EXTRAMODULES=.*/EXTRAMODULES=${r:17}/" $startdir/catalyst.install
fi
fi
done
cd "${srcdir}/archive_files/common/lib/modules/fglrx/build_mod"
install -m755 -d "${pkgdir}/usr/lib/modules/${_destidir}/"
install -m644 fglrx.ko "${pkgdir}/usr/lib/modules/${_destidir}/"

View File

@ -1,5 +1,5 @@
KERNEL_VERSION=3.19.1-1-CHAKRA
KERNEL_VERSION=4.0.5-1-CHAKRA
remove_hook(){
@ -11,18 +11,18 @@ remove_hook(){
}
post_install() {
EXTRAMODULES=extramodules-3.19-CHAKRA
EXTRAMODULES=extramodules-4.0-CHAKRA
depmod $(cat /lib/modules/$EXTRAMODULES/version)
}
post_upgrade() {
remove_hook
EXTRAMODULES=extramodules-3.19-CHAKRA
EXTRAMODULES=extramodules-4.0-CHAKRA
depmod $(cat /lib/modules/$EXTRAMODULES/version)
}
post_remove() {
EXTRAMODULES=extramodules-3.19-CHAKRA
EXTRAMODULES=extramodules-4.0-CHAKRA
depmod $(cat /lib/modules/$EXTRAMODULES/version)
}

View File

@ -0,0 +1,70 @@
diff -uNr 14.12/common/lib/modules/fglrx/build_mod/firegl_public.c 14.12_2/common/lib/modules/fglrx/build_mod/firegl_public.c
--- 14.12/common/lib/modules/fglrx/build_mod/firegl_public.c 2014-11-28 21:02:10.000000000 +0100
+++ 14.12_2/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-03-08 13:30:42.565275902 +0100
@@ -4468,8 +4468,13 @@
if (cpu_has_pge)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
cr4 = read_cr4();
write_cr4(cr4 & ~X86_CR4_PGE);
+#else
+ cr4 = __read_cr4();
+ __write_cr4(cr4 & ~X86_CR4_PGE);
+#endif
}
__flush_tlb();
@@ -4482,7 +4487,11 @@
write_cr0(cr0 & 0xbfffffff);
if (cpu_has_pge)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
write_cr4(cr4);
+#else
+ __write_cr4(cr4);
+#endif
}
local_irq_restore(flags);
@@ -4509,8 +4518,13 @@
if (cpu_has_pge)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
cr4 = read_cr4();
write_cr4(cr4 & ~X86_CR4_PGE);
+#else
+ cr4 = __read_cr4();
+ __write_cr4(cr4 & ~X86_CR4_PGE);
+#endif
}
__flush_tlb();
@@ -4522,7 +4536,11 @@
write_cr0(cr0 & 0xbfffffff);
if (cpu_has_pge)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
write_cr4(cr4);
+#else
+ __write_cr4(cr4);
+#endif
}
local_irq_restore(flags);
diff -uNr 14.12/common/lib/modules/fglrx/build_mod/kcl_str.c 14.12_2/common/lib/modules/fglrx/build_mod/kcl_str.c
--- 14.12/common/lib/modules/fglrx/build_mod/kcl_str.c 2014-11-28 21:02:10.000000000 +0100
+++ 14.12_2/common/lib/modules/fglrx/build_mod/kcl_str.c 2015-03-08 13:25:11.568396701 +0100
@@ -169,7 +169,11 @@
const char* s2,
KCL_TYPE_SizeSigned count)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
return strnicmp(s1, s2, count);
+#else
+ return strncasecmp(s1, s2, count);
+#endif
}
/** \brief Locate character in string

View File

@ -0,0 +1,15 @@
--- 15.3/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-03-06 17:44:48.000000000 +0100
+++ 15.3/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-06-04 12:12:04.997661763 +0200
@@ -3496,7 +3496,11 @@
#else
//when MSI enabled. keep irq disabled when calling the action handler,
//exclude this IRQ from irq balancing (only on one CPU)
- ((useMSI) ? (IRQF_DISABLED | IRQF_NOBALANCING) : (IRQF_SHARED)),
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
+ ((useMSI) ? (IRQF_DISABLED | IRQF_NOBALANCING) : (IRQF_SHARED)),
+#else
+ ((useMSI) ? (IRQF_NOBALANCING) : (IRQF_SHARED)),
+#endif
#endif
dev_name,
context);

View File

@ -1,12 +1,12 @@
# Maintainer: Neophytos Kolokotronis <tetris4 AT gmail DOT com>
_extramodules=extramodules-3.19-CHAKRA
_kver=$(cat /usr/lib/modules/${_extramodules}/version)
_kernelver=3.19.4
_extramodules=extramodules-4.0-CHAKRA
_kver="$(cat /usr/lib/modules/${_extramodules}/version)"
_kernelver=4.0.5
pkgname=('nvidia-304xx' 'chd-nvidia-304xx')
pkgver=304.125
pkgrel=6
pkgrel=7
arch=('x86_64')
url="http://www.nvidia.com/"
makedepends=("linux-headers=${_kernelver}")
@ -17,8 +17,12 @@ source+=("ftp://download.nvidia.com/XFree86/Linux-${arch}/${pkgver}/${_pkg}.run"
md5sums=('62d0cdb856cfae64753c0f3acf729d47'
'291d41ccdbcc08f752a38f9e0a7eeea0')
source+=('nv-drm.patch' 'nvidia-3.19.patch')
md5sums+=('79671a27131da619a33eb02ed0c2c031' 'd14e651d20054d18e0360c157ae60ae4')
source+=(nv-drm.patch
nvidia-3.19.patch
nvidia-4.0.patch)
md5sums+=('79671a27131da619a33eb02ed0c2c031'
'd14e651d20054d18e0360c157ae60ae4'
'7ff6828d2ad73364d528b69e2a14ab67')
prepare() {
cd "${srcdir}"
@ -28,6 +32,7 @@ prepare() {
# patches here
patch -p0 -i "$srcdir/nv-drm.patch"
patch -p1 -i "$srcdir/nvidia-3.19.patch"
patch -p0 -i "$srcdir/nvidia-4.0.patch"
}
build() {

View File

@ -0,0 +1,28 @@
--- kernel/nv-pat.c~ 2015-02-22 20:39:43.889075396 -0800
+++ kernel/nv-pat.c 2015-02-22 20:29:33.519735577 -0800
@@ -35,8 +35,13 @@
unsigned long cr0 = read_cr0();
write_cr0(((cr0 & (0xdfffffff)) | 0x40000000));
wbinvd();
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
+ *cr4 = __read_cr4();
+ if (*cr4 & 0x80) __write_cr4(*cr4 & ~0x80);
+#else
*cr4 = read_cr4();
if (*cr4 & 0x80) write_cr4(*cr4 & ~0x80);
+#endif
__flush_tlb();
}
@@ -46,7 +46,11 @@
wbinvd();
__flush_tlb();
write_cr0((cr0 & 0x9fffffff));
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
+ if (cr4 & 0x80) __write_cr4(cr4);
+#else
if (cr4 & 0x80) write_cr4(cr4);
+#endif
}
static int nv_determine_pat_mode(void)

View File

@ -1,633 +0,0 @@
--- 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
}
--- NVIDIA-Linux-x86_64-319.17-no-compat32/kernel/nv-procfs.c.old 2013-07-04 11:53:27.315381342 +0200
+++ NVIDIA-Linux-x86_64-319.17-no-compat32/kernel/nv-procfs.c 2013-07-04 11:53:43.105133901 +0200
@@ -784,28 +784,6 @@
entry = proc_create_data("registry", NV_PROC_RW, proc_nvidia_gpu, &nv_procfs_registry_fops, nv);
if (!entry)
goto failed;
-
- if (nv_find_pci_capability(nvl->dev, PCI_CAP_ID_AGP))
- {
- proc_nvidia_agp = NV_CREATE_PROC_DIR("agp", proc_nvidia);
- if (!proc_nvidia_agp)
- goto failed;
-
- entry = NV_CREATE_PROC_FILE("status", proc_nvidia_agp,
- nv_procfs_read_agp_status, NULL, NULL, nv);
- if (!entry)
- goto failed;
-
- entry = NV_CREATE_PROC_FILE("host-bridge", proc_nvidia_agp,
- nv_procfs_read_agp_info, NULL, NULL, NULL);
- if (!entry)
- goto failed;
-
- entry = NV_CREATE_PROC_FILE("gpu", proc_nvidia_agp,
- nv_procfs_read_agp_info, NULL, NULL, nv);
- if (!entry)
- goto failed;
- }
}
#endif
return 0;

View File

@ -1,15 +1,15 @@
post_install() {
EXTRAMODULES='extramodules-3.19-CHAKRA'
EXTRAMODULES='extramodules-4.0-CHAKRA'
depmod $(cat /lib/modules/$EXTRAMODULES/version)
echo 'In order to use nvidia module, reboot the system.'
}
post_upgrade() {
EXTRAMODULES='extramodules-3.19-CHAKRA'
EXTRAMODULES='extramodules-4.0-CHAKRA'
depmod $(cat /lib/modules/$EXTRAMODULES/version)
}
post_remove() {
EXTRAMODULES='extramodules-3.19-CHAKRA'
EXTRAMODULES='extramodules-4.0-CHAKRA'
depmod $(cat /lib/modules/$EXTRAMODULES/version)
}

View File

@ -1,24 +1,26 @@
# Maintainer: Neophytos Kolokotronis <tetris4 AT gmail DOT com>
_extramodules=extramodules-3.19-CHAKRA
_kver=$(cat /usr/lib/modules/${_extramodules}/version)
_kernelver=3.19.4
_extramodules=extramodules-4.0-CHAKRA
_kver="$(cat /usr/lib/modules/${_extramodules}/version)"
_kernelver=4.0.5
pkgname=('nvidia-340xx' 'chd-nvidia-340xx')
pkgver=340.76
pkgrel=2
pkgrel=3
arch=('x86_64')
url="http://www.nvidia.com/"
makedepends=("linux-headers=${_kernelver}")
license=('custom')
source=("https://gitorious.org/chakra/chakra-hardware-detection/blobs/raw/master/hwdb/nvidia_supported"
nv-drm.patch)
nv-drm.patch
nvidia-4.0.patch)
_ARCH='x86_64'
_pkg="NVIDIA-Linux-${_ARCH}-${pkgver}-no-compat32"
source+=("ftp://download.nvidia.com/XFree86/Linux-${_ARCH}/${pkgver}/${_pkg}.run")
md5sums=('62d0cdb856cfae64753c0f3acf729d47'
'79671a27131da619a33eb02ed0c2c031'
'f42bdf589f52d4e6c38baa5bef15eef8'
'440df290e213280d6e20d4d4be6f8b4c')
prepare() {
@ -26,6 +28,7 @@ prepare() {
cd "${_pkg}"
# patches here
patch -p0 -i ../nv-drm.patch
patch -p0 -i ../nvidia-4.0.patch
}
build() {

View File

@ -0,0 +1,28 @@
--- kernel/nv-pat.c~ 2015-02-22 20:39:43.889075396 -0800
+++ kernel/nv-pat.c 2015-02-22 20:29:33.519735577 -0800
@@ -35,8 +35,13 @@
unsigned long cr0 = read_cr0();
write_cr0(((cr0 & (0xdfffffff)) | 0x40000000));
wbinvd();
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
+ *cr4 = __read_cr4();
+ if (*cr4 & 0x80) __write_cr4(*cr4 & ~0x80);
+#else
*cr4 = read_cr4();
if (*cr4 & 0x80) write_cr4(*cr4 & ~0x80);
+#endif
__flush_tlb();
}
@@ -46,7 +46,11 @@
wbinvd();
__flush_tlb();
write_cr0((cr0 & 0x9fffffff));
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
+ if (cr4 & 0x80) __write_cr4(cr4);
+#else
if (cr4 & 0x80) write_cr4(cr4);
+#endif
}
static int nv_determine_pat_mode(void)

View File

@ -1,11 +1,11 @@
post_install() {
EXTRAMODULES='extramodules-3.19-CHAKRA'
EXTRAMODULES='extramodules-4.0-CHAKRA'
depmod $(cat /lib/modules/$EXTRAMODULES/version)
echo 'In order to use nvidia module, reboot the system.'
}
post_upgrade() {
EXTRAMODULES='extramodules-3.19-CHAKRA'
EXTRAMODULES='extramodules-4.0-CHAKRA'
depmod $(cat /lib/modules/$EXTRAMODULES/version)
echo -e '\e[31;46m WARNING'
echo -e '\e[31;46m If your card is from the 7xxx series or earlier, switch to nvidia-304xx'
@ -14,7 +14,7 @@ post_upgrade() {
}
post_remove() {
EXTRAMODULES='extramodules-3.19-CHAKRA'
EXTRAMODULES='extramodules-4.0-CHAKRA'
depmod $(cat /lib/modules/$EXTRAMODULES/version)
}

View File

@ -1,12 +1,12 @@
#
# Chakra Packages for Chakra, part of chakraos.org
_extramodules=extramodules-3.19-CHAKRA
_kver=$(cat /usr/lib/modules/${_extramodules}/version)
_kernelver=3.19.4
_extramodules=extramodules-4.0-CHAKRA
_kver="$(cat /usr/lib/modules/${_extramodules}/version)"
_kernelver=4.0.5
pkgname=('nvidia' 'chd-nvidia')
pkgver=346.59
pkgver=346.72
pkgrel=1
arch=('x86_64')
url="http://www.nvidia.com/"
@ -18,7 +18,7 @@ _ARCH='x86_64'
_pkg="NVIDIA-Linux-${_ARCH}-${pkgver}-no-compat32"
source+=("ftp://download.nvidia.com/XFree86/Linux-${_ARCH}/${pkgver}/${_pkg}.run")
md5sums=('874fc31d9a647e51ce20372d090083f5'
'db1cebc2a78eac85777bb4c7c2c8c70c')
'10bf6f0ac807c828f615640e71c4adbf')
prepare() {
sh "${_pkg}.run" --extract-only

View File

@ -1,11 +1,11 @@
post_install() {
EXTRAMODULES='extramodules-3.19-CHAKRA'
EXTRAMODULES='extramodules-4.0-CHAKRA'
depmod $(cat /lib/modules/$EXTRAMODULES/version)
echo 'In order to use nvidia module, reboot the system.'
}
post_upgrade() {
EXTRAMODULES='extramodules-3.19-CHAKRA'
EXTRAMODULES='extramodules-4.0-CHAKRA'
depmod $(cat /lib/modules/$EXTRAMODULES/version)
echo -e '\e[31;46m WARNING'
echo -e '\e[31;46m If your card is from the 7xxx series or earlier, switch to nvidia-304xx'
@ -14,7 +14,7 @@ post_upgrade() {
}
post_remove() {
EXTRAMODULES='extramodules-3.19-CHAKRA'
EXTRAMODULES='extramodules-4.0-CHAKRA'
depmod $(cat /lib/modules/$EXTRAMODULES/version)
}