Skip to content

Commit

Permalink
drm/radeon: fix R600_PTE_GART handling
Browse files Browse the repository at this point in the history
That didn't worked correctly any more and opened up a security problem.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Christian König authored and Alex Deucher committed Aug 5, 2014
1 parent ed5cb43 commit 33fa9fe
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions drivers/gpu/drm/radeon/cik_sdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -771,8 +771,7 @@ void cik_sdma_vm_set_page(struct radeon_device *rdev,

trace_radeon_vm_set_page(pe, addr, count, incr, flags);

/* XXX: How to distinguish between GART and other system memory pages? */
if (flags & R600_PTE_SYSTEM) {
if ((flags & R600_PTE_GART_MASK) == R600_PTE_GART_MASK) {
uint64_t src = rdev->gart.table_addr + (addr >> 12) * 8;
while (count) {
unsigned bytes = count * 8;
Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/radeon/radeon.h
Original file line number Diff line number Diff line change
Expand Up @@ -864,9 +864,9 @@ struct radeon_mec {
#define R600_PTE_FRAG_64KB (4 << 7)
#define R600_PTE_FRAG_256KB (6 << 7)

/* flags used for GART page table entries on R600+ */
#define R600_PTE_GART ( R600_PTE_VALID | R600_PTE_SYSTEM | R600_PTE_SNOOPED \
| R600_PTE_READABLE | R600_PTE_WRITEABLE)
/* flags needed to be set so we can copy directly from the GART table */
#define R600_PTE_GART_MASK ( R600_PTE_READABLE | R600_PTE_WRITEABLE | \
R600_PTE_SYSTEM | R600_PTE_VALID )

struct radeon_vm_pt {
struct radeon_bo *bo;
Expand Down
3 changes: 1 addition & 2 deletions drivers/gpu/drm/radeon/si_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ void si_dma_vm_set_page(struct radeon_device *rdev,

trace_radeon_vm_set_page(pe, addr, count, incr, flags);

/* XXX: How to distinguish between GART and other system memory pages? */
if (flags & R600_PTE_SYSTEM) {
if ((flags & R600_PTE_GART_MASK) == R600_PTE_GART_MASK) {
uint64_t src = rdev->gart.table_addr + (addr >> 12) * 8;
while (count) {
unsigned bytes = count * 8;
Expand Down

0 comments on commit 33fa9fe

Please sign in to comment.