android_kernel_xiaomi_sm8350/drivers/char/drm
David Howells 7d12e780e0 IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.

The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around.  On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).

Where appropriate, an arch may override the generic storage facility and do
something different with the variable.  On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.

Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions.  Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller.  A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.

I've build this code with allyesconfig for x86_64 and i386.  I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.

This will affect all archs.  Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:

	struct pt_regs *old_regs = set_irq_regs(regs);

And put the old one back at the end:

	set_irq_regs(old_regs);

Don't pass regs through to generic_handle_irq() or __do_IRQ().

In timer_interrupt(), this sort of change will be necessary:

	-	update_process_times(user_mode(regs));
	-	profile_tick(CPU_PROFILING, regs);
	+	update_process_times(user_mode(get_irq_regs()));
	+	profile_tick(CPU_PROFILING);

I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().

Some notes on the interrupt handling in the drivers:

 (*) input_dev() is now gone entirely.  The regs pointer is no longer stored in
     the input_dev struct.

 (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking.  It does
     something different depending on whether it's been supplied with a regs
     pointer or not.

 (*) Various IRQ handler function pointers have been moved to type
     irq_handler_t.

Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 15:10:12 +01:00
..
ati_pcigart.c drm: ati_pcigart: simplify page_count manipulations 2006-01-25 14:58:58 +11:00
drm_agpsupport.c drm: possible cleanups 2006-04-23 18:26:40 +10:00
drm_auth.c drm: fix return value in auth function 2006-09-22 05:32:32 +10:00
drm_bufs.c drm: allow multiple addMaps with the same 32-bit map offsset. 2006-09-22 05:32:34 +10:00
drm_context.c sem2mutex: drivers/char/drm/ 2006-02-02 19:37:46 +11:00
drm_core.h drm: add in-kernel entry points for rest of AGP ioctls 2005-11-11 22:33:39 +11:00
drm_dma.c drm: fixup PCI DMA support 2006-03-19 18:56:12 +11:00
drm_drawable.c drm: lindent the drm directory. 2005-09-25 14:28:13 +10:00
drm_drv.c drm: remove hash tables on drm exit 2006-09-22 05:32:33 +10:00
drm_fops.c drm: remove hash tables on drm exit 2006-09-22 05:32:33 +10:00
drm_hashtab.c drm: Fix hashtab implementation leaking illegal error codes to user space. 2006-09-22 05:32:34 +10:00
drm_hashtab.h drm: update user token hashing and map handles 2006-09-22 05:32:31 +10:00
drm_ioc32.c drm: cleanup old compat code and DRM fns from Linux only code 2006-09-22 05:32:30 +10:00
drm_ioctl.c drm: fixup setversion return codes.. 2006-09-22 05:32:33 +10:00
drm_irq.c drm: remove the DRM pci domain 2006-09-22 05:32:30 +10:00
drm_lock.c drm: merge in Linus mainline 2006-01-03 18:18:01 +11:00
drm_memory_debug.h Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
drm_memory.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
drm_memory.h Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
drm_mm.c drm: remove FALSE/TRUE that snuck in with simple memory manager changes. 2006-09-22 05:32:32 +10:00
drm_os_linux.h IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
drm_pci.c drm: drm_pci needs dma-mapping.h 2006-04-05 18:12:18 +10:00
drm_pciids.h drm: use radeon specific names for radeon flags 2006-09-22 05:32:34 +10:00
drm_proc.c drm: cleanup old compat code and DRM fns from Linux only code 2006-09-22 05:32:30 +10:00
drm_sarea.h drm: lindent the drm directory. 2005-09-25 14:28:13 +10:00
drm_scatter.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
drm_sman.c drm: cleanups 2006-09-22 05:32:33 +10:00
drm_sman.h drm: remove FALSE/TRUE that snuck in with simple memory manager changes. 2006-09-22 05:32:32 +10:00
drm_stub.c drm: add device/vendor id to drm_device_t for compat with FreeBSD drivers 2006-09-22 05:32:34 +10:00
drm_sysfs.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
drm_vm.c drm: update user token hashing and map handles 2006-09-22 05:32:31 +10:00
drm.h Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
drmP.h drm: add device/vendor id to drm_device_t for compat with FreeBSD drivers 2006-09-22 05:32:34 +10:00
ffb_context.c [PATCH] kfree cleanup: drivers/char 2005-11-07 07:54:02 -08:00
ffb_drv.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
ffb_drv.h drm: lindent the drm directory. 2005-09-25 14:28:13 +10:00
i810_dma.c drm: i810_dma.c: fix pointer arithmetic for 64-bit target 2006-09-22 05:32:33 +10:00
i810_drm.h drm: lindent the drm directory. 2005-09-25 14:28:13 +10:00
i810_drv.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
i810_drv.h drm: drivers/char/drm/: make some functions static 2006-02-02 19:21:38 +11:00
i830_dma.c drm: i810_dma.c: fix pointer arithmetic for 64-bit target 2006-09-22 05:32:33 +10:00
i830_drm.h drm: lindent the drm directory. 2005-09-25 14:28:13 +10:00
i830_drv.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
i830_drv.h drm: drivers/char/drm/: make some functions static 2006-02-02 19:21:38 +11:00
i830_irq.c drm: lindent the drm directory. 2005-09-25 14:28:13 +10:00
i915_dma.c drm: add device/vendor id to drm_device_t for compat with FreeBSD drivers 2006-09-22 05:32:34 +10:00
i915_drm.h drm: Add support for Intel i965G chipsets. 2006-09-22 05:32:32 +10:00
i915_drv.c drm: update to i915 1.3.0 2006-01-02 20:14:23 +11:00
i915_drv.h drm: Add support for Intel i965G chipsets. 2006-09-22 05:32:32 +10:00
i915_ioc32.c [PATCH] don't include ioctl32.h in drivers 2006-01-10 08:01:34 -08:00
i915_irq.c drm: Add support for Intel i965G chipsets. 2006-09-22 05:32:32 +10:00
i915_mem.c drm: i915 patches from Tungsten Graphics 2006-01-25 15:31:43 +11:00
Kconfig drm: add better explanation for i830/i915 2006-09-22 05:32:32 +10:00
Makefile drm: add drm simple memory manager support for SiS and VIA drivers 2006-09-22 05:32:31 +10:00
mga_dma.c drm: update mga driver for new bootstrap code 2005-11-11 23:11:34 +11:00
mga_drm.h drm: lindent the drm directory. 2005-09-25 14:28:13 +10:00
mga_drv.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
mga_drv.h drm: update mga driver for new bootstrap code 2005-11-11 23:11:34 +11:00
mga_ioc32.c [PATCH] don't include ioctl32.h in drivers 2006-01-10 08:01:34 -08:00
mga_irq.c drm: lindent the drm directory. 2005-09-25 14:28:13 +10:00
mga_state.c drm: move ioctl flags to a bit field of flags 2006-01-02 13:54:04 +11:00
mga_ucode.h drm: lindent the drm directory. 2005-09-25 14:28:13 +10:00
mga_warp.c drm: lindent the drm directory. 2005-09-25 14:28:13 +10:00
r128_cce.c drm: update PCIGART support from CVS 2006-01-02 17:18:39 +11:00
r128_drm.h drm: update PCIGART support from CVS 2006-01-02 17:18:39 +11:00
r128_drv.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
r128_drv.h drm: update PCIGART support from CVS 2006-01-02 17:18:39 +11:00
r128_ioc32.c [PATCH] don't include ioctl32.h in drivers 2006-01-10 08:01:34 -08:00
r128_irq.c drm: update PCIGART support from CVS 2006-01-02 17:18:39 +11:00
r128_state.c [PATCH] Unlinline a bunch of other functions 2006-01-14 18:27:06 -08:00
r300_cmdbuf.c drm: fixup r300 scratch on BE machines 2006-04-23 18:14:00 +10:00
r300_reg.h drm: update r300 register names 2006-03-19 19:12:10 +11:00
radeon_cp.c drm: use radeon specific names for radeon flags 2006-09-22 05:32:34 +10:00
radeon_drm.h drm: update radeon to 1.25 add r200 vertex program support 2006-06-24 17:32:10 +10:00
radeon_drv.c drm: use radeon specific names for radeon flags 2006-09-22 05:32:34 +10:00
radeon_drv.h drm: Use register writes instead of BITBLT_MULTI packets for buffer swap blits 2006-09-22 05:32:34 +10:00
radeon_ioc32.c [PATCH] don't include ioctl32.h in drivers 2006-01-10 08:01:34 -08:00
radeon_irq.c drm: lindent the drm directory. 2005-09-25 14:28:13 +10:00
radeon_mem.c drm: lindent the drm directory. 2005-09-25 14:28:13 +10:00
radeon_state.c drm: Use register writes instead of BITBLT_MULTI packets for buffer swap blits 2006-09-22 05:32:34 +10:00
README.drm
savage_bci.c drm: drivers/char/drm/: make some functions static 2006-02-02 19:21:38 +11:00
savage_drm.h drm: lindent the drm directory. 2005-09-25 14:28:13 +10:00
savage_drv.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
savage_drv.h drm: drivers/char/drm/: make some functions static 2006-02-02 19:21:38 +11:00
savage_state.c drm: fix a LOR issue on FreeBSD for savage driver 2006-01-02 16:11:44 +11:00
sis_drm.h drm: bring sis + tdfx up to latest CVS 2006-01-02 14:44:12 +11:00
sis_drv.c drm: SiS 315 Awareness. 2006-09-22 05:32:31 +10:00
sis_drv.h drm: SiS 315 Awareness. 2006-09-22 05:32:31 +10:00
sis_mm.c drm: cleanups 2006-09-22 05:32:33 +10:00
tdfx_drv.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
tdfx_drv.h drm: bring sis + tdfx up to latest CVS 2006-01-02 14:44:12 +11:00
via_3d_reg.h drm: lindent the drm directory. 2005-09-25 14:28:13 +10:00
via_dma.c drm: drivers/char/drm/: make some functions static 2006-02-02 19:21:38 +11:00
via_dmablit.c drm: realign via driver with drm git tree 2006-09-22 05:32:33 +10:00
via_dmablit.h drm: fix warning on alpha 2006-01-10 19:53:54 +11:00
via_drm.h drm: realign via driver with drm git tree 2006-09-22 05:32:33 +10:00
via_drv.c drm: add drm simple memory manager support for SiS and VIA drivers 2006-09-22 05:32:31 +10:00
via_drv.h drm: add drm simple memory manager support for SiS and VIA drivers 2006-09-22 05:32:31 +10:00
via_irq.c drm: Fix further issues in drivers/char/drm/via_irq.c 2006-04-18 21:04:48 +10:00
via_map.c drm: add drm simple memory manager support for SiS and VIA drivers 2006-09-22 05:32:31 +10:00
via_mm.c drm: realign via driver with drm git tree 2006-09-22 05:32:33 +10:00
via_mm.h
via_verifier.c drm: update VIA driver to 2.7.2 2005-11-12 21:52:46 +11:00
via_verifier.h drm: update VIA driver to 2.7.2 2005-11-12 21:52:46 +11:00
via_video.c drm: update VIA driver to 2.7.2 2005-11-12 21:52:46 +11: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/                          *
************************************************************