Skip to content

A8 GPU: one PM id per VM, and bind without exp_hw_support - #231

Merged
henrikklee merged 5 commits into
OrchardLinux:mainfrom
brkosebay:a8-gpu-pm-id
Nov 24, 2026
Merged

henrikklee merged 5 commits into
OrchardLinux:mainfrom
brkosebay:a8-gpu-pm-id

Conversation

@brkosebay

Copy link
Copy Markdown
Contributor

Follow-up to #196, so that the A8 boards (iPod touch 6, iPhone 6 and 6 Plus, iPad mini 4) can run the desktop on the GPU. Two patches:

  1. gpu/0075: give each A8 VM its own PM id. With two GPU clients on the A8 (T7000), the second client's geometry job could fault in the parameter manager and the GPU was lost. The GPU desktop always has a client (the compositor), so any GPU app started on it is a second client.
  2. gpu/0076: count the Apple A8 as supported. The A8's BVNC (3.10.4.5) is not in the driver's support list on main, so powervr binds only with exp_hw_support=1, which no A8 boot entry sets. An installed system's desktop never finds the GPU. This adds it next to the A9 and A10, as the kernels flown on the A8 have it. The login's GPU probe still falls back to the software desktop if the GPU doesn't draw.

The PM-id bug

Every A8 geometry and fragment job named PM id 0, each with its own VM's PM control block. The firmware loads a set's free list into the PM only when a job names an id other than the one that PM side last loaded (the check returns early at firmware 0x1000802c, in 0x10007fd8). With one id for every VM, one VM's TA could run on the free-list top index and saved PM registers that another VM had left loaded.

Seen on the device as, with a second client running next to the compositor:

  • VK_ERROR_DEVICE_LOST in the client;
  • a TE control-stream MMU fault in the PM's address space (requester tag 11, sideband 3, page catalogue 9 = PM-TE0), followed by a GPU reset; PM hangs in other runs.

What Apple does

The kext gives each live parameter manager an id of its own: assignPMId (0xfffffff008486614 in the iOS 12.4 iPod touch 6 kernelcache, 16G77) keeps the id in the PM object, pops a free id from a LIFO of 127 (0..126) for a PM that has none, and only steals the least recently used id of a PM whose work has retired. TA submit writes the id into both the TA and the 3D command. Its release (0x84804f0) puts the id back on the free stack and sends the firmware nothing.

When a job names a different id, the firmware saves the running set back into its own control block (0x100252cc) and loads the next one (0x10025a28), so each VM's TA runs on its own free list.

The fix

A8 jobs name the PM id of their VM's slot (slot - 1, 0..6) instead of 0. A slot belongs to one VM, so live VMs never share an id, and the firmware's save/load runs on every switch between VMs. Nothing else changes: control block, stack, barrier and pool sizing (a8_pm_blocks) are as merged in #196.

A new VM that takes a just-freed slot while that id is still loaded gets no load, as on iOS, where a freed id is handed out again at once in the same way.

Testing

iPod touch 6 (N102), installed system, labwc desktop on the GPU (Zink), with both patches (the flown driver source equals this branch's).

  • Before: headless vkmark while a terminal redraws the desktop (two VMs) → device lost and MMU fault.
  • After, same test: 551 fps, no faults.
  • Then, on one boot, with no fault, hang, lost-device or reset line in the kernel log:
    • two headless clients at once: 299 + 297 fps;
    • mixed PM pool sizes across ids: two headless clients at a8_pm_blocks 32 and 61 at once, 330 + 344 fps; a Wayland client at 61, then one at 16, each next to the compositor's 32: 463 and 461 fps;
    • vkmark on Wayland at 640x1136 with direct scanout (the original Wayland reproducer): 502 fps;
    • the full vkmark suite on Wayland at 640x1136: score 432, every scene.

Build: n102 (apple-4k) on clang 19 with no compiler warnings; against a build of main, only powervr.ko changes (227 of 228 output files identical). The series audit (kernel/audit-patches.py) passes with both patches for N102, N61, N56, J96 and J97, which share the apple-4k kernel and all enable the GPU node.

iPhone 6 and iPad mini 4: the desktop test for these boards follows once this is in a build.

🤖 Generated with Claude Code

brkosebay and others added 5 commits November 24, 2026 13:08
gpu/0075. Each A8 VM's geometry and fragment jobs name the PM id of
its slot (slot - 1, 0..6) instead of 0, as Apple's assignPMId gives
each live parameter manager its own id. The firmware loads a set's free
list only when a job names an id other than the one last loaded, and on
a switch saves the running set back to its control block. With one id
for every VM, a second client's TA ran on the first client's free-list
state: TE control-stream faults (tag 11, catalogue 9), device lost and
PM hangs with two clients on the GPU, which the GPU desktop always has.

Only powervr.ko changes on apple-4k.

Assisted-by: LLM
gpu/0076. The A8's GPU (BVNC 3.10.4.5) is not in the driver's support
list on main, so it binds only with powervr.exp_hw_support=1, which no
A8 board's boot entry sets: an installed system's desktop never finds
the GPU. Add it next to the A9 and A10, as the flown A8 kernels have it.
The login's GPU probe still falls back to the software desktop if it does
not draw. The series applies on n102, n61, n56, j96 and j97.

Assisted-by: LLM
# Conflicts:
#	CHANGELOG.md
@henrikklee
henrikklee merged commit 7a8760a into OrchardLinux:main Nov 24, 2026
@henrikklee

Copy link
Copy Markdown
Contributor

Merged, thanks Berkay! Both patches landed as they were: every A8 board (iPod touch 6, iPhone 6 and 6 Plus, iPad mini 4) now finds the GPU on an installed system without exp_hw_support, and a second GPU app next to the compositor no longer takes the GPU down. The A9 and A10 paths are untouched (the support-list line only adds the A8's ID, and the PM-id change is in the T7000 submit code only).

On top I only added a CHANGELOG entry and merged main into the branch for a CHANGELOG conflict. Nothing in your code changed, so no retest is needed for this. Your original head is tagged contrib/brkosebay-a8-pm-id.

One small thing: the two patch files have no Signed-off-by: from you. Could you send one (name and email) when you get a chance? We'll add it to the patches. It doesn't block anything.

The iPhone 6 and iPad mini 4 desktop runs you mentioned would be great to see once this is in a build.

@brkosebay

Copy link
Copy Markdown
Contributor Author

Signed-off-by: Berkay Kösebay brkosebay@users.noreply.github.com

This covers gpu/0075 and gpu/0076, and is approval to add the same line to every other patch of mine on main that lacks one. I count 163 of them, across gpu, t7000, s8000, power, usb, drm, iio and others, including the #202 ones you asked about there.

henrikklee added a commit that referenced this pull request Nov 24, 2026
He gave it for every patch of his on main that lacked one:
#231 (comment)

162 kernel patches and one m1n1 patch; trailers only.
@henrikklee

Copy link
Copy Markdown
Contributor

Thanks @brkosebay! Your sign-off is now on all 163 of your patches on main (162 kernel, 1 m1n1), each linked to your comment: d703fcf.

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.

2 participants