From aa2436c99a4ecbff7523ea1968d3be829f7c8760 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Mon, 12 Jan 2015 20:54:46 +0000
Subject: linux: update to 3.18.2.

---
 ...sallow-pin-ioctl-completely-for-kms-drive.patch | 79 ++++++++++++++++++++++
 abs/core/linux/PKGBUILD                            | 17 +++--
 abs/core/linux/__changelog                         |  1 +
 abs/core/linux/linux.install.pkg                   |  2 +-
 4 files changed, 94 insertions(+), 5 deletions(-)
 create mode 100644 abs/core/linux/0001-drm-i915-Disallow-pin-ioctl-completely-for-kms-drive.patch

diff --git a/abs/core/linux/0001-drm-i915-Disallow-pin-ioctl-completely-for-kms-drive.patch b/abs/core/linux/0001-drm-i915-Disallow-pin-ioctl-completely-for-kms-drive.patch
new file mode 100644
index 0000000..f9aa993
--- /dev/null
+++ b/abs/core/linux/0001-drm-i915-Disallow-pin-ioctl-completely-for-kms-drive.patch
@@ -0,0 +1,79 @@
+From d472fcc8379c062bd56a3876fc6ef22258f14a91 Mon Sep 17 00:00:00 2001
+From: Daniel Vetter <daniel.vetter@ffwll.ch>
+Date: Mon, 24 Nov 2014 11:12:42 +0100
+Subject: [PATCH] drm/i915: Disallow pin ioctl completely for kms drivers
+
+The problem here is that SNA pins batchbuffers to etch out a bit more
+performance. Iirc it started out as a w/a for i830M (which we've
+implemented in the kernel since a long time already). The problem is
+that the pin ioctl wasn't added in
+
+commit d23db88c3ab233daed18709e3a24d6c95344117f
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Fri May 23 08:48:08 2014 +0200
+
+    drm/i915: Prevent negative relocation deltas from wrapping
+
+Fix this by simply disallowing pinning from userspace so that the
+kernel is in full control of batch placement again. Especially since
+distros are moving towards running X as non-root, so most users won't
+even be able to see any benefits.
+
+UMS support is dead now, but we need this minimal patch for
+backporting. Follow-up patch will remove the pin ioctl code
+completely.
+
+Note to backporters: You must have both
+
+commit b45305fce5bb1abec263fcff9d81ebecd6306ede
+Author: Daniel Vetter <daniel.vetter@ffwll.ch>
+Date:   Mon Dec 17 16:21:27 2012 +0100
+
+    drm/i915: Implement workaround for broken CS tlb on i830/845
+
+which laned in 3.8 and
+
+commit c4d69da167fa967749aeb70bc0e94a457e5d00c1
+Author: Chris Wilson <chris@chris-wilson.co.uk>
+Date:   Mon Sep 8 14:25:41 2014 +0100
+
+    drm/i915: Evict CS TLBs between batches
+
+which is also marked cc: stable. Otherwise this could introduce a
+regression by disabling the userspace w/a without the kernel w/a being
+fully functional on i830/45.
+
+References: https://bugs.freedesktop.org/show_bug.cgi?id=76554#c116
+Cc: stable@vger.kernel.org # requires c4d69da167fa967749a and v3.8
+Cc: Chris Wilson <chris@chris-wilson.co.uk>
+Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
+---
+ drivers/gpu/drm/i915/i915_gem.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
+index fd17cca..97b86a5 100644
+--- a/drivers/gpu/drm/i915/i915_gem.c
++++ b/drivers/gpu/drm/i915/i915_gem.c
+@@ -4263,7 +4263,7 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data,
+ 	struct drm_i915_gem_object *obj;
+ 	int ret;
+ 
+-	if (INTEL_INFO(dev)->gen >= 6)
++	if (drm_core_check_feature(dev, DRIVER_MODESET))
+ 		return -ENODEV;
+ 
+ 	ret = i915_mutex_lock_interruptible(dev);
+@@ -4319,6 +4319,9 @@ i915_gem_unpin_ioctl(struct drm_device *dev, void *data,
+ 	struct drm_i915_gem_object *obj;
+ 	int ret;
+ 
++	if (drm_core_check_feature(dev, DRIVER_MODESET))
++		return -ENODEV;
++
+ 	ret = i915_mutex_lock_interruptible(dev);
+ 	if (ret)
+ 		return ret;
+-- 
+2.2.0
+
diff --git a/abs/core/linux/PKGBUILD b/abs/core/linux/PKGBUILD
index 1ebc072..b7dc250 100644
--- a/abs/core/linux/PKGBUILD
+++ b/abs/core/linux/PKGBUILD
@@ -5,8 +5,8 @@
 pkgbase=linux               # Build stock -ARCH kernel
 #pkgbase=linux-custom       # Build kernel with a different name
 _srcname=linux-3.18
-pkgver=3.18.1
-pkgrel=1
+pkgver=3.18.2
+pkgrel=2
 arch=('i686' 'x86_64')
 url="http://www.kernel.org/"
 license=('GPL2')
@@ -21,15 +21,21 @@ source=("https://www.kernel.org/pub/linux/kernel/v3.x/${_srcname}.tar.xz"
         # standard config files for mkinitcpio ramdisk
         'linux.preset'
         'change-default-console-loglevel.patch'
+        '0001-drm-i915-Disallow-pin-ioctl-completely-for-kms-drive.patch'
         )
 sha256sums=('becc413cc9e6d7f5cc52a3ce66d65c3725bc1d1cc1001f4ce6c32b69eb188cbd'
             #'SKIP'
-            '4df87c395c94012544ca297db6608fe8e7c8fb5289641c4bfb4d9d87b6f06968'
+            '927a30c152a193d22242de21b99c9765fb0086b0aa3fabd31938ffc6e1b3f37c'
             #'SKIP'
             'd3794c8b2cd11b71914b41f7a4e861369d4fa3c29fdd9e1d677ff0c2167eeb52'
             'df7886f5d57f8f85e89987066dfa5c316e922dc0b22e6e6ad01331333db52377'
             'f0d90e756f14533ee67afda280500511a62465b4f76adcc5effa95a40045179c'
-            '1256b241cd477b265a3c2d64bdc19ffe3c9bbcee82ea3994c590c2c76e767d99')
+            '1256b241cd477b265a3c2d64bdc19ffe3c9bbcee82ea3994c590c2c76e767d99'
+            '0bda45a3ef0f2780bbe588f2e53ab2b79814d29e9c6fc7bfff3b0dbdaa9e710d')
+validpgpkeys=(
+              'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linux Torvalds
+              '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
+             )
 
 _kernelname=${pkgbase#linux}
 
@@ -42,6 +48,9 @@ prepare() {
   # add latest fixes from stable queue, if needed
   # http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git
 
+  # fix #43143
+  patch -p1 -i "${srcdir}/0001-drm-i915-Disallow-pin-ioctl-completely-for-kms-drive.patch"
+  
   # set DEFAULT_CONSOLE_LOGLEVEL to 4 (same value as the 'quiet' kernel param)
   # remove this when a Kconfig knob is made available by upstream
   # (relevant patch sent upstream: https://lkml.org/lkml/2011/7/26/227)
diff --git a/abs/core/linux/__changelog b/abs/core/linux/__changelog
index 9a2e2b1..f470723 100644
--- a/abs/core/linux/__changelog
+++ b/abs/core/linux/__changelog
@@ -1 +1,2 @@
 PKGBUILD: remove nouveau modules
+PKGBUILD: comment out sign srcs
diff --git a/abs/core/linux/linux.install.pkg b/abs/core/linux/linux.install.pkg
index c7c6ca8..3e4e89b 100644
--- a/abs/core/linux/linux.install.pkg
+++ b/abs/core/linux/linux.install.pkg
@@ -2,7 +2,7 @@
 # arg 2:  the old package version
 
 KERNEL_NAME=
-KERNEL_VERSION=3.18.1-1-ARCH
+KERNEL_VERSION=3.18.2-2-ARCH
 
 post_install () {
   # updating module dependencies
-- 
cgit v0.12

