1. 10 Jan, 2012 3 commits
  2. 09 Jan, 2012 5 commits
  3. 06 Jan, 2012 9 commits
    • Dave Airlie's avatar
      drm: introduce drm_can_sleep and use in intel/radeon drivers. (v2) · cc1f7194
      Dave Airlie authored
      So we have a few places where the drm drivers would like to sleep to
      be nice to the system, mainly in the modesetting paths, but we also
      have two cases were atomic modesetting must take place, panic writing
      and kernel debugger. So provide a central inline to determine if a
      sleep or delay should be used and use this in the intel and radeon drivers.
      
      v2: drop intel_drv.h MSLEEP macro, nobody uses it.
      
      Based on patch from Michel Dänzer <michel.daenzer@amd.com>
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43941Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      cc1f7194
    • Michel Dänzer's avatar
      radeon: Fix disabling PCI bus mastering on big endian hosts. · 3df96909
      Michel Dänzer authored
      It would previously write basically random bits to PCI configuration space...
      Not very surprising that the GPU tended to stop responding completely. The
      resulting MCE even froze the whole machine sometimes.
      
      Now resetting the GPU after a lockup has at least a fighting chance of
      succeeding.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMichel Dänzer <michel.daenzer@amd.com>
      Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      3df96909
    • Jerome Glisse's avatar
      ttm: fix agp since ttm tt rework · dea7e0ac
      Jerome Glisse authored
      ttm tt rework modified the way we allocate and populate the
      ttm_tt structure, the AGP side was missing some bit to properly
      work. Fix those and fix radeon and nouveau AGP support.
      
      Tested on radeon only so far.
      Signed-off-by: default avatarJerome Glisse <jglisse@redhat.com>
      Reviewed-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      dea7e0ac
    • Tormod Volden's avatar
    • Konrad Rzeszutek Wilk's avatar
      drm/ttm/dma: Fix accounting error when calling ttm_mem_global_free_page and... · 2c05114d
      Konrad Rzeszutek Wilk authored
      drm/ttm/dma: Fix accounting error when calling ttm_mem_global_free_page and don't try to free freed pages.
      
      The code to figure out how many pages to shrink the pool
      ends up capping the 'count' at _manager->options.max_size - which is OK.
      Except that the 'count' is also used when accounting for how many pages
      are recycled - which we end up with the invalid values. This fixes
      it by using a different value for the amount of pages to shrink.
      
      On top of that we would free the cached page pool - which is nonsense
      as they are deleted from the pool - so there are no free pages in that
      pool..
      
      Also we also missed the opportunity to batch the amount of pages
      to free (similar to how ttm_page_alloc.c does it). This reintroduces
      the code that was lost during rebasing.
      Reviewed-by: default avatarJerome Glisse <jglisse@redhat.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      2c05114d
    • Konrad Rzeszutek Wilk's avatar
      drm/ttm/dma: Only call set_pages_array_wb when the page is not in WB pool. · 36d7c537
      Konrad Rzeszutek Wilk authored
      Otherwise we are doing redundant work. Especially since the 'unbind'
      and 'unpopulate' have been merged and nouveau driver ends up calling
      it quite excessivly. On a GeForce 8600 GT with Gnome Shell (GNOME 3)
      we end up spending about 54% CPU time in __change_page_attr_set_clr
      checking the page flags.
      
      The callgraph (annotated) looks as so before this patch:
      
          53.29%  gnome-shell  [kernel.kallsyms]                   [k] static_protections
                  |
                  --- static_protections
                     |
                     |--91.80%-- __change_page_attr_set_clr
                     |          change_page_attr_set_clr
                     |          set_pages_array_wb
                     |          |
                     |          |--96.55%-- ttm_dma_unpopulate
                     |          |          nouveau_ttm_tt_unpopulate
                     |          |          ttm_tt_destroy
                     |          |          ttm_bo_cleanup_memtype_use
                     |          |          ttm_bo_release
                     |          |          kref_put
                     |          |          ttm_bo_unref
                     |          |          nouveau_gem_object_del
                     |          |          drm_gem_object_free
                     |          |          kref_put
                     |          |          drm_gem_object_unreference_unlocked
                     |          |          drm_gem_object_handle_unreference_unlocked.part.1
                     |          |          drm_gem_handle_delete
                     |          |          drm_gem_close_ioctl
                     |          |          drm_ioctl
                     |          |          do_vfs_ioctl
                     |          |          sys_ioctl
                     |          |          system_call_fastpath
                     |          |          __GI___ioctl
                     |          |
                     |           --3.45%-- ttm_dma_pages_put
                     |                     ttm_dma_page_pool_free
                     |                     ttm_dma_unpopulate
                     |                     nouveau_ttm_tt_unpopulate
                     |                     ttm_tt_destroy
                     |                     ttm_bo_cleanup_memtype_use
                     |                     ttm_bo_release
                     |                     kref_put
                     |                     ttm_bo_unref
                     |                     nouveau_gem_object_del
                     |                     drm_gem_object_free
                     |                     kref_put
                     |                     drm_gem_object_unreference_unlocked
                     |                     drm_gem_object_handle_unreference_unlocked.part.1
                     |                     drm_gem_handle_delete
                     |                     drm_gem_close_ioctl
                     |                     drm_ioctl
                     |                     do_vfs_ioctl
                     |                     sys_ioctl
                     |                     system_call_fastpath
                     |                     __GI___ioctl
                     |
                      --8.20%-- change_page_attr_set_clr
                                set_pages_array_wb
                                |
                                |--93.76%-- ttm_dma_unpopulate
                                |          nouveau_ttm_tt_unpopulate
                                |          ttm_tt_destroy
                                |          ttm_bo_cleanup_memtype_use
                                |          ttm_bo_release
                                |          kref_put
                                |          ttm_bo_unref
                                |          nouveau_gem_object_del
                                |          drm_gem_object_free
                                |          kref_put
                                |          drm_gem_object_unreference_unlocked
                                |          drm_gem_object_handle_unreference_unlocked.part.1
                                |          drm_gem_handle_delete
                                |          drm_gem_close_ioctl
                                |          drm_ioctl
                                |          do_vfs_ioctl
                                |          sys_ioctl
                                |          system_call_fastpath
                                |          __GI___ioctl
                                |
                                 --6.24%-- ttm_dma_pages_put
                                           ttm_dma_page_pool_free
                                           ttm_dma_unpopulate
                                           nouveau_ttm_tt_unpopulate
                                           ttm_tt_destroy
                                           ttm_bo_cleanup_memtype_use
                                           ttm_bo_release
                                           kref_put
                                           ttm_bo_unref
                                           nouveau_gem_object_del
                                           drm_gem_object_free
                                           kref_put
                                           drm_gem_object_unreference_unlocked
                                           drm_gem_object_handle_unreference_unlocked.part.1
                                           drm_gem_handle_delete
                                           drm_gem_close_ioctl
                                           drm_ioctl
                                           do_vfs_ioctl
                                           sys_ioctl
                                           system_call_fastpath
                                           __GI___ioctl
      
      and after this patch all of that disappears.
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      36d7c537
    • Alex Deucher's avatar
      drm/radeon/kms: sync across multiple rings when doing bo moves v3 · 3000bf39
      Alex Deucher authored
      We need to synchronize across rings when doing a bo move to make
      sure we the buffer is idle if it's in use by a different ring than
      the ring doing the move.
      
      v2: fix fence setup for bo moves
      
      v3: add missing ring lock/unlock
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      3000bf39
    • Christian König's avatar
      drm/radeon/kms: Add support for multi-ring sync in CS ioctl (v2) · 93504fce
      Christian König authored
      Use semaphores to sync buffers across rings in the CS
      ioctl.  Add a reloc flag to allow userspace to skip
      sync for buffers.
      
      agd5f: port to latest CS ioctl changes.
      
      v2: add ring lock/unlock to make sure changes hit the ring.
      Signed-off-by: default avatarChristian König <deathsimple@vodafone.de>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      93504fce
    • Jerome Glisse's avatar
      drm/radeon: GPU virtual memory support v22 · 721604a1
      Jerome Glisse authored
      Virtual address space are per drm client (opener of /dev/drm).
      Client are in charge of virtual address space, they need to
      map bo into it by calling DRM_RADEON_GEM_VA ioctl.
      
      First 16M of virtual address space is reserved by the kernel.
      
      Once using 2 level page table we should be able to have a small
      vram memory footprint for each pt (there would be one pt for all
      gart, one for all vram and then one first level for each virtual
      address space).
      
      Plan include using the sub allocator for a common vm page table
      area and using memcpy to copy vm page table in & out. Or use
      a gart object and copy things in & out using dma.
      
      v2: agd5f fixes:
      - Add vram base offset for vram pages.  The GPU physical address of a
      vram page is FB_OFFSET + page offset.  FB_OFFSET is 0 on discrete
      cards and the physical bus address of the stolen memory on
      integrated chips.
      - VM_CONTEXT1_PROTECTION_FAULT_DEFAULT_ADDR covers all vmid's >= 1
      
      v3: agd5f:
      - integrate with the semaphore/multi-ring stuff
      
      v4:
      - rebase on top ttm dma & multi-ring stuff
      - userspace is now in charge of the address space
      - no more specific cs vm ioctl, instead cs ioctl has a new
        chunk
      
      v5:
      - properly handle mem == NULL case from move_notify callback
      - fix the vm cleanup path
      
      v6:
      - fix update of page table to only happen on valid mem placement
      
      v7:
      - add tlb flush for each vm context
      - add flags to define mapping property (readable, writeable, snooped)
      - make ring id implicit from ib->fence->ring, up to each asic callback
        to then do ring specific scheduling if vm ib scheduling function
      
      v8:
      - add query for ib limit and kernel reserved virtual space
      - rename vm->size to max_pfn (maximum number of page)
      - update gem_va ioctl to also allow unmap operation
      - bump kernel version to allow userspace to query for vm support
      
      v9:
      - rebuild page table only when bind and incrementaly depending
        on bo referenced by cs and that have been moved
      - allow virtual address space to grow
      - use sa allocator for vram page table
      - return invalid when querying vm limit on non cayman GPU
      - dump vm fault register on lockup
      
      v10: agd5f:
      - Move the vm schedule_ib callback to a standalone function, remove
        the callback and use the existing ib_execute callback for VM IBs.
      
      v11:
      - rebase on top of lastest Linus
      
      v12: agd5f:
      - remove spurious backslash
      - set IB vm_id to 0 in radeon_ib_get()
      
      v13: agd5f:
      - fix handling of RADEON_CHUNK_ID_FLAGS
      
      v14:
      - fix va destruction
      - fix suspend resume
      - forbid bo to have several different va in same vm
      
      v15:
      - rebase
      
      v16:
      - cleanup left over of vm init/fini
      
      v17: agd5f:
      - cs checker
      
      v18: agd5f:
      - reworks the CS ioctl to better support multiple rings and
      VM.  Rather than adding a new chunk id for VM, just re-use the
      IB chunk id and add a new flags for VM mode.  Also define additional
      dwords for the flags chunk id to define the what ring we want to use
      (gfx, compute, uvd, etc.) and the priority.
      
      v19:
      - fix cs fini in weird case of no ib
      - semi working flush fix for ni
      - rebase on top of sa allocator changes
      
      v20: agd5f:
      - further CS ioctl cleanups from Christian's comments
      
      v21: agd5f:
      - integrate CS checker improvements
      
      v22: agd5f:
      - final cleanups for release, only allow VM CS on cayman
      Signed-off-by: default avatarJerome Glisse <jglisse@redhat.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      721604a1
  4. 05 Jan, 2012 9 commits
  5. 03 Jan, 2012 14 commits