2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-21 03:33:59 +08:00
linux-next/drivers/char/drm
Dave Airlie 9a18664506 drm: 32/64-bit DRM ioctl compatibility patch
The patch is against a 2.6.11 kernel tree.  I am running this with a
32-bit X server (compiled up from X.org CVS as of a couple of weeks
ago) and 32-bit DRI libraries and clients.  All the userland stuff is
identical to what I am using under a 32-bit kernel on my G4 powerbook
(which is a 32-bit machine of course).  I haven't tried compiling up a
64-bit X server or clients yet.

In the compatibility routines I have assumed that the kernel can
safely access user addresses after set_fs(KERNEL_DS).  That is, where
an ioctl argument structure contains pointers to other structures, and
those other structures are already compatible between the 32-bit and
64-bit ABIs (i.e. they only contain things like chars, shorts or
ints), I just check the address with access_ok() and then pass it
through to the 64-bit ioctl code.  I believe this approach may not
work on sparc64, but it does work on ppc64 and x86_64 at least.

One tricky area which may need to be revisited is the question of how
to handle the handles which we pass back to userspace to identify
mappings.  These handles are generated in the ADDMAP ioctl and then
passed in as the offset value to mmap.  However, offset values for
mmap seem to be generated in other ways as well, particularly for AGP
mappings.

The approach I have ended up with is to generate a fake 32-bit handle
only for _DRM_SHM mappings.  The handles for other mappings (AGP, REG,
FB) are physical addresses which are already limited to 32 bits, and
generating fake handles for them created all sorts of problems in the
mmap/nopage code.

This patch has been updated to use the new compatibility ioctls.

From: Paul Mackerras <paulus@samba.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-06-23 21:29:18 +10:00
..
ati_pcigart.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_agpsupport.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_auth.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_bufs.c drm: 32/64-bit DRM ioctl compatibility patch 2005-06-23 21:29:18 +10:00
drm_context.c drm: 32/64-bit DRM ioctl compatibility patch 2005-06-23 21:29:18 +10:00
drm_core.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_dma.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_drawable.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_drv.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_fops.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_init.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_ioc32.c drm: 32/64-bit DRM ioctl compatibility patch 2005-06-23 21:29:18 +10:00
drm_ioctl.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_irq.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_lock.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_memory_debug.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_memory.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_memory.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_os_linux.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_pci.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_pciids.h [PATCH] drm add i945G pci id 2005-06-10 18:47:38 +10:00
drm_proc.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_sarea.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_scatter.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_stub.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_sysfs.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm_vm.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drm.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
drmP.h drm: 32/64-bit DRM ioctl compatibility patch 2005-06-23 21:29:18 +10:00
ffb_context.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ffb_drv.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ffb_drv.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
gamma_context.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
gamma_dma.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
gamma_drm.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
gamma_drv.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
gamma_drv.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
gamma_lists.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
gamma_lock.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
gamma_old_dma.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
i810_dma.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
i810_drm.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
i810_drv.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
i810_drv.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
i830_dma.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
i830_drm.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
i830_drv.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
i830_drv.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
i830_irq.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
i915_dma.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
i915_drm.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
i915_drv.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
i915_drv.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
i915_irq.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
i915_mem.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Kconfig Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Makefile drm: 32/64-bit DRM ioctl compatibility patch 2005-06-23 21:29:18 +10:00
mga_dma.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mga_drm.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mga_drv.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mga_drv.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mga_irq.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mga_state.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mga_ucode.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mga_warp.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
r128_cce.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
r128_drm.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
r128_drv.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
r128_drv.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
r128_irq.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
r128_state.c [PATCH] r128_state.c: break missing in switch statement 2005-04-16 15:24:04 -07:00
radeon_cp.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
radeon_drm.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
radeon_drv.c drm: 32/64-bit DRM ioctl compatibility patch 2005-06-23 21:29:18 +10:00
radeon_drv.h drm: 32/64-bit DRM ioctl compatibility patch 2005-06-23 21:29:18 +10:00
radeon_ioc32.c drm: 32/64-bit DRM ioctl compatibility patch 2005-06-23 21:29:18 +10:00
radeon_irq.c [PATCH] remove bogus hack from radeon IRQ handler 2005-06-10 19:27:51 +10:00
radeon_mem.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
radeon_state.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
README.drm Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sis_drm.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sis_drv.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sis_drv.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sis_ds.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sis_ds.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sis_mm.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
tdfx_drv.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
tdfx_drv.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00

************************************************************
* For the very latest on DRI development, please see:      *
*     http://dri.sourceforge.net/                          *
************************************************************

The Direct Rendering Manager (drm) is a device-independent kernel-level
device driver that provides support for the XFree86 Direct Rendering
Infrastructure (DRI).

The DRM supports the Direct Rendering Infrastructure (DRI) in four major
ways:

    1. The DRM provides synchronized access to the graphics hardware via
       the use of an optimized two-tiered lock.

    2. The DRM enforces the DRI security policy for access to the graphics
       hardware by only allowing authenticated X11 clients access to
       restricted regions of memory.

    3. The DRM provides a generic DMA engine, complete with multiple
       queues and the ability to detect the need for an OpenGL context
       switch.

    4. The DRM is extensible via the use of small device-specific modules
       that rely extensively on the API exported by the DRM module.


Documentation on the DRI is available from:
    http://precisioninsight.com/piinsights.html

For specific information about kernel-level support, see:

    The Direct Rendering Manager, Kernel Support for the Direct Rendering
    Infrastructure
    http://precisioninsight.com/dr/drm.html

    Hardware Locking for the Direct Rendering Infrastructure
    http://precisioninsight.com/dr/locking.html

    A Security Analysis of the Direct Rendering Infrastructure
    http://precisioninsight.com/dr/security.html

************************************************************
* For the very latest on DRI development, please see:      *
*     http://dri.sourceforge.net/                          *
************************************************************