diff options
author | Arnd Bergmann <arnd@arndb.de> | 2011-01-25 17:17:15 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-02-06 21:15:04 -0500 |
commit | 1f692a14cbfbeb11f9a9c16f25c8ecb8ab50d3d5 (patch) | |
tree | 4f9ab3542cb556e526f99644d82061ac503f6943 | |
parent | 7f50684717511d30bba180902105c4cd4efca732 (diff) |
drm/i810: remove the BKL
SMP i810 systems were practically nonexistent and the configuration
was not officially supported by Intel at the time when Pentium-III
was common.
With this change, it is still possible to build a distribution kernel
that has support for SMP and includes the i810 driver without the BKL.
As a precaution, check for the theoretical SMP case at run time and
refuse to load the driver.
We also need to disable CONFIG_PREEMPT builds for this driver.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | drivers/gpu/drm/Kconfig | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/i810/i810_dma.c | 18 | ||||
-rw-r--r-- | drivers/gpu/drm/i810/i810_drv.c | 6 |
3 files changed, 8 insertions, 20 deletions
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 44588764a524..a6feb78c404c 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig | |||
@@ -73,8 +73,8 @@ source "drivers/gpu/drm/radeon/Kconfig" | |||
73 | 73 | ||
74 | config DRM_I810 | 74 | config DRM_I810 |
75 | tristate "Intel I810" | 75 | tristate "Intel I810" |
76 | # BKL usage in order to avoid AB-BA deadlocks, may become BROKEN_ON_SMP | 76 | # !PREEMPT because of missing ioctl locking |
77 | depends on DRM && AGP && AGP_INTEL && BKL | 77 | depends on DRM && AGP && AGP_INTEL && (!PREEMPT || BROKEN) |
78 | help | 78 | help |
79 | Choose this option if you have an Intel I810 graphics card. If M is | 79 | Choose this option if you have an Intel I810 graphics card. If M is |
80 | selected, the module will be called i810. AGP support is required | 80 | selected, the module will be called i810. AGP support is required |
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c index ff33e53bbbf8..8f371e8d630f 100644 --- a/drivers/gpu/drm/i810/i810_dma.c +++ b/drivers/gpu/drm/i810/i810_dma.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <linux/interrupt.h> /* For task queue support */ | 37 | #include <linux/interrupt.h> /* For task queue support */ |
38 | #include <linux/delay.h> | 38 | #include <linux/delay.h> |
39 | #include <linux/slab.h> | 39 | #include <linux/slab.h> |
40 | #include <linux/smp_lock.h> | ||
41 | #include <linux/pagemap.h> | 40 | #include <linux/pagemap.h> |
42 | 41 | ||
43 | #define I810_BUF_FREE 2 | 42 | #define I810_BUF_FREE 2 |
@@ -94,7 +93,6 @@ static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma) | |||
94 | struct drm_buf *buf; | 93 | struct drm_buf *buf; |
95 | drm_i810_buf_priv_t *buf_priv; | 94 | drm_i810_buf_priv_t *buf_priv; |
96 | 95 | ||
97 | lock_kernel(); | ||
98 | dev = priv->minor->dev; | 96 | dev = priv->minor->dev; |
99 | dev_priv = dev->dev_private; | 97 | dev_priv = dev->dev_private; |
100 | buf = dev_priv->mmap_buffer; | 98 | buf = dev_priv->mmap_buffer; |
@@ -104,7 +102,6 @@ static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma) | |||
104 | vma->vm_file = filp; | 102 | vma->vm_file = filp; |
105 | 103 | ||
106 | buf_priv->currently_mapped = I810_BUF_MAPPED; | 104 | buf_priv->currently_mapped = I810_BUF_MAPPED; |
107 | unlock_kernel(); | ||
108 | 105 | ||
109 | if (io_remap_pfn_range(vma, vma->vm_start, | 106 | if (io_remap_pfn_range(vma, vma->vm_start, |
110 | vma->vm_pgoff, | 107 | vma->vm_pgoff, |
@@ -116,7 +113,7 @@ static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma) | |||
116 | static const struct file_operations i810_buffer_fops = { | 113 | static const struct file_operations i810_buffer_fops = { |
117 | .open = drm_open, | 114 | .open = drm_open, |
118 | .release = drm_release, | 115 | .release = drm_release, |
119 | .unlocked_ioctl = i810_ioctl, | 116 | .unlocked_ioctl = drm_ioctl, |
120 | .mmap = i810_mmap_buffers, | 117 | .mmap = i810_mmap_buffers, |
121 | .fasync = drm_fasync, | 118 | .fasync = drm_fasync, |
122 | .llseek = noop_llseek, | 119 | .llseek = noop_llseek, |
@@ -1242,19 +1239,6 @@ int i810_driver_dma_quiescent(struct drm_device *dev) | |||
1242 | return 0; | 1239 | return 0; |
1243 | } | 1240 | } |
1244 | 1241 | ||
1245 | /* | ||
1246 | * call the drm_ioctl under the big kernel lock because | ||
1247 | * to lock against the i810_mmap_buffers function. | ||
1248 | */ | ||
1249 | long i810_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | ||
1250 | { | ||
1251 | int ret; | ||
1252 | lock_kernel(); | ||
1253 | ret = drm_ioctl(file, cmd, arg); | ||
1254 | unlock_kernel(); | ||
1255 | return ret; | ||
1256 | } | ||
1257 | |||
1258 | struct drm_ioctl_desc i810_ioctls[] = { | 1242 | struct drm_ioctl_desc i810_ioctls[] = { |
1259 | DRM_IOCTL_DEF_DRV(I810_INIT, i810_dma_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY|DRM_UNLOCKED), | 1243 | DRM_IOCTL_DEF_DRV(I810_INIT, i810_dma_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY|DRM_UNLOCKED), |
1260 | DRM_IOCTL_DEF_DRV(I810_VERTEX, i810_dma_vertex, DRM_AUTH|DRM_UNLOCKED), | 1244 | DRM_IOCTL_DEF_DRV(I810_VERTEX, i810_dma_vertex, DRM_AUTH|DRM_UNLOCKED), |
diff --git a/drivers/gpu/drm/i810/i810_drv.c b/drivers/gpu/drm/i810/i810_drv.c index 88bcd331e7c5..0152fa27e616 100644 --- a/drivers/gpu/drm/i810/i810_drv.c +++ b/drivers/gpu/drm/i810/i810_drv.c | |||
@@ -57,7 +57,7 @@ static struct drm_driver driver = { | |||
57 | .owner = THIS_MODULE, | 57 | .owner = THIS_MODULE, |
58 | .open = drm_open, | 58 | .open = drm_open, |
59 | .release = drm_release, | 59 | .release = drm_release, |
60 | .unlocked_ioctl = i810_ioctl, | 60 | .unlocked_ioctl = drm_ioctl, |
61 | .mmap = drm_mmap, | 61 | .mmap = drm_mmap, |
62 | .poll = drm_poll, | 62 | .poll = drm_poll, |
63 | .fasync = drm_fasync, | 63 | .fasync = drm_fasync, |
@@ -79,6 +79,10 @@ static struct drm_driver driver = { | |||
79 | 79 | ||
80 | static int __init i810_init(void) | 80 | static int __init i810_init(void) |
81 | { | 81 | { |
82 | if (num_possible_cpus() > 1) { | ||
83 | pr_err("drm/i810 does not support SMP\n"); | ||
84 | return -EINVAL; | ||
85 | } | ||
82 | driver.num_ioctls = i810_max_ioctl; | 86 | driver.num_ioctls = i810_max_ioctl; |
83 | return drm_init(&driver); | 87 | return drm_init(&driver); |
84 | } | 88 | } |