diff options
author | Jerome Glisse <jglisse@redhat.com> | 2011-11-03 11:16:49 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-11-04 06:39:51 -0400 |
commit | c9a1be96277b3b2d2e8aff2ba69d7817ea8e46c9 (patch) | |
tree | 7f27b6d926b44184f8ef089527be81d981c08b9f /drivers/gpu/drm/radeon/radeon.h | |
parent | 0e2c978ef2248156f36db7fcda8c7b67998ec58a (diff) |
drm/radeon/kms: consolidate GART code, fix segfault after GPU lockup V2
After GPU lockup VRAM gart table is unpinned and thus its pointer
becomes unvalid. This patch move the unpin code to a common helper
function and set pointer to NULL so that page update code can check
if it should update GPU page table or not. That way bo still bound
to GART can be unbound (pci_unmap_page for all there page) properly
while there is no need to update the GPU page table.
V2 move the test for null gart out of the loop, small optimization
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon.h')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon.h | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index e94c6f18a157..b316b301152f 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -307,30 +307,17 @@ int radeon_mode_dumb_destroy(struct drm_file *file_priv, | |||
307 | */ | 307 | */ |
308 | struct radeon_mc; | 308 | struct radeon_mc; |
309 | 309 | ||
310 | struct radeon_gart_table_ram { | ||
311 | volatile uint32_t *ptr; | ||
312 | }; | ||
313 | |||
314 | struct radeon_gart_table_vram { | ||
315 | struct radeon_bo *robj; | ||
316 | volatile uint32_t *ptr; | ||
317 | }; | ||
318 | |||
319 | union radeon_gart_table { | ||
320 | struct radeon_gart_table_ram ram; | ||
321 | struct radeon_gart_table_vram vram; | ||
322 | }; | ||
323 | |||
324 | #define RADEON_GPU_PAGE_SIZE 4096 | 310 | #define RADEON_GPU_PAGE_SIZE 4096 |
325 | #define RADEON_GPU_PAGE_MASK (RADEON_GPU_PAGE_SIZE - 1) | 311 | #define RADEON_GPU_PAGE_MASK (RADEON_GPU_PAGE_SIZE - 1) |
326 | #define RADEON_GPU_PAGE_SHIFT 12 | 312 | #define RADEON_GPU_PAGE_SHIFT 12 |
327 | 313 | ||
328 | struct radeon_gart { | 314 | struct radeon_gart { |
329 | dma_addr_t table_addr; | 315 | dma_addr_t table_addr; |
316 | struct radeon_bo *robj; | ||
317 | void *ptr; | ||
330 | unsigned num_gpu_pages; | 318 | unsigned num_gpu_pages; |
331 | unsigned num_cpu_pages; | 319 | unsigned num_cpu_pages; |
332 | unsigned table_size; | 320 | unsigned table_size; |
333 | union radeon_gart_table table; | ||
334 | struct page **pages; | 321 | struct page **pages; |
335 | dma_addr_t *pages_addr; | 322 | dma_addr_t *pages_addr; |
336 | bool *ttm_alloced; | 323 | bool *ttm_alloced; |
@@ -341,6 +328,8 @@ int radeon_gart_table_ram_alloc(struct radeon_device *rdev); | |||
341 | void radeon_gart_table_ram_free(struct radeon_device *rdev); | 328 | void radeon_gart_table_ram_free(struct radeon_device *rdev); |
342 | int radeon_gart_table_vram_alloc(struct radeon_device *rdev); | 329 | int radeon_gart_table_vram_alloc(struct radeon_device *rdev); |
343 | void radeon_gart_table_vram_free(struct radeon_device *rdev); | 330 | void radeon_gart_table_vram_free(struct radeon_device *rdev); |
331 | int radeon_gart_table_vram_pin(struct radeon_device *rdev); | ||
332 | void radeon_gart_table_vram_unpin(struct radeon_device *rdev); | ||
344 | int radeon_gart_init(struct radeon_device *rdev); | 333 | int radeon_gart_init(struct radeon_device *rdev); |
345 | void radeon_gart_fini(struct radeon_device *rdev); | 334 | void radeon_gart_fini(struct radeon_device *rdev); |
346 | void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset, | 335 | void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset, |
@@ -348,6 +337,7 @@ void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset, | |||
348 | int radeon_gart_bind(struct radeon_device *rdev, unsigned offset, | 337 | int radeon_gart_bind(struct radeon_device *rdev, unsigned offset, |
349 | int pages, struct page **pagelist, | 338 | int pages, struct page **pagelist, |
350 | dma_addr_t *dma_addr); | 339 | dma_addr_t *dma_addr); |
340 | void radeon_gart_restore(struct radeon_device *rdev); | ||
351 | 341 | ||
352 | 342 | ||
353 | /* | 343 | /* |
@@ -1445,8 +1435,6 @@ void radeon_ring_write(struct radeon_device *rdev, uint32_t v); | |||
1445 | /* AGP */ | 1435 | /* AGP */ |
1446 | extern int radeon_gpu_reset(struct radeon_device *rdev); | 1436 | extern int radeon_gpu_reset(struct radeon_device *rdev); |
1447 | extern void radeon_agp_disable(struct radeon_device *rdev); | 1437 | extern void radeon_agp_disable(struct radeon_device *rdev); |
1448 | extern int radeon_gart_table_vram_pin(struct radeon_device *rdev); | ||
1449 | extern void radeon_gart_restore(struct radeon_device *rdev); | ||
1450 | extern int radeon_modeset_init(struct radeon_device *rdev); | 1438 | extern int radeon_modeset_init(struct radeon_device *rdev); |
1451 | extern void radeon_modeset_fini(struct radeon_device *rdev); | 1439 | extern void radeon_modeset_fini(struct radeon_device *rdev); |
1452 | extern bool radeon_card_posted(struct radeon_device *rdev); | 1440 | extern bool radeon_card_posted(struct radeon_device *rdev); |