Repository navigation
drm/radeon: use I/O accessors for the VCE firmware upload - #3464
Conversation
radeon_vce_resume() clears the VCPU buffer object and copies the VCE firmware into it with plain memset() and memcpy(), and vce_v1_0_load_fw() writes the signature words through a plain pointer. The buffer object lives in VRAM, so the CPU mapping is an ioremap_wc() of the PCI BAR, not normal memory. On arm64 memset() with a zero value uses DC ZVA. A DC ZVA into PCIe BAR space is not a valid PCIe transaction; on Apple Silicon the fabric answers it with an asynchronous SError and the kernel panics: SError Interrupt on CPU16, code 0x00000000be000000 -- SError pc : __pi_memset_generic+0x170/0x188 lr : radeon_vce_resume+0x70/0x1b4 [radeon] Kernel panic - not syncing: Asynchronous SError Interrupt Use memset_io(), memcpy_toio() and writel() as the UVD path in radeon and the VCE path in amdgpu already do. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
There was a problem hiding this comment.
Please retain the SI firmware signature alignment semantics. The old uint32_t pointer advanced by (len + 64) / 4 words; the new void __iomem pointer advances by len + 64 bytes and writes with writel. With an unaligned len, the new path makes unaligned MMIO writes where the old path used an aligned address. Preserve the old word offset or explicitly validate alignment before the writes if that is a firmware invariant. The I/O helpers themselves match the Radeon UVD and amdgpu VCE upload paths. Radeon ring, IB pool, and WB use GTT on the PCIe path, and fences use the WB allocation. The reported Hawaii bind, ring, IB, render and runtime-PM row supports that path. SI runtime and a second Apple family with the enclosure are still owed. Keep the user VRAM mmap issue tracked separately.
The previous change moved vce_v1_0_load_fw() from a uint32_t pointer to a void __iomem pointer. The old code advanced the pointer by (len + 64) / 4 dwords before writing the signature words, which rounds an unaligned length down to a dword boundary. The new code advanced by len + 64 bytes, so an unaligned len would give unaligned MMIO writes at a different address than before. Round the byte offset down to a multiple of 4 so the signature lands on the same dword as before. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Review at 98ceaee, item 1 (SI signature alignment): fixed in ccd862e. The pointer now advances by round_down(len + 64, 4) bytes, which is the same dword the old (len + 64) / 4 word step landed on, so the signature writel()s stay aligned and at the old address. Built W=1 for arm64 (vce_v1_0.o, radeon_vce.o), checkpatch clean. Hardware: the lab card is Hawaii (CIK), which does not run vce_v1_0_load_fw (SI/Aruba only), so the SI runtime row is still owed; the Hawaii row from the PR body is unchanged by this commit. User VRAM mmap issue stays tracked separately. |
There was a problem hiding this comment.
Verdict: MERGE at ccd862eb once the landing evidence is recorded. This clears the SI alignment change request.
Checked: Compared the revised SI signature address with the old unsigned dword index. The new round-down produces the same aligned byte address. Twelve sampled lengths, including unaligned lengths and the unsigned wrap boundary, agreed. The forward change touches only that offset. The earlier review covered the I/O accessors and checked the UVD and GTT ring/IB paths. No DT changes or board gating.
The K114s Hawaii bind and GLES report is useful feature evidence for the original patch. Attach the exact-commit build/receipt, hosted CI and second-family regression evidence before landing. SI runtime remains untested.
|
Merge readiness at
Areas: none matched in CODEOWNERS Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
Verdict: MERGE at ccd862eb5f28. Second, independent approval (REVIEW6 approved this head at 14:42); requested by ORCH5 for the eGPU demo/upstream path.
Checked:
- Offsets, old word arithmetic vs new byte arithmetic: signature block at (256 − 64)/4 words = 192 bytes; nonce at +0/4/8/12; length word
len + 64at +16; 44 zero bytes at +20; firmware body at +64; thendata += (len + 64)/4words =round_down(len + 64, 4)bytes, and sigval at +0..12 from there. All match.ccd862ebis exactly the fix that keeps that last offset (a plainlen + 64would differ when it isn't a multiple of 4). - Byte order:
writel(le32_to_cpu(x))puts the original little-endian bytes on the bus on any CPU, the same bytes the old raw store wrote on little-endian. - Access type: the VCPU BO is created and pinned in VRAM, so the kernel map is I/O memory.
memset_io/memcpy_toio/writelare right throughoutradeon_vce_resume()andvce_v1_0_load_fw(), and on x86 they compile to the same work as before. - The prototype in
radeon_asic.hmatches the newvoid __iomem *parameter. CI green at this head. No attribution.
|
Hardware row at
Not yet: an SI (VCE 1.0) runtime row. The lab has no SI card. |
Complement the VCE firmware upload fix (aurora-silicon#3464) by auditing the remaining kernel CPU accesses to VRAM-resident BOs in radeon and routing them through I/O accessors so compiler-merged stores or DC ZVA cannot fault on Device-nGnRnE non-posted BAR mappings: - Add radeon_bo_memset/memcpy_to/memcpy_from helpers keyed on bus.is_nonposted. - Use readl()/writel() for the UVD ring fence stored in vcpu_bo (VRAM), UVD_FW_START readback, RLC save/restore list, and CIK CP PG table. - Bounce the RLC clear-state buffer through host memory when is_nonposted and copy via memcpy_toio(). - Copy the UVD CS message header through radeon_bo_memcpy_from() with a BO-size check instead of dereferencing the kmap pointer directly. - Use radeon_bo_memcpy_from()/to() for VRAM reads/writes in radeon_do_test_moves(). Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Problem.
radeon_vce_resume()clears the VCE VCPU buffer object and copies the VCE firmware into it with plainmemset()/memcpy(), andvce_v1_0_load_fw()writes the signature words through a plain pointer. That buffer object is in VRAM, so the CPU mapping is a write-combined mapping of the PCI BAR. On arm64,memset()with a zero value usesdc zva, and adc zvainto PCIe BAR space is not a valid PCIe write. On Apple Silicon the fabric answers it with an asynchronous SError and the kernel panics. This killed every attempt to bind radeon to an R9 390X (Hawaii) in a Thunderbolt 5 enclosure on a K114s (M5 Pro): on hot-plug, at boot, and on a manualmodprobe.Change. Use
memset_io(),memcpy_toio()andwritel(), as radeon's UVD path and amdgpu's VCE path already do. No behaviour change on hosts where the plain accessors happened to work.Testing.
make M=drivers/gpu/drm/radeon) and loaded withinsmodon the same boot. Before:SError Interrupt ... pc : __pi_memset_generic+0x170(thedc zva),lr : radeon_vce_resume+0x70, panic, 4 of 4 attempts. After: POST, MSI, ring tests 0-7 and IB tests 0-7 pass,UVD initialized,VCE initialized, fb1 radeondrmfb, card2/renderD129. Stock Fedora Mesa 26.2.7 radeonsi (AMD radeonsi, hawaii, ACO, DRM 2.51) renders GLES 3.2 over EGL: clear read-back exact, 3 x 5000 full-screen 1080p draws, no DART fault, no AER error, runtime-PM resume (IB tests re-ran) OK.resource0_wc): 8/4/2/1-byte stores,stp, 16/32-byte NEON stores, unaligned stores, libcmemcpyand non-zeromemsetall pass; onlydc zvaand libcmemset(0)panic.Tested: K114s M5 Pro (T6050) + R9 390X (Hawaii) over Thunderbolt 5 at this diff (radeon.ko against 7.3.0-k114sstack): before 4/4 SError panics in radeon_vce_resume, after radeon binds with all 8 ring + 8 IB tests passing and radeonsi GLES 3.2 rendering
Risk: one-way · radeon only (VCE firmware upload path; SI vce_v1_0 path compiled, not run: no SI card)
Still to run. An SI card (Tahiti/Pitcairn/Verde) for the
vce_v1_0_load_fw()half. No other Mac in the lab has an AMD GPU, so there is no second regression Mac for this file.Evidence
traces/gpu/20261128-k114s-egpu/on the lab store:radeon-serror-netconsole.log(the panic),storeshape/result.txt(the matrix),live/(bind and GL logs). Patch kitkits/test/20261128-egpu/radeon-vce-iomem/. Not tainted.