7bb0d4b986
drm/amdgpu: Add a missing lock for drm_mm_takedown
...
Inside amdgpu_gtt_mgr_fini add a missing lock to maintain
locking balance
Signed-off-by: Mikita Lipski <mikita.lipski@amd.com >
Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2018-02-19 14:19:56 -05:00
770d13b19f
drm/amdgpu: move struct amdgpu_mc into amdgpu_gmc.h
...
And rename it to amdgpu_gmc as well.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Samuel Li <Samuel.Li@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2018-02-19 14:17:43 -05:00
c1c7ce8f56
drm/amdgpu: move GART recovery into GTT manager v2
...
The GTT manager handles the GART address space anyway, so it is
completely pointless to keep the same information around twice.
v2: rebased
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Chunming Zhou <david1.zhou@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-12-04 16:41:33 -05:00
3da917b6c6
drm/amdgpu: nuke amdgpu_ttm_is_bound() v2
...
Rename amdgpu_gtt_mgr_is_allocated() to amdgpu_gtt_mgr_has_gart_addr() and use
that instead.
v2: rename the function as well.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Chunming Zhou <david1.zhou@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-12-04 16:41:32 -05:00
9ee8ecbb3e
drm/amdgpu:fix memleak in takedown
...
this can fix the memory leak under the case that not all
BO are freed during "takedown" stage, because originally
it blocks following kfree on mgr.
Signed-off-by: Monk Liu <Monk.Liu@amd.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-11-16 13:35:48 -05:00
d2d7cc330d
drm/amdgpu: allow GTT overcommit during bind
...
While binding BOs to GART we need to allow a bit overcommit in the GTT
domain. Otherwise we can never use the full GART space when GART size=GTT size.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Chunming Zhou <david1.zhou@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-10-19 15:27:21 -04:00
1d00402b4d
drm/amdgpu: fix amdgpu_ttm_bind
...
Use ttm_bo_mem_space instead of manually allocating GART space.
This allows us to evict BOs when there isn't enought GART space any more.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-08-24 11:48:47 -04:00
9255d77d8c
drm/amdgpu: move gtt usage tracking into the gtt manager v2
...
It doesn't make much sense to count those numbers twice.
v2: use and atomic64_t instead
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-08-17 15:46:02 -04:00
97cbb28451
drm/amdgpu: move debug print into the MM managers
...
Instead of the separate switch/case in the calling function.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-08-17 15:46:01 -04:00
373533f80b
drm/ttm: make ttm_mem_type_manager_func debug more useful
...
Provide the drm printer directly instead of just the callback.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-08-17 15:45:59 -04:00
bb84284e10
drm/amdgpu: limit the GTT manager address space
...
We should only cover the GART size with the GTT manager.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-07-14 11:06:30 -04:00
cc25188afd
drm/amdgpu: reserve the first 2x512 pages of GART
...
We want to use them as remap address space.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-07-14 11:06:20 -04:00
98a7f88ce9
drm/amdgpu: bind BOs with GTT space allocated directly v2
...
This avoids binding them later on.
v2: fix typo in function name
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Acked-by: Felix Kuehling <Felix.Kuehling@amd.com >
2017-07-14 11:05:59 -04:00
05a72a2864
drm/amdgpu: add gtt print like vram when dump mm table V2
...
Signed-off-by: Chunming Zhou <David1.Zhou@amd.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-04-28 17:32:53 -04:00
4e64e5539d
drm: Improve drm_mm search (and fix topdown allocation) with rbtrees
...
The drm_mm range manager claimed to support top-down insertion, but it
was neither searching for the top-most hole that could fit the
allocation request nor fitting the request to the hole correctly.
In order to search the range efficiently, we create a secondary index
for the holes using either their size or their address. This index
allows us to find the smallest hole or the hole at the bottom or top of
the range efficiently, whilst keeping the hole stack to rapidly service
evictions.
v2: Search for holes both high and low. Rename flags to mode.
v3: Discover rb_entry_safe() and use it!
v4: Kerneldoc for enum drm_mm_insert_mode.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Cc: Alex Deucher <alexander.deucher@amd.com >
Cc: "Christian König" <christian.koenig@amd.com >
Cc: David Airlie <airlied@linux.ie >
Cc: Russell King <rmk+kernel@armlinux.org.uk >
Cc: Daniel Vetter <daniel.vetter@intel.com >
Cc: Jani Nikula <jani.nikula@linux.intel.com >
Cc: Sean Paul <seanpaul@chromium.org >
Cc: Lucas Stach <l.stach@pengutronix.de >
Cc: Christian Gmeiner <christian.gmeiner@gmail.com >
Cc: Rob Clark <robdclark@gmail.com >
Cc: Thierry Reding <thierry.reding@gmail.com >
Cc: Stephen Warren <swarren@wwwdotorg.org >
Cc: Alexandre Courbot <gnurou@gmail.com >
Cc: Eric Anholt <eric@anholt.net >
Cc: Sinclair Yeh <syeh@vmware.com >
Cc: Thomas Hellstrom <thellstrom@vmware.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Reviewed-by: Sinclair Yeh <syeh@vmware.com > # vmwgfx
Reviewed-by: Lucas Stach <l.stach@pengutronix.de > #etnaviv
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20170202210438.28702-1-chris@chris-wilson.co.uk
2017-02-03 11:10:32 +01:00
613e61a025
drm/amdgpu: use designated initializers
...
Prepare to mark sensitive kernel structures for randomization by making
sure they're using designated initializers. These were identified during
allyesconfig builds of x86, arm, and arm64, with most initializer fixes
extracted from grsecurity.
Signed-off-by: Kees Cook <keescook@chromium.org >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-01-27 11:12:40 -05:00
b5c3714fe8
drm/mm: Convert to drm_printer
...
Including all drivers. I thought about keeping small compat functions
to avoid having to change all drivers. But I really like the
drm_printer idea, so figured spreading it more widely is a good thing.
v2: Review from Chris:
- Natural argument order and better name for drm_mm_print.
- show_mm() macro in the selftest.
Cc: Rob Clark <robdclark@gmail.com >
Cc: Russell King <rmk+kernel@armlinux.org.uk >
Cc: Alex Deucher <alexander.deucher@amd.com >
Cc: Christian König <christian.koenig@amd.com >
Cc: Lucas Stach <l.stach@pengutronix.de >
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com >
Cc: Thierry Reding <thierry.reding@gmail.com >
Cc: Jyri Sarha <jsarha@ti.com >
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk >
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/1483009764-8281-1-git-send-email-daniel.vetter@ffwll.ch
2016-12-30 12:08:28 +01:00
47e50d5c0d
drm/amdgpu: fix gtt available page num accounting
...
Signed-off-by: Flora Cui <Flora.Cui@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2016-12-06 18:08:34 -05:00
d2e938701a
drm/amdgpu: set at least the node size in the gtt manager
...
Otherwise the new VM code becomes confused.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net >
Tested-by: Mike Lothian <mike@fireburn.co.uk >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2016-10-25 14:38:15 -04:00
8159730394
drm/amdgpu: fix gtt_mgr bo's offset
...
Signed-off-by: Flora Cui <Flora.Cui@amd.com >
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2016-09-28 16:16:23 -04:00
bb990bb092
drm/amdgpu: add a custom GTT memory manager v2
...
Only allocate address space when we really need it.
v2: fix a typo, add correct function description,
stop leaking the node in the error case.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2016-09-28 16:16:19 -04:00