Repository navigation
[Joshua's agent] K114c October series (draft): PMP bring-up so the GPU vote reaches firmware (T2 variant) - #2181
joshuaswarren wants to merge 2713 commits into
Conversation
A coprocessor CPU domain whose firmware Linux starts cold, such as the T6030 external display coprocessors' CPU domains, must not be clock or power gated behind its firmware's back. Describe a property that keeps automatic power management off for such a domain. Signed-off-by: Eryk Wieliczko <eryk@wieliczko.ninja> [port to integration/aurora: the apple,no-auto-pm part of b0aee2c ("dt-bindings: power: apple,pmgr-pwrstate: Add apple,no-auto-pm and apple,inherited-on"); apple,inherited-on is not an alias of apple,firmware-owned in this tree and is documented separately] Assisted-by: LLM Signed-off-by: Diljit Singh <hey@djdev.me> (cherry picked from commit 7d1726a) (cherry picked from commit 093f81775821f9c9285a6a5eea6a598b04453c12)
The T6030, T6031 and T8122 device trees mark the internal display power chain (DISP_SYS, DISP_FE, DISP_CPU) with apple,inherited-on, and the display handoff refuses to add the PMP unless the chain carries it; it then sets apple,min-state on the chain, which the power state driver applies, so the PMP cannot power the running display coprocessor down. The binding did not describe the property. Document it as the marker it is: the boot loader left the domain on. It is not apple,firmware-owned; the domain's register is still written. Assisted-by: LLM Signed-off-by: Diljit Singh <hey@djdev.me> (cherry picked from commit 3452b95) (cherry picked from commit 54e0cd55db58cc7c21ec6827f5d49d2c636eb43f)
A domain marked apple,no-auto-pm never gets automatic power management enabled: not when it is found on at probe, not when it is powered on, and not when a failed power-off is undone. Once powered up it stays at its requested state until Linux changes it, which a coprocessor CPU domain whose firmware Linux starts cold needs. Signed-off-by: Eryk Wieliczko <eryk@wieliczko.ninja> (cherry picked from commit b968acb12e5e6ea5a8f24cbe0a4e24ce3fc8d6d8) [port to integration/aurora: applied onto the driver's undo_timeout and retained_25g83 paths] Assisted-by: LLM Signed-off-by: Diljit Singh <hey@djdev.me> (cherry picked from commit a9cf855) [Chris Kearney: ported onto e0fde811, whose driver has no undo_timeout or retained_25g83 domain and undoes every failed power-off: the undo and the power-on take !no_auto_pm, as do the always-on probe path and the probe's auto-PM write, which keeps its firmware-owned exception] Generated-by: LLM (cherry picked from commit 24db07d5fc9caf65e870ed8ac81608d6b6a4502a)
… off Add KUnit coverage for apple,no-auto-pm on the power-on path and on the undo of a failed power-off. The tests run the driver's own power_on and power_off callbacks against an emulated power state register, whose actual state follows the target written unless the test holds it. - Powering on enables automatic PM unless the domain is apple,no-auto-pm. - A power-off that does not complete is undone by requesting the domain on again, with automatic PM only when the domain allows it. - A power-on that does not complete never enables automatic PM on such a domain, and the domain is requested off again. The probe's always-on path and its auto-PM write need the syscon parent and are not covered here. Generated-by: LLM (cherry picked from commit febe62e1389c152ecaf31147ff28ba8102af39c5) Signed-off-by: Chris Kearney <chris@kearneymail.com>
The T6031 board record admitted the J516C only; on a J514C the DCP was refused with "no board record for this machine" and the boot framebuffer stayed. aurora-silicon#363 admits the J514C alongside the J516C. Add a J514C record on the T6031 DCP with the J516C image (the image is the SoC's; its UUID is checked at probe). The J514C board file names the J514S panel values (the same chassis), not yet read from a J514C, so the record takes the panel size from the boot framebuffer like the T6030 record does, and logs every panel timing and the display clock on its first boots. Assisted-by: LLM Signed-off-by: Diljit Singh <hey@djdev.me> (cherry picked from commit 1cd6efc) (cherry picked from commit c5399c56d2f6689f586b8a9a3b4dcbc8045ad870)
… 1 MiB An HDMI 2.1 (FRL) sink's TimingElements arrive from the external processor as one chunked property transfer of more than 1 MiB (1.38 MB for a 4K120 TV). The 14.7 client refused any property above 1 MiB, so such a sink was described with no timings at all. Let an external processor keep up to 8 MiB per raw property and 24 MiB in all, with the chunked transfer's announced count bounded the same way; the panel's properties keep their limits. Signed-off-by: Eryk Wieliczko <eryk@wieliczko.ninja> [port to integration/aurora: the PR's DCP_PROPERTY_RAW_LIMIT/TOTAL for the external role, applied to the DCPLink client's raw property store] Assisted-by: LLM Signed-off-by: Diljit Singh <hey@djdev.me> (cherry picked from commit 7a99c02) (cherry picked from commit f37b11c20d12de9b2e4dbaa27d71256682e7f97c)
…bits
sio_send_dt_params() sends each boot parameter with its key split into an
endpoint byte (key >> 8) and a parameter byte (key & 0xff). A key wider
than 16 bits therefore reaches the firmware as its low 16 bits.
The T6030 boot-table check compared whole 32-bit keys. A list could
carry a checked table, such as the map ranges under 0x1a, and then
0x1001a with another page. Both keys were unique and the table check
passed, but the firmware got the second page for the map ranges,
unchecked.
Refuse any key above 0xffff before the duplicate and table checks. Up to
16 bits, every key is its own endpoint and parameter, so the existing
duplicate check covers what the firmware receives. The generic SIO path
is unchanged.
The KUnit test appends, after valid tables, keys that send the same setup
message as a checked table or size key: 0x1001a, 0xff00001a, 0x1000022,
0x10023, 0x1001c and 0x1001d. It checks that each sends that message,
and that each is refused. A wide key aliasing nothing in the list is
refused too, and the 16-bit key 0xffff is still admitted.
Fixes: 215e89d6906c ("dmaengine: apple-sio: Start the T6030 SIO only with protocol-10 tables")
Generated-by: LLM
(cherry picked from commit 621bce2f8d22dc916e7228728e2a9325e125d74e)
Signed-off-by: Chris Kearney <chris@kearneymail.com>
…solved
The T6030 boot-table check reads the IOVA windows from the
iommu-addresses entries of the SIO's memory regions. A short entry
refuses the tables, but an entry whose owner phandle did not resolve
only stopped reading that region. The windows before it still counted,
so tables inside them were admitted with the rest of the entry ignored.
Refuse such an entry, as a short one is. A phandle of 0, or one that no
node has, is malformed either way.
The device-tree KUnit test adds two regions. Each has a good window
holding the tables, followed by an entry owned by phandle 0 in one and by
an unknown phandle in the other. Both are refused.
Fixes: 215e89d6906c ("dmaengine: apple-sio: Start the T6030 SIO only with protocol-10 tables")
Generated-by: LLM
(cherry picked from commit efc2b24864514d3eac2ad61e46f8e8bdb610acd9)
Signed-off-by: Chris Kearney <chris@kearneymail.com>
apple-sio is built on the virt-dma helpers (vchan_init(), vchan_tx_submit(), vchan_find_desc() and the rest) but never selected DMA_VIRTUAL_CHANNELS. It only built when another driver selected it at a compatible level, as APPLE_ADMAC does in the asahi config, where both are modules. Any other combination fails to build: - APPLE_SIO=y with APPLE_ADMAC unset: vmlinux fails to link with undefined vchan_* symbols. - APPLE_SIO=y with APPLE_ADMAC=m: DMA_VIRTUAL_CHANNELS resolves to m, which a built-in apple-sio cannot link against. - APPLE_SIO=m with APPLE_ADMAC unset: modpost finds undefined vchan_* symbols. Select DMA_VIRTUAL_CHANNELS, as the other virt-dma drivers do. Resolved with allnoconfig plus fragments, DMA_VIRTUAL_CHANNELS now follows APPLE_SIO in each case. A KUnit kernel with APPLE_SIO=y and no APPLE_ADMAC links again. Fixes: 5fdca02 ("dmaengine: apple-sio: Add Apple SIO driver") Generated-by: LLM (cherry picked from commit 6b3173bea37605ba6d9ccbb1e672c2bedae40366) Signed-off-by: Chris Kearney <chris@kearneymail.com>
A T6030 SIO node is compatible with "apple,t6030-sio" and "apple,sio".
Without APPLE_SIO_T6030 the driver matched it as the generic SIO. It
then sent whatever boot tables the boot loader had passed, unchecked,
and configured the channels the generic way, which the T6030 firmware
does not expect.
Refuse such a node at the start of the probe when APPLE_SIO_T6030 is
not built: one message and -ENODEV, before the DMA masks, the registers,
runtime PM, RTKit or any firmware message. The M1 and M2 SIO nodes are
not T6030-compatible and probe as before. With APPLE_SIO_T6030 the
probe is unchanged.
KUnit (APPLE_SIO_KUNIT_TEST) calls the probe on an M1 node and on T6030
nodes with a T6030-aware boot loader's tables and with an earlier
loader's. The devices have no register range, so a probe that goes on
stops there with -EINVAL.
- With APPLE_SIO_T6030: the M1 node and the protocol-10 T6030 node go
on; the earlier tables are refused.
- Without it: the M1 node still goes on. Both T6030 nodes are refused,
with the device's DMA mask untouched.
Fixes: e7b14d8b199b ("dmaengine: apple-sio: Configure the T6030 channels as its firmware expects")
Generated-by: LLM
(cherry picked from commit ef76b66ab8bf99818b1c4dd6cbdf3be3d2947b83)
Signed-off-by: Chris Kearney <chris@kearneymail.com>
The G15 generation of the asahi GPU driver, added later in this series, links page tables into the UAT of the GPU's firmware coprocessor, whose table walker does not snoop the CPU caches. The tables are ordinary RAM pages that the shared page-table code allocates and writes through the cacheable linear map; they are not DMA-mapped, so the DMA API has nothing to sync them with. Each table, and each changed entry, has to be cleaned to the point of coherency before the firmware can walk it. Export the existing dcache_clean_poc() to GPL modules for that, instead of adding a new cache maintenance helper. Signed-off-by: Eryk Wieliczko <eryk@wieliczko.ninja> [port to integration/aurora: applied unchanged from aurora-silicon/linux PR aurora-silicon#358] Assisted-by: LLM Signed-off-by: Diljit Singh <hey@djdev.me> (cherry picked from commit 019af52)
The maintained driver's table excludes T6030/T6031 when the native G15 profile is selected. The native platform driver's private table matches these devices, but exports no module metadata. With DRM_ASAHI=m, udev therefore has no device alias with which to load asahi.ko on those Macs. Export a T6030 alias with the normal of_device_table! macro. Keep the separate platform driver and its two-device match data; this changes module discovery, not the probe's supplier admission or firmware-start requirements. The managed supplier ordering must also be satisfied before qualifying this profile for automatic boot. T6031 keeps explicit loading until it has an equivalent display-order admission gate. Generated-by: LLM Signed-off-by: Chris Kearney <303316+iconidentify@users.noreply.github.com>
The SIO coprocessor (ASC at 0x289c00000, mailbox at +0x8000, interrupts 907..910, stream 0 of the SIO DART) is the DMA controller of the DisplayPort audio interfaces. As on the other SoCs it stays disabled: the boot loader reserves its firmware, describes its parameters and enables it. Its firmware sets up the SPI, UART and audio DMA shims whichever of them its clients use, so SPI_P, UART_P and AUDIO_P join SIO as parents of the SIO CPU domain, as t8103, t8112, t600x and t602x describe them. The J514S built-in HDMI port's audio is DCPEXT0's audio service with DPA1, the DisplayPort audio interface linked from DCPEXT0's port@0, whose samples SIO channel 0x66 carries; DPA1 is in its own power domain. This is the M1 Pro/Max HDMI port's arrangement (dcpext0, dpaudio1, SIO 0x66). Enable the SIO mailbox, the alias the boot loader looks the SIO up by, and DPA1's audio controller. Signed-off-by: Eryk Wieliczko <eryk@wieliczko.ninja> [port to integration/aurora: the DPA1 audio controller, DCPEXT0's port@0 and the SIO alias and mailbox enable go into t603x-j514s-j516s-hdmi.dtsi against integration's dcpext node (the PR's t6030-j514s-dcpext.dtsi is not carried); the t6030.dtsi and t6030-pmgr.dtsi hunks are unchanged] Assisted-by: LLM Signed-off-by: Diljit Singh <hey@djdev.me> (cherry picked from commit 344f2bd) (cherry picked from commit 645dac18845071cc7a911ea38efb797980ad1985)
The J514S HDMI port's audio is DCPEXT0's DP/HDMI audio service (EP 0x29, DCPAVAudioInterface) with DPA1, whose samples the SIO coprocessor carries. On DCP firmware 14.7's external role the service numbers its methods as 13.5 does, but differs from what the driver does for M1/M2: - An element's ElementData, the link data every link method takes, is 32 bytes, not 24; the last eight are opaque and must be kept. - StopLink (0/10) and CompleteLink (0/11) carry the link data as PrepareLink and StartLink do, and every link method answers an IOReturn at body+48. - One link per stream start: the SIO channel is configured, PrepareLink sent; the cyclic DMA is issued before StartLink; on stop the DMA is terminated and drained before StopLink and CompleteLink. A link that was only prepared (a format probe) is completed at hw_free, the link of a connection that has gone is dropped unsent. No DPA reset follows CompleteLink: it silenced every later stream on this machine. - The catalog of a sink's audio elements can be large (114 elements on a TV): it is queried with a 256 KiB capacity. - An open DCPAV interface is a client the firmware waits for, up to 10 s, before it removes a terminated interface, and the sink's link with it. So the card follows the connection but the service is not opened with it: the PCM opens it (Open, command 4, status and opened Boolean checked) and its close closes it (Close, command 5). A Terminate report on an open service disconnects the card and closes the instance from a work item; an instance that goes away takes its open with it, and its successor is never closed for it. - The open, close and link calls wait for their replies without srv_rwsem and plug_lock, which the endpoint's receive path takes when an instance is published or removed: the instance the PCM opened is kept under a mutex of its own. When the card is disconnected for the display or the sink, an open PCM's link is completed on the still open service first; otherwise the firmware keeps it prepared and refuses every later PrepareLink. - The role's CEC interface (DCPDPCECInterface) broadcasts the same reports on the endpoint; it is matched and its reports dropped. The external role starts the audio endpoint on the driver's opt-in (appledrm.hdmi_audio), as the other DCPs do, for a controller whose port@0 links an audio device, once per session and after the sink's first EDID: with the endpoint's interfaces published, every CopyEDID made the firmware rebuild them and re-plug the sink. The audio service is connected when the display is powered on (A472 on) and disconnected when it is powered off and before the sink is released. Everything is behind DRM_APPLE_DCP_T6030_EXT and the 14.7 external role: other configurations build these files unchanged, and an M1/M2 DCP's 24-byte link data still goes out as the same 64 bytes. Tested on the J514S HDMI port: PCM streams through the card, DPMS cycles and firmware re-plugs with a PCM open. Signed-off-by: Eryk Wieliczko <eryk@wieliczko.ninja> [port to integration/aurora: keyed to integration's native T6030 external pipe, dcp_is_v14_7_external() (DCP_FIRMWARE_V_14_7 with external_native), in place of the PR's iomfb_is_v14_7_external(), and gated by a new DRM_APPLE_DCP_T6030_AUDIO option (default y under DRM_APPLE_AUDIO) in place of DRM_APPLE_DCP_T6030_EXT. The PR's dcpext-t6030.c lifecycle hunks become: the AV endpoint is started from dcp_get_modes() once the first EDID is installed (dcp_external_audio_start(), external_audio_work in dcp.c, disabled across unbind and system sleep); the audio service is connected after A472 on and disconnected before A472 off in dcp_v14_external_modeset() and iomfb_v14_7_poweroff(), and av_service_connect() waits for iomfb_v14_7_external_powered(); integration's dcp_poweroff() and DPTX release paths already disconnect the service. The av.c branches drop the pinned service through the out label, as integration's service pinning requires. The AV endpoint's RTKit messages were already routed to dcp->avep by the DCPLink receive path.] Assisted-by: LLM Signed-off-by: Diljit Singh <hey@djdev.me> (cherry picked from commit d71cc2c) [Chris Kearney: ported onto 94d08ac6, whose dcp.c and iomfb.c were reorganised since: the work's enable, disable, init and cancel go into the native external blocks of the current bind, unbind, probe, remove, suspend and resume; the audio start moves from apple_connector_edid_install(), which the base no longer has, to where dcp_get_modes() stores an EDID that passed its generation and service epoch checks] Generated-by: LLM (cherry picked from commit a06ab6c478cb82a49c22c88508288ba8f02adcf9)
A native external pipe's bind enables its audio work, and unbind and
system sleep disable it again; but probe leaves it enabled, so the
first bind's enable underflows the work's disable count and warns, on
every boot of a J514S/J516S (with hdmi_audio off as well), and panics
with panic_on_warn.
Disable it at probe, as the pipe's vblank work is. It is first queued
from the connector, after bind.
Fixes: a06ab6c478cb ("drm: apple: Add the DCP 14.7 external role's HDMI audio")
(cherry picked from commit 3f09f12df6f6c13a6899a7111c0da94f95c1db3c)
[Chris Kearney: Fixes retargeted from c1d99818, the SiliconForest
variant, to this tree's port of d71cc2c; the context line differs]
Generated-by: LLM
(cherry picked from commit 735cd9c06a754282f23f0f2dc9ab7820e2c1fc06)
Signed-off-by: Chris Kearney <303316+iconidentify@users.noreply.github.com>
…et fails early
An external mode set stops the sink's audio before it powers the
display down, and connects it again once the display is on. When the
description never settles, or the mode is gone from it, the mode set
fails before anything is powered down: the display goes on in its old
mode, but its audio stays disconnected. A retry that succeeds connects
it again; once the retries are spent, nothing does, and with no plug
event userspace does not reopen the PCM.
On such a failure, connect the audio again while the display is still
powered and the session running. The audio calls go through two small
helpers, which KUnit stubs to run the production mode set.
Fixes: a06ab6c478cb ("drm: apple: Add the DCP 14.7 external role's HDMI audio")
(cherry picked from commit 55dd126d7f31082a4450022f319845ef559b2fae)
[Chris Kearney: Fixes retargeted from c1d99818, the SiliconForest
variant, to this tree's port of d71cc2c; the test include block is new
here, since this iomfb_v14_7.c had none, and kunit/static_stub.h is
included for the two helpers]
Generated-by: LLM
(cherry picked from commit 9df037b2adc8c687371b686990b271a3af8131f6)
Signed-off-by: Chris Kearney <303316+iconidentify@users.noreply.github.com>
…AV service Two wire facts of the DCP 14.7 external role (T6030 DCPEXT), observed with its AV service and DPTX port on the J514S: - Its callback replies carry 8 in byte 35 of the EPIC sub-header. The AFK layer zeroed that field for every firmware. - After a replug it announces its AV service again on the channel the old instance had. That is a new instance: the old one is gone with the sink it served. The AFK layer refused a second announcement on a channel that still had a service, so the host kept the dead instance, never opened the new one, and read no EDID through it. Set the byte on the external role's callback replies, and tear the old AV instance down before the new announcement is taken, on that role only. Signed-off-by: Eryk Wieliczko <eryk@wieliczko.ninja> [port to integration/aurora: gated on dcp_is_v14_7_external(), the native DCPLink external pipe; integration's handling of the 14.7 kind-0 replies is kept] Assisted-by: LLM Signed-off-by: Diljit Singh <hey@djdev.me> (cherry picked from commit 5033ab8) (cherry picked from commit 7c5cef7c5f17de4d6f8606616abc58f72e5daa8c)
The DCP 14.7 external role answers EDID requests through an AV service
instance its client has opened. The host opened it with command 6, which
is SetVirtualEDIDMode: with the instance's interfaces present it removes
and recreates them, a software unplug of the sink, and it opens nothing.
DCPAV Open is command 4 (a zero 32-byte body; the reply's status at +0
and its opened Boolean at +16 say whether it took).
An open client is one the firmware waits for, up to 10 s, before it
removes the instance: it holds the reply to the sink's HPD low until the
instance's device has closed ("timeout while waiting for DCPDPDevice
close"), and with it the sink's release and the next sink. The host
never closed its client, so an unplug could leave the controller stuck.
Open the instance with DCPAV Open and check its reply; close the client
(DCPAV Close, command 5) before every HPD low and before a release, and
from a work item when the firmware terminates the instance (report group
2, command 1), after which the instance gets no new use. Close goes only
to the instance that was opened; a removed instance took its open with
it. The EDID read through this role is checked block by block (header
and checksums) before it is published.
Signed-off-by: Eryk Wieliczko <eryk@wieliczko.ninja>
[port to integration/aurora: dcp_ext_av_work/dcp_ext_av_close and
dcp_ext_v14_7_av_report re-implemented in dpavservep.c on the
dcpavserv.opened bookkeeping, the Close hooked into dptxport_set_hpd()
and dptxport_release_display(); drm_edid_valid() replaces the PR's
dcpext_edid_object() checks]
Assisted-by: LLM
Signed-off-by: Diljit Singh <hey@djdev.me>
(cherry picked from commit 375161e)
[Chris Kearney: ported onto 94d08ac6. The Open replaces the base's
afk_service_call(service, 4, 6, ...) in dcpavserv_copy_edid(); it is not
sent in addition to it. The base's enabled-only service pin, the EDID
generation and service epoch checks and the wire_v2 inline read are kept.
The opened/terminated resets join the base's init, teardown and detach
bookkeeping. The Close work is set up once at DCP probe rather than in
dpavservep_init(), since dpavservep_detach() can run before the endpoint
was ever started. The dptxep.c hooks go into the base's release and HPD
functions]
Generated-by: LLM
(cherry picked from commit bcccb5b7c2ce8bb1b2b25fd416c52b1b113a738e)
Comments and two log messages around the 14.7 external role's audio link, EDID copy and display status read used names that appear nowhere in the code. Describe them by the commands the code issues instead: the link's prepare, start, stop and complete (cmds.prepare, start_link, stop_link, unprepare), dcpavserv_copy_edid(), and A437. No functional change beyond the two log messages' wording. (cherry picked from commit 732f8107391c40365a21189f36ba6c225007ef3f) [Chris Kearney: the audio.c, av.c and dcp.c wording only; the A437 comment it also reworded comes with the external display status wait (45311f2), which is not in this tree yet] Generated-by: LLM (cherry picked from commit d0f41527ac4173ef6439bce4ece2dda66ac237a5) Signed-off-by: Chris Kearney <303316+iconidentify@users.noreply.github.com>
…t SIO Add two KUnit suites for the T6030 external audio path. The first, apple-dcp-external-audio-work, covers the native external pipe's audio work, now set up at probe by dcp_external_audio_init(). The test swaps the work function for a counter, so a start that queued the work shows. It checks that: - a first EDID before bind queues nothing; - bind's single enable is balanced, with no underflow warning; - suspend, resume, unbind and a second bind keep it so; - only a native external pipe starts it, and only once per session. The second, apple-dcpaud-no-sio, covers a DP audio interface whose DMA controller never registers. This is the T6030 SIO that refuses an earlier boot loader's tables. The interface gets no TX channel: every PCM open fails with -ENXIO, and no channel is kept. The display side is not involved. Generated-by: LLM (cherry picked from commit a7a32a6d537850fad3b437b960705650cb1617ed) Signed-off-by: Chris Kearney <chris@kearneymail.com>
The 14.7 external role's AV client was tracked by service pointer alone,
and its Open was not ordered against a Close or a Terminate. That left
four ways to get the client wrong.
- A Close before an HPD low, or a Terminate, that came while an Open was
in flight found nothing recorded open. The Open's reply then recorded
the client open: nothing closed it, and the firmware waits for that
client before it releases the sink.
- The Close work that a Terminate queued closed whichever instance was
open when it ran, including a successor published in the same slot
meanwhile.
- A Close cleared the Terminate mark, so the terminated instance was
opened and read again before its removal.
- A Terminate that came while no client was recorded open was dropped.
Name each instance by the epoch it was published in. The base already
changes dcpavserv.epoch even when a slot is reused. Then:
- Every Close and Terminate bumps a close generation. An Open that sees
the generation change is not recorded. If its instance is still the
published one, its opener closes the client again; an instance gone
meanwhile took the open with it.
- A Terminate marks its instance's epoch, and that instance gets no new
use until a successor is published. The Terminate also queues the
Close for that epoch, and the work closes that instance only.
- An Open in flight keeps a second EDID copy from opening the same
instance again.
The KUnit suite runs the production open, close, Terminate, Close work and
EDID copy on a fake instance, with only the client calls and the EDID read
stubbed. The Close work runs in test context, and the Open stub acts while
the Open is in flight. It covers:
- Close while Open is in flight, and Terminate while Open is in flight;
- the instance replaced in its slot while Open is in flight;
- an old Close work running after its successor was opened;
- a Terminate before and after its Close, and detach;
- the serial cases, as controls.
Fixes: bcccb5b7c2ce ("drm/apple: dpavservep: open and close the 14.7 external role's AV client")
Generated-by: LLM
(cherry picked from commit 5bf45496cb13766a7ed620e9a6e631c25e200d9d)
Signed-off-by: Chris Kearney <chris@kearneymail.com>
The audio service slots are reusable, but the 14.7 external role's audio
client was tracked by a raw, unpinned service pointer. Once an instance
was removed, its slot could be published again for a successor. Then:
- the successor's Open was skipped, as the stale pointer matched;
- a Close for the old client went to the successor;
- the Terminate work resolved the published service when it ran, so an
old Terminate disconnected a successor.
Keep the open instance pinned, with an instance generation that changes
whenever an instance is published or removed. The pin keeps its slot from
being reused while it is open.
- An Open on a later generation drops the old client, which went with
its instance, and opens the new one.
- A Close goes only to the instance still published under the generation
it was opened in.
- A Terminate records its instance's generation, and its work disconnects
only that instance.
- The comment that called the slot not reusable is corrected.
The KUnit suite publishes, removes and republishes one reusable slot
through the production init and teardown. It runs the production open,
close, Terminate report and Terminate work, with only the service calls
stubbed and the works run in test context. It covers:
- a successor in the slot being opened, not skipped;
- an old Close not reaching the successor;
- an old Terminate work running after the successor was opened;
- a Terminate from an instance that is not the published one;
- the serial case, as a control.
Fixes: a06ab6c478cb ("drm: apple: Add the DCP 14.7 external role's HDMI audio")
Generated-by: LLM
(cherry picked from commit a7b0d422dce22146ec881663fb47ca006b78c70f)
Signed-off-by: Chris Kearney <chris@kearneymail.com>
The Terminate work checked its instance generation when it started, but
its disconnect then released the PCM's link and closed whichever client
was open when it got there. Within the link release, which runs outside
plug_lock with no open_lock held, the old PCM can close. A successor can
then be published in the same slot and opened. The Terminate's final
Close then closed the successor.
Carry the generation into each step of the disconnect, and check it
where that step is taken, under that step's own lock:
- The card is disconnected only while that instance is still published,
checked under plug_lock with the generation read under srv_rwsem.
- The link is released only if it was prepared on that instance and that
instance is still the open one. dcpaud_release_link() asks
dcp_audiosrv_link_on() under its link_lock, which keeps the existing
link_lock then open_lock order.
- The final Close checks the generation after taking open_lock.
A link's stop and complete also go only to the instance it was prepared
on: once that instance has gone, the link went with it.
No lock is held across the release or any service call, and the receive
path's locks are not held over a call.
KUnit:
- The old PCM closes within the Terminate's link release, and a
successor is published in the same slot and opened. The Terminate's
Close leaves the successor open.
- A Terminate that finds a successor already published leaves the
successor and the card alone.
- Link stop and complete are refused after the instance changes, and a
link prepared on the successor is ended normally.
- The production dcpaud_release_link() leaves a link on another instance
in place, and ends the link of the instance asked for.
Fixes: a7b0d422dce2 ("drm/apple: av: keep the 14.7 audio client on its own instance")
Generated-by: LLM
(cherry picked from commit 387d9ea3bf336e55d7139e1f5616fa090a8b19bd)
Signed-off-by: Chris Kearney <chris@kearneymail.com>
When native G15 explicitly enables APPLE_T6030_GPU_PMP_LINK, use the existing validated halted-PMP startup path for the T6030 report. The actual overlay leaves the PMP, DART and mailbox disabled, and DCP waits on an acknowledged report entry; passive READY polling alone cannot bootstrap that graph. Route the scoped G15 supplier check through the same entry waiter. Keep the existing power-floor, halted-CPU, UUID and PTD-layout checks, bounded worker lifecycle, deferred external acknowledgements and storage no-ack policy. Other configurations keep the maintained descriptor behavior. No new direct hardware writes are added. Generated-by: LLM (cherry picked from commit 0a5be20bea11056a4953d975eeb468004f5b0b76) Signed-off-by: Chris K <iconidentify@users.noreply.github.com>
The checked translator is an ordinary exported symbol, so symbol_get() rejects it. DRM_APPLE already depends on OF_ADDRESS and can directly import the helper. Always pass the remaining tuple length to it instead of falling back to the unbounded translator after the failed lookup. Based-on: 388be40927b9c78bef4f9f22eb0a44584da2b163 [Chris: keep the reviewed production fix; omit the OF test that required additional configuration and positive-control fixes.] Generated-by: LLM Signed-off-by: Chris Kearney <303316+iconidentify@users.noreply.github.com>
Before 5bf45496, dcpavserv_v14_close() cleared the Terminate mark. After the Close that a Terminate queued, the next EDID copy then opened and read the terminated instance again, before its removal. 5bf45496 keeps the mark until a successor is published, and the Terminate's Close work no longer goes through dcpavserv_v14_close(). So no test had a Close reach the instance after its Terminate, and reintroducing the clearing went unnoticed. Add a regression test. A Terminate is followed by a Close, as before an HPD low, in both orders: after the Terminate's queued Close has run, and before it. In each order: - the instance gets one Open and one Close; - the mark stays on its epoch; - no EDID copy opens or reads it again; - its successor, a new epoch in the same slot, is opened. Test only; no production change. Generated-by: LLM (cherry picked from commit 66d0fbf8094c1c1017081ce8bc5e7646a332a055) Signed-off-by: Chris Kearney <chris@kearneymail.com>
Derive DISP, deferred external and storage request metadata from the shipped overlay, then execute the real report probe, startup descriptor/layout validation, child probes and request seeding, managed worker, entry waiter and supplier dispatch. Hardware, work scheduling and OF storage are explicit host boundaries; READY is produced by the simulated firmware bind, never by readiness admission. Cover missing handoff/layout, missing requests, wrong initial status, failed safety checks/enabling/bind/readiness/acknowledgement, deferred external ACKs, storage no-ack and drained startup ownership. Original 51a9 is a negative control: the real DISP entry waiter fails. Add T6030 worker KUnit cases for deferred external admission; those source cases still need a kernel run. Host controls: 18 graph cases and 12 compiling runtime mutants; separate config-off/on selection controls and 21 runtime mutants. Generated-by: LLM (cherry picked from commit 4bddce608349022a02d952d4d010af8d498c23af) Signed-off-by: Chris Kearney <303316+iconidentify@users.noreply.github.com>
PMP DISP acknowledgement establishes power readiness, not successful native DRM setup. Publish the T6030 component master only after DRM registration and client setup, and withdraw it before unplug/component teardown. Keep a device reference while published, refuse replacement by another master, and serialize admission links against withdrawal with a leaf mutex. The G15 ADT/PMP admission path gets this optional GPL helper before retaining a PMP supplier or voting for GPU power. An absent module or unpublished display returns EPROBE_DEFER without a hard build dependency. This establishes initial startup order; it does not make retained G15 firmware safe across forced display supplier unbind. T6031 is intentionally unchanged. Validation: 15 actual-body host controls, including concurrent link/withdraw, and 7 compiling runtime mutants. Publication and withdrawal source ordering checked separately; automatic deferred reprobe and rendering still require hardware qualification. Generated-by: LLM (cherry picked from commit 5dd4c76b7e66b496ac38af801344d334814e1caf) Signed-off-by: Chris Kearney <303316+iconidentify@users.noreply.github.com>
A display publisher can run while appledrm is MODULE_STATE_COMING. symbol_get then fails even after successful display registration, and the driver core has no mandatory deferred-probe trigger after the module becomes LIVE. On an otherwise idle system the GPU may remain deferred indefinitely. Use a direct GPL import and constrain G15 to built-in display support or matching modular GPU/display support. The module loader waits for a COMING dependency to become LIVE before resolving the GPU import, or refuses a failed provider; the existing helper still defers until actual component readiness. No notifier, polling worker or global bus rescan is added. G15-off normal profiles remain unconstrained. Validation: actual Kconfig conf passes all 18 consumer/provider/request combinations, accepting G15 only for y/y, m/y and m/m. Updated actual-body admission controls pass 14 cases and all 7 compiling runtime mutants. Final modpost, module dependency metadata and hardware startup remain separate gates. Generated-by: LLM (cherry picked from commit 8c40970dc1ca5afe43ce98dd1c96d0481e3b0ecb) Signed-off-by: Chris Kearney <303316+iconidentify@users.noreply.github.com>
The production prepare helper now waits for a registered native display. Extend the existing extracted-body fixture with that provider boundary, and require display refusal to leave the PMP link and power votes untouched. Successful display admission must precede each PMP-link attempt. Generated-by: LLM Signed-off-by: Chris Kearney <303316+iconidentify@users.noreply.github.com>
Override the t6050-die0.dtsi pcie0 (apple,t6050-pcie) with the port 0 register windows, the port interrupt and the N1 endpoint on port00: the Control (pci106b,1900) with the K114c FTAB firmware name and platform id, the Wi-Fi (pci106b,1902) and Bluetooth (pci106b,1903) functions, PERST# on pinctrl_ap pin 80 and the endpoint power line on SMC GPIO 19; dart_apcie0 (AIC 1524) goes status okay, and kboot fills the factory MAC/BD addresses through the wifi0/bluetooth0 aliases. Every value is from the K114c ADT ioreg gather of 2026-11-10: the register windows map one-to-one onto Edi Moldovan's J714c set (ADT reg 0, 1, 16, 18, 19, 3, 5, 6, 2 and 4; config identity-mapped, the rest +0x200000000), with the K114c's own sizes for axi2af (0x1000000) and phy-window (0x800000); port0 is AIC 1523; pci-bridge0 owns MSI vectors 0-31 at apcie0 vector offset 1824 (msi-ranges and apple,msi-vector-base already in die0); function-perst = GPIO 80, function-reset = pKW4 gP13; bus-range 0-8 from the ADT (the J714c's says 0-4); root board-id 0x04, so platform id = (0x04 << 16) | 0x6050 = 0x00046050. iBoot leaves the port untrained and the N1 off; the kernel cold-trains it (apple_pcie_t6050_cold_train, entered when adopt finds the link down and the port names pwren-gpios), and apple,link-trained-by-bootloader stays because it is the adopt path's port-validity flag. t6050-k114c-pcie-tunables.dtsi carries the two tunable properties the K114c ADT (2026-11-10) differs in from the J714c: cio3pllcore (one value 0x94 vs 0x95, offsets re-based +0x2200 onto pcieclkgen as the driver applies them there) and phy-ip-pll (three PLL trim values). axi2af, pcieclkgen, phy and phy-ip-auspma are entry-for-entry identical, so the J714c file stays included as the base. Based on work by Edi Moldovan (edimoldovan).
k114c.config, derived from Edi Moldovan's j714c.config with the same options, K114c-neutral: LOCALVERSION -k114c-ARCH. It keeps the PCIe host (CONFIG_PCIE_APPLE), the N1 drivers (WLAN_VENDOR_APPLE, APPLE_CENTAURI, APPLE_CENTAURI_WIFI, BT_HCICENTAURI), NVMe, USB 2.0 host, the SMC/keyboard/fan stack, iwd's crypto menu and the regulatory.db EXTRA_FIRMWARE entries, plus the rest of the J714c bring-up options so the two boards build from one fragment shape. Use with KCONFIG_ALLCONFIG and allnoconfig, as j714c.config is. Based on work by Edi Moldovan (edimoldovan).
apple_pcie_t6050_tune_host() returned -EINVAL without a message when a tunable property named a reg window that the device tree lacks, or when the property had a cell count that is not a multiple of 4. The probe then failed with "probe failed with error -22" and nothing else on the console. Name the property and the window, or the cell count. Analysis by w86 (M5 boot 3, 2026-11-10). Based on work by Edi Moldovan (edimoldovan).
The two -EINVAL returns at the top of the adopt_link branch of apple_pcie_probe() gave no message either. Name the cause. Based on work by Edi Moldovan (edimoldovan).
pcie-apple deferred the N1 root port forever: its reset-gpios names GPIO 80 on pinctrl_ap, which the SoC dtsi leaves disabled until a board needs it. Enable it as the J714c does. Based on work by Edi Moldovan (edimoldovan).
The multi-touch interface of the 14-inch M5 Max MacBook Pro (t6050) declares its raw touch report as a single Report Size item of 0x80000 bits. hid-core rejects any Report Size above 16384 with "invalid report_size 524288", so the trackpad never registered although the firmware, the interface and the keyboard all came up. hid-magicmouse consumes these reports in raw_event() and never uses the parsed field layout. Clamp each Report Size item in the copied descriptor to the hid-core limit before parsing, and log the clamp once per item.
The driver is built in, so it probes from the initramfs before the root file system with the personalized ftab is mounted. The ROM boot then failed once with -ENOENT and the N1 stayed down until a manual rebind. Poll for the firmware every 500 ms, up to two minutes, while no DMA has started, and log the error only when the wait runs out.
The trackpad analog front end reset is the SMC pcIO output 28, which the
driver selects by machine compatible. K114c was not in the list, so the
line stayed an input and dchid_open() got -EPERM from
gpiod_set_value_cansleep() on every open: the multi-touch interface never
started, the trackpad produced no events, and no message was logged.
The K114c ADT function-afe-reset is pKW8("pcIO", 0x10000, 0x11c0000), the
same words as J714c.
Based on work by Edi Moldovan (edimoldovan).
The K114c multi-touch descriptor has a Digitizer-page field under a Mouse application. hid-input reads that as a pen and sets INPUT_PROP_DIRECT, and udev then tags the trackpad as a touchscreen instead of a touchpad. The pad is an indirect pointing device: clear the property.
The K114c MTP firmware (personality K2C1, "AppleMTPFirmwareMac-6320.86.1") does not send the 0x75 report that magicmouse registers. It sends report 0x5a. hid_get_report() finds no report with that id, so hid_input_report() returned -1 for every packet and the trackpad never produced an input event, although the dockchannel interrupt fired on every touch. Register 0x5a next to 0x75 and parse it on dockchannel devices. 0x75 devices keep the old parser. Report layout. Offsets are bytes from the report id, little endian: 0 report id, 0x5a 1-47 firmware header: counter, timestamp. Not used. 48 contact section tag, 0x02 49 section header size, 8 50 contact record size, 48 51 section payload size, header size + count * record size 53 number of contact records 59 bit 4: physical button 60 start of the first record total 113 + 48 * count bytes, so 113, 161, 209, 257 for 0 to 3 contacts Contact record, 48 bytes: +1 tracking id, rolling +2 phase: 1 start, 2-3 approach, 4 touching, 5-7 lifting, 0 gone +5 f32 x, in micrometres +9 f32 y +13 f32 velocity x +17 f32 velocity y +21 f32 major axis +25 f32 minor axis +29 three f32 whose meaning is not known +41 f32 force, 0 to about 840 at a hard click +45 three bytes, not used A contact counts in phases 3 and 4. The floats are converted by hand because the kernel avoids the FPU. Positions and axes go out in tens of micrometres, which fits the J314 ranges the input device already advertises. The layout was read from kprobe captures of hid_input_report() on a 14-inch M5 Max MacBook Pro with one, two and three fingers and clicks. With the parser loaded, the input device reported 929 frames, X -5896 to 5875, four clicks and the two-finger tool bit. The button bit and the phase rule are read from those captures, not from documentation.
The gpu, gfx_mbox and gfx1_mbox nodes are enabled for the K114c GPU bring-up (Main 15:49 CST, w7c working tree 2026-11-10, uncommitted there). Snapshotted here because the PMP vote branch builds on it; the committing lane will rebase onto the real commit. The UAT reserved-memory addresses stay zero; dt_set_gpu_g17 fills them from the ADT at boot.
…rmware The K114c ADT carries pmp0 (/arm-io/pmp0, asc at 0x284e00000, clock-gates 0x1b 0x1c = ps_pmp + ps_pms_sram): the PMP coprocessor owns the b2bd GPU fabric plane and the CPU's direct ps writes to it are dropped. Without the PMP the asahi probe turns on afr/gpx but the fabric stays dark and the b2bd writes never land. Include t6050-pmp.dtsi (which rewires the gpu consumer to the pmp_report_gfx entry, reg 0xf = soc-device 0x10) and the t6050-j714c-pmp-tunables, and give the pmp node its two clock gates as power-domains. The node itself stays disabled: pmp-report.c (starts_pmp on T6050) takes the start over from the disabled node. A generic consumer can vote the same way: declare power-domains = <&pmp_report_X> on any node whose soc-device has a report entry (dispint 0x12, ans 0x24, gfx 0xf so far; the ANE entry lands once the ADT id behind gate 664 is read).
asahi_g15_pmp_put() released the T6030 AGX vote (apple_pmp set_device_power with the J514S device id 5) unconditionally, so any put() from a boot that never voted - a probe failure on a non-t6030 board, or a future caller - sent a spurious vote into the PMP. Gate it on the same board and compatible checks the vote path uses. The t6050 vote needs no glue.c change: its driver path is G17, which never calls the g15 glue, and its vote flows through the pmp_report_gfx genpd from the device tree.
The ANE gate 664 (ANE_SYS_V) is notify_pmp like the GPU fabric planes (w7C, Main 23:35 CST): the ANE votes through its own report entry, soc-device 0x11 = reg 0x10, behind ps_ane_sys. Consumers attach with power-domains = <&pmp_report_ane> on their node; the diagnostic overlay (ane@5080000000) takes it from here. Scope: board file only - the J714c shares t6050-pmp.dtsi and its ADT does not carry this entry.
Three review findings (Claude review of 3cc8f88 + 82bdd6e): - The ANE report entry moves from the K114c board file into t6050-pmp.dtsi as pmp_report_ane_sys (soc-device 0x11 = reg 0x10, behind ps_ane_sys): the ANE gate 664 (ANE_SYS_V) is notify_pmp like the GPU fabric planes, so its vote rides the same genpd entry mechanism. Consumers attach with power-domains = <&pmp_report_ane_sys>. - The board file drops the &pmp power-domains override: the binding takes one entry and both gates (ps_pmp, ps_pms_sram) are always-on. - The dtsi still carries J714c-derived PMP values (board-id, firmware UUID, tunables, pmp_fw map); the K114c-specific four come from the K114c ADT dump and land in the next commit with line cites.
Overlay consumers (the ANE diagnostic DTBO) reference the entry numerically: the live FDT has no __symbols__, so a source-side label is not enough. 0xa1 is the next free phandle after the compiler assigned 0xa0.
The shared t6050-pmp.dtsi and t6050-j714c-pmp-tunables.dtsi carry J714c values. The K114c's live ADT (macOS ioreg) differs: - /chosen board-id is 0x4, not 0xa (IODeviceTree.txt line 61) - /chosen dram-vendor-id is 0x1 (line 187) - the iop-pmp0-nub tunables are byte-identical to the J714c file except agx-dvfs-state-voltages (line 7808); the firmware UUID is the same (line 7821) - fast-die-ctrl-loop, which the nub does not carry, differs from the value in t6050-pmp.dtsi in three words (IOService.txt line 21574) dt_set_pmp in the loader looks up a "pmp" alias that the dtsi does not define, so none of these come from the ADT at boot; the board file must carry them. The pmp-fw page is left alone: it moves with the boot path.
The GPU vote acks but ps_gfx stays off, because the vote was wired behind ps_gfx and the PMP owns the afr domain. Keep afr as a ps_gfx parent, the ADT lists it as one, and add the vote last so genpd sends it too. The GPU lists one power domain. The report genpd is IRQ-safe, so the link holds.
The ADT hangs ANE_SYS_V under ANE_CPU, so an entry behind ps_ane_sys alone votes with ANE_CPU still off - the same gap afr showed for the GPU, where the vote acked but the parent gate stayed dark. The ANE vote now parents to ps_ane_cpu.
|
[Joshua's agent] K114c
Context: |
|
Thanks for keeping this record. As the status note says, this branch is ~3000 commits of merged history and 100+ files against an old base, and it's DIRTY with no CI. So it can't be reviewed or merged as it is. What's missing is the clean stacked series on the current tip that you describe: one commit per subsystem, each trial-booted. Things to settle in that series:
Once the series is up we'll review it piece by piece. Please close this one when it is replaced. |
|
[Joshua's agent] Thanks. I’ll keep this branch as the frozen record until a replacement exists. The replacement will use current |
|
Thanks, the plan is fine. Since nothing yet shows which PMP vote placement is right, please leave the vote out of the first replacement series rather than carrying all three variants. It can follow as its own PR once a comparison picks one. |
|
Note 🤖 GPT-6.2 Sol responding on behalf of Joshua Warren The first replacement will leave out all three GPU vote placements. Current integration already has the shared PMP nodes and the K114c GPU handoff. I reduced the remaining scope to K114c PMP startup and its board-specific data. The old ANE vote and per-machine config also stay out. This draft remains the record until the replacement boots. |
|
Of the 22 K114c commits here, the 13 shared with #2180 and the GPU handoff (bc2b3bf) are now on integration/aurora in another form. The tip still has no PMP description for the K114c: t6050-k114c.dts has no PMP nodes, while J714c (t6050-j714c.dts:275-316) and K116s have them. That makes the replacement scope K114c PMP startup plus its board data from ccbd5ad, as planned. The g15 vote gate (glue.c:80-115) keys on the board and a fixed device id. If the vote comes back later, it should take the device and agent from the DT report entry. |
|
Thanks for the review, Ryan. Closing this: the 13 commits shared with #2180 and the GPU handoff (bc2b3bf) are on integration/aurora in another form. What remains unique is K114c PMP startup plus its board data (ccbd5ad), which will come back as the focused replacement you scoped. When the vote returns, the gate will take the device and agent from the DT report entry instead of the fixed id. Assisted-by: LLM (Anthropic:claude-opus-5.5) |
[Joshua's agent] Preserved series from our October/November K114c work, opened as draft per a patch-id audit: these commits are neither in integration/aurora nor on any PR head. The branch is based on integration/aurora as of 2026-11-10 and is well behind the tip; it needs a rebase before review, and CI should be expected to fail at this base. Draft because it is not rebuilt or booted on the current base.
Series (branch w7c/k114c-pmp-t2, 22 commits): the PMP brought up on the K114c so the GPU power vote reaches firmware. The DTS work (K114c PMP board values, the ANE PMP report entry with an explicit phandle, parented to ps_ane_cpu, bring-up fixes per review), the vote placed before the pmgr write, a snapshot of the K114c GPU enablement, and drm/asahi g15 gating the PMP vote release on the voting compatible. The first eleven commits are the shared K114c board/input base, listed commit by commit in the companion input-series PR.
This is one of three parallel variants of the PMP vote (board, s3 and T2; this branch, T2, was the last worked). The sibling variants differ in one or two vote-placement commits each and are on the fork as w7c/k114c-pmp-board and w7c/k114c-pmp-s3; I can open them as drafts too if a comparison is wanted.