drm/radeon: make VM flushs a ring operation
Move flushing the VMs as function into the rings. First step to make VM operations async. Signed-off-by: Christian König <deathsimple@vodafone.de> Reviewed-by: Jerome Glisse <jglisse@redhat.com>
This commit is contained in:

committed by
Alex Deucher

parent
f82cbddddb
commit
9b40e5d842
@@ -1502,24 +1502,9 @@ int cayman_vm_bind(struct radeon_device *rdev, struct radeon_vm *vm, int id)
|
||||
WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR + (id << 2), 0);
|
||||
WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR + (id << 2), vm->last_pfn);
|
||||
WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (id << 2), vm->pt_gpu_addr >> 12);
|
||||
/* flush hdp cache */
|
||||
WREG32(HDP_MEM_COHERENCY_FLUSH_CNTL, 0x1);
|
||||
/* bits 0-7 are the VM contexts0-7 */
|
||||
WREG32(VM_INVALIDATE_REQUEST, 1 << id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cayman_vm_tlb_flush(struct radeon_device *rdev, struct radeon_vm *vm)
|
||||
{
|
||||
if (vm->id == -1)
|
||||
return;
|
||||
|
||||
/* flush hdp cache */
|
||||
WREG32(HDP_MEM_COHERENCY_FLUSH_CNTL, 0x1);
|
||||
/* bits 0-7 are the VM contexts0-7 */
|
||||
WREG32(VM_INVALIDATE_REQUEST, 1 << vm->id);
|
||||
}
|
||||
|
||||
#define R600_PTE_VALID (1 << 0)
|
||||
#define R600_PTE_SYSTEM (1 << 1)
|
||||
#define R600_PTE_SNOOPED (1 << 2)
|
||||
@@ -1551,3 +1536,19 @@ void cayman_vm_set_page(struct radeon_device *rdev, struct radeon_vm *vm,
|
||||
addr |= flags;
|
||||
writeq(addr, ptr + (pfn * 8));
|
||||
}
|
||||
|
||||
void cayman_vm_flush(struct radeon_device *rdev, struct radeon_ib *ib)
|
||||
{
|
||||
struct radeon_ring *ring = &rdev->ring[ib->ring];
|
||||
|
||||
if (!ib->vm || ib->vm->id == -1)
|
||||
return;
|
||||
|
||||
/* flush hdp cache */
|
||||
radeon_ring_write(ring, PACKET0(HDP_MEM_COHERENCY_FLUSH_CNTL, 0));
|
||||
radeon_ring_write(ring, 0x1);
|
||||
|
||||
/* bits 0-7 are the VM contexts0-7 */
|
||||
radeon_ring_write(ring, PACKET0(VM_INVALIDATE_REQUEST, 0));
|
||||
radeon_ring_write(ring, 1 << ib->vm->id);
|
||||
}
|
||||
|
Reference in New Issue
Block a user