diff options
author | Dmitry Cherkasov <dcherkassov@gmail.com> | 2012-09-17 13:36:19 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2012-09-27 10:22:44 -0400 |
commit | fa87e62d357ccf73831cd52ed316593d0968020d (patch) | |
tree | c80c7a2c1bae57ce3da99683681eae1509b4b46c /drivers/gpu/drm/radeon/radeon.h | |
parent | dce34bfd633d23ebddb196af8a4fa1c93c90ed07 (diff) |
drm/radeon: add 2-level VM pagetables support v9
PDE/PTE update code uses CP ring for memory writes.
All page table entries are preallocated for now in alloc_pt().
It is made as whole because it's hard to divide it to several patches
that compile and doesn't break anything being applied separately.
Tested on cayman card.
v2: rebased on top of "refactor set_page chipset interface v3",
code cleanups
v3: switched offsets calc macros to inline funcs where possible,
remove pd_addr from radeon_vm, switched RADEON_BLOCK_SIZE define,
to 9 (and PTE_COUNT to 1 << BLOCK_SIZE)
v4 (ck): move "incr" documentation to previous patch, cleanup and
document RADEON_VM_* constants, change commit message to
our usual format, simplify patch allot by removing
everything current not necessary, disable SI workaround.
v5: (agd5f): Fix typo in tables_size calculation in
radeon_vm_alloc_pt(). Second line should have been
'+=' rather than '='.
v6: fix npdes calculation. In scenario when pfns to be mapped overlap
two PDE spans:
+-----------+-------------+
| PDE span | PDE span |
+-----------+----+--------+
| |
+---------+
| pfns |
+---------+
the following npdes calculation gives incorrect result:
npdes = (nptes >> RADEON_VM_BLOCK_SIZE) + 1;
For the case above picture it should give npdes = 2, but gives one.
This patch corrects it by rounding last pfn up to 512 border,
first - down to 512 border and then subtracting and dividing by 512.
v7: Make npde calculation clearer, fix ndw calculation.
v8: (agd5f): reserve enough for 2 full VM PTs, add some
additional comments.
v9: fix typo in npde calculation
Signed-off-by: Dmitry Cherkasov <Dmitrii.Cherkasov@amd.com>
Signed-off-by: Christian König <deathsimple@vodafone.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon.h')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index d0d414df29f3..519d8a32aa43 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -648,15 +648,23 @@ struct radeon_ring { | |||
648 | * VM | 648 | * VM |
649 | */ | 649 | */ |
650 | 650 | ||
651 | /* maximum number of VMIDs */ | ||
651 | #define RADEON_NUM_VM 16 | 652 | #define RADEON_NUM_VM 16 |
652 | 653 | ||
654 | /* defines number of bits in page table versus page directory, | ||
655 | * a page is 4KB so we have 12 bits offset, 9 bits in the page | ||
656 | * table and the remaining 19 bits are in the page directory */ | ||
657 | #define RADEON_VM_BLOCK_SIZE 9 | ||
658 | |||
659 | /* number of entries in page table */ | ||
660 | #define RADEON_VM_PTE_COUNT (1 << RADEON_VM_BLOCK_SIZE) | ||
661 | |||
653 | struct radeon_vm { | 662 | struct radeon_vm { |
654 | struct list_head list; | 663 | struct list_head list; |
655 | struct list_head va; | 664 | struct list_head va; |
656 | unsigned id; | 665 | unsigned id; |
657 | unsigned last_pfn; | 666 | unsigned last_pfn; |
658 | u64 pt_gpu_addr; | 667 | u64 pd_gpu_addr; |
659 | u64 *pt; | ||
660 | struct radeon_sa_bo *sa_bo; | 668 | struct radeon_sa_bo *sa_bo; |
661 | struct mutex mutex; | 669 | struct mutex mutex; |
662 | /* last fence for cs using this vm */ | 670 | /* last fence for cs using this vm */ |