1. 30 8月, 2010 2 次提交
  2. 17 8月, 2010 1 次提交
    • D
      drm: block userspace under allocating buffer and having drivers overwrite it (v2) · 1b2f1489
      Dave Airlie 提交于
      With the current screwed but its ABI, ioctls for the drm, Linus pointed out that we could allow userspace to specify the allocation size, but we pass it to the driver which then uses it blindly to store a struct. Now if userspace specifies the allocation size as smaller than the driver needs, the driver can possibly overwrite memory.
      
      This patch restructures the driver ioctls so we store the structure size we are expecting, and make sure we allocate at least that size. The copy from/to userspace are still restricted to the size the user specifies, this allows ioctl structs to grow on both sides of the equation.
      
      Up until now we didn't really use the DRM_IOCTL defines in the kernel, so this cleans them up and adds them for nouveau.
      
      v2:
      fix nouveau pushbuf arg (thanks to Ben for pointing it out)
      Reported-by: NLinus Torvalds <torvalds@linuxfoundation.org>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      1b2f1489
  3. 10 8月, 2010 1 次提交
    • B
      drm: Fix support for PCI domains · c17c2f89
      Benjamin Herrenschmidt 提交于
      (For some reason I thought that went in ages ago ...)
      
      This fixes support for PCI domains in what should hopefully be a backward
      compatible way along with a change to libdrm.
      
      When the interface version is set to 1.4, we assume userspace understands
      domains and the world is at peace. We thus pass proper domain numbers
      instead of 0 to userspace.
      
      The newer libdrm will then try 1.4 first, and fallback to 1.1, along with
      ignoring domains in the later case (well, except on alpha of course)
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      c17c2f89
  4. 05 8月, 2010 1 次提交
    • A
      drm: kill BKL from common code · 58374713
      Arnd Bergmann 提交于
      This restricts the use of the big kernel lock to the i830 and i810
      device drivers. The three remaining users in common code (open, ioctl
      and release) get converted to a new mutex, the drm_global_mutex,
      making the locking stricter than the big kernel lock.
      
      This may have a performance impact, but only in those cases that
      currently don't use DRM_UNLOCKED flag in the ioctl list and would
      benefit from that anyway.
      
      The reason why i810 and i830 cannot use drm_global_mutex in their
      mmap functions is a lock-order inversion problem between the current
      use of the BKL and mmap_sem in these drivers. Since the BKL has
      release-on-sleep semantics, it's harmless but it would cause trouble
      if we replace the BKL with a mutex.
      
      Instead, these drivers get their own ioctl wrappers that take the
      BKL around every ioctl call and then set their own handlers as
      DRM_UNLOCKED.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: David Airlie <airlied@linux.ie>
      Cc: dri-devel@lists.freedesktop.org
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      58374713
  5. 04 8月, 2010 1 次提交
  6. 02 7月, 2010 1 次提交
  7. 01 6月, 2010 2 次提交
  8. 20 4月, 2010 2 次提交
  9. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  10. 15 3月, 2010 1 次提交
  11. 11 2月, 2010 1 次提交
  12. 07 1月, 2010 1 次提交
  13. 18 12月, 2009 1 次提交
    • A
      drm: convert drm_ioctl to unlocked_ioctl · ed8b6704
      Arnd Bergmann 提交于
      drm_ioctl is called with the Big Kernel Lock held,
      which shows up very high in statistics on vfs_ioctl.
      
      Moving the lock into the drm_ioctl function itself
      makes sure we blame the right subsystem and it gets
      us one step closer to eliminating the locked version
      of fops->ioctl.
      
      Since drm_ioctl does not require the lock itself,
      we only need to hold it while calling the specific
      handler. The 32 bit conversion handlers do not
      interact with any other code, so they don't need
      the BKL here either and can just call drm_ioctl.
      
      As a bonus, this cleans up all the other users
      of drm_ioctl which now no longer have to find
      the inode or call lock_kernel.
      
      [airlied: squashed the non-driver bits
      of the second patch in here, this provides
      the flag for drivers to use to select unlocked
      ioctls - but doesn't modify any drivers].
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: David Airlie <airlied@linux.ie>
      Cc: dri-devel@lists.sourceforge.net
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      ed8b6704
  14. 04 12月, 2009 2 次提交
  15. 02 12月, 2009 1 次提交
    • L
      drm/i915: Fix sync to vblank when VGA output is turned off · 778c9026
      Li Peng 提交于
      In current vblank-wait implementation, if we turn off VGA output,
      drm_wait_vblank will still wait on the disabled pipe until timeout,
      because vblank on the pipe is assumed be enabled. This would cause
      slow system response on some system such as moblin.
      
      This patch resolve the issue by adding a drm helper function
      drm_vblank_off which explicitly clear vblank_enabled[crtc], wake up
      any waiting queue and save last vblank counter before turning off
      crtc. It also slightly change drm_vblank_get to ensure that we will
      will return immediately if trying to wait on a disabled pipe.
      Signed-off-by: NLi Peng <peng.li@intel.com>
      Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      [anholt: hand-applied for conflicts with overlay changes]
      Signed-off-by: NEric Anholt <eric@anholt.net>
      778c9026
  16. 25 11月, 2009 1 次提交
    • E
      drm/i915: Replace a calloc followed by copying data over it with malloc. · c8e0f93a
      Eric Anholt 提交于
      Execbufs involve quite a bit of payload, to the extent that cache misses
      show up in the profiles here, and a suspicion that some of those cachelines
      may get evicted and then reloaded in the subsequent copy.
      
      This is still abstracted like drm_calloc_large since we want to check for
      size overflow, and because we want to choose between kmalloc and vmalloc
      on the fly.  cairo's interface for malloc-with-calloc's-args was used as
      the model.
      Signed-off-by: NEric Anholt <eric@anholt.net>
      c8e0f93a
  17. 18 11月, 2009 3 次提交
  18. 26 10月, 2009 1 次提交
  19. 21 9月, 2009 1 次提交
    • D
      drm/vgaarb: add VGA arbitration support to the drm and kms. · 28d52043
      Dave Airlie 提交于
      VGA arb requires DRM support for non-kms drivers, to turn on/off
      irqs when disabling the mem/io regions.
      
      VGA arb requires KMS support for GPUs where we can turn off VGA
      decoding. Currently we know how to do this for intel and radeon
      kms drivers, which allows them to be removed from the arbiter.
      
      This patch comes from Fedora rawhide kernel.
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      28d52043
  20. 27 8月, 2009 1 次提交
  21. 04 8月, 2009 3 次提交
  22. 19 6月, 2009 1 次提交
  23. 12 6月, 2009 2 次提交
  24. 11 6月, 2009 2 次提交
    • Y
      drm: add separate drm debugging levels · 4fefcb27
      yakui_zhao 提交于
      Now all the DRM debug info will be reported if the boot option of
      "drm.debug=1" is added. Sometimes it is inconvenient to get the debug
      info in KMS mode. We will get too much unrelated info.
      
      This will separate several DRM debug levels and the debug level can be used
      to print the different debug info. And the debug level is controlled by the
      module parameter of drm.debug
      
      In this patch it is divided into four debug levels;
             	drm_core, drm_driver, drm_kms, drm_mode.
      
      At the same time we can get the different debug info by changing the debug
      level. This can be done by adding the module parameter. Of course it can
      be changed through the /sys/module/drm/parameters/debug after the system is
      booted.
      
      Four debug macro definitions are provided.
      	DRM_DEBUG(fmt, args...)
      	DRM_DEBUG_DRIVER(prefix, fmt, args...)
      	DRM_DEBUG_KMS(prefix, fmt, args...)
      	DRM_DEBUG_MODE(prefix, fmt, args...)
      
      When the boot option of "drm.debug=4" is added, it will print the debug info
      using DRM_DEBUG_KMS macro definition.
      When the boot option of "drm.debug=6" is added, it will print the debug info
      using DRM_DEBUG_KMS/DRM_DEBUG_DRIVER.
      
      Sometimes we expect to print the value of an array.
      For example: SDVO command,
      In such case the following four DRM debug macro definitions are added:
      	DRM_LOG(fmt, args...)
      	DRM_LOG_DRIVER(fmt, args...)
      	DRM_LOG_KMS(fmt, args...)
      	DRM_LOG_MODE(fmt, args...)
      Signed-off-by: NZhao Yakui <yakui.zhao@intel.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      4fefcb27
    • R
      drm: fix LOCK_TEST_WITH_RETURN macro · dcae3626
      Roel Kluin 提交于
      When this macro isn't called with 'file_priv' this will result in a build
      failure.
      Signed-off-by: NRoel Kluin <roel.kluin@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      dcae3626
  25. 20 5月, 2009 1 次提交
    • J
      drm/i915: allocate large pointer arrays with vmalloc · 8e7d2b2c
      Jesse Barnes 提交于
      For awhile now, many of the GEM code paths have allocated page or
      object arrays with the slab allocator.  This is nice and fast, but
      won't work well if memory is fragmented, since the slab allocator works
      with physically contiguous memory (i.e. order > 2 allocations are
      likely to fail fairly early after booting and doing some work).
      
      This patch works around the issue by falling back to vmalloc for
      >PAGE_SIZE allocations.  This is ugly, but much less work than chaining
      a bunch of pages together by hand (suprisingly there's not a bunch of
      generic kernel helpers for this yet afaik).  vmalloc space is somewhat
      precious on 32 bit kernels, but our allocations shouldn't be big enough
      to cause problems, though they're routinely more than a page.
      
      Note that this patch doesn't address the unchecked
      alloc-based-on-ioctl-args in GEM; that needs to be fixed in a separate
      patch.
      
      Also, I've deliberately ignored the DRM's "area" junk.  I don't think
      anyone actually uses it anymore and I'm hoping it gets ripped out soon.
      
      [Updated: removed size arg to new free function.  We could unify the
      free functions as well once the DRM mem tracking is ripped out.]
      
      fd.o bug #20152 (part 1/3)
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NEric Anholt <eric@anholt.net>
      8e7d2b2c
  26. 29 3月, 2009 1 次提交
  27. 28 3月, 2009 1 次提交
  28. 13 3月, 2009 3 次提交