aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon.h
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2011-11-03 11:16:49 -0400
committerDave Airlie <airlied@redhat.com>2011-11-04 06:39:51 -0400
commitc9a1be96277b3b2d2e8aff2ba69d7817ea8e46c9 (patch)
tree7f27b6d926b44184f8ef089527be81d981c08b9f /drivers/gpu/drm/radeon/radeon.h
parent0e2c978ef2248156f36db7fcda8c7b67998ec58a (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.h22
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 */
308struct radeon_mc; 308struct radeon_mc;
309 309
310struct radeon_gart_table_ram {
311 volatile uint32_t *ptr;
312};
313
314struct radeon_gart_table_vram {
315 struct radeon_bo *robj;
316 volatile uint32_t *ptr;
317};
318
319union 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
328struct radeon_gart { 314struct 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);
341void radeon_gart_table_ram_free(struct radeon_device *rdev); 328void radeon_gart_table_ram_free(struct radeon_device *rdev);
342int radeon_gart_table_vram_alloc(struct radeon_device *rdev); 329int radeon_gart_table_vram_alloc(struct radeon_device *rdev);
343void radeon_gart_table_vram_free(struct radeon_device *rdev); 330void radeon_gart_table_vram_free(struct radeon_device *rdev);
331int radeon_gart_table_vram_pin(struct radeon_device *rdev);
332void radeon_gart_table_vram_unpin(struct radeon_device *rdev);
344int radeon_gart_init(struct radeon_device *rdev); 333int radeon_gart_init(struct radeon_device *rdev);
345void radeon_gart_fini(struct radeon_device *rdev); 334void radeon_gart_fini(struct radeon_device *rdev);
346void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset, 335void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset,
@@ -348,6 +337,7 @@ void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset,
348int radeon_gart_bind(struct radeon_device *rdev, unsigned offset, 337int 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);
340void 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 */
1446extern int radeon_gpu_reset(struct radeon_device *rdev); 1436extern int radeon_gpu_reset(struct radeon_device *rdev);
1447extern void radeon_agp_disable(struct radeon_device *rdev); 1437extern void radeon_agp_disable(struct radeon_device *rdev);
1448extern int radeon_gart_table_vram_pin(struct radeon_device *rdev);
1449extern void radeon_gart_restore(struct radeon_device *rdev);
1450extern int radeon_modeset_init(struct radeon_device *rdev); 1438extern int radeon_modeset_init(struct radeon_device *rdev);
1451extern void radeon_modeset_fini(struct radeon_device *rdev); 1439extern void radeon_modeset_fini(struct radeon_device *rdev);
1452extern bool radeon_card_posted(struct radeon_device *rdev); 1440extern bool radeon_card_posted(struct radeon_device *rdev);