1
From: Arnd Bergmann <arnd@arndb.de>
2
Date: Tue, 25 Jan 2011 23:17:15 +0100
3
Subject: [PATCH] drm/i810: remove the BKL
5
commit 1f692a14cbfbeb11f9a9c16f25c8ecb8ab50d3d5 upstream.
7
SMP i810 systems were practically nonexistent and the configuration
8
was not officially supported by Intel at the time when Pentium-III
11
With this change, it is still possible to build a distribution kernel
12
that has support for SMP and includes the i810 driver without the BKL.
13
As a precaution, check for the theoretical SMP case at run time and
14
refuse to load the driver.
16
We also need to disable CONFIG_PREEMPT builds for this driver.
18
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
19
Cc: dri-devel@lists.freedesktop.org
20
Signed-off-by: Dave Airlie <airlied@redhat.com>
22
drivers/gpu/drm/Kconfig | 4 ++--
23
drivers/gpu/drm/i810/i810_dma.c | 18 +-----------------
24
drivers/gpu/drm/i810/i810_drv.c | 6 +++++-
25
3 files changed, 8 insertions(+), 20 deletions(-)
27
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
28
index 4458876..a6feb78c 100644
29
--- a/drivers/gpu/drm/Kconfig
30
+++ b/drivers/gpu/drm/Kconfig
31
@@ -73,8 +73,8 @@ source "drivers/gpu/drm/radeon/Kconfig"
35
- # BKL usage in order to avoid AB-BA deadlocks, may become BROKEN_ON_SMP
36
- depends on DRM && AGP && AGP_INTEL && BKL
37
+ # !PREEMPT because of missing ioctl locking
38
+ depends on DRM && AGP && AGP_INTEL && (!PREEMPT || BROKEN)
40
Choose this option if you have an Intel I810 graphics card. If M is
41
selected, the module will be called i810. AGP support is required
42
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c
43
index ff33e53..8f371e8 100644
44
--- a/drivers/gpu/drm/i810/i810_dma.c
45
+++ b/drivers/gpu/drm/i810/i810_dma.c
47
#include <linux/interrupt.h> /* For task queue support */
48
#include <linux/delay.h>
49
#include <linux/slab.h>
50
-#include <linux/smp_lock.h>
51
#include <linux/pagemap.h>
53
#define I810_BUF_FREE 2
54
@@ -94,7 +93,6 @@ static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
56
drm_i810_buf_priv_t *buf_priv;
59
dev = priv->minor->dev;
60
dev_priv = dev->dev_private;
61
buf = dev_priv->mmap_buffer;
62
@@ -104,7 +102,6 @@ static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
65
buf_priv->currently_mapped = I810_BUF_MAPPED;
68
if (io_remap_pfn_range(vma, vma->vm_start,
70
@@ -116,7 +113,7 @@ static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
71
static const struct file_operations i810_buffer_fops = {
73
.release = drm_release,
74
- .unlocked_ioctl = i810_ioctl,
75
+ .unlocked_ioctl = drm_ioctl,
76
.mmap = i810_mmap_buffers,
78
.llseek = noop_llseek,
79
@@ -1242,19 +1239,6 @@ int i810_driver_dma_quiescent(struct drm_device *dev)
84
- * call the drm_ioctl under the big kernel lock because
85
- * to lock against the i810_mmap_buffers function.
87
-long i810_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
91
- ret = drm_ioctl(file, cmd, arg);
96
struct drm_ioctl_desc i810_ioctls[] = {
97
DRM_IOCTL_DEF_DRV(I810_INIT, i810_dma_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY|DRM_UNLOCKED),
98
DRM_IOCTL_DEF_DRV(I810_VERTEX, i810_dma_vertex, DRM_AUTH|DRM_UNLOCKED),
99
diff --git a/drivers/gpu/drm/i810/i810_drv.c b/drivers/gpu/drm/i810/i810_drv.c
100
index 88bcd33..0152fa2 100644
101
--- a/drivers/gpu/drm/i810/i810_drv.c
102
+++ b/drivers/gpu/drm/i810/i810_drv.c
103
@@ -57,7 +57,7 @@ static struct drm_driver driver = {
104
.owner = THIS_MODULE,
106
.release = drm_release,
107
- .unlocked_ioctl = i810_ioctl,
108
+ .unlocked_ioctl = drm_ioctl,
111
.fasync = drm_fasync,
112
@@ -79,6 +79,10 @@ static struct drm_driver driver = {
114
static int __init i810_init(void)
116
+ if (num_possible_cpus() > 1) {
117
+ pr_err("drm/i810 does not support SMP\n");
120
driver.num_ioctls = i810_max_ioctl;
121
return drm_init(&driver);