[PR #115] [CLOSED] FWSEC: round DMEM DMA up to 256 bytes (fixes RTX 3060 10de:2544) #147

Closed
opened 2026-10-26 16:41:19 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Zagitta/gpu-unlock/pull/115
Author: @lerpongn
Created: 10/25/2026
Status: ❌ Closed

Base: main ← Head: fwsec-dmem-align


📝 Commits (1)

  • b78b713 FWSEC: round DMEM DMA up to 256 bytes

📊 Changes

1 file changed (+28 additions, -4 deletions)

View changed files

📝 kernel/gpu_unlock/unlock_610.c (+28 -4)

📄 Description

Summary

Unlocks the RTX 3060 10de:2544 (non-LHR GA106), which previously failed with -22 in unlock_transaction_fwsec and left the card stuck until a power cycle.

Root cause

This card's FWSEC image has dmem=0x980, which is not a multiple of 256. Falcon DMA moves 256-byte blocks, so falcon_dma_valid() rejected the DMEM load inside falcon_hs() with -EINVAL. This happened after firmware_started was set, so the unwind tried to stop firmware that was never started (quiesced=0), kept the DMA buffers, and nvidia then failed to claim the BAR (request_mem_region failed).

The last MMIO before the failure was 0x8241e0 (the FWSEC fuse read for ucode 9), which confirms the failure was before any Falcon access.

The FWSEC header differs from previously reported cards: signatures=4 versions=0xf (working cards report signatures=3 versions=0x7). Signature selection itself was fine (fuse version 2 -> 3rd signature).

Fix

  • Round the DMEM DMA size up to 256 bytes and zero-pad the buffer (here 0x980 -> 0xa00, buffer 0xed00 = image size).
  • Validate the Falcon DMA geometry before firmware_started is set, so an unloadable layout fails cleanly instead of needing a power cycle.
  • Uses plain arithmetic instead of ALIGN/max_t so tests/unlock_shim still compiles.

Cards with a 256-aligned DMEM (e.g. 10de:2504, dmem=0x800) take exactly the same path as before.

Hardware

Card 1 Card 2
Card Zotac RTX 3060 12GB Twin Edge PNY RTX 3060 12GB
PCI ID 10de:2544 (subsystem 19da:2630) 10de:2504
VBIOS 94.06.54.00.17 94.06.2F.00.89
Before this patch unlock failed (-22), card stuck unlocked
With this patch unlocked unlocked

Ubuntu 24.04, kernel 6.8.0-147-generic, NVIDIA open driver 595.99.02, gpu_unlock.targets=0000:2b:00.0,0000:04:00.0. Both cards unlock in the same boot.

Logs

Before (Zotac):

pci 0000:2b:00.0: failure unlock_610.c:1025 unlock_transaction_fwsec error=-22 last_mmio=0x8241e0 value=0x3 valid=1 mapped=1 master=1 firmware_started=1 quiesced=0
pci 0000:2b:00.0: firmware did not stop; keeping its DMA buffers until power off
pci 0000:2b:00.0: gpu_unlock: unlock failed (-22)
NVRM: request_mem_region failed for 16M @ 0xfb000000.
nvidia: probe of 0000:2b:00.0 failed with error -1

After (Zotac, now at 04:00.0 after a slot swap):

FWSEC: DMEM size 0x980 rounded to 0xa00 for DMA (buffer 0xed00)
FWSEC fuse: raw=0x3 version=2
Falcon DMA: base=0x110000 dest=0x0 offset=0x0 src=0xddcc0000 size=0xe300 cmd=0x614
Falcon DMA: base=0x110000 dest=0x0 offset=0x0 src=0xddcce300 size=0xa00 cmd=0x600
FWSEC result: scratch=0x0 expected_hi16=0
FWSEC WPR2: low=0x2ffe000 high=0x2ffee00 expected_page=0x2ffe00 end=0x2fff00000
selector write: SS0=0x88888888
selector write: SS1=0x8
pre-FLR selectors: ss0=0x88888888 expected=0x88888888 ss1=0x8 expected=0x8
post-FLR SEC2 reset released, GSP halted, BME=0 pending=0 WPR2=1ffffe00:00000000 SS0=88888888 SS1=00000008
gpu_unlock: unlocked

Benchmark

Dense 8192^3 GEMM, FP32 accumulation, median of 5, both cards at 140 W:

Card BF16 before BF16 after Gain
Zotac 10de:2544 27.0 TFLOPS 45.6 TFLOPS +69%
PNY 10de:2504 26.3 TFLOPS 45.3 TFLOPS +72%

Testing

  • make install (Debian package path) passes all 5 unit tests, including test_components.
  • Module builds cleanly against 6.8.0-147-generic.
  • Cold boot with both cards targeted: both unlock, nvidia binds both.

This patch was developed with AI assistance (Claude) and tested on the hardware above.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Zagitta/gpu-unlock/pull/115 **Author:** [@lerpongn](https://github.com/lerpongn) **Created:** 10/25/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fwsec-dmem-align` --- ### 📝 Commits (1) - [`b78b713`](https://github.com/Zagitta/gpu-unlock/commit/b78b71321a484ee05e8b4e063fecb90d4c7f1c76) FWSEC: round DMEM DMA up to 256 bytes ### 📊 Changes **1 file changed** (+28 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `kernel/gpu_unlock/unlock_610.c` (+28 -4) </details> ### 📄 Description ## Summary Unlocks the RTX 3060 `10de:2544` (non-LHR GA106), which previously failed with `-22` in `unlock_transaction_fwsec` and left the card stuck until a power cycle. ## Root cause This card's FWSEC image has `dmem=0x980`, which is not a multiple of 256. Falcon DMA moves 256-byte blocks, so `falcon_dma_valid()` rejected the DMEM load inside `falcon_hs()` with `-EINVAL`. This happened after `firmware_started` was set, so the unwind tried to stop firmware that was never started (`quiesced=0`), kept the DMA buffers, and `nvidia` then failed to claim the BAR (`request_mem_region failed`). The last MMIO before the failure was `0x8241e0` (the FWSEC fuse read for ucode 9), which confirms the failure was before any Falcon access. The FWSEC header differs from previously reported cards: `signatures=4 versions=0xf` (working cards report `signatures=3 versions=0x7`). Signature selection itself was fine (fuse version 2 -> 3rd signature). ## Fix - Round the DMEM DMA size up to 256 bytes and zero-pad the buffer (here `0x980 -> 0xa00`, buffer `0xed00` = image size). - Validate the Falcon DMA geometry before `firmware_started` is set, so an unloadable layout fails cleanly instead of needing a power cycle. - Uses plain arithmetic instead of `ALIGN`/`max_t` so `tests/unlock_shim` still compiles. Cards with a 256-aligned DMEM (e.g. `10de:2504`, `dmem=0x800`) take exactly the same path as before. ## Hardware | | Card 1 | Card 2 | | --- | --- | --- | | Card | Zotac RTX 3060 12GB Twin Edge | PNY RTX 3060 12GB | | PCI ID | `10de:2544` (subsystem `19da:2630`) | `10de:2504` | | VBIOS | `94.06.54.00.17` | `94.06.2F.00.89` | | Before this patch | `unlock failed (-22)`, card stuck | unlocked | | With this patch | unlocked | unlocked | Ubuntu 24.04, kernel `6.8.0-147-generic`, NVIDIA open driver `595.99.02`, `gpu_unlock.targets=0000:2b:00.0,0000:04:00.0`. Both cards unlock in the same boot. ## Logs Before (Zotac): ~~~ pci 0000:2b:00.0: failure unlock_610.c:1025 unlock_transaction_fwsec error=-22 last_mmio=0x8241e0 value=0x3 valid=1 mapped=1 master=1 firmware_started=1 quiesced=0 pci 0000:2b:00.0: firmware did not stop; keeping its DMA buffers until power off pci 0000:2b:00.0: gpu_unlock: unlock failed (-22) NVRM: request_mem_region failed for 16M @ 0xfb000000. nvidia: probe of 0000:2b:00.0 failed with error -1 ~~~ After (Zotac, now at 04:00.0 after a slot swap): ~~~ FWSEC: DMEM size 0x980 rounded to 0xa00 for DMA (buffer 0xed00) FWSEC fuse: raw=0x3 version=2 Falcon DMA: base=0x110000 dest=0x0 offset=0x0 src=0xddcc0000 size=0xe300 cmd=0x614 Falcon DMA: base=0x110000 dest=0x0 offset=0x0 src=0xddcce300 size=0xa00 cmd=0x600 FWSEC result: scratch=0x0 expected_hi16=0 FWSEC WPR2: low=0x2ffe000 high=0x2ffee00 expected_page=0x2ffe00 end=0x2fff00000 selector write: SS0=0x88888888 selector write: SS1=0x8 pre-FLR selectors: ss0=0x88888888 expected=0x88888888 ss1=0x8 expected=0x8 post-FLR SEC2 reset released, GSP halted, BME=0 pending=0 WPR2=1ffffe00:00000000 SS0=88888888 SS1=00000008 gpu_unlock: unlocked ~~~ ## Benchmark Dense 8192^3 GEMM, FP32 accumulation, median of 5, both cards at 140 W: | Card | BF16 before | BF16 after | Gain | | --- | --- | --- | --- | | Zotac `10de:2544` | 27.0 TFLOPS | 45.6 TFLOPS | +69% | | PNY `10de:2504` | 26.3 TFLOPS | 45.3 TFLOPS | +72% | ## Testing - `make install` (Debian package path) passes all 5 unit tests, including `test_components`. - Module builds cleanly against `6.8.0-147-generic`. - Cold boot with both cards targeted: both unlock, `nvidia` binds both. This patch was developed with AI assistance (Claude) and tested on the hardware above. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi changed title from [PR #115] FWSEC: round DMEM DMA up to 256 bytes (fixes RTX 3060 10de:2544) to [PR #115] [CLOSED] FWSEC: round DMEM DMA up to 256 bytes (fixes RTX 3060 10de:2544) 2026-10-30 04:55:53 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Zagitta/gpu-unlock#147
No description provided.