aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/si.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/radeon/si.c')
-rw-r--r--drivers/gpu/drm/radeon/si.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index 7d5083dc4acb..60df444bd075 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -3365,6 +3365,7 @@ void si_fence_ring_emit(struct radeon_device *rdev,
3365void si_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib) 3365void si_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib)
3366{ 3366{
3367 struct radeon_ring *ring = &rdev->ring[ib->ring]; 3367 struct radeon_ring *ring = &rdev->ring[ib->ring];
3368 unsigned vm_id = ib->vm ? ib->vm->ids[ib->ring].id : 0;
3368 u32 header; 3369 u32 header;
3369 3370
3370 if (ib->is_const_ib) { 3371 if (ib->is_const_ib) {
@@ -3400,14 +3401,13 @@ void si_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib)
3400#endif 3401#endif
3401 (ib->gpu_addr & 0xFFFFFFFC)); 3402 (ib->gpu_addr & 0xFFFFFFFC));
3402 radeon_ring_write(ring, upper_32_bits(ib->gpu_addr) & 0xFFFF); 3403 radeon_ring_write(ring, upper_32_bits(ib->gpu_addr) & 0xFFFF);
3403 radeon_ring_write(ring, ib->length_dw | 3404 radeon_ring_write(ring, ib->length_dw | (vm_id << 24));
3404 (ib->vm ? (ib->vm->id << 24) : 0));
3405 3405
3406 if (!ib->is_const_ib) { 3406 if (!ib->is_const_ib) {
3407 /* flush read cache over gart for this vmid */ 3407 /* flush read cache over gart for this vmid */
3408 radeon_ring_write(ring, PACKET3(PACKET3_SET_CONFIG_REG, 1)); 3408 radeon_ring_write(ring, PACKET3(PACKET3_SET_CONFIG_REG, 1));
3409 radeon_ring_write(ring, (CP_COHER_CNTL2 - PACKET3_SET_CONFIG_REG_START) >> 2); 3409 radeon_ring_write(ring, (CP_COHER_CNTL2 - PACKET3_SET_CONFIG_REG_START) >> 2);
3410 radeon_ring_write(ring, ib->vm ? ib->vm->id : 0); 3410 radeon_ring_write(ring, vm_id);
3411 radeon_ring_write(ring, PACKET3(PACKET3_SURFACE_SYNC, 3)); 3411 radeon_ring_write(ring, PACKET3(PACKET3_SURFACE_SYNC, 3));
3412 radeon_ring_write(ring, PACKET3_TCL1_ACTION_ENA | 3412 radeon_ring_write(ring, PACKET3_TCL1_ACTION_ENA |
3413 PACKET3_TC_ACTION_ENA | 3413 PACKET3_TC_ACTION_ENA |
@@ -5023,27 +5023,23 @@ static void si_vm_decode_fault(struct radeon_device *rdev,
5023 block, mc_id); 5023 block, mc_id);
5024} 5024}
5025 5025
5026void si_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) 5026void si_vm_flush(struct radeon_device *rdev, struct radeon_ring *ring,
5027 unsigned vm_id, uint64_t pd_addr)
5027{ 5028{
5028 struct radeon_ring *ring = &rdev->ring[ridx];
5029
5030 if (vm == NULL)
5031 return;
5032
5033 /* write new base address */ 5029 /* write new base address */
5034 radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); 5030 radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
5035 radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(1) | 5031 radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(1) |
5036 WRITE_DATA_DST_SEL(0))); 5032 WRITE_DATA_DST_SEL(0)));
5037 5033
5038 if (vm->id < 8) { 5034 if (vm_id < 8) {
5039 radeon_ring_write(ring, 5035 radeon_ring_write(ring,
5040 (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (vm->id << 2)) >> 2); 5036 (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (vm_id << 2)) >> 2);
5041 } else { 5037 } else {
5042 radeon_ring_write(ring, 5038 radeon_ring_write(ring,
5043 (VM_CONTEXT8_PAGE_TABLE_BASE_ADDR + ((vm->id - 8) << 2)) >> 2); 5039 (VM_CONTEXT8_PAGE_TABLE_BASE_ADDR + ((vm_id - 8) << 2)) >> 2);
5044 } 5040 }
5045 radeon_ring_write(ring, 0); 5041 radeon_ring_write(ring, 0);
5046 radeon_ring_write(ring, vm->pd_gpu_addr >> 12); 5042 radeon_ring_write(ring, pd_addr >> 12);
5047 5043
5048 /* flush hdp cache */ 5044 /* flush hdp cache */
5049 radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); 5045 radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
@@ -5059,7 +5055,7 @@ void si_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm)
5059 WRITE_DATA_DST_SEL(0))); 5055 WRITE_DATA_DST_SEL(0)));
5060 radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2); 5056 radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2);
5061 radeon_ring_write(ring, 0); 5057 radeon_ring_write(ring, 0);
5062 radeon_ring_write(ring, 1 << vm->id); 5058 radeon_ring_write(ring, 1 << vm_id);
5063 5059
5064 /* sync PFP to ME, otherwise we might get invalid PFP reads */ 5060 /* sync PFP to ME, otherwise we might get invalid PFP reads */
5065 radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); 5061 radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0));