summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>2018-02-08 01:24:07 +0100
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2018-03-30 17:11:52 +0200
commit83d29c9dde04d0c8f2460831a6b22bce6579a72e (patch)
tree9fc9450da3e798fb2de1b63649ec1d6d04030561
parentb2a5d3a1b7d5987ec1c3f5b85f944b29149afcaa (diff)
Integrate Thierry's fbdev mmap fix allowing legacy applications that use the mmap() syscall on the fbdev device to map framebuffer memory without causing a hang. Useful e.g. for Tezi. While at it also update to 4.14.30. Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0009-drm-tegra-gem-Reshuffle-declarations.patch33
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0010-drm-tegra-gem-Make-__tegra_gem_mmap-available-more-w.patch64
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline-4.14/0011-drm-tegra-fb-Implement-fb_mmap-callback.patch56
-rw-r--r--recipes-kernel/linux/linux-toradex-mainline_4.14.bb9
4 files changed, 159 insertions, 3 deletions
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0009-drm-tegra-gem-Reshuffle-declarations.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0009-drm-tegra-gem-Reshuffle-declarations.patch
new file mode 100644
index 0000000..8be8142
--- /dev/null
+++ b/recipes-kernel/linux/linux-toradex-mainline-4.14/0009-drm-tegra-gem-Reshuffle-declarations.patch
@@ -0,0 +1,33 @@
+From b6d7974d10b30bf3baed7e50d8e574f5184cfdd1 Mon Sep 17 00:00:00 2001
+From: Thierry Reding <treding@nvidia.com>
+Date: Wed, 7 Feb 2018 18:45:54 +0100
+Subject: [PATCH] drm/tegra: gem: Reshuffle declarations
+
+Move declarations in the gem.h header file into the same order as the
+corresponding definitions in gem.c.
+
+Signed-off-by: Thierry Reding <treding@nvidia.com>
+---
+ drivers/gpu/drm/tegra/gem.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/tegra/gem.h b/drivers/gpu/drm/tegra/gem.h
+index 8eb9fd24ef0e..1fcf94dce45c 100644
+--- a/drivers/gpu/drm/tegra/gem.h
++++ b/drivers/gpu/drm/tegra/gem.h
+@@ -68,10 +68,10 @@ void tegra_bo_free_object(struct drm_gem_object *gem);
+ int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
+ struct drm_mode_create_dumb *args);
+
+-int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma);
+-
+ extern const struct vm_operations_struct tegra_bo_vm_ops;
+
++int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma);
++
+ struct dma_buf *tegra_gem_prime_export(struct drm_device *drm,
+ struct drm_gem_object *gem,
+ int flags);
+--
+2.15.1
+
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0010-drm-tegra-gem-Make-__tegra_gem_mmap-available-more-w.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0010-drm-tegra-gem-Make-__tegra_gem_mmap-available-more-w.patch
new file mode 100644
index 0000000..2e80852
--- /dev/null
+++ b/recipes-kernel/linux/linux-toradex-mainline-4.14/0010-drm-tegra-gem-Make-__tegra_gem_mmap-available-more-w.patch
@@ -0,0 +1,64 @@
+From 04c0746663bd3ae3cce5e02d5b32c8ade2a833b8 Mon Sep 17 00:00:00 2001
+From: Thierry Reding <treding@nvidia.com>
+Date: Wed, 7 Feb 2018 18:45:55 +0100
+Subject: [PATCH] drm/tegra: gem: Make __tegra_gem_mmap() available more widely
+
+This function allows mapping a GEM object into a virtual memory address
+space, which makes it useful outside of the GEM code.
+
+While at it, rename the function so it doesn't clash with the function
+that implements the DRM_TEGRA_GEM_MMAP IOCTL.
+
+Signed-off-by: Thierry Reding <treding@nvidia.com>
+---
+ drivers/gpu/drm/tegra/gem.c | 7 +++----
+ drivers/gpu/drm/tegra/gem.h | 1 +
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
+index 49b9bf28f872..d3b3aa148225 100644
+--- a/drivers/gpu/drm/tegra/gem.c
++++ b/drivers/gpu/drm/tegra/gem.c
+@@ -459,8 +459,7 @@ const struct vm_operations_struct tegra_bo_vm_ops = {
+ .close = drm_gem_vm_close,
+ };
+
+-static int tegra_gem_mmap(struct drm_gem_object *gem,
+- struct vm_area_struct *vma)
++int __tegra_gem_mmap(struct drm_gem_object *gem, struct vm_area_struct *vma)
+ {
+ struct tegra_bo *bo = to_tegra_bo(gem);
+
+@@ -507,7 +506,7 @@ int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma)
+
+ gem = vma->vm_private_data;
+
+- return tegra_gem_mmap(gem, vma);
++ return __tegra_gem_mmap(gem, vma);
+ }
+
+ static struct sg_table *
+@@ -600,7 +599,7 @@ static int tegra_gem_prime_mmap(struct dma_buf *buf, struct vm_area_struct *vma)
+ if (err < 0)
+ return err;
+
+- return tegra_gem_mmap(gem, vma);
++ return __tegra_gem_mmap(gem, vma);
+ }
+
+ static void *tegra_gem_prime_vmap(struct dma_buf *buf)
+diff --git a/drivers/gpu/drm/tegra/gem.h b/drivers/gpu/drm/tegra/gem.h
+index 1fcf94dce45c..6bd7dd7e55b4 100644
+--- a/drivers/gpu/drm/tegra/gem.h
++++ b/drivers/gpu/drm/tegra/gem.h
+@@ -70,6 +70,7 @@ int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
+
+ extern const struct vm_operations_struct tegra_bo_vm_ops;
+
++int __tegra_gem_mmap(struct drm_gem_object *gem, struct vm_area_struct *vma);
+ int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma);
+
+ struct dma_buf *tegra_gem_prime_export(struct drm_device *drm,
+--
+2.15.1
+
diff --git a/recipes-kernel/linux/linux-toradex-mainline-4.14/0011-drm-tegra-fb-Implement-fb_mmap-callback.patch b/recipes-kernel/linux/linux-toradex-mainline-4.14/0011-drm-tegra-fb-Implement-fb_mmap-callback.patch
new file mode 100644
index 0000000..7aa85ae
--- /dev/null
+++ b/recipes-kernel/linux/linux-toradex-mainline-4.14/0011-drm-tegra-fb-Implement-fb_mmap-callback.patch
@@ -0,0 +1,56 @@
+From b8f3f500e09c2c457efc2fcbfe8b7f815f2e6a0e Mon Sep 17 00:00:00 2001
+From: Thierry Reding <treding@nvidia.com>
+Date: Wed, 7 Feb 2018 18:45:56 +0100
+Subject: [PATCH] drm/tegra: fb: Implement ->fb_mmap() callback
+
+This fixes hangs with legacy applications that use the mmap() syscall on
+the fbdev device to map framebuffer memory. The fbdev implementation for
+mmap() creates a mapping that conflicts with DRM usage and causes a hang
+when the memory is accessed through the mapping.
+
+Reported-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
+Signed-off-by: Thierry Reding <treding@nvidia.com>
+Tested-by: Stefan Agner <stefan@agner.ch>
+Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
+Reported-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
+Signed-off-by: Thierry Reding <treding@nvidia.com>
+---
+ drivers/gpu/drm/tegra/fb.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c
+index 001cb77e2f59..0786159edef3 100644
+--- a/drivers/gpu/drm/tegra/fb.c
++++ b/drivers/gpu/drm/tegra/fb.c
+@@ -224,12 +224,28 @@ struct drm_framebuffer *tegra_fb_create(struct drm_device *drm,
+ }
+
+ #ifdef CONFIG_DRM_FBDEV_EMULATION
++static int tegra_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
++{
++ struct drm_fb_helper *helper = info->par;
++ struct tegra_bo *bo;
++ int err;
++
++ bo = tegra_fb_get_plane(helper->fb, 0);
++
++ err = drm_gem_mmap_obj(&bo->gem, bo->gem.size, vma);
++ if (err < 0)
++ return err;
++
++ return __tegra_gem_mmap(&bo->gem, vma);
++}
++
+ static struct fb_ops tegra_fb_ops = {
+ .owner = THIS_MODULE,
+ DRM_FB_HELPER_DEFAULT_OPS,
+ .fb_fillrect = drm_fb_helper_sys_fillrect,
+ .fb_copyarea = drm_fb_helper_sys_copyarea,
+ .fb_imageblit = drm_fb_helper_sys_imageblit,
++ .fb_mmap = tegra_fb_mmap,
+ };
+
+ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
+--
+2.15.1
+
diff --git a/recipes-kernel/linux/linux-toradex-mainline_4.14.bb b/recipes-kernel/linux/linux-toradex-mainline_4.14.bb
index f5a197b..6f23ae8 100644
--- a/recipes-kernel/linux/linux-toradex-mainline_4.14.bb
+++ b/recipes-kernel/linux/linux-toradex-mainline_4.14.bb
@@ -9,7 +9,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
inherit kernel siteinfo
include conf/tdx_version.conf
-LINUX_VERSION ?= "4.14.8"
+LINUX_VERSION ?= "4.14.30"
LOCALVERSION = "-${PR}"
PR = "${TDX_VER_ITEM}"
@@ -25,13 +25,16 @@ TK1-PATCHES = " \
file://0006-tegra_defconfig-snapd-squashfs-configuration.patch \
file://0007-ARM-tegra-apalis-tk1-support-v1.2-hardware-revision.patch \
file://0008-apalis-tk1-fix-pcie-reset-for-reliable-gigabit-ether.patch \
+ file://0009-drm-tegra-gem-Reshuffle-declarations.patch \
+ file://0010-drm-tegra-gem-Make-__tegra_gem_mmap-available-more-w.patch \
+ file://0011-drm-tegra-fb-Implement-fb_mmap-callback.patch \
"
SRC_URI = " \
https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-${PV}.tar.xz \
${TK1-PATCHES} \
"
-SRC_URI[md5sum] = "0a2120cc58fe9ff0cbb7330dd1acb82e"
-SRC_URI[sha256sum] = "6ebcc57ba31d714af872347184d1de32f4ab0b7096ef4e062d1ca6b3234d9333"
+SRC_URI[md5sum] = "1f25f5abe06404f9c3d41fbf25d8a22e"
+SRC_URI[sha256sum] = "7c5bb02feb48f1b7ab9a9c3ff051f325c0c6474fb0e25d9d7bcee91b2cfe6645"
# For CI use one could use the following instead (plus patches still of course)
LINUX_VERSION_use-head-next ?= "4.14"