Skip to content

gm: the GM8126 and GM8128 on the vendor 2.6.28 kernel - #306

Merged
openipc-ai merged 2 commits into
masterfrom
gm8128-vendor-kernel
Dec 3, 2026
Merged

openipc-ai merged 2 commits into
masterfrom
gm8128-vendor-kernel

Conversation

@openipc-ai

Copy link
Copy Markdown
Contributor

Closes #305.

The GM8126 generation's vendor 2.6.28 kernel says Hardware : Faraday GM8126 in /proc/cpuinfo whatever the die is, and has no /proc/pmu/chipver (that file belongs to the GM813x kernels). So no row in the vendor table matched, and ipctool printed no vendor matches /proc/cpuinfo: Faraday.

The kernel names the die on its own boot line from the PMU ID word, 0x99000000 >> 8. I disassembled its decoder from a vendor dump:

ID Boot line
0x812610 IC: GM8126
0x812620 IC: GM8126 MP
0x812621 IC: GM8128 MP

/proc/pmu/attribute shows the same word as pmuver, so ipctool reads it from there, without /dev/mem. If pmuver is missing or holds another value, the name comes from the Hardware line.

Like the rest of the GM8126 support (#293), this is in ipctool only. ipcinfo is byte-identical on arm32 (153852 bytes).

Tested

In qemu-bench's gm8126 machine, booted from a GM8126 camera's vendor flash dump (report r-nz9qyrtg):

  • master gives exactly the error in GM8128 #305.
  • With this branch, the full report comes back in 21 s: chip GM8126, MAC, all 10 NOR partitions, 128M RAM, the 2.6.28 kernel and toolchain, and the OV7725 at 0x42 on bus 0.
  • With -global gm-sys8126.chip-id=0x81262100, the kernel prints IC: GM8128 MP (the reporter's boot line), pmuver reads 8463905, and ipctool reports GM8128.

The native build passes all six unit tests, and clang-format finds nothing to change in the diff. Not yet run on real silicon: the reporter's GM8128 is the check.

Known gaps on this kernel, not in this PR

  • The ROM size shows 15M, because the partitions skip the 4 KiB header at 0.
  • Media memory is missing, because /proc/frammap/ddr_info here is a table with a MemSize column, not the size: line ipctool parses.

That kernel says "Hardware : Faraday GM8126" for every die and has no
/proc/pmu/chipver, so no row matched. It names the die on its boot line
("IC: GM8128 MP") from the PMU ID word, 0x99000000 >> 8: 0x812610 GM8126,
0x812620 GM8126 MP, 0x812621 GM8128 MP. /proc/pmu/attribute shows the same
word as pmuver, so it is read from there, without /dev/mem.

ipctool only, as the rest of the GM8126 support: ipcinfo is unchanged.

Closes #305
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

gm: detect GM8126/GM8128 on the vendor 2.6.28 kernel

🐞 Bug fix ✨ Enhancement 🕐 10-20 Minutes

Grey Divider

AI Description

• Adds a Faraday detector for the GM8126 vendor 2.6.28 kernel, which reports the same Hardware line
 for every die.
• Reads the die from the PMU ID word in /proc/pmu/attribute (pmuver), falling back to the Hardware
 line.
• ipctool only; ipcinfo is unchanged. Closes #305.
Merge Risk 🟡 Medium

Blast radius 🟢 Low 💥 1 capability

  • 1 affected end-to-end capability after fault-specific containment; implementation boundaries do not widen its functional scope.
  • The changed detector feeds the single getchipname() path and then the existing GM HAL setup, so identification and the diagnostics that require that identity form one bounded GM integration rather than separate technical-layer capabilities.
Behavioral complexity 🟡 Medium 🧩 Compatibility cases, Interacting branches

  • Before, GM detection used /proc/pmu/chipver or device-tree compatibility.
  • After, a vendor-kernel compatibility path first requires a Faraday Hardware-line match, then maps PMU IDs through multiple cases with a generic GM812x fallback.
  • The new correctness conditions are selecting this path only for the intended kernel representation, parsing the pmuver attribute correctly, preserving the existing detector order, and keeping unknown PMU IDs from becoming an unsupported precise model.
  • The switch is small and uses existing file/regex infrastructure; the interaction comes from combining two kernel data sources and preserving alternate detection paths, not from the helper infrastructure itself.
Potential damage 🟡 Medium 🩹 Temporary loss

  • When detection returns false and no later detector succeeds, getchipname() returns NULL; report construction explicitly aborts on that condition, and other chip-dependent callers similarly gate their work on detection.
  • The exact set of commands used on affected systems is not fully enumerated, so the consequence is limited to detection-dependent behavior.
  • Reverting the detector stops new failures; rerunning after deployment of corrected code restores operation, with no persistent state repair or external compensation required.
Assessed commit fbcd2f8
Diagram

graph TD
    A["/proc/cpuinfo"] --> B["gm_faraday_detect_cpu"]
    B --> C["/proc/pmu/attribute"]
    C --> D{"pmuver ID"}
    D -->|0x812621| E["GM8128"]
    D -->|0x812610 or 0x812620| F["GM8126"]
    D -->|other or missing| G["GM from Hardware line"]
    B --> H["chipid.c manufacturer table"]
Loading
High-Level Assessment

Keeping the chip-name decision in a small detector keyed on the PMU ID word is the right fit. The vendor kernel gives no per-die field in cpuinfo, and /proc/pmu/attribute is readable without /dev/mem, which is the main alternative (reading the ID word from memory) and would need root and a fixed address. The fallback to the Hardware line keeps behaviour unchanged on kernels without pmuver. Using the existing line_from_file helper, as the other detectors do, avoids new parsing code.

Files changed (3) +48 / -0

Enhancement (3) +48 / -0
chipid.cRegister Faraday detector in the manufacturer table +2/-0

Register Faraday detector in the manufacturer table

• Adds a Faraday entry that calls gm_faraday_detect_cpu with VENDOR_GM and gm_setup_hal. It sits after the Grain entry and before the generic device-tree fallback, inside the non-standalone guard.

src/chipid.c

gm.cDetect GM8126/GM8128 from the PMU ID word +45/-0

Detect GM8126/GM8128 from the PMU ID word

• Adds gm_pmuver(), which parses the pmuver value from /proc/pmu/attribute, and gm_faraday_detect_cpu(), which matches the Faraday GM<n> Hardware line. It maps 0x812621 to GM8128, 0x812610 and 0x812620 to GM8126, and uses the Hardware line number otherwise.

src/hal/gm.c

gm.hDeclare gm_faraday_detect_cpu +1/-0

Declare gm_faraday_detect_cpu

• Adds the prototype for gm_faraday_detect_cpu under the same non-standalone guard as gm_dt_detect_cpu.

src/hal/gm.h

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. GM8128 dies misreported as GM8126 without pmuver ✓ Resolved Bug Correctness
Description
gm_faraday_detect_cpu falls back to sprintf(chip_name, "GM%.4s", buf), where buf is the digits
from the Hardware : Faraday GM8126 line. The PR says that line reads GM8126 on every die, so any
GM8128 (or unlisted PMU ID) whose /proc/pmu/attribute lacks pmuver or holds another value is
reported as GM8126. This happens whenever gm_pmuver() returns 0 or an unlisted value, and the
wrong chip name then flows into the HAL selection for that device.

Grey Divider

Tip of the day
💡 Did you know, you can move or hide resolved findings to focus on what still needs action

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

The Hardware line reads GM8126 on the GM8128 too, so with no pmuver, or one
the kernel itself does not know, it cannot name the die.
@openipc-ai

Copy link
Copy Markdown
Contributor Author

Qodo's finding is fixed in fbcd2f8. The Hardware line says GM8126 on a GM8128 too, so without a pmuver the kernel knows, the report now gives only the generation, GM812x. I checked it in qemu-bench with chip-id=0x81263000: the vendor kernel prints IC: Uknown!!!!!! 812630 and ipctool reports GM812x. I didn't return false instead, because that would put this kernel back to "SoC not recognised" (#305).

@openipc-ai
openipc-ai merged commit c4581d8 into master Dec 3, 2026
5 checks passed
@openipc-ai
openipc-ai deleted the gm8128-vendor-kernel branch December 3, 2026 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GM8128

1 participant