Skip to content

Commit

Permalink
drm/radeon: allocate page tables on demand v4
Browse files Browse the repository at this point in the history
Based on Dmitries work, but splitting the code into page
directory and page table handling makes it far more
readable and (hopefully) more reliable.

Allocations of page tables are made from the SA on demand,
that should still work fine since all page tables are of
the same size.

Also using the fact that allocations from the SA are mostly
continuously (except for end of buffer wraps and under very
high memory pressure) to group updates send to the chipset
specific code into larger chunks.

v3: mostly a rewrite of Dmitries previous patch.
v4: fix some typos and coding style

Signed-off-by: Dmitry Cherkasov <Dmitrii.Cherkasov@amd.com>
Signed-off-by: Christian König <deathsimple@vodafone.de>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Christian König authored and Alex Deucher committed Oct 15, 2012
1 parent 23d4f1f commit 90a51a3
Show file tree
Hide file tree
Showing 3 changed files with 262 additions and 73 deletions.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/radeon/ni.c
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ void cayman_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm)
radeon_ring_write(ring, 0);

radeon_ring_write(ring, PACKET0(VM_CONTEXT0_PAGE_TABLE_END_ADDR + (vm->id << 2), 0));
radeon_ring_write(ring, vm->last_pfn);
radeon_ring_write(ring, rdev->vm_manager.max_pfn);

radeon_ring_write(ring, PACKET0(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (vm->id << 2), 0));
radeon_ring_write(ring, vm->pd_gpu_addr >> 12);
Expand Down
11 changes: 8 additions & 3 deletions drivers/gpu/drm/radeon/radeon.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,9 +663,14 @@ struct radeon_vm {
struct list_head list;
struct list_head va;
unsigned id;
unsigned last_pfn;
u64 pd_gpu_addr;
struct radeon_sa_bo *sa_bo;

/* contains the page directory */
struct radeon_sa_bo *page_directory;
uint64_t pd_gpu_addr;

/* array of page tables, one for each page directory entry */
struct radeon_sa_bo **page_tables;

struct mutex mutex;
/* last fence for cs using this vm */
struct radeon_fence *fence;
Expand Down
Loading

0 comments on commit 90a51a3

Please sign in to comment.