[PR #250] [MERGED] gpu_unlock: fix the two sparse type warnings #242

Closed
opened 2026-10-30 04:56:02 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Zagitta/gpu-unlock/pull/250
Author: @randomizedcoder
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/28/2026
Merged by: @Zagitta

Base: main ← Head: upstream/sparse


📝 Commits (2)

  • 500e48c gpu_unlock: take gfp_t in diag_dma_alloc()
  • ca78f02 gpu_unlock: decode PMCSR D0 with a helper

📊 Changes

3 files changed (+12 additions, -2 deletions)

View changed files

📝 kernel/gpu_unlock/gfw_eval.c (+5 -0)
📝 kernel/gpu_unlock/gfw_eval.h (+5 -0)
📝 kernel/gpu_unlock/unlock_610.c (+2 -2)

📄 Description

Two small type fixes that make the module clean under sparse (make C=2 CHECK=sparse). Neither changes behaviour at run time.

Commit sparse warning Fix
gfp_t incorrect type in argument (different base types), at diag_dma_alloc() and both callers diag_dma_alloc() takes gfp_t, the type dma_alloc_coherent() expects, instead of unsigned int. Callers already pass GFP_KERNEL.
PMCSR restricted pci_power_t degrades to integer unlock_transaction_claim() compared the PMCSR state field with PCI_D0, which is the kernel's pci_power_t and not a register value. Both happen to be 0. The new gpu_unlock_pmcsr_d0() in gfw_eval.c compares the register bits with register constants.

Testing

On 2.0 (1fc6d62), with linux 7.3:

sparse warnings
2.0 4 (3 gfp_t, 1 pci_power_t)
+ gfp_t 1
+ PMCSR 0
  • The module builds with KCFLAGS=-Werror.
  • checkpatch.pl reports 0 errors and 0 warnings on the code changes.
  • I checked gpu_unlock_pmcsr_d0() on the host against gfw_eval.c for D0, D1, D2 and D3hot, D0 with every other bit set, and 0xffff. The table is in the commit message.
  • I booted the same two commits on 1.1.0, on an RTX 3070 with nvidia 615.71.09: gpu_unlock: unlocked, and BF16 GEMM went from 44 to 86 TFLOPS. I haven't booted them on 2.0.

🤖 Generated with Claude Code


🔄 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/250 **Author:** [@randomizedcoder](https://github.com/randomizedcoder) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@Zagitta](https://github.com/Zagitta) **Base:** `main` ← **Head:** `upstream/sparse` --- ### 📝 Commits (2) - [`500e48c`](https://github.com/Zagitta/gpu-unlock/commit/500e48c7c2fdf8b8e3c5ba0e4e1021470826b940) gpu_unlock: take gfp_t in diag_dma_alloc() - [`ca78f02`](https://github.com/Zagitta/gpu-unlock/commit/ca78f02c895a7c9c36d8597ebba8f3e2519b8df4) gpu_unlock: decode PMCSR D0 with a helper ### 📊 Changes **3 files changed** (+12 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `kernel/gpu_unlock/gfw_eval.c` (+5 -0) 📝 `kernel/gpu_unlock/gfw_eval.h` (+5 -0) 📝 `kernel/gpu_unlock/unlock_610.c` (+2 -2) </details> ### 📄 Description Two small type fixes that make the module clean under sparse (`make C=2 CHECK=sparse`). Neither changes behaviour at run time. | Commit | sparse warning | Fix | |---|---|---| | gfp_t | `incorrect type in argument (different base types)`, at `diag_dma_alloc()` and both callers | `diag_dma_alloc()` takes `gfp_t`, the type `dma_alloc_coherent()` expects, instead of `unsigned int`. Callers already pass `GFP_KERNEL`. | | PMCSR | `restricted pci_power_t degrades to integer` | `unlock_transaction_claim()` compared the PMCSR state field with `PCI_D0`, which is the kernel's `pci_power_t` and not a register value. Both happen to be 0. The new `gpu_unlock_pmcsr_d0()` in `gfw_eval.c` compares the register bits with register constants. | ## Testing On 2.0 (1fc6d62), with linux 7.3: | | sparse warnings | |---|---| | 2.0 | 4 (3 gfp_t, 1 pci_power_t) | | + gfp_t | 1 | | + PMCSR | 0 | - The module builds with `KCFLAGS=-Werror`. - `checkpatch.pl` reports 0 errors and 0 warnings on the code changes. - I checked `gpu_unlock_pmcsr_d0()` on the host against `gfw_eval.c` for D0, D1, D2 and D3hot, D0 with every other bit set, and `0xffff`. The table is in the commit message. - I booted the same two commits on 1.1.0, on an RTX 3070 with nvidia 615.71.09: `gpu_unlock: unlocked`, and BF16 GEMM went from 44 to 86 TFLOPS. I haven't booted them on 2.0. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-30 04:56:02 +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#242
No description provided.