Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/radeon: implement async vm_flush for the CP (v7)

Update the page table base address and flush the
VM TLB using the CP.

v2: update for 2 level PTs
v3: use new packet for invalidate
v4: update SH_MEM* regs when flushing the VM
v5: add pfp sync, go back to old style vm TLB invalidate
v6: fix hdp flush packet count
v7: use old style HDP flush

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

+79
+79
drivers/gpu/drm/radeon/cik.c
··· 2698 2698 { 2699 2699 } 2700 2700 2701 + /** 2702 + * cik_vm_flush - cik vm flush using the CP 2703 + * 2704 + * @rdev: radeon_device pointer 2705 + * 2706 + * Update the page table base and flush the VM TLB 2707 + * using the CP (CIK). 2708 + */ 2709 + void cik_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) 2710 + { 2711 + struct radeon_ring *ring = &rdev->ring[ridx]; 2712 + 2713 + if (vm == NULL) 2714 + return; 2715 + 2716 + radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); 2717 + radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | 2718 + WRITE_DATA_DST_SEL(0))); 2719 + if (vm->id < 8) { 2720 + radeon_ring_write(ring, 2721 + (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (vm->id << 2)) >> 2); 2722 + } else { 2723 + radeon_ring_write(ring, 2724 + (VM_CONTEXT8_PAGE_TABLE_BASE_ADDR + ((vm->id - 8) << 2)) >> 2); 2725 + } 2726 + radeon_ring_write(ring, 0); 2727 + radeon_ring_write(ring, vm->pd_gpu_addr >> 12); 2728 + 2729 + /* update SH_MEM_* regs */ 2730 + radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); 2731 + radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | 2732 + WRITE_DATA_DST_SEL(0))); 2733 + radeon_ring_write(ring, SRBM_GFX_CNTL >> 2); 2734 + radeon_ring_write(ring, 0); 2735 + radeon_ring_write(ring, VMID(vm->id)); 2736 + 2737 + radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 6)); 2738 + radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | 2739 + WRITE_DATA_DST_SEL(0))); 2740 + radeon_ring_write(ring, SH_MEM_BASES >> 2); 2741 + radeon_ring_write(ring, 0); 2742 + 2743 + radeon_ring_write(ring, 0); /* SH_MEM_BASES */ 2744 + radeon_ring_write(ring, 0); /* SH_MEM_CONFIG */ 2745 + radeon_ring_write(ring, 1); /* SH_MEM_APE1_BASE */ 2746 + radeon_ring_write(ring, 0); /* SH_MEM_APE1_LIMIT */ 2747 + 2748 + radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); 2749 + radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | 2750 + WRITE_DATA_DST_SEL(0))); 2751 + radeon_ring_write(ring, SRBM_GFX_CNTL >> 2); 2752 + radeon_ring_write(ring, 0); 2753 + radeon_ring_write(ring, VMID(0)); 2754 + 2755 + /* HDP flush */ 2756 + /* We should be using the WAIT_REG_MEM packet here like in 2757 + * cik_fence_ring_emit(), but it causes the CP to hang in this 2758 + * context... 2759 + */ 2760 + radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); 2761 + radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | 2762 + WRITE_DATA_DST_SEL(0))); 2763 + radeon_ring_write(ring, HDP_MEM_COHERENCY_FLUSH_CNTL >> 2); 2764 + radeon_ring_write(ring, 0); 2765 + radeon_ring_write(ring, 0); 2766 + 2767 + /* bits 0-15 are the VM contexts0-15 */ 2768 + radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); 2769 + radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | 2770 + WRITE_DATA_DST_SEL(0))); 2771 + radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2); 2772 + radeon_ring_write(ring, 0); 2773 + radeon_ring_write(ring, 1 << vm->id); 2774 + 2775 + /* sync PFP to ME, otherwise we might get invalid PFP reads */ 2776 + radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); 2777 + radeon_ring_write(ring, 0x0); 2778 + } 2779 +