aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-06-16 05:48:19 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-16 12:39:05 -0400
commitf4d2781731e846c2f01dd85e71883d120860c6dd (patch)
treeaac469bb1017619d0c314b6efcbbb465196237d6
parentde7f928ca460005086a8296be07c217aac4b625d (diff)
fix radeon setparam on 32/64 systems, harder.
Commit 9b01bd5b284bbf519b726b39f1352023cb5e9e69 introduced a compat_ioctl handler for RADEON_SETPARAM, the sole purpose of which was to handle the fact that on i386, alignof(uint64_t)==4. Unfortunately, this handler was installed for _all_ 64-bit architectures, instead of only x86_64 and ia64. And thus it breaks 32-bit compatibility on every other arch, where 64-bit integers are aligned to 8 bytes in 32-bit mode just the same as in 64-bit mode. Arnd has a cunning plan to use 'compat_u64' with appropriate alignment attributes according to the 32-bit ABI, but for now let's just make the compat_radeon_cp_setparam routine entirely disappear on 64-bit machines whose 32-bit compat support isn't for i386. It would be a no-op with compat_u64 anyway. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Dave Airlie <airlied@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/char/drm/radeon_ioc32.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/char/drm/radeon_ioc32.c b/drivers/char/drm/radeon_ioc32.c
index 04126c2e79ab..56decda2a71f 100644
--- a/drivers/char/drm/radeon_ioc32.c
+++ b/drivers/char/drm/radeon_ioc32.c
@@ -349,6 +349,8 @@ static int compat_radeon_irq_emit(struct file *file, unsigned int cmd,
349 DRM_IOCTL_RADEON_IRQ_EMIT, (unsigned long)request); 349 DRM_IOCTL_RADEON_IRQ_EMIT, (unsigned long)request);
350} 350}
351 351
352/* The two 64-bit arches where alignof(u64)==4 in 32-bit code */
353#if defined (CONFIG_X86_64) || defined(CONFIG_IA64)
352typedef struct drm_radeon_setparam32 { 354typedef struct drm_radeon_setparam32 {
353 int param; 355 int param;
354 u64 value; 356 u64 value;
@@ -373,6 +375,9 @@ static int compat_radeon_cp_setparam(struct file *file, unsigned int cmd,
373 return drm_ioctl(file->f_dentry->d_inode, file, 375 return drm_ioctl(file->f_dentry->d_inode, file,
374 DRM_IOCTL_RADEON_SETPARAM, (unsigned long) request); 376 DRM_IOCTL_RADEON_SETPARAM, (unsigned long) request);
375} 377}
378#else
379#define compat_radeon_cp_setparam NULL
380#endif /* X86_64 || IA64 */
376 381
377drm_ioctl_compat_t *radeon_compat_ioctls[] = { 382drm_ioctl_compat_t *radeon_compat_ioctls[] = {
378 [DRM_RADEON_CP_INIT] = compat_radeon_cp_init, 383 [DRM_RADEON_CP_INIT] = compat_radeon_cp_init,