From e1a25aeb656d7f458936a83d1c2937a8778714a1 Mon Sep 17 00:00:00 2001 From: David McFarland Date: Wed, 26 Oct 2016 22:50:56 -0300 Subject: amdgpu-pro: fix kernel module for linux-4.8 --- pkgs/os-specific/linux/amdgpu-pro/default.nix | 27 +-- ...1-Add-vga-switcheroo-handler-flag-for-4.8.patch | 27 +++ .../patches/0001-add-OS-detection-for-arch.patch | 26 --- .../0002-Remove-dependency-on-System.map.patch | 112 +++++++++++ ...2-update-kcl_ttm_bo_reserve-for-linux-4.7.patch | 25 --- .../0003-add-kcl_drm_gem_object_lookup.patch | 204 --------------------- .../patches/0003-disable-dal-by-default.patch | 25 +++ .../0004-paging-changes-for-linux-4.6.patch | 42 ----- ...005-LRU-stuff-isn-t-available-until-4.7.x.patch | 48 ----- ...-of-vblank_disable_allowed-to-vblank_disa.patch | 29 --- ...ector-parameter-from-__drm_atomic_helper_.patch | 29 --- ...t-typo-in-bandwidth_calcs-causing-array-e.patch | 25 --- .../patches/0009-disable-dal-by-default.patch | 25 --- .../0010-remove-dependency-on-System.map.patch | 112 ----------- 14 files changed, 180 insertions(+), 576 deletions(-) create mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0001-Add-vga-switcheroo-handler-flag-for-4.8.patch delete mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0001-add-OS-detection-for-arch.patch create mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0002-Remove-dependency-on-System.map.patch delete mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0002-update-kcl_ttm_bo_reserve-for-linux-4.7.patch delete mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0003-add-kcl_drm_gem_object_lookup.patch create mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0003-disable-dal-by-default.patch delete mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0004-paging-changes-for-linux-4.6.patch delete mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0005-LRU-stuff-isn-t-available-until-4.7.x.patch delete mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0006-Change-name-of-vblank_disable_allowed-to-vblank_disa.patch delete mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0007-Remove-connector-parameter-from-__drm_atomic_helper_.patch delete mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0008-fix-apparent-typo-in-bandwidth_calcs-causing-array-e.patch delete mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0009-disable-dal-by-default.patch delete mode 100644 pkgs/os-specific/linux/amdgpu-pro/patches/0010-remove-dependency-on-System.map.patch (limited to 'pkgs/os-specific') diff --git a/pkgs/os-specific/linux/amdgpu-pro/default.nix b/pkgs/os-specific/linux/amdgpu-pro/default.nix index 856989381ef1..5c11fad35970 100644 --- a/pkgs/os-specific/linux/amdgpu-pro/default.nix +++ b/pkgs/os-specific/linux/amdgpu-pro/default.nix @@ -1,6 +1,7 @@ { stdenv, fetchurl, elfutils, mesa_noglu , xorg, patchelf, openssl, libdrm, libudev , libxcb, libxshmfence, epoxy, perl, zlib +, fetchFromGitHub , libsOnly ? false, kernel ? null }: @@ -42,6 +43,13 @@ in stdenv.mkDerivation rec { curlOpts = "--referer http://support.amd.com/en-us/kb-articles/Pages/AMDGPU-PRO-Beta-Driver-for-Vulkan-Release-Notes.aspx"; }; + vulkanOverlay = fetchFromGitHub { + owner = "Lucretia"; + repo = "vulkan-overlay"; + rev = "70558192e7ac16103e1ec6100c1bebd6f162c818"; + sha256 = "1ycl55m3wc72q0a6pkyhhzji7llliw8076aiynr60jyv6cnmcgdz"; + }; + hardeningDisable = [ "pic" "format" ]; inherit libsOnly; @@ -55,21 +63,18 @@ in stdenv.mkDerivation rec { ''; modulePatches = [ - ./patches/0001-add-OS-detection-for-arch.patch - ./patches/0002-update-kcl_ttm_bo_reserve-for-linux-4.7.patch - ./patches/0003-add-kcl_drm_gem_object_lookup.patch - ./patches/0004-paging-changes-for-linux-4.6.patch - ./patches/0005-LRU-stuff-isn-t-available-until-4.7.x.patch - ./patches/0006-Change-name-of-vblank_disable_allowed-to-vblank_disa.patch - ./patches/0007-Remove-connector-parameter-from-__drm_atomic_helper_.patch - ./patches/0008-fix-apparent-typo-in-bandwidth_calcs-causing-array-e.patch - ./patches/0009-disable-dal-by-default.patch - ./patches/0010-remove-dependency-on-System.map.patch + ./patches/0001-Add-vga-switcheroo-handler-flag-for-4.8.patch + ./patches/0002-Remove-dependency-on-System.map.patch + ./patches/0003-disable-dal-by-default.patch ]; patchPhase = optionalString (!libsOnly) '' pushd usr/src/amdgpu-pro-${build} - for patch in $modulePatches; do echo $patch; patch -p1 < $patch; done + for patch in $vulkanOverlay/sys-kernel/amdgpu-pro-dkms/files/${build}/*.patch $modulePatches + do + echo $patch + patch -f -p1 < $patch || true + done popd ''; diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0001-Add-vga-switcheroo-handler-flag-for-4.8.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0001-Add-vga-switcheroo-handler-flag-for-4.8.patch new file mode 100644 index 000000000000..eba98965e679 --- /dev/null +++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0001-Add-vga-switcheroo-handler-flag-for-4.8.patch @@ -0,0 +1,27 @@ +From c41b07cad36b1019e8d8debc8d46a7f2673982b7 Mon Sep 17 00:00:00 2001 +From: David McFarland +Date: Wed, 26 Oct 2016 22:19:05 -0300 +Subject: [PATCH 1/2] Add vga switcheroo handler flag for 4.8 + +--- + amd/amdgpu/amdgpu_atpx_handler.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/amd/amdgpu/amdgpu_atpx_handler.c b/amd/amdgpu/amdgpu_atpx_handler.c +index cc9b998..e48d935 100644 +--- a/amd/amdgpu/amdgpu_atpx_handler.c ++++ b/amd/amdgpu/amdgpu_atpx_handler.c +@@ -565,7 +565,9 @@ void amdgpu_register_atpx_handler(void) + if (!r) + return; + +- vga_switcheroo_register_handler(&amdgpu_atpx_handler); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) ++ vga_switcheroo_register_handler(&amdgpu_atpx_handler, 0); ++#endif + } + + /** +-- +2.10.0 + diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0001-add-OS-detection-for-arch.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0001-add-OS-detection-for-arch.patch deleted file mode 100644 index 46302ae0ea89..000000000000 --- a/pkgs/os-specific/linux/amdgpu-pro/patches/0001-add-OS-detection-for-arch.patch +++ /dev/null @@ -1,26 +0,0 @@ -From e78ede724fff53fc0220999f6381242142ce8c33 Mon Sep 17 00:00:00 2001 -From: David McFarland -Date: Sun, 21 Aug 2016 16:30:25 -0300 -Subject: [PATCH 1/8] add OS detection for arch - ---- - amd/backport/Makefile | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/amd/backport/Makefile b/amd/backport/Makefile -index 0c285ef..6447a15 100644 ---- a/amd/backport/Makefile -+++ b/amd/backport/Makefile -@@ -17,6 +17,9 @@ else ifeq ("ubuntu",$(OS_NAME)) - ccflags-y += -DOS_NAME_UBUNTU - else ifeq ("steamos",$(OS_NAME)) - ccflags-y += -DOS_NAME_STEAMOS -+else ifeq ("arch",$(OS_NAME)) -+ccflags-y += -DOS_NAME_ARCH -+OS_VERSION = "0.0" - else - ccflags-y += -DOS_NAME_UNKNOWN - endif --- -2.9.3 - diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0002-Remove-dependency-on-System.map.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0002-Remove-dependency-on-System.map.patch new file mode 100644 index 000000000000..3e36e9166bb3 --- /dev/null +++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0002-Remove-dependency-on-System.map.patch @@ -0,0 +1,112 @@ +From e03fd9f392af963a534dd3c40df06e81976766e6 Mon Sep 17 00:00:00 2001 +From: David McFarland +Date: Wed, 26 Oct 2016 22:26:39 -0300 +Subject: [PATCH 2/2] Remove dependency on System.map + +--- + amd/backport/Makefile | 3 +-- + amd/backport/kcl_fence.c | 10 ++++++++-- + amd/backport/symbols | 3 --- + dkms.conf | 1 - + pre-build.sh | 32 -------------------------------- + 5 files changed, 9 insertions(+), 40 deletions(-) + delete mode 100644 amd/backport/symbols + delete mode 100755 pre-build.sh + +diff --git a/amd/backport/Makefile b/amd/backport/Makefile +index dcc94d5..ef27e94 100644 +--- a/amd/backport/Makefile ++++ b/amd/backport/Makefile +@@ -55,10 +55,9 @@ ccflags-y += -DOS_NAME_RHEL_7 + endif + endif + +-BACKPORT_OBJS = symbols.o + endif + +-BACKPORT_OBJS += kcl_drm.o kcl_ttm.o kcl_amdgpu.o kcl_fence.o kcl_mn.o ++BACKPORT_OBJS = kcl_drm.o kcl_ttm.o kcl_amdgpu.o kcl_fence.o kcl_mn.o + + amdgpu-y += $(addprefix ../backport/,$(BACKPORT_OBJS)) + +diff --git a/amd/backport/kcl_fence.c b/amd/backport/kcl_fence.c +index 2141eef..ceef1fe 100644 +--- a/amd/backport/kcl_fence.c ++++ b/amd/backport/kcl_fence.c +@@ -22,8 +22,14 @@ struct default_wait_cb { + struct task_struct *task; + }; + +-extern void +-(*fence_default_wait_cb)(struct fence *fence, struct fence_cb *cb); ++static void ++fence_default_wait_cb(struct fence *fence, struct fence_cb *cb) ++{ ++ struct default_wait_cb *wait = ++ container_of(cb, struct default_wait_cb, base); ++ ++ wake_up_process(wait->task); ++} + + signed long + _kcl_fence_wait_any_timeout(struct fence **fences, uint32_t count, +diff --git a/amd/backport/symbols b/amd/backport/symbols +deleted file mode 100644 +index 2d3f2ee..0000000 +--- a/amd/backport/symbols ++++ /dev/null +@@ -1,3 +0,0 @@ +-SYMS="" +- +-SYMS+="fence_default_wait_cb" +diff --git a/dkms.conf b/dkms.conf +index f553501..e50ec3d 100644 +--- a/dkms.conf ++++ b/dkms.conf +@@ -4,4 +4,3 @@ BUILT_MODULE_NAME[0]="amdgpu" + BUILT_MODULE_LOCATION[0]="amd/amdgpu" + DEST_MODULE_LOCATION[0]="/kernel/drivers/gpu/drm/amd/amdgpu" + AUTOINSTALL="yes" +-PRE_BUILD="pre-build.sh $kernelver" +\ No newline at end of file +diff --git a/pre-build.sh b/pre-build.sh +deleted file mode 100755 +index 6f45523..0000000 +--- a/pre-build.sh ++++ /dev/null +@@ -1,32 +0,0 @@ +-#!/bin/bash +- +-KERNELVER=$1 +-KERNELVER_BASE=${KERNELVER%%-*} +- +-version_lt () { +- newest=$((echo "$1"; echo "$2") | sort -V | tail -n1) +- [ "$1" != "$newest" ] +-} +- +-version_ge () { +- newest=$((echo "$1"; echo "$2") | sort -V | tail -n1) +- [ "$1" = "$newest" ] +-} +- +-version_gt () { +- oldest=$((echo "$1"; echo "$2") | sort -V | head -n1) +- [ "$1" != "$oldest" ] +-} +- +-version_le () { +- oldest=$((echo "$1"; echo "$2") | sort -V | head -n1) +- [ "$1" = "$oldest" ] +-} +- +-source amd/backport/symbols +- +-echo '// auto generated by DKMS pre-build.sh' > amd/backport/symbols.c +-for sym in $SYMS; do +- addr=$(grep $sym /boot/System.map*-$KERNELVER | awk -F' ' '{print $1}') +- echo "void *$sym = (void *)0x$addr;" >> amd/backport/symbols.c +-done +-- +2.10.0 + diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0002-update-kcl_ttm_bo_reserve-for-linux-4.7.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0002-update-kcl_ttm_bo_reserve-for-linux-4.7.patch deleted file mode 100644 index 4101662a4ebe..000000000000 --- a/pkgs/os-specific/linux/amdgpu-pro/patches/0002-update-kcl_ttm_bo_reserve-for-linux-4.7.patch +++ /dev/null @@ -1,25 +0,0 @@ -From d84bd62a10308efb6a414e8f6582a7b1e9860638 Mon Sep 17 00:00:00 2001 -From: David McFarland -Date: Sun, 21 Aug 2016 16:31:12 -0300 -Subject: [PATCH 2/8] update kcl_ttm_bo_reserve for linux-4.7 - ---- - amd/backport/include/kcl/kcl_ttm.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/amd/backport/include/kcl/kcl_ttm.h b/amd/backport/include/kcl/kcl_ttm.h -index 3575004..0d1560d 100644 ---- a/amd/backport/include/kcl/kcl_ttm.h -+++ b/amd/backport/include/kcl/kcl_ttm.h -@@ -84,7 +84,7 @@ static inline int kcl_ttm_bo_reserve(struct ttm_buffer_object *bo, - bool interruptible, bool no_wait, - struct ww_acquire_ctx *ticket) - { --#if defined(BUILD_AS_DKMS) -+#if defined(BUILD_AS_DKMS) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0) - return ttm_bo_reserve(bo, interruptible, no_wait, false, ticket); - #else - return ttm_bo_reserve(bo, interruptible, no_wait, ticket); --- -2.9.3 - diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0003-add-kcl_drm_gem_object_lookup.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0003-add-kcl_drm_gem_object_lookup.patch deleted file mode 100644 index 214b8effd9d3..000000000000 --- a/pkgs/os-specific/linux/amdgpu-pro/patches/0003-add-kcl_drm_gem_object_lookup.patch +++ /dev/null @@ -1,204 +0,0 @@ -From 2637dfe990e4c277bc724f6ba48e6661506805ec Mon Sep 17 00:00:00 2001 -From: David McFarland -Date: Sun, 21 Aug 2016 16:37:34 -0300 -Subject: [PATCH 3/8] add kcl_drm_gem_object_lookup - ---- - amd/amdgpu/amdgpu_atpx_handler.c | 4 ++++ - amd/amdgpu/amdgpu_bo_list.c | 2 +- - amd/amdgpu/amdgpu_cs.c | 2 +- - amd/amdgpu/amdgpu_display.c | 2 +- - amd/amdgpu/amdgpu_gem.c | 10 +++++----- - amd/amdgpu/dce_v10_0.c | 2 +- - amd/amdgpu/dce_v11_0.c | 2 +- - amd/amdgpu/dce_v8_0.c | 2 +- - amd/backport/include/kcl/kcl_drm.h | 11 +++++++++++ - amd/dal/amdgpu_dm/amdgpu_dm_types.c | 2 +- - 10 files changed, 27 insertions(+), 12 deletions(-) - -diff --git a/amd/amdgpu/amdgpu_atpx_handler.c b/amd/amdgpu/amdgpu_atpx_handler.c -index cc9b998..7e47478 100644 ---- a/amd/amdgpu/amdgpu_atpx_handler.c -+++ b/amd/amdgpu/amdgpu_atpx_handler.c -@@ -565,7 +565,11 @@ void amdgpu_register_atpx_handler(void) - if (!r) - return; - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) -+ vga_switcheroo_register_handler(&amdgpu_atpx_handler, 0); -+#else - vga_switcheroo_register_handler(&amdgpu_atpx_handler); -+#endif - } - - /** -diff --git a/amd/amdgpu/amdgpu_bo_list.c b/amd/amdgpu/amdgpu_bo_list.c -index 35d0856..1d163ec 100644 ---- a/amd/amdgpu/amdgpu_bo_list.c -+++ b/amd/amdgpu/amdgpu_bo_list.c -@@ -106,7 +106,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev, - struct amdgpu_bo *bo; - struct mm_struct *usermm; - -- gobj = drm_gem_object_lookup(adev->ddev, filp, info[i].bo_handle); -+ gobj = kcl_drm_gem_object_lookup(adev->ddev, filp, info[i].bo_handle); - if (!gobj) { - r = -ENOENT; - goto error_free; -diff --git a/amd/amdgpu/amdgpu_cs.c b/amd/amdgpu/amdgpu_cs.c -index d16ed26..b0390b5 100644 ---- a/amd/amdgpu/amdgpu_cs.c -+++ b/amd/amdgpu/amdgpu_cs.c -@@ -92,7 +92,7 @@ static int amdgpu_cs_user_fence_chunk(struct amdgpu_cs_parser *p, - { - struct drm_gem_object *gobj; - -- gobj = drm_gem_object_lookup(p->adev->ddev, p->filp, -+ gobj = kcl_drm_gem_object_lookup(p->adev->ddev, p->filp, - data->handle); - if (gobj == NULL) - return -EINVAL; -diff --git a/amd/amdgpu/amdgpu_display.c b/amd/amdgpu/amdgpu_display.c -index 46326b3..9b5441f 100644 ---- a/amd/amdgpu/amdgpu_display.c -+++ b/amd/amdgpu/amdgpu_display.c -@@ -594,7 +594,7 @@ amdgpu_user_framebuffer_create(struct drm_device *dev, - struct amdgpu_framebuffer *amdgpu_fb; - int ret; - -- obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]); -+ obj = kcl_drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]); - if (obj == NULL) { - dev_err(&dev->pdev->dev, "No GEM object associated to handle 0x%08X, " - "can't create framebuffer\n", mode_cmd->handles[0]); -diff --git a/amd/amdgpu/amdgpu_gem.c b/amd/amdgpu/amdgpu_gem.c -index 0069aec..d10c282 100644 ---- a/amd/amdgpu/amdgpu_gem.c -+++ b/amd/amdgpu/amdgpu_gem.c -@@ -397,7 +397,7 @@ int amdgpu_mode_dumb_mmap(struct drm_file *filp, - struct drm_gem_object *gobj; - struct amdgpu_bo *robj; - -- gobj = drm_gem_object_lookup(dev, filp, handle); -+ gobj = kcl_drm_gem_object_lookup(dev, filp, handle); - if (gobj == NULL) { - return -ENOENT; - } -@@ -461,7 +461,7 @@ int amdgpu_gem_wait_idle_ioctl(struct drm_device *dev, void *data, - int r = 0; - long ret; - -- gobj = drm_gem_object_lookup(dev, filp, handle); -+ gobj = kcl_drm_gem_object_lookup(dev, filp, handle); - if (gobj == NULL) { - return -ENOENT; - } -@@ -495,7 +495,7 @@ int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data, - int r = -1; - - DRM_DEBUG("%d \n", args->handle); -- gobj = drm_gem_object_lookup(dev, filp, args->handle); -+ gobj = kcl_drm_gem_object_lookup(dev, filp, args->handle); - if (gobj == NULL) - return -ENOENT; - robj = gem_to_amdgpu_bo(gobj); -@@ -643,7 +643,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data, - return -EINVAL; - } - -- gobj = drm_gem_object_lookup(dev, filp, args->handle); -+ gobj = kcl_drm_gem_object_lookup(dev, filp, args->handle); - if (gobj == NULL) - return -ENOENT; - rbo = gem_to_amdgpu_bo(gobj); -@@ -705,7 +705,7 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data, - struct amdgpu_bo *robj; - int r; - -- gobj = drm_gem_object_lookup(dev, filp, args->handle); -+ gobj = kcl_drm_gem_object_lookup(dev, filp, args->handle); - if (gobj == NULL) { - return -ENOENT; - } -diff --git a/amd/amdgpu/dce_v10_0.c b/amd/amdgpu/dce_v10_0.c -index 7554dd7..6d38754 100644 ---- a/amd/amdgpu/dce_v10_0.c -+++ b/amd/amdgpu/dce_v10_0.c -@@ -2594,7 +2594,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc, - return -EINVAL; - } - -- obj = drm_gem_object_lookup(crtc->dev, file_priv, handle); -+ obj = kcl_drm_gem_object_lookup(crtc->dev, file_priv, handle); - if (!obj) { - DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, amdgpu_crtc->crtc_id); - return -ENOENT; -diff --git a/amd/amdgpu/dce_v11_0.c b/amd/amdgpu/dce_v11_0.c -index d9c9b88..93dbc1a 100644 ---- a/amd/amdgpu/dce_v11_0.c -+++ b/amd/amdgpu/dce_v11_0.c -@@ -2604,7 +2604,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc, - return -EINVAL; - } - -- obj = drm_gem_object_lookup(crtc->dev, file_priv, handle); -+ obj = kcl_drm_gem_object_lookup(crtc->dev, file_priv, handle); - if (!obj) { - DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, amdgpu_crtc->crtc_id); - return -ENOENT; -diff --git a/amd/amdgpu/dce_v8_0.c b/amd/amdgpu/dce_v8_0.c -index 7a027ce..c56a298 100644 ---- a/amd/amdgpu/dce_v8_0.c -+++ b/amd/amdgpu/dce_v8_0.c -@@ -2501,7 +2501,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc, - return -EINVAL; - } - -- obj = drm_gem_object_lookup(crtc->dev, file_priv, handle); -+ obj = kcl_drm_gem_object_lookup(crtc->dev, file_priv, handle); - if (!obj) { - DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, amdgpu_crtc->crtc_id); - return -ENOENT; -diff --git a/amd/backport/include/kcl/kcl_drm.h b/amd/backport/include/kcl/kcl_drm.h -index a65ee25..5a8a7b3 100644 ---- a/amd/backport/include/kcl/kcl_drm.h -+++ b/amd/backport/include/kcl/kcl_drm.h -@@ -3,6 +3,7 @@ - - #include - #include -+#include - - #if defined(BUILD_AS_DKMS) - extern int drm_pcie_get_max_link_width(struct drm_device *dev, u32 *mlw); -@@ -123,4 +124,14 @@ static inline int kcl_drm_universal_plane_init(struct drm_device *dev, struct dr - #endif - } - -+static inline struct drm_gem_object *kcl_drm_gem_object_lookup(struct drm_device *dev, -+ struct drm_file *filp, -+ u32 handle) { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) -+ return drm_gem_object_lookup(filp, handle); -+#else -+ return drm_gem_object_lookup(dev, filp, handle); -+#endif -+} -+ - #endif /* AMDGPU_BACKPORT_KCL_DRM_H */ -diff --git a/amd/dal/amdgpu_dm/amdgpu_dm_types.c b/amd/dal/amdgpu_dm/amdgpu_dm_types.c -index 3f357a5..2e2d2e6 100644 ---- a/amd/dal/amdgpu_dm/amdgpu_dm_types.c -+++ b/amd/dal/amdgpu_dm/amdgpu_dm_types.c -@@ -152,7 +152,7 @@ static int dm_crtc_pin_cursor_bo_new( - - amdgpu_crtc = to_amdgpu_crtc(crtc); - -- obj = drm_gem_object_lookup(crtc->dev, file_priv, handle); -+ obj = kcl_drm_gem_object_lookup(crtc->dev, file_priv, handle); - - if (!obj) { - DRM_ERROR( --- -2.9.3 - diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0003-disable-dal-by-default.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0003-disable-dal-by-default.patch new file mode 100644 index 000000000000..05bcbf8bd061 --- /dev/null +++ b/pkgs/os-specific/linux/amdgpu-pro/patches/0003-disable-dal-by-default.patch @@ -0,0 +1,25 @@ +From 49d45957ddaafe13a9cc7bacd1b9665fe9c517ac Mon Sep 17 00:00:00 2001 +From: David McFarland +Date: Thu, 25 Aug 2016 22:17:06 -0300 +Subject: [PATCH] disable dal by default + +--- + amd/amdgpu/amdgpu_drv.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/amd/amdgpu/amdgpu_drv.c b/amd/amdgpu/amdgpu_drv.c +index 793528b..9a4dfcc 100644 +--- a/amd/amdgpu/amdgpu_drv.c ++++ b/amd/amdgpu/amdgpu_drv.c +@@ -79,7 +79,7 @@ int amdgpu_vm_block_size = -1; + int amdgpu_vm_fault_stop = 0; + int amdgpu_vm_debug = 0; + int amdgpu_exp_hw_support = 0; +-int amdgpu_dal = -1; ++int amdgpu_dal = 0; + int amdgpu_sched_jobs = 32; + int amdgpu_sched_hw_submission = 2; + int amdgpu_powerplay = -1; +-- +2.9.3 + diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0004-paging-changes-for-linux-4.6.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0004-paging-changes-for-linux-4.6.patch deleted file mode 100644 index 54394b7879be..000000000000 --- a/pkgs/os-specific/linux/amdgpu-pro/patches/0004-paging-changes-for-linux-4.6.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 2bd83488ccea22bb9e399986c171cccc3b6beb93 Mon Sep 17 00:00:00 2001 -From: David McFarland -Date: Sun, 21 Aug 2016 16:40:32 -0300 -Subject: [PATCH 4/8] paging changes for linux-4.6 - ---- - amd/amdgpu/amdgpu_ttm.c | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -diff --git a/amd/amdgpu/amdgpu_ttm.c b/amd/amdgpu/amdgpu_ttm.c -index 7bdebde..8b676c2 100644 ---- a/amd/amdgpu/amdgpu_ttm.c -+++ b/amd/amdgpu/amdgpu_ttm.c -@@ -548,8 +548,12 @@ int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, struct page **pages) - list_add(&guptask.list, >t->guptasks); - spin_unlock(>t->guptasklock); - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) -+ r = get_user_pages(userptr, num_pages, write, 0, p, NULL); -+#else - r = get_user_pages(current, current->mm, userptr, num_pages, -- write, 0, p, NULL); -+ write, 0, p, NULL); -+#endif - - spin_lock(>t->guptasklock); - list_del(&guptask.list); -@@ -625,7 +629,11 @@ static void amdgpu_ttm_tt_unpin_userptr(struct ttm_tt *ttm) - set_page_dirty(page); - - mark_page_accessed(page); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) -+ put_page(page); -+#else - page_cache_release(page); -+#endif - } - - sg_free_table(ttm->sg); --- -2.9.3 - diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0005-LRU-stuff-isn-t-available-until-4.7.x.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0005-LRU-stuff-isn-t-available-until-4.7.x.patch deleted file mode 100644 index 6da3e46a3ee6..000000000000 --- a/pkgs/os-specific/linux/amdgpu-pro/patches/0005-LRU-stuff-isn-t-available-until-4.7.x.patch +++ /dev/null @@ -1,48 +0,0 @@ -From c41c15fa04e363c41272e7b5d767710170691347 Mon Sep 17 00:00:00 2001 -From: "Luke A. Guest" -Date: Mon, 4 Jul 2016 19:19:45 +0100 -Subject: [PATCH 5/8] LRU stuff isn't available until >= 4.7.x - ---- - amd/amdgpu/amdgpu_ttm.c | 4 ++-- - amd/backport/kcl_ttm.c | 2 +- - 2 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/amd/amdgpu/amdgpu_ttm.c b/amd/amdgpu/amdgpu_ttm.c -index 8b676c2..752d065 100644 ---- a/amd/amdgpu/amdgpu_ttm.c -+++ b/amd/amdgpu/amdgpu_ttm.c -@@ -907,7 +907,7 @@ uint32_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm, - return flags; - } - --#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) - - static void amdgpu_ttm_lru_removal(struct ttm_buffer_object *tbo) - { -@@ -969,7 +969,7 @@ static struct ttm_bo_driver amdgpu_bo_driver = { - .fault_reserve_notify = &amdgpu_bo_fault_reserve_notify, - .io_mem_reserve = &amdgpu_ttm_io_mem_reserve, - .io_mem_free = &amdgpu_ttm_io_mem_free, --#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) - .lru_removal = &amdgpu_ttm_lru_removal, - .lru_tail = &amdgpu_ttm_lru_tail, - .swap_lru_tail = &amdgpu_ttm_swap_lru_tail, -diff --git a/amd/backport/kcl_ttm.c b/amd/backport/kcl_ttm.c -index 24f7a83..1a2cb7b 100644 ---- a/amd/backport/kcl_ttm.c -+++ b/amd/backport/kcl_ttm.c -@@ -7,7 +7,7 @@ static int _kcl_ttm_bo_del_from_lru(struct ttm_buffer_object *bo) - { - int put_count = 0; - --#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) - struct ttm_bo_device *bdev = bo->bdev; - - if (bdev->driver->lru_removal) --- -2.9.3 - diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0006-Change-name-of-vblank_disable_allowed-to-vblank_disa.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0006-Change-name-of-vblank_disable_allowed-to-vblank_disa.patch deleted file mode 100644 index 5be5acad00d6..000000000000 --- a/pkgs/os-specific/linux/amdgpu-pro/patches/0006-Change-name-of-vblank_disable_allowed-to-vblank_disa.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 5b90b8d8ab44637c707623b25ee98aa4ebded308 Mon Sep 17 00:00:00 2001 -From: "Luke A. Guest" -Date: Mon, 4 Jul 2016 19:30:08 +0100 -Subject: [PATCH 6/8] Change name of vblank_disable_allowed to - vblank_disable_immediate under 4.7.x. - ---- - amd/amdgpu/amdgpu_irq.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/amd/amdgpu/amdgpu_irq.c b/amd/amdgpu/amdgpu_irq.c -index d13865a..5cfa69f 100644 ---- a/amd/amdgpu/amdgpu_irq.c -+++ b/amd/amdgpu/amdgpu_irq.c -@@ -240,7 +240,11 @@ int amdgpu_irq_init(struct amdgpu_device *adev) - INIT_WORK(&adev->hotplug_work, - amdgpu_hotplug_work_func); - } -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) -+ adev->ddev->vblank_disable_immediate = true; -+#else - adev->ddev->vblank_disable_allowed = true; -+#endif - - INIT_WORK(&adev->reset_work, amdgpu_irq_reset_work_func); - --- -2.9.3 - diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0007-Remove-connector-parameter-from-__drm_atomic_helper_.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0007-Remove-connector-parameter-from-__drm_atomic_helper_.patch deleted file mode 100644 index 13d4a282ac82..000000000000 --- a/pkgs/os-specific/linux/amdgpu-pro/patches/0007-Remove-connector-parameter-from-__drm_atomic_helper_.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 27ef2ce0d4d8eeb3bca32ddeae503f0a334832aa Mon Sep 17 00:00:00 2001 -From: "Luke A. Guest" -Date: Mon, 4 Jul 2016 19:41:08 +0100 -Subject: [PATCH 7/8] Remove connector parameter from - __drm_atomic_helper_connector_destroy_state for 4.7.x kernels. - ---- - amd/dal/amdgpu_dm/amdgpu_dm_types.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/amd/dal/amdgpu_dm/amdgpu_dm_types.c b/amd/dal/amdgpu_dm/amdgpu_dm_types.c -index 2e2d2e6..cd34607 100644 ---- a/amd/dal/amdgpu_dm/amdgpu_dm_types.c -+++ b/amd/dal/amdgpu_dm/amdgpu_dm_types.c -@@ -1205,7 +1205,11 @@ void amdgpu_dm_connector_atomic_destroy_state( - struct dm_connector_state *dm_state = - to_dm_connector_state(state); - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) -+ __drm_atomic_helper_connector_destroy_state(state); -+#else - __drm_atomic_helper_connector_destroy_state(connector, state); -+#endif - - kfree(dm_state); - } --- -2.9.3 - diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0008-fix-apparent-typo-in-bandwidth_calcs-causing-array-e.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0008-fix-apparent-typo-in-bandwidth_calcs-causing-array-e.patch deleted file mode 100644 index 693ad8b2f40d..000000000000 --- a/pkgs/os-specific/linux/amdgpu-pro/patches/0008-fix-apparent-typo-in-bandwidth_calcs-causing-array-e.patch +++ /dev/null @@ -1,25 +0,0 @@ -From c9f2501131da0d9173e21f7e8ff5741a7fcfedb6 Mon Sep 17 00:00:00 2001 -From: David McFarland -Date: Sun, 21 Aug 2016 16:58:45 -0300 -Subject: [PATCH 8/8] fix apparent typo in bandwidth_calcs causing array error - ---- - amd/dal/dc/calcs/bandwidth_calcs.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/amd/dal/dc/calcs/bandwidth_calcs.c b/amd/dal/dc/calcs/bandwidth_calcs.c -index 8a19139..c4ededd 100644 ---- a/amd/dal/dc/calcs/bandwidth_calcs.c -+++ b/amd/dal/dc/calcs/bandwidth_calcs.c -@@ -3181,7 +3181,7 @@ static void calculate_bandwidth( - bw_int_to_fixed( - 2), - vbios->mcifwrmc_urgent_latency), -- results->dmif_burst_time[i][j]), -+ results->dmif_burst_time[results->y_clk_level][results->sclk_level]), - results->mcifwr_burst_time[results->y_clk_level][results->sclk_level])), - results->dispclk), - bw_int_to_fixed( --- -2.9.3 - diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0009-disable-dal-by-default.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0009-disable-dal-by-default.patch deleted file mode 100644 index 05bcbf8bd061..000000000000 --- a/pkgs/os-specific/linux/amdgpu-pro/patches/0009-disable-dal-by-default.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 49d45957ddaafe13a9cc7bacd1b9665fe9c517ac Mon Sep 17 00:00:00 2001 -From: David McFarland -Date: Thu, 25 Aug 2016 22:17:06 -0300 -Subject: [PATCH] disable dal by default - ---- - amd/amdgpu/amdgpu_drv.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/amd/amdgpu/amdgpu_drv.c b/amd/amdgpu/amdgpu_drv.c -index 793528b..9a4dfcc 100644 ---- a/amd/amdgpu/amdgpu_drv.c -+++ b/amd/amdgpu/amdgpu_drv.c -@@ -79,7 +79,7 @@ int amdgpu_vm_block_size = -1; - int amdgpu_vm_fault_stop = 0; - int amdgpu_vm_debug = 0; - int amdgpu_exp_hw_support = 0; --int amdgpu_dal = -1; -+int amdgpu_dal = 0; - int amdgpu_sched_jobs = 32; - int amdgpu_sched_hw_submission = 2; - int amdgpu_powerplay = -1; --- -2.9.3 - diff --git a/pkgs/os-specific/linux/amdgpu-pro/patches/0010-remove-dependency-on-System.map.patch b/pkgs/os-specific/linux/amdgpu-pro/patches/0010-remove-dependency-on-System.map.patch deleted file mode 100644 index ec8f2c5a5999..000000000000 --- a/pkgs/os-specific/linux/amdgpu-pro/patches/0010-remove-dependency-on-System.map.patch +++ /dev/null @@ -1,112 +0,0 @@ -From fbc0d704f47526ca38f518b60237962cc6b08305 Mon Sep 17 00:00:00 2001 -From: David McFarland -Date: Thu, 25 Aug 2016 23:08:02 -0300 -Subject: [PATCH] remove dependency on System.map - ---- - amd/backport/Makefile | 3 +-- - amd/backport/kcl_fence.c | 10 ++++++++-- - amd/backport/symbols | 3 --- - dkms.conf | 1 - - pre-build.sh | 32 -------------------------------- - 5 files changed, 9 insertions(+), 40 deletions(-) - delete mode 100644 amd/backport/symbols - delete mode 100755 pre-build.sh - -diff --git a/amd/backport/Makefile b/amd/backport/Makefile -index 6447a15..4682e0f 100644 ---- a/amd/backport/Makefile -+++ b/amd/backport/Makefile -@@ -53,10 +53,9 @@ ccflags-y += -DOS_NAME_RHEL_7 - endif - endif - --BACKPORT_OBJS = symbols.o - endif - --BACKPORT_OBJS += kcl_drm.o kcl_ttm.o kcl_amdgpu.o kcl_fence.o kcl_mn.o -+BACKPORT_OBJS = kcl_drm.o kcl_ttm.o kcl_amdgpu.o kcl_fence.o kcl_mn.o - - amdgpu-y += $(addprefix ../backport/,$(BACKPORT_OBJS)) - -diff --git a/amd/backport/kcl_fence.c b/amd/backport/kcl_fence.c -index 2141eef..ceef1fe 100644 ---- a/amd/backport/kcl_fence.c -+++ b/amd/backport/kcl_fence.c -@@ -22,8 +22,14 @@ struct default_wait_cb { - struct task_struct *task; - }; - --extern void --(*fence_default_wait_cb)(struct fence *fence, struct fence_cb *cb); -+static void -+fence_default_wait_cb(struct fence *fence, struct fence_cb *cb) -+{ -+ struct default_wait_cb *wait = -+ container_of(cb, struct default_wait_cb, base); -+ -+ wake_up_process(wait->task); -+} - - signed long - _kcl_fence_wait_any_timeout(struct fence **fences, uint32_t count, -diff --git a/amd/backport/symbols b/amd/backport/symbols -deleted file mode 100644 -index 2d3f2ee..0000000 ---- a/amd/backport/symbols -+++ /dev/null -@@ -1,3 +0,0 @@ --SYMS="" -- --SYMS+="fence_default_wait_cb" -diff --git a/dkms.conf b/dkms.conf -index 9ca148e..36be480 100644 ---- a/dkms.conf -+++ b/dkms.conf -@@ -4,4 +4,3 @@ BUILT_MODULE_NAME[0]="amdgpu" - BUILT_MODULE_LOCATION[0]="amd/amdgpu" - DEST_MODULE_LOCATION[0]="/extra" - AUTOINSTALL="yes" --PRE_BUILD="pre-build.sh $kernelver" -\ No newline at end of file -diff --git a/pre-build.sh b/pre-build.sh -deleted file mode 100755 -index 88ec680..0000000 ---- a/pre-build.sh -+++ /dev/null -@@ -1,32 +0,0 @@ --#!/bin/bash -- --KERNELVER=$1 --KERNELVER_BASE=${KERNELVER%%-*} -- --version_lt () { -- newest=$((echo "$1"; echo "$2") | sort -V | tail -n1) -- [ "$1" != "$newest" ] --} -- --version_ge () { -- newest=$((echo "$1"; echo "$2") | sort -V | tail -n1) -- [ "$1" = "$newest" ] --} -- --version_gt () { -- oldest=$((echo "$1"; echo "$2") | sort -V | head -n1) -- [ "$1" != "$oldest" ] --} -- --version_le () { -- oldest=$((echo "$1"; echo "$2") | sort -V | head -n1) -- [ "$1" = "$oldest" ] --} -- --source amd/backport/symbols -- --echo '// auto generated by DKMS pre-build.sh' > amd/backport/symbols.c --for sym in $SYMS; do -- addr=$(grep $sym /boot/System.map-$KERNELVER | awk -F' ' '{print $1}') -- echo "void *$sym = (void *)0x$addr;" >> amd/backport/symbols.c --done --- -2.9.3 - -- cgit 1.4.1