aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / scripts / gpu_bench / STEP4_gfx_ring.bench
| 1 | # STEP4_gfx_ring.bench -- CP soft reset, microcode load, GFX ring setup. |
| 2 | # BAR5 DWORD indices (byte offset / 4). Source: amd_gpu_regs.h (gfx_8_0_d.h, gfx_v8_0.c). |
| 3 | # |
| 4 | # Not runnable as a whole yet: the write allowlist does not cover these registers |
| 5 | # (needs 0x2008, 0xf814-0xf815, 0x3041-0x3045, 0xf83c-0xf83d, 0xec00), and the ring |
| 6 | # and firmware steps need physical addresses and dword streams the console cannot take |
| 7 | # from a script. Those lines stay commented. |
| 8 | |
| 9 | # Read GRBM_SOFT_RESET, then pulse CP and RLC reset |
| 10 | # mmGRBM_SOFT_RESET, byte 0x8020 |
| 11 | bar5_read 0x2008 |
| 12 | # bit values not yet checked against gfx_v8_0.c |
| 13 | bar5_write 0x2008 0x00010005 |
| 14 | # release |
| 15 | bar5_write 0x2008 0x0 |
| 16 | |
| 17 | # RLC and PFP microcode address reset (the dword stream is loaded by the driver, not here) |
| 18 | # mmRLC_GPM_UCODE_ADDR, byte 0x3E0F0 |
| 19 | bar5_write 0xf83c 0x0 |
| 20 | # mmCP_PFP_UCODE_ADDR, byte 0x3E050 |
| 21 | bar5_write 0xf814 0x0 |
| 22 | # bar5_write 0xf83d <dword> # mmRLC_GPM_UCODE_DATA, one line per dword (polaris11_rlc.bin) |
| 23 | # bar5_write 0xf815 <dword> # mmCP_PFP_UCODE_DATA, one line per dword (polaris11_pfp.bin) |
| 24 | |
| 25 | # Enable RLC |
| 26 | # mmRLC_CNTL, byte 0x3B000 |
| 27 | bar5_write 0xec00 0x1 |
| 28 | |
| 29 | # GFX ring 0 (ring 16 KiB, below 4 GiB). The base, rptr address and wptr values come from the |
| 30 | # driver's boot log (gpu: gfx_ring:) and cannot be written from a script: |
| 31 | # CP_RB0_BASE 0x3040 (byte 0xC100) = ring_pa >> 8; CP_RB0_BASE_HI 0x30b1 (byte 0xC2C4) = ring_pa >> 40 |
| 32 | # CP_RB0_RPTR_ADDR 0x3043 (byte 0xC10C) = rptr_pa lo; CP_RB0_RPTR_ADDR_HI 0x3044 (byte 0xC110) |
| 33 | # mmCP_RB0_CNTL, byte 0xC104: BLKSZ 11 (4096 dwords) |
| 34 | bar5_write 0x3041 0xb |
| 35 | # mmCP_RB0_WPTR, byte 0xC114: reset |
| 36 | bar5_write 0x3045 0x0 |
| 37 | |
| 38 | # CP idle: CP_STAT (0xe4, byte 0x390) bit 0 (PFP_BUSY) clears |
| 39 | bar5_poll 0x21a0 0x1 0x0 5000 |
| 40 | |
| 41 | # NOP + WRITE_DATA fence: the six dwords are written by the driver (amd_gfx_ring_test), then |
| 42 | # CP_RB0_WPTR = 6 (the driver does this). Not expressible here: fence readback is by memory. |