aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorKridsada Thanabulpong2019-07-22 01:50:39 +0700
committerKridsada Thanabulpong2019-07-24 15:18:25 +0700
commit228feaec9f5cb60054684b52c59bc076b8637fef (patch)
tree6eebbef355a6c4982fd9db6691309c97577dd666
downloadaur-228feaec9f5cb60054684b52c59bc076b8637fef.tar.gz
Initial commit.
-rw-r--r--.SRCINFO53
-rw-r--r--.gitignore3
-rw-r--r--PKGBUILD84
-rw-r--r--README.md5
-rw-r--r--patch_Makefile.patch30
-rw-r--r--patch_amd_amdgpu_amdgpu_acpi_c.patch12
-rw-r--r--patch_amd_amdgpu_amdgpu_connectors_c.patch12
-rw-r--r--patch_amd_amdgpu_amdgpu_device_c.patch24
-rw-r--r--patch_amd_amdgpu_amdgpu_drv_c.patch25
-rw-r--r--patch_amd_amdgpu_amdgpu_fb_c.patch23
-rw-r--r--patch_amd_amdgpu_amdgpu_irq_c.patch12
-rw-r--r--patch_amd_amdgpu_amdgpu_mn_c.patch49
-rw-r--r--patch_amd_amdgpu_dce_v10_0_c.patch21
-rw-r--r--patch_amd_amdgpu_dce_v11_0_c.patch21
-rw-r--r--patch_amd_amdgpu_dce_v6_0_c.patch31
-rw-r--r--patch_amd_amdgpu_dce_v8_0_c.patch21
-rw-r--r--patch_amd_amdgpu_dce_virtual_c.patch12
-rw-r--r--patch_amd_amdgpu_gmc_v6_0_c.patch14
-rw-r--r--patch_amd_amdgpu_gmc_v7_0_c.patch14
-rw-r--r--patch_amd_amdgpu_gmc_v8_0_c.patch14
-rw-r--r--patch_amd_amdgpu_gmc_v9_0_c.patch14
-rw-r--r--patch_amd_amdkfd_kfd_doorbell_c.patch15
-rw-r--r--patch_amd_display_amdgpu_dm_amdgpu_dm_c.patch21
-rw-r--r--patch_amd_display_amdgpu_dm_amdgpu_dm_mst_types_c.patch12
24 files changed, 542 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..f8c969308bf9
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,53 @@
+pkgbase = amdgpu-dkms
+ pkgdesc = DKMS AMDGPU driver from AMD
+ pkgver = 19.30_838629
+ pkgrel = 2
+ url = https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-navi-linux
+ arch = x86_64
+ license = custom
+ depends = dkms
+ source = https://drivers.amd.com/drivers/linux/amdgpu-pro-19.30-838629-ubuntu-18.04.tar.xz
+ source = patch_amd_amdgpu_amdgpu_acpi_c.patch
+ source = patch_amd_amdgpu_amdgpu_connectors_c.patch
+ source = patch_amd_amdgpu_amdgpu_device_c.patch
+ source = patch_amd_amdgpu_amdgpu_drv_c.patch
+ source = patch_amd_amdgpu_amdgpu_fb_c.patch
+ source = patch_amd_amdgpu_amdgpu_irq_c.patch
+ source = patch_amd_amdgpu_amdgpu_mn_c.patch
+ source = patch_amd_amdgpu_dce_v10_0_c.patch
+ source = patch_amd_amdgpu_dce_v11_0_c.patch
+ source = patch_amd_amdgpu_dce_v6_0_c.patch
+ source = patch_amd_amdgpu_dce_v8_0_c.patch
+ source = patch_amd_amdgpu_dce_virtual_c.patch
+ source = patch_amd_amdgpu_gmc_v6_0_c.patch
+ source = patch_amd_amdgpu_gmc_v7_0_c.patch
+ source = patch_amd_amdgpu_gmc_v8_0_c.patch
+ source = patch_amd_amdgpu_gmc_v9_0_c.patch
+ source = patch_amd_amdkfd_kfd_doorbell_c.patch
+ source = patch_amd_display_amdgpu_dm_amdgpu_dm_c.patch
+ source = patch_amd_display_amdgpu_dm_amdgpu_dm_mst_types_c.patch
+ source = patch_Makefile.patch
+ sha256sums = e2eb0a34745ecb9e244f81e0f3af8e4ab063d699dbc3e1a1e0867e8ce773d473
+ sha256sums = d575728fbe9e53586a30c24865a4741b19ffb29e9845a2dd935cac3faea4bec9
+ sha256sums = be0940ccf42c941a5537acfeff299b2b0588e7e5e8f01a53e76a01b30efca2fd
+ sha256sums = aa09dc25dfdfbbcb1ccd16f5420f9f8291c5db97e7d366828244460015262f4a
+ sha256sums = f169f7731877be9de1f2222b1d70658a057a6fc653b4b7bb820f9d88a0ba29e4
+ sha256sums = 62a6958c51817f53aeaf6d839132ebf4c81964658f6930146ac802d002d0ff74
+ sha256sums = ad824a6e0d30ed93fbe68b532029d70aca7bdacb3c227c35b835a4471c0d18f7
+ sha256sums = 7c8efd69177fc84cb340feb1940b224b684ba6459327e0f09ff720e1f16039e6
+ sha256sums = 9bb273f24c8c207b3fd138f5ec7b735641a8575e8943b1ee9d1916c571cb7e80
+ sha256sums = 115aca05e36bbb335e3c4b606ebe49b91344af4383f11bae2b2518c4f235eb6a
+ sha256sums = 7bb66f1f259ee99aaca3471c0942fbc3b40cbcd26fea804b77ebeab75a105e89
+ sha256sums = a55a2284fc11e58a67d60a38bf6e7c0056e6cdf71fe92c45b11f40a03a48ccc7
+ sha256sums = 771df8eee0e090994d82d825b2a054ed41a798c8b7fcbef0de2399e0891580a6
+ sha256sums = 4b66f561925791c5d32caed023c0e43ffd9870abd1741390aa789143cb5283f0
+ sha256sums = 01fe9db1ef0ae7eb68b55e46cfa6d6fea89f6b4472c4d9b2a268a8b2c2365ab1
+ sha256sums = b6fee4ea027005e7b3b99cf47b071a82ec74f4b275f26186ce7ae5981b01693c
+ sha256sums = 271d6d7b81794d02fbb027222d15d217abf3eb51ee0ad968e86dda87d5e43485
+ sha256sums = 04cd611a19cd0bc47c8d300f623e4b1b1999ad2a9d4fa1040ac87fcfde968552
+ sha256sums = 3f650c253593ea7969be36ce64f6a6f23e41fa2088738e03cc1d5a89c33d54e7
+ sha256sums = 3079a671f88e4710f9a1698a7c1854fe6b275b4dfe916308f172c3545c721870
+ sha256sums = 13aba0223748b6af424058c250cb8d957ce56230b3044f98b66117a14fc5cc04
+
+pkgname = amdgpu-dkms
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..7caf235b600e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+*.tar.xz
+src/
+pkg/
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..a128f89feb4f
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,84 @@
+major=19.30
+minor=838629
+
+pkgname='amdgpu-dkms'
+pkgver=${major}_${minor}
+pkgdesc="DKMS AMDGPU driver from AMD"
+pkgrel=2
+arch=('x86_64')
+url=https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-navi-linux
+license=('custom')
+depends=('dkms')
+
+DLAGENTS='https::/usr/bin/curl -O -e https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-navi-linux %u'
+
+source=(https://drivers.amd.com/drivers/linux/amdgpu-pro-${major}-${minor}-ubuntu-18.04.tar.xz
+ patch_amd_amdgpu_amdgpu_acpi_c.patch
+ patch_amd_amdgpu_amdgpu_connectors_c.patch
+ patch_amd_amdgpu_amdgpu_device_c.patch
+ patch_amd_amdgpu_amdgpu_drv_c.patch
+ patch_amd_amdgpu_amdgpu_fb_c.patch
+ patch_amd_amdgpu_amdgpu_irq_c.patch
+ patch_amd_amdgpu_amdgpu_mn_c.patch
+ patch_amd_amdgpu_dce_v10_0_c.patch
+ patch_amd_amdgpu_dce_v11_0_c.patch
+ patch_amd_amdgpu_dce_v6_0_c.patch
+ patch_amd_amdgpu_dce_v8_0_c.patch
+ patch_amd_amdgpu_dce_virtual_c.patch
+ patch_amd_amdgpu_gmc_v6_0_c.patch
+ patch_amd_amdgpu_gmc_v7_0_c.patch
+ patch_amd_amdgpu_gmc_v8_0_c.patch
+ patch_amd_amdgpu_gmc_v9_0_c.patch
+ patch_amd_amdkfd_kfd_doorbell_c.patch
+ patch_amd_display_amdgpu_dm_amdgpu_dm_c.patch
+ patch_amd_display_amdgpu_dm_amdgpu_dm_mst_types_c.patch
+ patch_Makefile.patch)
+
+sha256sums=('e2eb0a34745ecb9e244f81e0f3af8e4ab063d699dbc3e1a1e0867e8ce773d473'
+ 'd575728fbe9e53586a30c24865a4741b19ffb29e9845a2dd935cac3faea4bec9'
+ 'be0940ccf42c941a5537acfeff299b2b0588e7e5e8f01a53e76a01b30efca2fd'
+ 'aa09dc25dfdfbbcb1ccd16f5420f9f8291c5db97e7d366828244460015262f4a'
+ 'f169f7731877be9de1f2222b1d70658a057a6fc653b4b7bb820f9d88a0ba29e4'
+ '62a6958c51817f53aeaf6d839132ebf4c81964658f6930146ac802d002d0ff74'
+ 'ad824a6e0d30ed93fbe68b532029d70aca7bdacb3c227c35b835a4471c0d18f7'
+ '7c8efd69177fc84cb340feb1940b224b684ba6459327e0f09ff720e1f16039e6'
+ '9bb273f24c8c207b3fd138f5ec7b735641a8575e8943b1ee9d1916c571cb7e80'
+ '115aca05e36bbb335e3c4b606ebe49b91344af4383f11bae2b2518c4f235eb6a'
+ '7bb66f1f259ee99aaca3471c0942fbc3b40cbcd26fea804b77ebeab75a105e89'
+ 'a55a2284fc11e58a67d60a38bf6e7c0056e6cdf71fe92c45b11f40a03a48ccc7'
+ '771df8eee0e090994d82d825b2a054ed41a798c8b7fcbef0de2399e0891580a6'
+ '4b66f561925791c5d32caed023c0e43ffd9870abd1741390aa789143cb5283f0'
+ '01fe9db1ef0ae7eb68b55e46cfa6d6fea89f6b4472c4d9b2a268a8b2c2365ab1'
+ 'b6fee4ea027005e7b3b99cf47b071a82ec74f4b275f26186ce7ae5981b01693c'
+ '271d6d7b81794d02fbb027222d15d217abf3eb51ee0ad968e86dda87d5e43485'
+ '04cd611a19cd0bc47c8d300f623e4b1b1999ad2a9d4fa1040ac87fcfde968552'
+ '3f650c253593ea7969be36ce64f6a6f23e41fa2088738e03cc1d5a89c33d54e7'
+ '3079a671f88e4710f9a1698a7c1854fe6b275b4dfe916308f172c3545c721870'
+ '13aba0223748b6af424058c250cb8d957ce56230b3044f98b66117a14fc5cc04')
+
+build() {
+ cd "${srcdir}/amdgpu-pro-${major}-${minor}-ubuntu-18.04"
+
+ for m in core dkms; do
+ echo "Extracting ${m}..."
+ ar x "amdgpu-${m}_${major}-${minor}_all.deb"
+ tar -xJf data.tar.xz -C "${srcdir}"
+ done
+
+ for p in ${srcdir}/patch_*.patch; do
+ test -f "${p}" || continue
+ patch -p1 -d "${srcdir}/usr/src/amdgpu-${major}-${minor}" -i "${p}"
+ done
+
+ mkdir -p "${srcdir}/usr/share/licenses/${pkgname}"
+ find "${srcdir}/usr/share/doc" -name 'changelog.Debian.gz' -delete
+ find "${srcdir}/usr/share/doc" -name 'copyright' -exec mv {} ${srcdir}/usr/share/licenses/${pkgname} \;
+ find "${srcdir}/usr/share/doc" -type d -empty -delete
+}
+
+package() {
+ cd "${srcdir}/amdgpu-pro-${major}-${minor}-ubuntu-18.04"
+
+ cp -rf "${srcdir}/usr" "${pkgdir}"
+ cp -rf "${srcdir}/etc" "${pkgdir}"
+}
diff --git a/README.md b/README.md
new file mode 100644
index 000000000000..abf843c0764f
--- /dev/null
+++ b/README.md
@@ -0,0 +1,5 @@
+# AMDGPU DKMS
+
+This repository contains Arch Linux `PKGBUILD` and patches to make AMDGPU DKMS 19.30 builds on Linux 5.1 and 5.2. You should not really use this unless you're using Navi cards (e.g. Radeon RX 5700).
+
+This package only provides the DKMS, you will need OpenGL and other libraries, e.g. [amdgpu-pro](https://aur.archlinux.org/packages/?O=0&SeB=n&K=amdgpu-pro&outdated=&SB=n&SO=a&PP=50&do_Search=Go) packages.
diff --git a/patch_Makefile.patch b/patch_Makefile.patch
new file mode 100644
index 000000000000..b4a4dac884d4
--- /dev/null
+++ b/patch_Makefile.patch
@@ -0,0 +1,30 @@
+--- ./Makefile.orig 2019-07-06 00:42:03.000000000 +0000
++++ ./Makefile 2019-07-23 17:48:36.559101824 +0000
+@@ -18,11 +18,17 @@
+ OS_VERSION = $(shell sed -n 's/^VERSION_ID=\(.*\)/\1/p' /etc/os-release)
+ endif
+ else
++ifneq (,$(wildcard /etc/arch-release))
++OS_NAME = "arch"
++else ifneq (,$(wildcard /etc/artix-release))
++OS_NAME = "arch"
++else
+ OS_NAME = "unknown"
++endif
+ OS_VERSION = "0.0"
+ endif
+
+-ifneq ($(findstring $(OS_NAME), "ubuntu" "sled" "sles" "opensuse" "opensuse-leap" "amzn" "custom-rhel"),)
++ifneq ($(findstring $(OS_NAME), "ubuntu" "sled" "sles" "opensuse" "opensuse-leap" "amzn" "custom-rhel" "arch"),)
+ DRM_VER=$(shell sed -n 's/^VERSION = \(.*\)/\1/p' $(kdir)/Makefile)
+ DRM_PATCH=$(shell sed -n 's/^PATCHLEVEL = \(.*\)/\1/p' $(kdir)/Makefile)
+ else ifeq ("debian", $(OS_NAME))
+@@ -60,6 +66,8 @@
+ subdir-ccflags-y += -DOS_NAME_AMZ
+ else ifeq ("debian",$(OS_NAME))
+ subdir-ccflags-y += -DOS_NAME_DEBIAN
++else ifeq ("arch",$(OS_NAME))
++subdir-ccflags-y += -DOS_NAME_ARCH
+ else
+ subdir-ccflags-y += -DOS_NAME_UNKNOWN
+ endif
diff --git a/patch_amd_amdgpu_amdgpu_acpi_c.patch b/patch_amd_amdgpu_amdgpu_acpi_c.patch
new file mode 100644
index 000000000000..dca37ce9df1c
--- /dev/null
+++ b/patch_amd_amdgpu_amdgpu_acpi_c.patch
@@ -0,0 +1,12 @@
+--- ./amd/amdgpu/amdgpu_acpi.c.orig 2019-07-06 00:42:03.000000000 +0000
++++ ./amd/amdgpu/amdgpu_acpi.c 2019-07-23 17:48:36.532435161 +0000
+@@ -29,6 +29,9 @@
+ #include <acpi/video.h>
+ #include <drm/drmP.h>
+ #include <drm/drm_crtc_helper.h>
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 1, 0)
++#include <drm/drm_probe_helper.h>
++#endif
+ #include "amdgpu.h"
+ #include "amdgpu_pm.h"
+ #include "amdgpu_display.h"
diff --git a/patch_amd_amdgpu_amdgpu_connectors_c.patch b/patch_amd_amdgpu_amdgpu_connectors_c.patch
new file mode 100644
index 000000000000..9b3e7a348056
--- /dev/null
+++ b/patch_amd_amdgpu_amdgpu_connectors_c.patch
@@ -0,0 +1,12 @@
+--- ./amd/amdgpu/amdgpu_connectors.c.orig 2019-07-06 00:42:03.000000000 +0000
++++ ./amd/amdgpu/amdgpu_connectors.c 2019-07-23 17:48:36.532435161 +0000
+@@ -27,6 +27,9 @@
+ #include <drm/drm_edid.h>
+ #include <drm/drm_crtc_helper.h>
+ #include <drm/drm_fb_helper.h>
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 1, 0)
++#include <drm/drm_probe_helper.h>
++#endif
+ #include <drm/amdgpu_drm.h>
+ #include "amdgpu.h"
+ #include "atom.h"
diff --git a/patch_amd_amdgpu_amdgpu_device_c.patch b/patch_amd_amdgpu_amdgpu_device_c.patch
new file mode 100644
index 000000000000..28971e3e1711
--- /dev/null
+++ b/patch_amd_amdgpu_amdgpu_device_c.patch
@@ -0,0 +1,24 @@
+--- ./amd/amdgpu/amdgpu_device.c.orig 2019-07-06 00:42:03.000000000 +0000
++++ ./amd/amdgpu/amdgpu_device.c 2019-07-23 17:48:36.535768494 +0000
+@@ -32,6 +32,9 @@
+ #include <drm/drmP.h>
+ #include <drm/drm_crtc_helper.h>
+ #include <drm/drm_atomic_helper.h>
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 1, 0)
++#include <drm/drm_probe_helper.h>
++#endif
+ #include <drm/amdgpu_drm.h>
+ #include <linux/vgaarb.h>
+ #include <linux/vga_switcheroo.h>
+@@ -2842,7 +2845,11 @@
+ drm_atomic_helper_shutdown(adev->ddev);
+ else
+ #endif
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 1, 0)
++ drm_helper_force_disable_all(adev->ddev);
++#else
+ drm_crtc_force_disable_all(adev->ddev);
++#endif
+ }
+ amdgpu_ib_pool_fini(adev);
+ amdgpu_fence_driver_fini(adev);
diff --git a/patch_amd_amdgpu_amdgpu_drv_c.patch b/patch_amd_amdgpu_amdgpu_drv_c.patch
new file mode 100644
index 000000000000..b4347bf2ced6
--- /dev/null
+++ b/patch_amd_amdgpu_amdgpu_drv_c.patch
@@ -0,0 +1,25 @@
+--- ./amd/amdgpu/amdgpu_drv.c.orig 2019-07-06 00:42:03.000000000 +0000
++++ ./amd/amdgpu/amdgpu_drv.c 2019-07-23 17:48:36.539101827 +0000
+@@ -33,6 +33,9 @@
+ #include <linux/pm_runtime.h>
+ #include <linux/vga_switcheroo.h>
+ #include <drm/drm_crtc_helper.h>
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 1, 0)
++#include <drm/drm_probe_helper.h>
++#endif
+
+ #include "amdgpu.h"
+ #include "amdgpu_irq.h"
+@@ -1450,7 +1453,11 @@
+ #if DRM_VERSION_CODE >= DRM_VERSION(4, 20, 0)
+ DRIVER_ATOMIC |
+ #endif
+- DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM |
++ DRIVER_HAVE_IRQ |
++#if DRM_VERSION_CODE < DRM_VERSION(5, 1, 0)
++ DRIVER_IRQ_SHARED |
++#endif
++ DRIVER_GEM |
+ #if DRM_VERSION_CODE >= DRM_VERSION(4, 13, 0)
+ DRIVER_SYNCOBJ |
+ #endif
diff --git a/patch_amd_amdgpu_amdgpu_fb_c.patch b/patch_amd_amdgpu_amdgpu_fb_c.patch
new file mode 100644
index 000000000000..64a1b7f92e3d
--- /dev/null
+++ b/patch_amd_amdgpu_amdgpu_fb_c.patch
@@ -0,0 +1,23 @@
+--- ./amd/amdgpu/amdgpu_fb.c.orig 2019-07-23 17:49:26.555766634 +0000
++++ ./amd/amdgpu/amdgpu_fb.c 2019-07-23 17:55:38.005752841 +0000
+@@ -266,7 +266,7 @@
+
+ #if DRM_VERSION_CODE < DRM_VERSION(4, 11, 0)
+ drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth);
+-#else
++#elif DRM_VERSION_CODE < DRM_VERSION(5, 2, 0)
+ drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
+ #endif
+
+@@ -278,7 +278,11 @@
+ info->screen_base = amdgpu_bo_kptr(abo);
+ info->screen_size = amdgpu_bo_size(abo);
+
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 2, 0)
++ drm_fb_helper_fill_info(info, &rfbdev->helper, sizes);
++#else
+ drm_fb_helper_fill_var(info, &rfbdev->helper, sizes->fb_width, sizes->fb_height);
++#endif
+
+ /* setup aperture base/size for vesafb takeover */
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
diff --git a/patch_amd_amdgpu_amdgpu_irq_c.patch b/patch_amd_amdgpu_amdgpu_irq_c.patch
new file mode 100644
index 000000000000..ac14af8379e7
--- /dev/null
+++ b/patch_amd_amdgpu_amdgpu_irq_c.patch
@@ -0,0 +1,12 @@
+--- ./amd/amdgpu/amdgpu_irq.c.orig 2019-07-06 00:42:03.000000000 +0000
++++ ./amd/amdgpu/amdgpu_irq.c 2019-07-23 17:48:36.539101827 +0000
+@@ -45,6 +45,9 @@
+ #include <linux/irq.h>
+ #include <drm/drmP.h>
+ #include <drm/drm_crtc_helper.h>
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 1, 0)
++#include <drm/drm_probe_helper.h>
++#endif
+ #include <drm/amdgpu_drm.h>
+ #include "amdgpu.h"
+ #include "amdgpu_ih.h"
diff --git a/patch_amd_amdgpu_amdgpu_mn_c.patch b/patch_amd_amdgpu_amdgpu_mn_c.patch
new file mode 100644
index 000000000000..8d39538a18d3
--- /dev/null
+++ b/patch_amd_amdgpu_amdgpu_mn_c.patch
@@ -0,0 +1,49 @@
+--- ./amd/amdgpu/amdgpu_mn.c.orig 2019-07-23 18:15:10.135709298 +0000
++++ ./amd/amdgpu/amdgpu_mn.c 2019-07-23 18:18:08.299036001 +0000
+@@ -280,14 +280,22 @@
+ /* TODO we should be able to split locking for interval tree and
+ * amdgpu_mn_invalidate_node
+ */
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 2, 0)
++ if (amdgpu_mn_read_lock(amn, mmu_notifier_range_blockable(range)))
++#else
+ if (amdgpu_mn_read_lock(amn, range->blockable))
++#endif
+ return -EAGAIN;
+
+ it = interval_tree_iter_first(&amn->objects, range->start, end);
+ while (it) {
+ struct amdgpu_mn_node *node;
+
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 2, 0)
++ if (!mmu_notifier_range_blockable(range)) {
++#else
+ if (!range->blockable) {
++#endif
+ amdgpu_mn_read_unlock(amn);
+ return -EAGAIN;
+ }
+@@ -323,7 +331,11 @@
+ /* notification is exclusive, but interval is inclusive */
+ end = range->end - 1;
+
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 2, 0)
++ if (amdgpu_mn_read_lock(amn, mmu_notifier_range_blockable(range)))
++#else
+ if (amdgpu_mn_read_lock(amn, range->blockable))
++#endif
+ return -EAGAIN;
+
+ it = interval_tree_iter_first(&amn->objects, range->start, end);
+@@ -331,7 +343,11 @@
+ struct amdgpu_mn_node *node;
+ struct amdgpu_bo *bo;
+
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 2, 0)
++ if (!mmu_notifier_range_blockable(range)) {
++#else
+ if (!range->blockable) {
++#endif
+ amdgpu_mn_read_unlock(amn);
+ return -EAGAIN;
+ }
diff --git a/patch_amd_amdgpu_dce_v10_0_c.patch b/patch_amd_amdgpu_dce_v10_0_c.patch
new file mode 100644
index 000000000000..1babfac2aae9
--- /dev/null
+++ b/patch_amd_amdgpu_dce_v10_0_c.patch
@@ -0,0 +1,21 @@
+--- ./amd/amdgpu/dce_v10_0.c.orig 2019-07-06 00:42:03.000000000 +0000
++++ ./amd/amdgpu/dce_v10_0.c 2019-07-23 17:48:36.542435160 +0000
+@@ -21,6 +21,9 @@
+ *
+ */
+ #include <drm/drmP.h>
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 1, 0)
++#include <drm/drm_probe_helper.h>
++#endif
+ #include "amdgpu.h"
+ #include "amdgpu_pm.h"
+ #include "amdgpu_i2c.h"
+@@ -1685,6 +1688,8 @@
+ #if DRM_VERSION_CODE < DRM_VERSION(4, 14, 0) && \
+ !defined(OS_NAME_SUSE_15) && !defined(OS_NAME_SUSE_15_1)
+ err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
++#elif DRM_VERSION_CODE >= DRM_VERSION(5, 1, 0)
++ err = drm_hdmi_avi_infoframe_from_display_mode(&frame, connector, mode);
+ #else
+ err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
+ #endif
diff --git a/patch_amd_amdgpu_dce_v11_0_c.patch b/patch_amd_amdgpu_dce_v11_0_c.patch
new file mode 100644
index 000000000000..caad6ed6ceac
--- /dev/null
+++ b/patch_amd_amdgpu_dce_v11_0_c.patch
@@ -0,0 +1,21 @@
+--- ./amd/amdgpu/dce_v11_0.c.orig 2019-07-06 00:42:03.000000000 +0000
++++ ./amd/amdgpu/dce_v11_0.c 2019-07-23 17:48:36.545768493 +0000
+@@ -21,6 +21,9 @@
+ *
+ */
+ #include <drm/drmP.h>
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 1, 0)
++#include <drm/drm_probe_helper.h>
++#endif
+ #include "amdgpu.h"
+ #include "amdgpu_pm.h"
+ #include "amdgpu_i2c.h"
+@@ -1727,6 +1730,8 @@
+ #if DRM_VERSION_CODE < DRM_VERSION(4, 14, 0) && \
+ !defined(OS_NAME_SUSE_15) && !defined(OS_NAME_SUSE_15_1)
+ err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
++#elif DRM_VERSION_CODE >= DRM_VERSION(5, 1, 0)
++ err = drm_hdmi_avi_infoframe_from_display_mode(&frame, connector, mode);
+ #else
+ err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
+ #endif
diff --git a/patch_amd_amdgpu_dce_v6_0_c.patch b/patch_amd_amdgpu_dce_v6_0_c.patch
new file mode 100644
index 000000000000..2f2b372be0fb
--- /dev/null
+++ b/patch_amd_amdgpu_dce_v6_0_c.patch
@@ -0,0 +1,31 @@
+--- ./amd/amdgpu/dce_v6_0.c.orig 2019-07-06 00:42:03.000000000 +0000
++++ ./amd/amdgpu/dce_v6_0.c 2019-07-23 17:48:36.545768493 +0000
+@@ -21,6 +21,9 @@
+ *
+ */
+ #include <drm/drmP.h>
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 1, 0)
++#include <drm/drm_probe_helper.h>
++#endif
+ #include "amdgpu.h"
+ #include "amdgpu_pm.h"
+ #include "amdgpu_i2c.h"
+@@ -1423,6 +1426,9 @@
+ struct amdgpu_device *adev = dev->dev_private;
+ struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder);
+ struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv;
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 1, 0)
++ struct drm_connector *connector = amdgpu_get_connector_for_encoder(encoder);
++#endif
+ struct hdmi_avi_infoframe frame;
+ u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AVI_INFOFRAME_SIZE];
+ uint8_t *payload = buffer + 3;
+@@ -1433,6 +1439,8 @@
+ #if DRM_VERSION_CODE < DRM_VERSION(4, 14, 0) && \
+ !defined(OS_NAME_SUSE_15) && !defined(OS_NAME_SUSE_15_1)
+ err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
++#elif DRM_VERSION_CODE >= DRM_VERSION(5, 1, 0)
++ err = drm_hdmi_avi_infoframe_from_display_mode(&frame, connector, mode);
+ #else
+ err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
+ #endif
diff --git a/patch_amd_amdgpu_dce_v8_0_c.patch b/patch_amd_amdgpu_dce_v8_0_c.patch
new file mode 100644
index 000000000000..de84207b4ff2
--- /dev/null
+++ b/patch_amd_amdgpu_dce_v8_0_c.patch
@@ -0,0 +1,21 @@
+--- ./amd/amdgpu/dce_v8_0.c.orig 2019-07-06 00:42:03.000000000 +0000
++++ ./amd/amdgpu/dce_v8_0.c 2019-07-23 17:48:36.549101826 +0000
+@@ -21,6 +21,9 @@
+ *
+ */
+ #include <drm/drmP.h>
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 1, 0)
++#include <drm/drm_probe_helper.h>
++#endif
+ #include "amdgpu.h"
+ #include "amdgpu_pm.h"
+ #include "amdgpu_i2c.h"
+@@ -1619,6 +1622,8 @@
+ #if DRM_VERSION_CODE < DRM_VERSION(4, 14, 0) && \
+ !defined(OS_NAME_SUSE_15) && !defined(OS_NAME_SUSE_15_1)
+ err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode);
++#elif DRM_VERSION_CODE >= DRM_VERSION(5, 1, 0)
++ err = drm_hdmi_avi_infoframe_from_display_mode(&frame, connector, mode);
+ #else
+ err = drm_hdmi_avi_infoframe_from_display_mode(&frame, mode, false);
+ #endif
diff --git a/patch_amd_amdgpu_dce_virtual_c.patch b/patch_amd_amdgpu_dce_virtual_c.patch
new file mode 100644
index 000000000000..aaa65b267bab
--- /dev/null
+++ b/patch_amd_amdgpu_dce_virtual_c.patch
@@ -0,0 +1,12 @@
+--- ./amd/amdgpu/dce_virtual.c.orig 2019-07-06 00:42:03.000000000 +0000
++++ ./amd/amdgpu/dce_virtual.c 2019-07-23 17:48:36.552435159 +0000
+@@ -21,6 +21,9 @@
+ *
+ */
+ #include <drm/drmP.h>
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 1, 0)
++#include <drm/drm_probe_helper.h>
++#endif
+ #include "amdgpu.h"
+ #include "amdgpu_pm.h"
+ #include "amdgpu_i2c.h"
diff --git a/patch_amd_amdgpu_gmc_v6_0_c.patch b/patch_amd_amdgpu_gmc_v6_0_c.patch
new file mode 100644
index 000000000000..68e4203f6c73
--- /dev/null
+++ b/patch_amd_amdgpu_gmc_v6_0_c.patch
@@ -0,0 +1,14 @@
+--- ./amd/amdgpu/gmc_v6_0.c.orig 2019-07-23 18:04:33.135732941 +0000
++++ ./amd/amdgpu/gmc_v6_0.c 2019-07-23 18:12:10.319049313 +0000
+@@ -874,7 +874,11 @@
+ pci_set_consistent_dma_mask(adev->pdev, DMA_BIT_MASK(32));
+ dev_warn(adev->dev, "amdgpu: No coherent DMA available.\n");
+ }
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 2, 0)
++ adev->need_swiotlb = drm_need_swiotlb(dma_bits);
++#else
+ adev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits);
++#endif
+
+ r = gmc_v6_0_init_microcode(adev);
+ if (r) {
diff --git a/patch_amd_amdgpu_gmc_v7_0_c.patch b/patch_amd_amdgpu_gmc_v7_0_c.patch
new file mode 100644
index 000000000000..c84dccd16acb
--- /dev/null
+++ b/patch_amd_amdgpu_gmc_v7_0_c.patch
@@ -0,0 +1,14 @@
+--- ./amd/amdgpu/gmc_v7_0.c.orig 2019-07-23 18:06:45.552394719 +0000
++++ ./amd/amdgpu/gmc_v7_0.c 2019-07-23 18:13:32.999046265 +0000
+@@ -1008,7 +1008,11 @@
+ pci_set_consistent_dma_mask(adev->pdev, DMA_BIT_MASK(32));
+ pr_warn("amdgpu: No coherent DMA available\n");
+ }
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 2, 0)
++ adev->need_swiotlb = drm_need_swiotlb(dma_bits);
++#else
+ adev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits);
++#endif
+
+ r = gmc_v7_0_init_microcode(adev);
+ if (r) {
diff --git a/patch_amd_amdgpu_gmc_v8_0_c.patch b/patch_amd_amdgpu_gmc_v8_0_c.patch
new file mode 100644
index 000000000000..858512a02a4b
--- /dev/null
+++ b/patch_amd_amdgpu_gmc_v8_0_c.patch
@@ -0,0 +1,14 @@
+--- ./amd/amdgpu/gmc_v8_0.c.orig 2019-07-23 18:08:14.902391363 +0000
++++ ./amd/amdgpu/gmc_v8_0.c 2019-07-23 18:10:42.879052582 +0000
+@@ -1139,7 +1139,11 @@
+ pci_set_consistent_dma_mask(adev->pdev, DMA_BIT_MASK(32));
+ pr_warn("amdgpu: No coherent DMA available\n");
+ }
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 2, 0)
++ adev->need_swiotlb = drm_need_swiotlb(dma_bits);
++#else
+ adev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits);
++#endif
+
+ r = gmc_v8_0_init_microcode(adev);
+ if (r) {
diff --git a/patch_amd_amdgpu_gmc_v9_0_c.patch b/patch_amd_amdgpu_gmc_v9_0_c.patch
new file mode 100644
index 000000000000..5baafd55d9d2
--- /dev/null
+++ b/patch_amd_amdgpu_gmc_v9_0_c.patch
@@ -0,0 +1,14 @@
+--- ./amd/amdgpu/gmc_v9_0.c.orig 2019-07-23 18:08:17.902391268 +0000
++++ ./amd/amdgpu/gmc_v9_0.c 2019-07-23 18:11:10.455718188 +0000
+@@ -1046,7 +1046,11 @@
+ pci_set_consistent_dma_mask(adev->pdev, DMA_BIT_MASK(32));
+ printk(KERN_WARNING "amdgpu: No coherent DMA available.\n");
+ }
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 2, 0)
++ adev->need_swiotlb = drm_need_swiotlb(dma_bits);
++#else
+ adev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits);
++#endif
+
+ if (adev->gmc.xgmi.supported) {
+ r = gfxhub_v1_1_get_xgmi_info(adev);
diff --git a/patch_amd_amdkfd_kfd_doorbell_c.patch b/patch_amd_amdkfd_kfd_doorbell_c.patch
new file mode 100644
index 000000000000..12700287a64c
--- /dev/null
+++ b/patch_amd_amdkfd_kfd_doorbell_c.patch
@@ -0,0 +1,15 @@
+--- ./amd/amdkfd/kfd_doorbell.c.orig 2019-07-06 00:42:03.000000000 +0000
++++ ./amd/amdkfd/kfd_doorbell.c 2019-07-23 17:48:36.552435159 +0000
+@@ -156,7 +156,11 @@
+ }
+
+
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
++vm_fault_t kfd_doorbell_vm_fault(struct vm_fault *vmf)
++{
++ struct kfd_process_device *pdd = vmf->vma->vm_private_data;
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+ static int kfd_doorbell_vm_fault(struct vm_fault *vmf)
+ {
+ struct kfd_process_device *pdd = vmf->vma->vm_private_data;
diff --git a/patch_amd_display_amdgpu_dm_amdgpu_dm_c.patch b/patch_amd_display_amdgpu_dm_amdgpu_dm_c.patch
new file mode 100644
index 000000000000..252d2be486fe
--- /dev/null
+++ b/patch_amd_display_amdgpu_dm_amdgpu_dm_c.patch
@@ -0,0 +1,21 @@
+--- ./amd/display/amdgpu_dm/amdgpu_dm.c.orig 2019-07-06 00:42:03.000000000 +0000
++++ ./amd/display/amdgpu_dm/amdgpu_dm.c 2019-07-23 17:48:36.555768491 +0000
+@@ -64,6 +64,9 @@
+ #include <drm/drm_atomic_helper.h>
+ #include <drm/drm_dp_mst_helper.h>
+ #include <drm/drm_fb_helper.h>
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 1, 0)
++#include <drm/drm_probe_helper.h>
++#endif
+ #include <drm/drm_edid.h>
+
+ #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
+@@ -2010,6 +2013,8 @@
+ * integrate modeset lock with private objects" upstreamed.
+ */
+ adev->ddev,
++#elif DRM_VERSION_CODE >= DRM_VERSION(5, 1, 0)
++ adev->ddev,
+ #endif
+ &adev->dm.atomic_obj,
+ &state->base,
diff --git a/patch_amd_display_amdgpu_dm_amdgpu_dm_mst_types_c.patch b/patch_amd_display_amdgpu_dm_amdgpu_dm_mst_types_c.patch
new file mode 100644
index 000000000000..852ef2dd4403
--- /dev/null
+++ b/patch_amd_display_amdgpu_dm_amdgpu_dm_mst_types_c.patch
@@ -0,0 +1,12 @@
+--- ./amd/display/amdgpu_dm/amdgpu_dm_mst_types.c.orig 2019-07-06 00:42:03.000000000 +0000
++++ ./amd/display/amdgpu_dm/amdgpu_dm_mst_types.c 2019-07-23 17:48:36.555768491 +0000
+@@ -25,6 +25,9 @@
+
+ #include <linux/version.h>
+ #include <drm/drm_atomic_helper.h>
++#if DRM_VERSION_CODE >= DRM_VERSION(5, 1, 0)
++#include <drm/drm_probe_helper.h>
++#endif
+ #include "dm_services.h"
+ #include "amdgpu.h"
+ #include "amdgpu_dm.h"