aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/rv770.c
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/rv770.c
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/rv770.c')
-rw-r--r--drivers/gpu/drm/radeon/rv770.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index a09049d15901..a983f410ab89 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -124,7 +124,7 @@ int rv770_pcie_gart_enable(struct radeon_device *rdev)
124 u32 tmp; 124 u32 tmp;
125 int r, i; 125 int r, i;
126 126
127 if (rdev->gart.table.vram.robj == NULL) { 127 if (rdev->gart.robj == NULL) {
128 dev_err(rdev->dev, "No VRAM object for PCIE GART.\n"); 128 dev_err(rdev->dev, "No VRAM object for PCIE GART.\n");
129 return -EINVAL; 129 return -EINVAL;
130 } 130 }
@@ -171,7 +171,7 @@ int rv770_pcie_gart_enable(struct radeon_device *rdev)
171void rv770_pcie_gart_disable(struct radeon_device *rdev) 171void rv770_pcie_gart_disable(struct radeon_device *rdev)
172{ 172{
173 u32 tmp; 173 u32 tmp;
174 int i, r; 174 int i;
175 175
176 /* Disable all tables */ 176 /* Disable all tables */
177 for (i = 0; i < 7; i++) 177 for (i = 0; i < 7; i++)
@@ -191,14 +191,7 @@ void rv770_pcie_gart_disable(struct radeon_device *rdev)
191 WREG32(MC_VM_MB_L1_TLB1_CNTL, tmp); 191 WREG32(MC_VM_MB_L1_TLB1_CNTL, tmp);
192 WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp); 192 WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp);
193 WREG32(MC_VM_MB_L1_TLB3_CNTL, tmp); 193 WREG32(MC_VM_MB_L1_TLB3_CNTL, tmp);
194 if (rdev->gart.table.vram.robj) { 194 radeon_gart_table_vram_unpin(rdev);
195 r = radeon_bo_reserve(rdev->gart.table.vram.robj, false);
196 if (likely(r == 0)) {
197 radeon_bo_kunmap(rdev->gart.table.vram.robj);
198 radeon_bo_unpin(rdev->gart.table.vram.robj);
199 radeon_bo_unreserve(rdev->gart.table.vram.robj);
200 }
201 }
202} 195}
203 196
204void rv770_pcie_gart_fini(struct radeon_device *rdev) 197void rv770_pcie_gart_fini(struct radeon_device *rdev)