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>
This commit is contained in:

committed by
Dave Airlie

parent
0e2c978ef2
commit
c9a1be9627
@@ -577,7 +577,7 @@ int r100_pci_gart_init(struct radeon_device *rdev)
|
||||
{
|
||||
int r;
|
||||
|
||||
if (rdev->gart.table.ram.ptr) {
|
||||
if (rdev->gart.ptr) {
|
||||
WARN(1, "R100 PCI GART already initialized\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -636,10 +636,12 @@ void r100_pci_gart_disable(struct radeon_device *rdev)
|
||||
|
||||
int r100_pci_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr)
|
||||
{
|
||||
u32 *gtt = rdev->gart.ptr;
|
||||
|
||||
if (i < 0 || i > rdev->gart.num_gpu_pages) {
|
||||
return -EINVAL;
|
||||
}
|
||||
rdev->gart.table.ram.ptr[i] = cpu_to_le32(lower_32_bits(addr));
|
||||
gtt[i] = cpu_to_le32(lower_32_bits(addr));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user