This commit is contained in:
nyyu 2020-05-08 10:36:08 +02:00
commit 5bb948e82d
5 changed files with 270 additions and 352 deletions

View File

@ -5,7 +5,7 @@
pkgbase=linux # Build stock -ARCH kernel
#pkgbase=linux-custom # Build kernel with a different name
_srcname=linux
pkgver=4.16rc2.r375.g5f6e57ee27fc
pkgver=4.17rc6.r158.gbee797529d7c
pkgrel=1
arch=('x86_64')
url="https://www.kernel.org/"
@ -13,14 +13,14 @@ license=('GPL2')
makedepends=('xmlto' 'kmod' 'inetutils' 'bc' 'libelf')
options=('!strip')
source=(
'git+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git'
'config' # the main kernel config file
'60-linux.hook' # pacman hook for depmod
'90-linux.hook' # pacman hook for initramfs regeneration
'linux.preset' # standard config files for mkinitcpio ramdisk
git+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
config # the main kernel config file
60-linux.hook # pacman hook for depmod
90-linux.hook # pacman hook for initramfs regeneration
linux.preset # standard config files for mkinitcpio ramdisk
)
sha256sums=('SKIP'
'f38927db126ec7141ea2dd70cabb2ef378552672b31db4ab621493928497abd7'
'e39c02fd021f125a6202f7e4c0692dfd3ced93d404ecb6c8dca6994c8e17b227'
'ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21'
'75f99f5239e03238f88d1a834c50043ec32b1dc568f2cc291b07d04718483919'
'ad6344badc91ad0630caacde83f7f9b97276f80d26a20619a87952be65492c65')
@ -37,8 +37,6 @@ pkgver() {
prepare() {
cd ${_srcname}
git revert --no-edit 4bd89ed39b2ab8dc4ac4b6c59b07d420b0213bec
# add upstream patch
#patch -p1 -i ../patch-${pkgver}

File diff suppressed because it is too large Load Diff

View File

@ -1,181 +0,0 @@
diff --git a/NVIDIA-Linux-x86_64-390.25-no-compat32/kernel/conftest.sh b/NVIDIA-Linux-x86_64-390.25-no-compat32/kernel/conftest.sh
index 292d7da..5f254e1 100755
--- a/NVIDIA-Linux-x86_64-390.25-no-compat32/kernel/conftest.sh
+++ b/NVIDIA-Linux-x86_64-390.25-no-compat32/kernel/conftest.sh
@@ -2123,6 +2123,7 @@ compile_test() {
#endif
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
+ #include <linux/version.h>
#if !defined(CONFIG_DRM) && !defined(CONFIG_DRM_MODULE)
#error DRM not enabled
#endif
@@ -2146,8 +2147,12 @@ compile_test() {
/* 2014-12-18 88a48e297b3a3bac6022c03babfb038f1a886cea */
i = DRIVER_ATOMIC;
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
/* 2015-04-10 df63b9994eaf942afcdb946d27a28661d7dfbf2a */
for_each_crtc_in_state(s, c, cs, i) { }
+ #else
+ for_each_new_crtc_in_state(s, c, cs, i) {}
+ #endif
/* 2015-05-18 036ef5733ba433760a3512bb5f7a155946e2df05 */
a = offsetof(struct drm_mode_config_funcs, atomic_state_alloc);
diff --git a/NVIDIA-Linux-x86_64-390.25-no-compat32/kernel/nvidia-drm/nvidia-drm-connector.c b/NVIDIA-Linux-x86_64-390.25-no-compat32/kernel/nvidia-drm/nvidia-drm-connector.c
index cf16b6f..a66ae5a 100644
--- a/NVIDIA-Linux-x86_64-390.25-no-compat32/kernel/nvidia-drm/nvidia-drm-connector.c
+++ b/NVIDIA-Linux-x86_64-390.25-no-compat32/kernel/nvidia-drm/nvidia-drm-connector.c
@@ -33,6 +33,7 @@
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
+#include <linux/version.h>
static void nv_drm_connector_destroy(struct drm_connector *connector)
{
@@ -87,7 +88,11 @@ static enum drm_connector_status __nv_drm_connector_detect_internal(
break;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
encoder = drm_encoder_find(dev, connector->encoder_ids[i]);
+#else
+ encoder = drm_encoder_find(dev, NULL, connector->encoder_ids[i]);
+#endif
if (encoder == NULL) {
BUG_ON(encoder != NULL);
diff --git a/NVIDIA-Linux-x86_64-390.25-no-compat32/kernel/nvidia-drm/nvidia-drm-crtc.c b/NVIDIA-Linux-x86_64-390.25-no-compat32/kernel/nvidia-drm/nvidia-drm-crtc.c
index b54128a..d820dc2 100644
--- a/NVIDIA-Linux-x86_64-390.25-no-compat32/kernel/nvidia-drm/nvidia-drm-crtc.c
+++ b/NVIDIA-Linux-x86_64-390.25-no-compat32/kernel/nvidia-drm/nvidia-drm-crtc.c
@@ -37,6 +37,7 @@
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
+#include <linux/version.h>
static const u32 nv_default_supported_plane_drm_formats[] = {
DRM_FORMAT_ARGB1555,
@@ -141,7 +142,11 @@ static int nv_drm_plane_atomic_check(struct drm_plane *plane,
goto done;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
for_each_crtc_in_state(plane_state->state, crtc, crtc_state, i) {
+#else
+ for_each_new_crtc_in_state(plane_state->state, crtc, crtc_state, i) {
+#endif
struct nv_drm_crtc_state *nv_crtc_state = to_nv_crtc_state(crtc_state);
struct NvKmsKapiHeadRequestedConfig *head_req_config =
&nv_crtc_state->req_config;
@@ -365,7 +370,11 @@ static int nv_drm_crtc_atomic_check(struct drm_crtc *crtc,
req_config->flags.displaysChanged = NV_TRUE;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
for_each_connector_in_state(crtc_state->state,
+#else
+ for_each_new_connector_in_state(crtc_state->state,
+#endif
connector, connector_state, j) {
if (connector_state->crtc != crtc) {
continue;
@@ -613,7 +622,11 @@ int nv_drm_get_crtc_crc32_ioctl(struct drm_device *dev,
goto done;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
crtc = drm_crtc_find(dev, params->crtc_id);
+#else
+ crtc = drm_crtc_find(dev, NULL, params->crtc_id);
+#endif
if (!crtc) {
ret = -ENOENT;
goto done;
diff --git a/NVIDIA-Linux-x86_64-390.25-no-compat32/kernel/nvidia-drm/nvidia-drm-modeset.c b/NVIDIA-Linux-x86_64-390.25-no-compat32/kernel/nvidia-drm/nvidia-drm-modeset.c
index da15d89..91f64ea 100644
--- a/NVIDIA-Linux-x86_64-390.25-no-compat32/kernel/nvidia-drm/nvidia-drm-modeset.c
+++ b/NVIDIA-Linux-x86_64-390.25-no-compat32/kernel/nvidia-drm/nvidia-drm-modeset.c
@@ -33,6 +33,7 @@
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc.h>
+#include <linux/version.h>
struct nv_drm_atomic_state {
struct NvKmsKapiRequestedModeSetConfig config;
@@ -110,7 +111,11 @@ nv_drm_atomic_apply_modeset_config(struct drm_device *dev,
memset(requested_config, 0, sizeof(*requested_config));
/* Loop over affected crtcs and construct NvKmsKapiRequestedModeSetConfig */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
for_each_crtc_in_state(state, crtc, crtc_state, i) {
+#else
+ for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
+#endif
/*
* When commiting a state, the new state is already stored in
* crtc->state. When checking a proposed state, the proposed state is
@@ -178,7 +183,11 @@ void nv_drm_atomic_helper_commit_tail(struct drm_atomic_state *state)
nv_drm_write_combine_flush();
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
for_each_crtc_in_state(state, crtc, crtc_state, i) {
+#else
+ for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
+#endif
struct nv_drm_crtc *nv_crtc = to_nv_crtc(crtc);
struct nv_drm_crtc_state *nv_crtc_state = to_nv_crtc_state(crtc->state);
struct nv_drm_flip *nv_flip = nv_crtc_state->nv_flip;
@@ -282,7 +291,11 @@ static void nv_drm_atomic_commit_task_callback(struct work_struct *work)
ret);
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
for_each_crtc_in_state(state, crtc, crtc_state, i) {
+#else
+ for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
+#endif
struct nv_drm_crtc *nv_crtc = to_nv_crtc(crtc);
if (wait_event_timeout(
@@ -351,7 +364,11 @@ static int nv_drm_atomic_commit_internal(
* condition between two/more nvKms->applyModeSetConfig() on single
* crtc and generate flip events in correct order.
*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
for_each_crtc_in_state(state, crtc, crtc_state, i) {
+#else
+ for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
+#endif
struct nv_drm_device *nv_dev = to_nv_device(dev);
struct nv_drm_crtc *nv_crtc = to_nv_crtc(crtc);
@@ -372,7 +389,11 @@ static int nv_drm_atomic_commit_internal(
}
}
} else {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
for_each_crtc_in_state(state, crtc, crtc_state, i) {
+#else
+ for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
+#endif
struct nv_drm_crtc *nv_crtc = to_nv_crtc(crtc);
if (atomic_read(&nv_crtc->has_pending_commit) ||
@@ -388,7 +409,11 @@ static int nv_drm_atomic_commit_internal(
* flip events.
*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
for_each_crtc_in_state(state, crtc, crtc_state, i) {
+#else
+ for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
+#endif
struct nv_drm_crtc *nv_crtc = to_nv_crtc(crtc);
atomic_set(&nv_crtc->has_pending_commit, true);

View File

@ -4,48 +4,32 @@
# Contributor: Thomas Baechler <thomas@archlinux.org>
pkgbase=nvidia
pkgname=nvidia
pkgver=390.42
_extramodules=extramodules-4.16-ARCH
pkgname=(nvidia)
pkgver=396.24
_extramodules=extramodules-4.17-ARCH
pkgrel=99
pkgdesc="NVIDIA drivers for linux"
arch=('x86_64')
url="http://www.nvidia.com/"
makedepends=('nvidia-libgl' "nvidia-utils=${pkgver}" 'linux' 'linux-headers>=4.15' 'linux-headers<4.17')
makedepends=("nvidia-utils=${pkgver}" 'linux' 'linux-headers>=4.16' 'linux-headers<4.17')
license=('custom')
options=('!strip')
source=("http://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run"
4.15-FS57305.patch)
sha256sums=('5f242cf0f7f4dcc45759eee3b4973191114842fe7c146c5ae7a12a2ebea394aa'
'145d436f117455a1a8315b31dc2c9fce3c90c135d8c530b8b8da0e70548f48d9')
_pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32"
_pkg="NVIDIA-Linux-x86_64-${pkgver}"
source=("http://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/${_pkg}.run"
kernel-4.16.patch)
sha256sums=('59bb112b17ca72cd15fed4e521d4b52b0e9f5b8b13a95b36521f8eda978b568e'
'622ac792ec200b2239cb663c0010392118b78c9904973d82cd261165c16d6385')
prepare() {
sh "${_pkg}.run" --extract-only
cd "${_pkg}"
patch -Np2 -i "${srcdir}"/4.15-FS57305.patch
# Restore phys_to_dma support (still needed for 396.18)
# https://bugs.archlinux.org/task/58074
patch -Np1 -i ../kernel-4.16.patch
# Change to GPL license
find . -name '*.c' -type f -print0 | xargs -0 sed -i -E 's/MODULE_LICENSE\("(.*)"\)/MODULE_LICENSE\("GPL"\)/g'
cp -a kernel kernel-dkms
cd kernel-dkms
sed -i "s/__VERSION_STRING/${pkgver}/" dkms.conf
sed -i 's/__JOBS/`nproc`/' dkms.conf
sed -i 's/__DKMS_MODULES//' dkms.conf
sed -i '$iBUILT_MODULE_NAME[0]="nvidia"\
DEST_MODULE_LOCATION[0]="/kernel/drivers/video"\
BUILT_MODULE_NAME[1]="nvidia-uvm"\
DEST_MODULE_LOCATION[1]="/kernel/drivers/video"\
BUILT_MODULE_NAME[2]="nvidia-modeset"\
DEST_MODULE_LOCATION[2]="/kernel/drivers/video"\
BUILT_MODULE_NAME[3]="nvidia-drm"\
DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
# Gift for linux-rt guys
sed -i 's/NV_EXCLUDE_BUILD_MODULES/IGNORE_PREEMPT_RT_PRESENCE=1 NV_EXCLUDE_BUILD_MODULES/' dkms.conf
}
build() {
@ -56,7 +40,7 @@ build() {
package_nvidia() {
pkgdesc="NVIDIA drivers for linux"
depends=('linux>=4.15' 'linux<4.17' "nvidia-utils=${pkgver}" 'libgl')
depends=('linux>=4.16' 'linux<4.17' "nvidia-utils=${pkgver}" 'libgl')
install -Dt "${pkgdir}/usr/lib/modules/${_extramodules}" -m644 \
"${srcdir}/${_pkg}/kernel"/nvidia{,-modeset,-drm,-uvm}.ko

33
nvidia/kernel-4.16.patch Normal file
View File

@ -0,0 +1,33 @@
diff --git a/kernel/common/inc/nv-linux.h b/kernel/common/inc/nv-linux.h
index 10fc418..22ef968 100644
--- a/kernel/common/inc/nv-linux.h
+++ b/kernel/common/inc/nv-linux.h
@@ -175,7 +175,11 @@ static inline uid_t __kuid_val(kuid_t uid)
#if defined(NV_VM_INSERT_PAGE_PRESENT)
#include <linux/pagemap.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
#include <linux/dma-mapping.h>
+#else
+#include <linux/dma-direct.h>
+#endif
#endif
#if defined(CONFIG_SWIOTLB) && defined(NVCPU_AARCH64)
diff --git a/kernel/conftest.sh b/kernel/conftest.sh
index b23dbb4..42dc576 100755
--- a/kernel/conftest.sh
+++ b/kernel/conftest.sh
@@ -1906,7 +1906,12 @@ compile_test() {
# Determine if the phys_to_dma function is present.
#
CODE="
+ #include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
#include <linux/dma-mapping.h>
+#else
+ #include <linux/dma-direct.h>
+#endif
void conftest_phys_to_dma(void) {
phys_to_dma();
}"