From 93e4c349e1b453e8ccb7a783f4afa86f14e5ec42 Mon Sep 17 00:00:00 2001 From: garymeyerca <220751193+garymeyerca@users.noreply.github.com> Date: Fri, 16 Oct 2026 17:04:02 -0400 Subject: [PATCH 01/14] media: apple: isp: correct the T8122 PMU base address The extra trailing zero places the PMU address outside the PMGR range on J613. Correcting it resolves the probe-time firmware translation fault on a J613 running firmware compatibility 14.7. Hardware tested as a module override on the original PR95 kernel, 7.1.12-2-20261013.95-sep-ARCH. Rebased integration source has separate hardware qualification pending. Link: https://github.com/omacom/linux-aurora/issues/117 Assisted-by: Codex:GPT-6 Signed-off-by: Scott Jones Link: https://github.com/omacom/linux-aurora/commit/6b3404044e17da6b5afb9a6c54214701eb54a0fd --- drivers/media/platform/apple/isp/isp-drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/apple/isp/isp-drv.c b/drivers/media/platform/apple/isp/isp-drv.c index f0410cea88b5f..e5152915bbc43 100644 --- a/drivers/media/platform/apple/isp/isp-drv.c +++ b/drivers/media/platform/apple/isp/isp-drv.c @@ -1028,7 +1028,7 @@ static const struct apple_isp_hw apple_isp_hw_t6020 = { static const struct apple_isp_hw apple_isp_hw_t8122 = { .gen = ISP_GEN_T8112, - .pmu_base = 0x2d07040000, + .pmu_base = 0x2d0704000, .dsid_count = 1, .dsid_clr_base0 = 0x2221c4000, From 19b4be432b17298b862f1d5bade06b91520f0d86 Mon Sep 17 00:00:00 2001 From: Joshua Warren <816217+joshuaswarren@users.noreply.github.com> Date: Thu, 22 Oct 2026 18:45:06 -0500 Subject: [PATCH 02/14] PCI: apple: enable the root-port prefetchable window on cold-initialized tunnel ports apple_pcie_config_write() tells the port block about the root port's prefetchable window (PORT_PREFMEM_ENABLE, port register 0x994) when the PCI core programs PREF_MEMORY_BASE/LIMIT, but only if pcie->kernel_init is set. kernel_init is true for apple,t8103-pciec with apple,pciec-kernel-init. The T600x/T602x tunnel ports use pcie->tunnel_cold_init instead, so on those ports the hook never runs and the enable bit stays 0. Measured on a 16-inch M1 Max (T6001), Intel Arc Pro B60 in a Sonnet Breakaway Box on USB4 tunnel 2 (pcie@f30000000), kernel 7.1.12-2-20261013.18: - Every CPU read of a BAR behind the root port's prefetchable window returned all-ones, with no AER, abort or UR bits on any bridge. This held for the 64-bit window with the identity DT range, for the 32-bit prefetchable window, and with the BARs placed inside the working non-prefetchable CPU window. A function behind the same chain in the non-prefetchable window read correct data in every configuration. - A runtime bisect with setpci gave each bridge in turn its prefetchable window while the others forwarded through widened non-prefetchable windows: the windows of 04:01.0, 03:00.0, 02:00.0 and 01:00.0 each read data; only the root port's own prefetchable window (0001:00:00.0) read all-ones. - PORT_PREFMEM_ENABLE (phys 0xf21000994) read 0 on that boot (0x990 read 1). With the kernel's original bridge windows in place and the BARs reachable only through the prefetchable windows, reads returned all-ones; after one 32-bit write of 1 to the register (writel_relaxed, mb, isb, non-posted mapping) the same reads returned correct data (B60 BAR0 registers and VRAM). The register reads back 0 after the write, so it is a write strobe. Run the existing hook for tunnel_cold_init ports too. T6001 only until it is tested on T6021: on a 14-inch M2 Max (T6021) the prefetchable window forwarded once the DT range was identity. Tested: the register write above (direct, from a test module). The hook path itself has not been booted: a rebuilt kernel changes the BTF base of the modules. (cherry picked from commit 4466fe2ad955d47290fc79c13963c51c0b253706) [conflict: our config_write takes the cio_cfg_lock and runs the MPS timer hook first, so the kernel_init test moved below them; the change is applied to that test] Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com> Link: https://github.com/omacom/linux-aurora/commit/bb2885b7169d4252c2462a214911188f168a7a0d --- drivers/pci/controller/pcie-apple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c index b6c3b98af2c9e..a7dd2059745e4 100644 --- a/drivers/pci/controller/pcie-apple.c +++ b/drivers/pci/controller/pcie-apple.c @@ -3875,7 +3875,7 @@ static int apple_pcie_config_write(struct pci_bus *bus, unsigned int devfn, if (pcie->hw->mps_timers && where == PCIEC_RP_DEVCTL) apple_pcie_update_mps_timers(pcie, FIELD_GET(PCI_EXP_DEVCTL_PAYLOAD, val)); - if (!pcie->kernel_init) + if (!(pcie->kernel_init || pcie->tunnel_cold_init)) return ret; /* Root-port prefetchable window. The port block has to be told too. */ if (where < 0x24 || where >= 0x30) From 60de232029567bcd305ff7b24b11524625a25914 Mon Sep 17 00:00:00 2001 From: Naeem Malik Date: Thu, 5 Nov 2026 10:20:04 +0000 Subject: [PATCH 03/14] wifi: brcmfmac: pcie: don't drop ring completions in the hard IRQ handler brcmf_pcie_quick_check_isr() masks the dongle with brcmf_pcie_intr_disable() whenever mailboxint reads non-zero. Since commit f04be345ad51 ("wifi: brcmfmac: Do not service msgbuf IRQs until ready in MSI mode") that helper also clears irq_ready, and the threaded handler services the rings only while irq_ready is set. The thread therefore skips brcmf_proto_msgbuf_rx_trigger() for exactly the interrupts the hard handler caught with mailboxint still set, and then sets irq_ready again on its way out. In MSI mode the firmware clears mailboxint itself, so whether the hard handler sees it set is a race. When it does, completions that arrived with that interrupt stay in the D2H rings until a later interrupt. On firmware that sends mailbox data over the control ring (no BRCMF_PCIE_SHARED_USE_MAILBOX) that includes the D3 ACK, and ioctl responses: brcmf_msgbuf_query_dcmd_len() and brcmf_pcie_pm_enter_D3() then time out, the latter aborting system suspend. On a MacBook Air (M1) with BCM4378 this became frequent with PCIe ASPM L1.2 enabled. In INTx mode the hard handler always clears irq_ready first, so the rings are never serviced at all. Let the hard handler mask the dongle without touching irq_ready, and let the thread unmask without setting it, so irq_ready is controlled only by the code that sets the rings up and tears them down. Fixes: f04be345ad51 ("wifi: brcmfmac: Do not service msgbuf IRQs until ready in MSI mode") Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Naeem Malik Link: https://github.com/omacom/linux-aurora/commit/3a936edf2c49afddf0e173ad7c8593ae2ba4d885 --- .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c index 2bfee245f4331..ecac0b94a806a 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c @@ -1231,7 +1231,10 @@ static irqreturn_t brcmf_pcie_quick_check_isr(int irq, void *arg) struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)arg; if (brcmf_pcie_read_pcie32(devinfo, devinfo->reginfo->mailboxint)) { - brcmf_pcie_intr_disable(devinfo); + /* Mask the dongle only: irq_ready gates ring servicing while the + * rings are not set up or are being torn down, not this IRQ. + */ + brcmf_pcie_write_pcie32(devinfo, devinfo->reginfo->mailboxmask, 0); brcmf_dbg(PCIE, "Enter\n"); return IRQ_WAKE_THREAD; } @@ -1271,8 +1274,13 @@ static irqreturn_t brcmf_pcie_isr_thread(int irq, void *arg) } brcmf_pcie_bus_console_read(devinfo, false); - if (devinfo->state == BRCMFMAC_PCIE_STATE_UP) - brcmf_pcie_intr_enable(devinfo); + /* Unmask, but leave irq_ready to the code that sets the rings up and + * tears them down. + */ + if (devinfo->state == BRCMFMAC_PCIE_STATE_UP && READ_ONCE(devinfo->irq_ready)) + brcmf_pcie_write_pcie32(devinfo, devinfo->reginfo->mailboxmask, + devinfo->reginfo->int_d2h_db | + devinfo->reginfo->int_fn0); devinfo->in_irq = false; return IRQ_HANDLED; } From f485a0bbc94f1861ea80dfbe06944ceb63c89629 Mon Sep 17 00:00:00 2001 From: zoan37 <104385984+zoan37@users.noreply.github.com> Date: Fri, 6 Nov 2026 19:24:49 -0500 Subject: [PATCH 04/14] wifi: mt7932: join WPA2-PSK APs with a TKIP group key An AP in WPA/WPA2 mixed mode offers CCMP and TKIP pairwise ciphers with a TKIP group cipher. The driver registers only CCMP, so iwd refuses the BSS with NotSupported before any association attempt, and the failure looks like a wrong password. The firmware runs the handshake and owns the keys, and it joined such an AP and passed unicast and group traffic with no other change. Register TKIP and accept it as the group cipher for WPA2-PSK. Pairwise TKIP, WPA1, and a TKIP group with SAE or OWE stay refused. Tested on J700 against one AP's 5 GHz network: gateway and internet traffic, DNS, and mDNS discovery of other LAN devices through the group key. Link: https://github.com/omacom/linux-aurora/issues/398 Assisted-by: Claude:claude-opus-5-5 [conflict: kept our 6 GHz band check and PSK_SHA256/AES-CMAC entries and our PMF-required PSK test row; the TKIP group rule follows the band check] Signed-off-by: zoan37 <104385984+zoan37@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 Link: https://github.com/omacom/linux-aurora/commit/eb6549c0c2aec4759d55151834fc95c7a1dfef6e --- .../mediatek/mt7932/association-test.c | 33 +++++++++++++++++-- .../wireless/mediatek/mt7932/association.h | 10 +++++- .../net/wireless/mediatek/mt7932/startup.c | 3 +- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt7932/association-test.c b/drivers/net/wireless/mediatek/mt7932/association-test.c index 08dc14c6f89e4..8f828f2b29985 100644 --- a/drivers/net/wireless/mediatek/mt7932/association-test.c +++ b/drivers/net/wireless/mediatek/mt7932/association-test.c @@ -176,6 +176,7 @@ enum mt_auth_change { MT_AUTH_NO_PASSWORD, MT_AUTH_WPA, MT_AUTH_PAIR_COUNT, MT_AUTH_PAIR, MT_AUTH_GROUP, MT_AUTH_NO_AKM, MT_AUTH_PSK_FIRST, MT_AUTH_SAE_FIRST, MT_AUTH_OTHER_FIRST, MT_AUTH_OTHER_AKM, MT_AUTH_PSK, + MT_AUTH_OWE, }; static void mt_connect_auth_test(struct kunit *test) @@ -189,6 +190,13 @@ static void mt_connect_auth_test(struct kunit *test) { "pure PSK", MT_AUTH_PSK, 0, WLAN_AKM_SUITE_PSK }, { "PSK missing PMK", MT_AUTH_PSK, 1, -EOPNOTSUPP }, { "PSK required MFP", MT_AUTH_PSK, 2, WLAN_AKM_SUITE_PSK }, + { "PSK TKIP group", MT_AUTH_PSK, 3, WLAN_AKM_SUITE_PSK }, + { "PSK TKIP pairwise", MT_AUTH_PSK, 4, -EOPNOTSUPP }, + { "PSK WEP group", MT_AUTH_PSK, 5, -EOPNOTSUPP }, + { "PSK TKIP group missing PMK", MT_AUTH_PSK, 6, -EOPNOTSUPP }, + { "PSK TKIP group WPA1", MT_AUTH_PSK, 7, -EOPNOTSUPP }, + { "OWE", MT_AUTH_OWE, WLAN_CIPHER_SUITE_CCMP, WLAN_AKM_SUITE_OWE }, + { "OWE TKIP group", MT_AUTH_OWE, WLAN_CIPHER_SUITE_TKIP, -EOPNOTSUPP }, { "pure SAE", MT_AUTH_NONE, 0, WLAN_AKM_SUITE_SAE }, { "optional MFP", MT_AUTH_MFP, NL80211_MFP_OPTIONAL, WLAN_AKM_SUITE_SAE }, { "no MFP", MT_AUTH_MFP, NL80211_MFP_NO, -EOPNOTSUPP }, @@ -213,7 +221,7 @@ static void mt_connect_auth_test(struct kunit *test) { "no pairwise", MT_AUTH_PAIR_COUNT, 0, -EOPNOTSUPP }, { "multiple pairwise", MT_AUTH_PAIR_COUNT, 2, -EOPNOTSUPP }, { "TKIP pairwise", MT_AUTH_PAIR, WLAN_CIPHER_SUITE_TKIP, -EOPNOTSUPP }, - { "TKIP group", MT_AUTH_GROUP, WLAN_CIPHER_SUITE_TKIP, -EOPNOTSUPP }, + { "SAE TKIP group", MT_AUTH_GROUP, WLAN_CIPHER_SUITE_TKIP, -EOPNOTSUPP }, { "no AKM", MT_AUTH_NO_AKM, 0, -EOPNOTSUPP }, { "SAE EXT KEY", MT_AUTH_OTHER_AKM, SUITE(0x000fac, 24), -EOPNOTSUPP }, { "PSK SHA256", MT_AUTH_OTHER_AKM, WLAN_AKM_SUITE_PSK_SHA256, -EOPNOTSUPP }, @@ -226,6 +234,8 @@ static void mt_connect_auth_test(struct kunit *test) { "PSK first mixed versions", MT_AUTH_PSK_FIRST, 4, WLAN_AKM_SUITE_PSK }, { "PSK first VERSION_3 only", MT_AUTH_PSK_FIRST, 5, -EOPNOTSUPP }, { "SAE first mixed versions", MT_AUTH_SAE_FIRST, 2, WLAN_AKM_SUITE_SAE }, + { "SAE first TKIP group", MT_AUTH_SAE_FIRST, 3, -EOPNOTSUPP }, + { "PSK first TKIP group", MT_AUTH_PSK_FIRST, 6, WLAN_AKM_SUITE_PSK }, { "unsupported AKM before SAE", MT_AUTH_OTHER_FIRST, 0, -EOPNOTSUPP }, }; u8 password[64] = {}, pmk[32] = {}; @@ -287,11 +297,26 @@ static void mt_connect_auth_test(struct kunit *test) case MT_AUTH_PSK: p.crypto.wpa_versions = NL80211_WPA_VERSION_2; p.crypto.akm_suites[0] = WLAN_AKM_SUITE_PSK; - p.crypto.psk = value == 1 ? NULL : pmk; + p.crypto.psk = value == 1 || value == 6 ? NULL : pmk; p.crypto.sae_pwd = NULL; p.crypto.sae_pwd_len = 0; p.auth_type = NL80211_AUTHTYPE_AUTOMATIC; p.mfp = value == 2 ? NL80211_MFP_REQUIRED : NL80211_MFP_NO; + if (value == 3 || value == 4 || value == 6 || value == 7) + p.crypto.cipher_group = WLAN_CIPHER_SUITE_TKIP; + if (value == 4) + p.crypto.ciphers_pairwise[0] = WLAN_CIPHER_SUITE_TKIP; + if (value == 5) + p.crypto.cipher_group = WLAN_CIPHER_SUITE_WEP40; + if (value == 7) + p.crypto.wpa_versions = NL80211_WPA_VERSION_1; + break; + case MT_AUTH_OWE: + p.crypto.akm_suites[0] = WLAN_AKM_SUITE_OWE; + p.crypto.cipher_group = value; + p.crypto.sae_pwd = NULL; + p.crypto.sae_pwd_len = 0; + p.auth_type = NL80211_AUTHTYPE_OPEN_SYSTEM; break; case MT_AUTH_PSK_FIRST: p.crypto.wpa_versions = value == 5 ? NL80211_WPA_VERSION_3 : @@ -305,6 +330,8 @@ static void mt_connect_auth_test(struct kunit *test) p.auth_type = NL80211_AUTHTYPE_OPEN_SYSTEM; p.mfp = value == 2 ? NL80211_MFP_REQUIRED : value == 3 ? NL80211_MFP_NO : NL80211_MFP_OPTIONAL; + if (value == 6) + p.crypto.cipher_group = WLAN_CIPHER_SUITE_TKIP; break; case MT_AUTH_SAE_FIRST: p.crypto.n_akm_suites = 2; @@ -314,6 +341,8 @@ static void mt_connect_auth_test(struct kunit *test) p.crypto.sae_pwd = NULL; if (value == 2) p.crypto.wpa_versions |= NL80211_WPA_VERSION_2; + if (value == 3) + p.crypto.cipher_group = WLAN_CIPHER_SUITE_TKIP; p.mfp = NL80211_MFP_OPTIONAL; break; case MT_AUTH_OTHER_FIRST: diff --git a/drivers/net/wireless/mediatek/mt7932/association.h b/drivers/net/wireless/mediatek/mt7932/association.h index 78189eab6b279..20d5f5c58e904 100644 --- a/drivers/net/wireless/mediatek/mt7932/association.h +++ b/drivers/net/wireless/mediatek/mt7932/association.h @@ -42,6 +42,7 @@ static inline int mt7932_connect_auth(const struct cfg80211_connect_params *p) { u32 versions = p->crypto.wpa_versions; + bool tkip_group = p->crypto.cipher_group == WLAN_CIPHER_SUITE_TKIP; /* SAE offload clients use VERSION_3; older clients use VERSION_2. * A transition request can carry both. The selected AKM still owns @@ -51,7 +52,7 @@ mt7932_connect_auth(const struct cfg80211_connect_params *p) (versions & ~(NL80211_WPA_VERSION_2 | NL80211_WPA_VERSION_3)) || p->crypto.n_ciphers_pairwise != 1 || p->crypto.ciphers_pairwise[0] != WLAN_CIPHER_SUITE_CCMP || - p->crypto.cipher_group != WLAN_CIPHER_SUITE_CCMP || + (p->crypto.cipher_group != WLAN_CIPHER_SUITE_CCMP && !tkip_group) || p->crypto.n_akm_suites < 1) return -EOPNOTSUPP; @@ -60,6 +61,13 @@ mt7932_connect_auth(const struct cfg80211_connect_params *p) p->crypto.sae_pwe)) return -EOPNOTSUPP; + /* WPA/WPA2 mixed-mode APs pair a CCMP unicast key with a TKIP group + * key. The firmware owns the handshake and both keys. Only plain + * WPA2-PSK may do this; pairwise TKIP stays refused. + */ + if (tkip_group && p->crypto.akm_suites[0] != WLAN_AKM_SUITE_PSK) + return -EOPNOTSUPP; + switch (p->crypto.akm_suites[0]) { case WLAN_AKM_SUITE_PSK: /* iwd and wpa_supplicant both send REQUIRED once they have diff --git a/drivers/net/wireless/mediatek/mt7932/startup.c b/drivers/net/wireless/mediatek/mt7932/startup.c index f60651470b216..e0e2b1f729564 100644 --- a/drivers/net/wireless/mediatek/mt7932/startup.c +++ b/drivers/net/wireless/mediatek/mt7932/startup.c @@ -820,7 +820,8 @@ int mt_register_regulatory_gate(struct mt7932 *m) { static const int rates[] = {10,20,55,110,60,90,120,180,240,360,480,540}; static const u32 ciphers[] = { WLAN_CIPHER_SUITE_CCMP, - WLAN_CIPHER_SUITE_AES_CMAC }; + WLAN_CIPHER_SUITE_AES_CMAC, + WLAN_CIPHER_SUITE_TKIP }; static const u32 akms[] = { WLAN_AKM_SUITE_PSK, WLAN_AKM_SUITE_PSK_SHA256, From 8ca5abfd706acb1a85097b1fd54519ec70e011e2 Mon Sep 17 00:00:00 2001 From: zoan37 <104385984+zoan37@users.noreply.github.com> Date: Sat, 7 Nov 2026 12:28:59 -0500 Subject: [PATCH 05/14] docs: wifi: mt7932: describe the TKIP group key The station security notes still say CCMP only. Describe what the driver accepts, and record that MIC failure reporting and TKIP countermeasures are left to firmware and have not been verified. Link: https://github.com/omacom/linux-aurora/issues/398 Assisted-by: Claude:claude-opus-5-5 [conflict: our notes already list PSK-SHA256, OWE and BIP-CMAC-128; the TKIP text is added to them] Signed-off-by: zoan37 <104385984+zoan37@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 Link: https://github.com/omacom/linux-aurora/commit/a2b0f533cbe05ff03597c790a58c2de53a50350b --- .../device_drivers/wifi/mt7932-neo.rst | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Documentation/networking/device_drivers/wifi/mt7932-neo.rst b/Documentation/networking/device_drivers/wifi/mt7932-neo.rst index 3fd4a1c81853e..187bbf70aa081 100644 --- a/Documentation/networking/device_drivers/wifi/mt7932-neo.rst +++ b/Documentation/networking/device_drivers/wifi/mt7932-neo.rst @@ -112,8 +112,9 @@ fallback reason and the result of each lookup. Station security ---------------- -The driver advertises PSK, PSK-SHA256, SAE and OWE with CCMP, plus -BIP-CMAC-128 for management protection. Firmware performs SAE +The driver advertises PSK, PSK-SHA256, SAE and OWE with CCMP as the pairwise +cipher, plus BIP-CMAC-128 for management protection. PSK also accepts a TKIP +group key, described below. Firmware performs SAE authentication and the four-way handshake and owns PTK, GTK and IGTK; there is no host key-install interface or external-auth exchange. @@ -151,9 +152,21 @@ follows the AP's RSN capabilities; it is not a firmware readback. Selectors The standard SAE PWE settings (unspecified, hunting-and-pecking, hash-to-element and both) are accepted; firmware chooses the exchange without a host PWE field. Exact PWE policy behavior on 2.4 and 5 GHz still needs -qualification. SAE-PK, SAE-EXT-KEY and additional ciphers are not advertised. OWE and +qualification. SAE-PK and SAE-EXT-KEY are not advertised. OWE and 6 GHz support are described below. +TKIP is registered so that WPA2-PSK can join a WPA/WPA2 mixed-mode access point, +which pairs a CCMP unicast key with a TKIP group key. Pairwise TKIP, WPA1, and a +TKIP group key with SAE or OWE are refused. Firmware owns the TKIP group key like +any other. MIC failure reporting and TKIP countermeasures are left to firmware and +have not been verified: firmware runs the four-way handshake, so the host has no +KCK and calling ``cfg80211_michael_mic_failure()`` would do nothing. + +J700 hardware testing joined one mixed-mode router on 2.4 and 5 GHz, and stayed +connected to a hostapd access point through 14 group rekeys at 60 second intervals +with ARP and mDNS still received. DHCP renewal, IPv6 router advertisements and a +commercial access point's own rekey still need qualification. + J700 hardware testing with NetworkManager and wpa_supplicant on a PSK+SAE transition network has confirmed, on 2.4 GHz channel 6 and 5 GHz channel 149: From b9ce87f698f984d53aa04b7d9c89ced6858781cf Mon Sep 17 00:00:00 2001 From: Kallisti Date: Sun, 8 Nov 2026 20:38:42 -0500 Subject: [PATCH 06/14] fix bindgen layout checks without rustfmt bindgen emits valid unformatted Rust when rustfmt is unavailable. Accept whitespace around the unconditional const assertion and reject both formatted and unformatted test attributes. Keep the C/Rust compilation and layout assertions unchanged. Assisted-by: LLM Signed-off-by: Kallisti Link: https://github.com/omacom/linux-aurora/commit/6ba4695259f3d207f8d26aed8bf203f46abc8772 --- tools/aurora-bindgen/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/aurora-bindgen/test.py b/tools/aurora-bindgen/test.py index 6d93f8b35b9d8..e5ae87bd6e8a3 100644 --- a/tools/aurora-bindgen/test.py +++ b/tools/aurora-bindgen/test.py @@ -39,7 +39,7 @@ def run(cmd):return subprocess.run(cmd,capture_output=True,text=True) if fixture == 'bitfields.h' and label == 'baseline':continue cmd=[tool,str(header),'--rust-target','1.85','--no-doc-comments','--use-core','--no-derive-debug','--ctypes-prefix','core::ffi','--','-target',ct,'-x',language,*extra] g=run(cmd);assert g.returncode==0,(fixture,g.stderr) - assert 'const _: ()' in g.stdout and '#[test]' not in g.stdout,'generator did not emit unconditional const layout checks' + assert re.search(r'\bconst\s+_\s*:\s*\(\s*\)\s*=',g.stdout) and not re.search(r'#\s*\[\s*test\s*\]',g.stdout),'generator did not emit unconditional const layout checks' rs=O/(fixture+'.'+label+'.rs');rs.write_text('#![no_std]\n'+g.stdout+(access if fixture=='anonymous-members.h' and label=='fixed' else '')) rcmd=rust+[str(rs),'-o',str(O/(fixture+'.'+label+'.o'))];r=run(rcmd);(O/(fixture+'.'+label+'.log')).write_text(r.stdout+r.stderr) expected=label=='fixed' or fixture=='tag-only.h';assert (r.returncode==0)==expected,(fixture,label,r.stderr) From b697ea8bda273675de70483533d74aa05bafd6d6 Mon Sep 17 00:00:00 2001 From: Scott Jones Date: Fri, 13 Nov 2026 14:06:58 -0500 Subject: [PATCH 07/14] drm/asahi: g15: decline probes before activation with -ENODEV Before the module's final activate() step, the G15 probe returned -EPROBE_DEFER. That put the GPU on the driver core's deferred-probe list. activate() then runs the real probe through driver_attach(), but if that probe fails for good, for example because the firmware is rejected, the driver core does not take the device off the list. It stays in /sys/kernel/debug/devices_deferred until the deferred-probe work next runs, so anything that waits on that list keeps waiting. Return -ENODEV instead. activate() already reprobes every unbound device once MODULE_READY is set, and a device added later sees it set, so nothing needs the deferred list to retry. The display and PMP waits inside the real probe still return -EPROBE_DEFER. g15-probe-init-tests.py now checks that every probe before activation returns -ENODEV, and adds a mutant that defers again. Assisted-by: Claude:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 [conflict: our module also registers the G16 adapter, so the host test counts each attempted registration instead of assuming two, and the mutant table keeps our activation-before-g16-registration entry] Signed-off-by: Scott Jones Link: https://github.com/omacom/linux-aurora/commit/6447458068e3df86c978386925481ddb439e5164 --- drivers/gpu/drm/asahi/g15/mod.rs | 5 ++++- tools/asahi/g15-probe-init-tests.py | 23 +++++++++++++++++++---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/asahi/g15/mod.rs b/drivers/gpu/drm/asahi/g15/mod.rs index 4cb221fb0a5df..9553dc46f3c55 100644 --- a/drivers/gpu/drm/asahi/g15/mod.rs +++ b/drivers/gpu/drm/asahi/g15/mod.rs @@ -202,8 +202,11 @@ impl platform::Driver for Driver<'_> { // after probe_g15 started firmware would return an unbound device. try_pin_init!(Driver { _driver: { + // Not EPROBE_DEFER: a deferred device stays listed in devices_deferred until the + // deferred-probe work runs, even after activate()'s probe fails for good. Activation + // reprobes every unbound device; a device added later sees MODULE_READY set. if !MODULE_READY.load(Ordering::Acquire) { - return Err(EPROBE_DEFER); + return Err(ENODEV); } let cfg = *info.ok_or(ENODEV)?; dev_info!(pdev.as_ref(), "G15: probing ({})\n", cfg.name); diff --git a/tools/asahi/g15-probe-init-tests.py b/tools/asahi/g15-probe-init-tests.py index a7b9b900b7af5..88be177882337 100644 --- a/tools/asahi/g15-probe-init-tests.py +++ b/tools/asahi/g15-probe-init-tests.py @@ -82,6 +82,8 @@ def item(text, marker): static EXEC_SHARE_READY: Cell = const { Cell::new(false) }; static ATTACH_ERROR: Cell = const { Cell::new(false) }; static PROBE_ERROR: Cell = const { Cell::new(0) }; + static PRE_ACTIVATION: Cell = const { Cell::new(0) }; + static ATTEMPTED_REGISTRATION: Cell = const { Cell::new(0) }; } struct Core<'a>(PhantomData<&'a ()>); struct Device { data: Cell<*mut core::ffi::c_void> } @@ -184,7 +186,17 @@ def item(text, marker): }; // Model driver_attach and a late driver_add_groups failure. A deferred // worker can also retry G15 while the other registration is in progress. - let _ = callback::>(&PDEV, Some(&&CFG)); + ATTEMPTED_REGISTRATION.set(ATTEMPTED_REGISTRATION.get() + 1); + let ready = MODULE_READY.load(Ordering::Acquire); + let started = PROBES.get(); + let result = callback::>(&PDEV, Some(&&CFG)); + // A probe that started firmware here is the readiness-gate failure, checked below. + if !ready && PROBES.get() == started { + // A deferral would keep the GPU in devices_deferred after a later + // terminal failure; before activation the probe must decline outright. + assert_eq!(result, Err(ENODEV), "pre-activation probe deferred instead of ENODEV"); + PRE_ACTIVATION.set(PRE_ACTIVATION.get() + 1); + } if FAIL_REGISTRATION.get() == stage { return Err(-5); } COMPLETED_REGISTRATION.set(stage); stage @@ -252,7 +264,7 @@ def item(text, marker): PDEV.base.data.set(core::ptr::null_mut()); MODULE_READY.store(false, Ordering::Release); COMPLETED_REGISTRATION.set(0); FAIL_REGISTRATION.set(failure); - ACTIVATED.set(false); ATTACH_ERROR.set(failure == 0); + ACTIVATED.set(false); ATTACH_ERROR.set(failure == 0); PRE_ACTIVATION.set(0); ATTEMPTED_REGISTRATION.set(0); let init = ::init(&MODULE); assert_eq!(PROBES.get(), 0, "module initializer eagerly started firmware"); let result = KBox::pin_init(init, GFP_KERNEL); @@ -269,6 +281,8 @@ def item(text, marker): assert!(!PDEV.base.data.get().is_null()); unsafe { drop(Box::from_raw(PDEV.base.data.get().cast::>())); } } + // Every probe before activation declined: one per completed or failing registration. + assert_eq!(PRE_ACTIVATION.get(), ATTEMPTED_REGISTRATION.get(), "pre-activation probes"); println!("module-registration-{failure}: PASS"); } } @@ -415,9 +429,10 @@ def main(): needle = " None\n" assert probe.count(needle) == 1 variants["retained-error-unbinds"] = (probe.replace(needle, " return Err(error);\n"), module_code) - gate = " if !MODULE_READY.load(Ordering::Acquire) {\n return Err(EPROBE_DEFER);\n }\n" + gate = " if !MODULE_READY.load(Ordering::Acquire) {\n return Err(ENODEV);\n }\n" assert probe.count(gate) == 1 variants["no-registration-readiness-gate"] = (probe.replace(gate, ""), module_code) + variants["pre-activation-defers"] = (probe.replace(gate, gate.replace("ENODEV", "EPROBE_DEFER")), module_code) late = " #[cfg(CONFIG_DRM_ASAHI_G15)]\n _g15_ready: g15::activate(),\n" assert module_code.count(late) == 1 early = module_code.replace(late, "").replace(" _driver <-", late + " _driver <-", 1) @@ -446,7 +461,7 @@ def main(): else: receipt["mutants"][label] = result if r.returncode == 0: raise SystemExit("SURVIVED: " + name) - intended = {"eager-probe-before-allocation": "allocation-before-start: firmware probe before drvdata allocation", "retained-error-unbinds": "retained-start-failure-binds: callback result", "no-registration-readiness-gate": "late registration failure started firmware", "activation-before-last-registration": "activation before all registrations completed", "activation-before-g16-registration": "activation before all registrations completed"}[name] + intended = {"eager-probe-before-allocation": "allocation-before-start: firmware probe before drvdata allocation", "retained-error-unbinds": "retained-start-failure-binds: callback result", "no-registration-readiness-gate": "late registration failure started firmware", "activation-before-last-registration": "activation before all registrations completed", "activation-before-g16-registration": "activation before all registrations completed", "pre-activation-defers": "pre-activation probe deferred instead of ENODEV"}[name] result["intended_failure"] = intended in r.stderr if not result["intended_failure"]: raise SystemExit("INVALID unrelated failure: " + name + "\n" + r.stderr) (out / "result.json").write_text(json.dumps(receipt, indent=2) + "\n") From 70e38c6ab5986fdd70e1cdfc162be2a8450b8bd3 Mon Sep 17 00:00:00 2001 From: Chris Kearney <303316+chriskearney@users.noreply.github.com> Date: Thu, 5 Nov 2026 08:27:22 -0800 Subject: [PATCH 08/14] pmdomain: apple: name the explicit T6031 display fallback J514C and J516C native display now starts on normal boots. The PMP failure diagnostic still recommends omitting enable=1, which no longer requests the boot-framebuffer fallback on those boards. Name the explicit apple_t6031_display.enable=0 owner opt-out instead. This changes only the diagnostic string. It does not change PMP startup, matching, handoff checks, display defaults or GPU admission. Checkpatch passes with sign-off checking disabled, and the existing production selector/owner-opt-out host checks pass. Normal kernel CI will run on the new head; the prior8c309ed2a18d full technical CI remains recorded. [on this tree J514C is still opt-in and b55bcaaba520 is not present; the string is still wrong on the J516C, whose native display is on by default, and enable=0 matches the T6030 and T8122 diagnostics] Fixes: b55bcaaba520 ("soc: apple: default J514C native display on normal boots") Assisted-by: Codex:GPT-6 Signed-off-by: Scott Jones Link: https://github.com/omacom/linux-aurora/commit/10a834038f4b4309c1c5b251acea1da6b11287c1 --- drivers/pmdomain/apple/pmp-report.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pmdomain/apple/pmp-report.c b/drivers/pmdomain/apple/pmp-report.c index 7ce01a88bb069..9d5aeced81f74 100644 --- a/drivers/pmdomain/apple/pmp-report.c +++ b/drivers/pmdomain/apple/pmp-report.c @@ -2441,7 +2441,7 @@ static const struct apple_pmp_report_offsets apple_pmp_offsets_t6031 = { .status = 0x10, .starts_pmp = true, .name = "T6031", - .fallback = "leave out apple_t6031_display.enable=1", + .fallback = "apple_t6031_display.enable=0", .pwrstate = "apple,t6031-pmgr-pwrstate", .devices_ordered = true, }; From 3613c60de224f64c2b7420be6b17a8bd729c06af Mon Sep 17 00:00:00 2001 From: Scott Jones Date: Fri, 23 Oct 2026 00:24:18 -0400 Subject: [PATCH 09/14] pmdomain: apple: pmp-report: keep the T8122 14.x GPU readiness for the M3 runtime The 7.2 rebase replaced the T8122 14.x branch of apple_pmp_report_wait_supplier_ready() with a T6030-only one, so on an M3 MacBook Air every GPU power vote returns -ENODEV even with the PMP running. With the new hidden APPLE_T8122_GPU_PMP_LINK, which DRM_ASAHI_M3_T8122 selects (as DRM_ASAHI_G15 selects APPLE_T6030_GPU_PMP_LINK), wait for the unique T8122 report's display request (DISP, reg 7) to be ready and acknowledged before AGX, as on the 7.1.12 kernel the runtime was qualified with. The PMP graph and supplier host tests copy the dispatch, so they copy the T8122 wait too, built off there; their mutations still target the T6030 path. [conflict: our dispatch also selects the T8132 report; the T8122 14.x branch is added in front of it unchanged] Generated-by: LLM Co-Authored-By: Claude Opus 5.5 Signed-off-by: Scott Jones Link: https://github.com/omacom/linux-aurora/commit/d8ecb2e706378e853c4a749fb8bb84a1d862d123 --- drivers/gpu/drm/asahi/Kconfig | 1 + drivers/pmdomain/apple/pmp-report.c | 43 ++++++++++++++++++++++++- drivers/soc/apple/Kconfig | 9 ++++++ tools/asahi/t6030-pmp-graph-tests.c | 1 + tools/asahi/t6030-pmp-graph-tests.py | 12 +++++-- tools/asahi/t6030-pmp-supplier-tests.py | 12 +++++++ 6 files changed, 74 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/asahi/Kconfig b/drivers/gpu/drm/asahi/Kconfig index d383802ee8825..03939a732fc24 100644 --- a/drivers/gpu/drm/asahi/Kconfig +++ b/drivers/gpu/drm/asahi/Kconfig @@ -84,6 +84,7 @@ config DRM_ASAHI_M3_T8122 depends on DRM_ASAHI # The runtime adopts the firmware's UAT through the G15 backend's handoff helpers. depends on DRM_ASAHI_G15 + select APPLE_T8122_GPU_PMP_LINK select CRYPTO_LIB_SHA256 default n help diff --git a/drivers/pmdomain/apple/pmp-report.c b/drivers/pmdomain/apple/pmp-report.c index 9d5aeced81f74..f544e27f91d1b 100644 --- a/drivers/pmdomain/apple/pmp-report.c +++ b/drivers/pmdomain/apple/pmp-report.c @@ -614,6 +614,44 @@ static int apple_pmp_report_wait_t6030_14(struct device *supplier, unsigned int return ret; } +/* + * The T8122 (M3 MacBook Air) GPU on its 14.8.3 firmware, for the M3 runtime + * (APPLE_T8122_GPU_PMP_LINK): the unique T8122 report linked to this PMP, and + * its display request (DISP, reg 7) READY and acknowledged before AGX, as on + * the 7.1.12 kernel that runtime was qualified with. + */ +static int apple_pmp_report_wait_t8122_14(struct device *supplier, unsigned int timeout_ms) +{ + struct device_node *np, *report = NULL, *pmp, *entry; + int ret; + + if (!IS_ENABLED(CONFIG_APPLE_T8122_GPU_PMP_LINK) || + !of_machine_is_compatible("apple,t8122") || + !of_device_is_compatible(supplier->of_node, "apple,t8122-pmp-v2")) + return -ENODEV; + for_each_compatible_node(np, NULL, "apple,t8122-pmp-v2-report") { + if (report) { + of_node_put(np); + of_node_put(report); + return -ENODEV; + } + report = of_node_get(np); + } + if (!report || !of_device_is_available(report) || + of_property_count_u32_elems(report, "apple,pmp") != 1) { + of_node_put(report); + return -ENODEV; + } + pmp = of_parse_phandle(report, "apple,pmp", 0); + entry = apple_pmp_report_t6030_entry(report); + ret = pmp == supplier->of_node && entry ? + apple_pmp_report_wait_ready(entry, msecs_to_jiffies(timeout_ms)) : -ENODEV; + of_node_put(entry); + of_node_put(pmp); + of_node_put(report); + return ret; +} + /* The native 25G83 PMP starts through its supplier topology, after requests * are seeded. Its report is pinned against removal while readiness is read. */ @@ -628,8 +666,11 @@ int apple_pmp_report_wait_supplier_ready(struct device *supplier, unsigned int t int ret; /* A declared report always takes the existing native25 path below. */ - if (!np && !of_property_present(supplier->of_node, "apple,pmp-report")) + if (!np && !of_property_present(supplier->of_node, "apple,pmp-report")) { + if (of_machine_is_compatible("apple,t8122")) + return apple_pmp_report_wait_t8122_14(supplier, timeout_ms); return apple_pmp_report_wait_t6030_14(supplier, timeout_ms); + } if (!np || !of_device_is_compatible(np, t8132 ? "apple,t8132-pmp-v2-report" : "apple,j613-25g83-pmp-report")) { of_node_put(np); diff --git a/drivers/soc/apple/Kconfig b/drivers/soc/apple/Kconfig index 9225b054e7cde..3c40bf8a41a79 100644 --- a/drivers/soc/apple/Kconfig +++ b/drivers/soc/apple/Kconfig @@ -368,6 +368,15 @@ config APPLE_DISPLAY_GATE Say 'y' if you want the native display on M3 Pro, M3 Max, M3 and M4 Pro Macs. +config APPLE_T8122_GPU_PMP_LINK + bool + depends on APPLE_PMP_REPORT + default n + help + Let T8122 (M3 MacBook Air) GPU power commands wait for the display + request the PMP report acknowledges on the 14.8.3 firmware, as the + M3 runtime of DRM_ASAHI_M3_T8122 requires. + config APPLE_T6030_GPU_PMP_LINK bool depends on APPLE_DISPLAY_GATE diff --git a/tools/asahi/t6030-pmp-graph-tests.c b/tools/asahi/t6030-pmp-graph-tests.c index e89d982d2d0a6..89a6ac0efc8e7 100644 --- a/tools/asahi/t6030-pmp-graph-tests.c +++ b/tools/asahi/t6030-pmp-graph-tests.c @@ -20,6 +20,7 @@ typedef uint8_t u8; #define BIT(n) (1U << (n)) #define IS_ENABLED(x) (x) #define CONFIG_APPLE_T6030_GPU_PMP_LINK 1 +#define CONFIG_APPLE_T8122_GPU_PMP_LINK 0 #define PMP_REPORT_READY 1 #define GFP_KERNEL 0 #define GENPD_FLAG_ACTIVE_WAKEUP 1 diff --git a/tools/asahi/t6030-pmp-graph-tests.py b/tools/asahi/t6030-pmp-graph-tests.py index 4c85001acf1a8..c8a58b302e727 100644 --- a/tools/asahi/t6030-pmp-graph-tests.py +++ b/tools/asahi/t6030-pmp-graph-tests.py @@ -60,6 +60,12 @@ def main(): 'static int apple_pmp_report_entry_resume_noirq('] offsets = re.search(r'static const struct apple_pmp_report_offsets apple_pmp_offsets_t6030 = \{.*?\n\};', source, re.S)[0] functions = '\n'.join(extract.function(source, n) for n in names) + # The T8122 14.x wait (CONFIG_APPLE_T8122_GPU_PMP_LINK=0 here) precedes the dispatch; it is + # added after the mutations are placed, so they target the T6030 path only. + t8122 = extract.function(source, 'static int apple_pmp_report_wait_t8122_14(') + '\n' + dispatch = 'int apple_pmp_report_wait_supplier_ready(' + def with_t8122(text): + return text.replace(dispatch, t8122 + dispatch, 1) validation = re.sub(r'^#include .*\n', '', (ROOT / 'drivers/pmdomain/apple/pmp-report-validation.h').read_text(), flags=re.M) dram_type = re.search(r'struct apple_pmp_dram \{.*?\n\};', (ROOT / 'drivers/pmdomain/apple/pmp-dram.h').read_text(), re.S)[0] @@ -78,7 +84,7 @@ def main(): '\n' + dram_attrs + '\n' + functions) # The actual overlay must still describe a halted supplier and disabled DMA/mailbox. assert overlay.count('status = \"disabled\";') >= 3 - (args.output / 'production.h').write_text(code) + (args.output / 'production.h').write_text(with_t8122(code)) (args.output / 'overlay.h').write_text('static const struct overlay_entry overlay_entries[] = {\n' + entry_data + '\n};\n') compiler = shlex.split(os.environ.get('CC', 'clang')) command = compiler + ['-std=gnu11', '-g', '-O1', '-Wall', '-Wextra', '-Werror', @@ -133,13 +139,13 @@ def main(): ] for name, old, new in controls: assert code.count(old) == 1, (name, code.count(old)) - (args.output / 'production.h').write_text(code.replace(old, new)) + (args.output / 'production.h').write_text(with_t8122(code.replace(old, new))) built = subprocess.run(command, capture_output=True, text=True) # A mutant must compile; compilation failure is not regression evidence. ran = subprocess.run([str(args.output / 'graph')], capture_output=True, text=True) if not built.returncode else None (args.output / (name + '.log')).write_text(built.stdout + built.stderr + (ran.stdout + ran.stderr if ran else '')) mutations.append({'name': name, 'build_rc': built.returncode, 'run_rc': ran.returncode if ran else None}) - (args.output / 'production.h').write_text(code) + (args.output / 'production.h').write_text(with_t8122(code)) assert all(m['build_rc'] == 0 and m['run_rc'] != 0 for m in mutations), mutations (args.output / 'receipt.json').write_text(json.dumps({'source_ref': args.ref, 'source_sha256': hashlib.sha256(code.encode()).hexdigest(), 'overlay_sha256': hashlib.sha256(overlay.encode()).hexdigest(), 'overlay_entries': entries, diff --git a/tools/asahi/t6030-pmp-supplier-tests.py b/tools/asahi/t6030-pmp-supplier-tests.py index 269006b36aa4f..725e37e24f6cf 100755 --- a/tools/asahi/t6030-pmp-supplier-tests.py +++ b/tools/asahi/t6030-pmp-supplier-tests.py @@ -56,6 +56,7 @@ def run(out, name, code, compiler, configs=(0, 1)): command = compiler + ["-std=gnu11", "-g", "-O1", "-Wall", "-Wextra", "-Werror", "-fsanitize=address,undefined", "-fno-omit-frame-pointer", f"-DCONFIG_APPLE_T6030_GPU_PMP_LINK={config}", + "-DCONFIG_APPLE_T8122_GPU_PMP_LINK=0", "-I", str(dest), str(ROOT / "tools/asahi/t6030-pmp-supplier-tests.c"), "-o", str(binary)] @@ -148,6 +149,17 @@ def main(): assert code.count(old) == 1, (name, code.count(old)) variants.append((name, code.replace(old, new))) variants.append(("control-after", code)) + # The T8122 14.x wait is built with CONFIG_APPLE_T8122_GPU_PMP_LINK=0 here; it is added to + # every variant after the T6030 mutations are placed, so they target the T6030 path only. + dispatch = "int apple_pmp_report_wait_supplier_ready(" + t8122 = function(report, "static int apple_pmp_report_wait_t8122_14(") + "\n" + def with_t8122(source): + if dispatch not in source: + return source + return source.replace(dispatch, t8122 + dispatch, 1) + variants = [(name, with_t8122(source)) for name, source in variants] + if baseline_code and "apple_pmp_report_wait_t8122_14(" in baseline_code: + baseline_code = with_t8122(baseline_code) results = [run(args.output, name, source, compiler) for name, source in variants] if baseline_code: results.append(run(args.output, "control-prior-config-off", baseline_code, compiler, (0,))) From 8ea5e7e01730c92df672224de2dfd8f96e409fbb Mon Sep 17 00:00:00 2001 From: DjDeveloperr Date: Sat, 31 Oct 2026 10:27:58 -0400 Subject: [PATCH 10/14] dt-bindings: display: apple: describe a common scanout aperture Document the display consumer's optional DMA aperture, which can differ from the defaults of individual scanout DARTs. Include the T8122 display subsystem compatible so its shared aperture is checked by this binding. Assisted-by: OpenAI Codex (gpt-6.1-sol) [conflict: our binding lists compatibles under oneOf and adds the J713 memory-region properties; the T8122 compatible and apple,dma-range are added to it] Signed-off-by: DjDeveloperr Link: https://github.com/omacom/linux-aurora/commit/b53dc2bc4df51a2c48060d43b737d0f704f49024 --- .../bindings/display/apple,display-subsystem.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/display/apple,display-subsystem.yaml b/Documentation/devicetree/bindings/display/apple,display-subsystem.yaml index ac106575a9672..d2f0438188560 100644 --- a/Documentation/devicetree/bindings/display/apple,display-subsystem.yaml +++ b/Documentation/devicetree/bindings/display/apple,display-subsystem.yaml @@ -19,6 +19,7 @@ properties: - enum: - apple,display-subsystem - apple,t6031-display-subsystem + - apple,t8122-display-subsystem - apple,t8132-display-subsystem - const: apple,t8132-display-diagnostics deprecated: true @@ -50,6 +51,15 @@ properties: type: boolean description: The loader validated the inherited J713 SID0 scanout mapping. + apple,dma-range: + $ref: /schemas/types.yaml#/definitions/uint64-array + minItems: 2 + maxItems: 2 + description: + Common scanout DMA aperture, encoded as a base and nonzero size. This + overrides the default aperture of each referenced DART stream. Other + consumers of the same DART retain their own apertures. + required: - compatible - iommus From 16740137c47cbd87cb0902708cfb1e4b9f591b04 Mon Sep 17 00:00:00 2001 From: DjDeveloperr Date: Sat, 31 Oct 2026 10:27:58 -0400 Subject: [PATCH 11/14] iommu/apple-dart: honor consumer apertures before intersecting streams Domain allocation already lets a consumer specify apple,dma-range, but of_xlate intersects the provider defaults before that override is read. A consumer with a common scanout alias and DARTs with disjoint defaults therefore fails configuration before its domain can be allocated. Apply the same consumer aperture while parsing each specifier, retaining validation of both explicit five-cell windows and the override. Share the alignment, overflow and alias-width checks. Consumers without an override keep their existing windows. Add KUnit cases for the J613 high scanout alias across internal/external DART defaults, independent low PIODMA, malformed overrides and invalid five-cell specifiers. An ASAN/UBSAN fixture executing the production parser and of_xlate reproduces the old rejection and accepts the common window. Assisted-by: OpenAI Codex (gpt-6.1-sol) Signed-off-by: DjDeveloperr Link: https://github.com/omacom/linux-aurora/commit/21d3646b87af3dc7bb7095d06a232572b5d479e5 --- drivers/iommu/apple-dart-test.c | 104 ++++++++++++++++++++++++++++++++ drivers/iommu/apple-dart.c | 81 +++++++++++++++---------- 2 files changed, 153 insertions(+), 32 deletions(-) diff --git a/drivers/iommu/apple-dart-test.c b/drivers/iommu/apple-dart-test.c index dcb65db633d80..f5c8efc52e7f9 100644 --- a/drivers/iommu/apple-dart-test.c +++ b/drivers/iommu/apple-dart-test.c @@ -90,6 +90,108 @@ static void apple_dart_test_iommu_specifiers(struct kunit *test) } } +static void apple_dart_test_consumer_window(struct kunit *test) +{ + __be32 value[] = { cpu_to_be32(0x100), 0, cpu_to_be32(0x10), 0 }; + struct property property = { + .name = "apple,dma-range", + .length = sizeof(value), + .value = value, + }; + struct device_node node = { .properties = &property }; + struct of_phandle_args args = { .args_count = 1 }; + struct apple_dart *dart; + struct device *dev; + dma_addr_t dma_min, dma_max; + int i, ret; + + dev = kunit_device_register(test, "apple-dart-consumer-window-test"); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev); + dart = kunit_kzalloc(test, sizeof(*dart), GFP_KERNEL); + KUNIT_ASSERT_NOT_NULL(test, dart); + dart->ias = 36; + dart->pgsize = SZ_16K; + dev->of_node = &node; + + /* J613's common scanout aperture must survive both DART defaults. */ + for (i = 0; i < 2; i++) { + dart->dma_min = i ? 0 : 0x10000000000; + dart->dma_max = i ? 0xffffeffff : 0x10fffffffff; + ret = apple_dart_parse_dma_window(dev, dart, &args, + &dma_min, &dma_max); + KUNIT_EXPECT_EQ(test, ret, 0); + KUNIT_EXPECT_EQ(test, dma_min, (dma_addr_t)0x10000000000); + KUNIT_EXPECT_EQ(test, dma_max, (dma_addr_t)0x10fffffffff); + } + + /* Domain allocation gives the consumer priority over five-cell args too. */ + args.args_count = 5; + args.args[3] = 0xf; + args.args[4] = 0xffff0000; + ret = apple_dart_parse_dma_window(dev, dart, &args, &dma_min, &dma_max); + KUNIT_EXPECT_EQ(test, ret, 0); + KUNIT_EXPECT_EQ(test, dma_min, (dma_addr_t)0x10000000000); + KUNIT_EXPECT_EQ(test, dma_max, (dma_addr_t)0x10fffffffff); + + /* An override must not make a malformed stream specifier acceptable. */ + args.args[3] = 0; + args.args[4] = 0; + KUNIT_EXPECT_EQ(test, apple_dart_parse_dma_window(dev, dart, &args, + &dma_min, &dma_max), -EINVAL); + + /* PIODMA is a different consumer of the same external display DART. */ + dev->of_node = NULL; + args.args_count = 1; + args.args[0] = 4; + ret = apple_dart_parse_dma_window(dev, dart, &args, &dma_min, &dma_max); + KUNIT_EXPECT_EQ(test, ret, 0); + KUNIT_EXPECT_EQ(test, dma_min, (dma_addr_t)0); + KUNIT_EXPECT_EQ(test, dma_max, (dma_addr_t)0xffffeffff); +} + +static void apple_dart_test_invalid_consumer_window(struct kunit *test) +{ + static const struct { + u64 base, size; + } windows[] = { + { 0, 0 }, + { U64_MAX - SZ_16K + 1, 2 * SZ_16K }, + { 1, SZ_16K }, + { 0, SZ_16K + 1 }, + { 0, BIT_ULL(37) }, + }; + __be64 value[2]; + struct property property = { + .name = "apple,dma-range", + .length = sizeof(value), + .value = value, + }; + struct device_node node = { .properties = &property }; + struct of_phandle_args args = { .args_count = 1 }; + struct apple_dart *dart; + struct device *dev; + dma_addr_t dma_min, dma_max; + int i; + + dev = kunit_device_register(test, "apple-dart-invalid-window-test"); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev); + dart = kunit_kzalloc(test, sizeof(*dart), GFP_KERNEL); + KUNIT_ASSERT_NOT_NULL(test, dart); + dart->ias = 36; + dart->pgsize = SZ_16K; + dev->of_node = &node; + for (i = 0; i < ARRAY_SIZE(windows); i++) { + value[0] = cpu_to_be64(windows[i].base); + value[1] = cpu_to_be64(windows[i].size); + KUNIT_EXPECT_EQ(test, apple_dart_parse_dma_window(dev, dart, &args, + &dma_min, &dma_max), -EINVAL); + } + property.length = sizeof(__be32); + KUNIT_EXPECT_LT(test, apple_dart_parse_dma_window(dev, dart, &args, + &dma_min, &dma_max), 0); + dev->of_node = NULL; +} + static void apple_dart_test_before_attach(struct kunit *test) { struct apple_dart_master_cfg master = {}; @@ -1174,6 +1276,8 @@ static struct kunit_case apple_dart_test_cases[] = { KUNIT_CASE(apple_dart_test_strict_engines), KUNIT_CASE(apple_dart_test_topology), KUNIT_CASE(apple_dart_test_iommu_specifiers), + KUNIT_CASE(apple_dart_test_consumer_window), + KUNIT_CASE(apple_dart_test_invalid_consumer_window), KUNIT_CASE(apple_dart_test_independent_remap_roots), KUNIT_CASE(apple_dart_test_before_attach), KUNIT_CASE(apple_dart_test_locked_handoff), diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index a8b91c7e63316..b69ad96f4e94b 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -3583,10 +3583,37 @@ static void apple_dart_domain_free(struct iommu_domain *domain) kfree(dart_domain); } +static int apple_dart_validate_dma_window(struct device *dev, + const struct apple_dart *dart, + dma_addr_t dma_min, dma_addr_t length, + dma_addr_t *dma_max) +{ + if (!length) + return -EINVAL; + if (!IS_ALIGNED(dma_min, dart->pgsize) || !IS_ALIGNED(length, dart->pgsize)) { + dev_err(dev, "Unaligned DMA window %pad, %pad (0x%x)\n", + &dma_min, &length, dart->pgsize); + return -EINVAL; + } + if (check_add_overflow(dma_min, length - 1, dma_max)) { + dev_err(dev, "DMA window length (%pad) overflows range for start %pad\n", + &length, &dma_min); + return -EINVAL; + } + + /* High bits may select an alias, but the window must fit within it. */ + if ((dma_min ^ *dma_max) & ~DMA_BIT_MASK(dart->ias)) { + dev_err(dev, "Invalid DMA window for ias=%d\n", dart->ias); + return -EINVAL; + } + return 0; +} + /* * Work out the DMA window of one "iommus" specifier. One cell is the stream * ID alone and keeps the window of the DART node. Five cells add the 64-bit - * start and length of the window that the device uses. + * start and length of the window that the device uses. A consumer's + * apple,dma-range overrides either default, as it does at domain allocation. */ static int apple_dart_parse_dma_window(struct device *dev, const struct apple_dart *dart, @@ -3595,43 +3622,33 @@ static int apple_dart_parse_dma_window(struct device *dev, dma_addr_t *dma_max) { dma_addr_t length; + u64 window[2]; + int ret; + if (args->args_count != 1 && args->args_count != 5) + return -EINVAL; *dma_min = dart->dma_min; *dma_max = dart->dma_max; - if (args->args_count == 1) - return 0; - if (args->args_count != 5) - return -EINVAL; - - length = ((dma_addr_t)args->args[3] << 32) | args->args[4]; - if (!length) - return -EINVAL; - - if (*dma_min != 0 || *dma_max != DMA_BIT_MASK(dart->ias)) - dev_err(dev, "still using legacy \"apple,dma-range\" property\n"); - - *dma_min = ((dma_addr_t)args->args[1] << 32) | args->args[2]; - - if (!IS_ALIGNED(*dma_min, dart->pgsize) || - !IS_ALIGNED(length, dart->pgsize)) { - dev_err(dev, "Unaligned DMA window %pad, %pad (0x%x)\n", - dma_min, &length, dart->pgsize); - return -EINVAL; - } - if (check_add_overflow(*dma_min, length - 1, dma_max)) { - dev_err(dev, "DMA window length (%pad) overflows range for start %pad\n", - &length, dma_min); - return -EINVAL; - } - - /* Ensure that the DMA window does not exceed the DART's ias. */ - if ((*dma_min ^ *dma_max) & ~DMA_BIT_MASK(dart->ias)) { - dev_err(dev, "Invalid DMA window for ias=%d\n", dart->ias); - return -EINVAL; + if (args->args_count == 5) { + if (*dma_min != 0 || *dma_max != DMA_BIT_MASK(dart->ias)) + dev_err(dev, "still using legacy \"apple,dma-range\" property\n"); + *dma_min = ((dma_addr_t)args->args[1] << 32) | args->args[2]; + length = ((dma_addr_t)args->args[3] << 32) | args->args[4]; + ret = apple_dart_validate_dma_window(dev, dart, *dma_min, length, dma_max); + if (ret) + return ret; } - return 0; + /* Apply the consumer aperture before intersecting its DART windows. */ + if (!of_property_present(dev->of_node, "apple,dma-range")) + return 0; + ret = of_property_read_u64_array(dev->of_node, "apple,dma-range", + window, ARRAY_SIZE(window)); + if (ret) + return ret; + *dma_min = window[0]; + return apple_dart_validate_dma_window(dev, dart, *dma_min, window[1], dma_max); } static int apple_dart_of_xlate(struct device *dev, From 2d9dfb63ed513c79e1edcc91bc75cc402f132a50 Mon Sep 17 00:00:00 2001 From: DjDeveloperr Date: Sat, 31 Oct 2026 10:27:59 -0400 Subject: [PATCH 12/14] arm64: dts: apple: t8122: retain the common scanout DMA alias The display gate adds the external display DART to the shared display subsystem. Its low PIODMA default does not overlap the internal display's inherited 1 TiB alias, so their defaults cannot be intersected for scanout. Describe the subsystem's common scanout aperture explicitly, matching the internal DART. The external PIODMA consumer retains its existing low aperture and the external processor still requires the firmware-ready gate. This is a software-validated candidate; hardware external-display qualification remains pending. Assisted-by: OpenAI Codex (gpt-6.1-sol) [conflict: our dispext0 comment was shortened in 3b1f90e0; the sentence about the display subsystem aperture is added to it] Signed-off-by: DjDeveloperr Link: https://github.com/omacom/linux-aurora/commit/56e6f927515df12d689b6736ce0942361f714203 --- arch/arm64/boot/dts/apple/t8122-dcp.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/boot/dts/apple/t8122-dcp.dtsi b/arch/arm64/boot/dts/apple/t8122-dcp.dtsi index 8d812eae377e8..cf3686c8255eb 100644 --- a/arch/arm64/boot/dts/apple/t8122-dcp.dtsi +++ b/arch/arm64/boot/dts/apple/t8122-dcp.dtsi @@ -33,6 +33,8 @@ display: display-subsystem { compatible = "apple,t8122-display-subsystem"; iommus = <&disp0_dart 0>; + /* Keep the inherited scanout alias when adding external streams. */ + apple,dma-range = /bits/ 64 <0x10000000000 0x1000000000>; status = "disabled"; }; }; @@ -112,6 +114,9 @@ /* * External display processor: the boot loader only reserves its * firmware, the driver starts it. DMA windows as on T8112. + * The display subsystem's stream 0 on dispext0_dart uses the display + * subsystem's own high scanout aperture; its PIODMA stream keeps the + * low window below. */ dispext0_dart: iommu@319304000 { compatible = "apple,t8122-dart", "apple,t8110-dart"; From b908da42f83e61c61f8091aaa8987b9205d04295 Mon Sep 17 00:00:00 2001 From: Eryk Wieliczko Date: Mon, 9 Nov 2026 17:47:44 +0100 Subject: [PATCH 13/14] drm/apple: v14.7: take primary planes that reach past the mode's edge The 14.7 presenter scans out one unscaled image of the mode's size from the top-left of the framebuffer, and iomfb_v14_7_atomic_check() admitted only planes that describe exactly that. It compared the plane's raw src_* and crtc_* fields with the mode, so it rejected a plane whose destination reaches past the right or bottom edge of the CRTC with -EINVAL. The DRM uAPI allows such a plane: apple_plane_atomic_check() has already clipped it with drm_atomic_helper_check_plane_state() (can_position is true), and the part left on the mode is what the presenter shows. KWin puts up such a plane when it mirrors one output on another. On a J514S (M3 Pro), with the 3024x1964 panel at scale 1.7 mirrored onto an XREAL One (1920x1080 over DisplayPort alt mode), it centres a 1663-pixel wide picture and rounds the 128.5-pixel border up on both sides, so the external primary plane is 1921x1080 on a 1920x1080 mode. Every frame on the glasses then failed its commit, and they showed nothing. Once the glasses dropped and asserted HPD again, the connector's link-status went bad and KWin forced a modeset that included the panel. That commit failed on the same plane, and KWin retried it on every frame, so the panel froze too, with the pointer: around 350 failed commits a second until the mirror was turned off. Judge the plane by its clipped rectangles instead: the clipped source must start at the framebuffer's origin and, like the clipped destination, be of the mode's size. Hand the presenter the clipped source size on external pipes. Planes that start left of or above the mode, are offset into the framebuffer, are scaled or do not cover the mode are still rejected, and the panel still takes only a framebuffer of its mode's size, as before. A plane that the old check admitted has clipped rectangles equal to its raw ones, so it is judged and shown as before. The new KUnit suite runs drm_atomic_helper_check_plane_state() with the limits apple_plane_atomic_check() passes it, and checks which planes are admitted and, through the helper flush uses, what size the presenter is given. Fixes: 98d767ecf921 ("drm/apple, media: apple: avd: T6030 internal panel, external display and AVD fixes") Signed-off-by: Eryk Wieliczko Assisted-by: Claude:claude-opus-5-5 Link: https://github.com/omacom/linux-aurora/commit/b9ed2578d00a89e8e8809ed3cf9f5a29c462ef19 --- drivers/gpu/drm/apple/Makefile | 1 + drivers/gpu/drm/apple/iomfb_v14_7.c | 16 +-- drivers/gpu/drm/apple/iomfb_v14_7_plane.h | 65 ++++++++++ drivers/gpu/drm/apple/v14-plane-test.c | 146 ++++++++++++++++++++++ 4 files changed, 218 insertions(+), 10 deletions(-) create mode 100644 drivers/gpu/drm/apple/iomfb_v14_7_plane.h create mode 100644 drivers/gpu/drm/apple/v14-plane-test.c diff --git a/drivers/gpu/drm/apple/Makefile b/drivers/gpu/drm/apple/Makefile index f91642a35a9c4..24473e1497582 100644 --- a/drivers/gpu/drm/apple/Makefile +++ b/drivers/gpu/drm/apple/Makefile @@ -49,4 +49,5 @@ obj-$(CONFIG_DRM_APPLE_PARSER_KUNIT_TEST) += afkv2-test.o appledrm-$(CONFIG_DRM_APPLE_DISPLAY_KUNIT_TEST) += parser-test.o appledrm-$(CONFIG_DRM_APPLE_DISPLAY_KUNIT_TEST) += hotplug-test.o appledrm-$(CONFIG_DRM_APPLE_DISPLAY_KUNIT_TEST) += v14-board-test.o +appledrm-$(CONFIG_DRM_APPLE_DISPLAY_KUNIT_TEST) += v14-plane-test.o appledrm-$(CONFIG_DRM_APPLE_DISPLAY_KUNIT_TEST) += audio-no-sio-test.dtbo.o diff --git a/drivers/gpu/drm/apple/iomfb_v14_7.c b/drivers/gpu/drm/apple/iomfb_v14_7.c index a99bfed67183f..4e753210d957f 100644 --- a/drivers/gpu/drm/apple/iomfb_v14_7.c +++ b/drivers/gpu/drm/apple/iomfb_v14_7.c @@ -42,6 +42,7 @@ #include "iomfb_v14_7.h" #include "iomfb_v14_7_backlight.h" #include "iomfb_v14_7_board.h" +#include "iomfb_v14_7_plane.h" #include "iomfb_v14_7_link.h" #include "iomfb_v14_7_swap.h" #include "av.h" @@ -3085,12 +3086,7 @@ int iomfb_v14_7_atomic_check(struct apple_dcp *dcp, struct drm_crtc *crtc, if (fb->modifier != DRM_FORMAT_MOD_LINEAR || fb->offsets[0] || fb->pitches[0] < width * 4 || (fb->pitches[0] & 63)) return -EINVAL; - /* An external pipe may show the top-left of a larger framebuffer. */ - if (p->src_x || p->src_y || p->crtc_x || p->crtc_y || - p->src_w != width << 16 || p->src_h != height << 16 || - p->crtc_w != width || p->crtc_h != height || - (dcp->external ? fb->width < width || fb->height < height : - fb->width != width || fb->height != height)) + if (!dcp_v14_plane_fits_mode(p, width, height, dcp->external)) return -EINVAL; obj = drm_fb_dma_get_gem_obj(fb, 0); if (!obj || !obj->dma_addr || (u64)fb->pitches[0] * height > obj->base.size) @@ -3344,12 +3340,15 @@ void iomfb_v14_7_flush(struct apple_dcp *dcp, struct drm_crtc *crtc, struct drm_plane_state *p = drm_atomic_get_new_plane_state(state, crtc->primary); struct drm_crtc_state *cs = drm_atomic_get_new_crtc_state(state, crtc); struct drm_framebuffer *fb; + u32 width = 0, height = 0; if (!p) p = crtc->primary->state; if (!cs) cs = crtc->state; fb = p && p->visible ? p->fb : NULL; + if (fb) + dcp_v14_plane_scanout_size(p, dcp->external, &width, &height); /* * No swaps while an external display is off, unset, unplugged, or * being described again. @@ -3364,10 +3363,7 @@ void iomfb_v14_7_flush(struct apple_dcp *dcp, struct drm_crtc *crtc, if (!dcp->external) dcp_v14_configure_backlight(dcp); dcp->swap_start = ktime_get(); - if (dcp->v14 && dcp_v14_present(dcp->v14, fb, - fb ? (dcp->external ? p->src_w >> 16 : fb->width) : 0, - fb ? (dcp->external ? p->src_h >> 16 : fb->height) : 0, - dcp->notch_height, cs)) { + if (dcp->v14 && dcp_v14_present(dcp->v14, fb, width, height, dcp->notch_height, cs)) { dcp_drm_crtc_page_flip(dcp, ktime_get()); /* * The swap completed: the framebuffers this commit and earlier diff --git a/drivers/gpu/drm/apple/iomfb_v14_7_plane.h b/drivers/gpu/drm/apple/iomfb_v14_7_plane.h new file mode 100644 index 0000000000000..d330d38ca6d01 --- /dev/null +++ b/drivers/gpu/drm/apple/iomfb_v14_7_plane.h @@ -0,0 +1,65 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR MIT */ + +#ifndef __APPLE_IOMFB_V14_7_PLANE_H__ +#define __APPLE_IOMFB_V14_7_PLANE_H__ + +#include + +#include +#include +#include + +/* + * The 14.7 presenter scans out one unscaled image of the mode's size from + * the top-left corner of the framebuffer. Judge a plane by its clipped + * rectangles, which drm_atomic_helper_check_plane_state() has set by the + * time the CRTC is checked: a plane that reaches past the right or bottom + * edge of the mode is clipped there, and what remains is exactly what the + * presenter scans out. Compositors put up such planes, for example when they + * centre a mirrored output and round its borders up on both sides. + * + * A plane that starts left of or above the mode, or that is scaled, starts + * its clipped source inside the framebuffer or differs in size from the + * mode, which the presenter cannot show. Clipping rounds the source toward + * 1:1, so a plane that reaches past the edge with a source less than a pixel + * off unscaled may clip to exactly the mode's size; it is then taken and + * shown unscaled. + * + * An external pipe may show the top-left of a larger framebuffer; the panel + * takes only a framebuffer of its mode's size. + */ +static inline bool dcp_v14_plane_fits_mode(const struct drm_plane_state *p, + u32 width, u32 height, bool external) +{ + const struct drm_framebuffer *fb = p->fb; + + if (p->src.x1 || p->src.y1 || p->dst.x1 || p->dst.y1) + return false; + if (drm_rect_width(&p->src) != (int)(width << 16) || + drm_rect_height(&p->src) != (int)(height << 16) || + drm_rect_width(&p->dst) != (int)width || + drm_rect_height(&p->dst) != (int)height) + return false; + if (external) + return fb->width >= width && fb->height >= height; + return fb->width == width && fb->height == height; +} + +/* + * The size of the image the presenter scans out for a visible plane that + * dcp_v14_plane_fits_mode() took: its clipped source on an external pipe, + * where the framebuffer may be larger, and the framebuffer on the panel. + */ +static inline void dcp_v14_plane_scanout_size(const struct drm_plane_state *p, + bool external, u32 *width, u32 *height) +{ + if (external) { + *width = drm_rect_width(&p->src) >> 16; + *height = drm_rect_height(&p->src) >> 16; + } else { + *width = p->fb->width; + *height = p->fb->height; + } +} + +#endif /* __APPLE_IOMFB_V14_7_PLANE_H__ */ diff --git a/drivers/gpu/drm/apple/v14-plane-test.c b/drivers/gpu/drm/apple/v14-plane-test.c new file mode 100644 index 0000000000000..2527b6726c759 --- /dev/null +++ b/drivers/gpu/drm/apple/v14-plane-test.c @@ -0,0 +1,146 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT +/* + * Which primary planes the 14.7 presenter takes: one unscaled image of the + * mode's size from the top-left of the framebuffer, judged on the rectangles + * drm_atomic_helper_check_plane_state() clips to the mode, with the scaling + * limits apple_plane_atomic_check() passes it. A plane that reaches past the + * right or bottom edge of the mode is clipped there and taken; one that is + * offset into the mode, starts left of or above it, or is scaled is not. For + * a plane it takes, check the size iomfb_v14_7_flush() hands the presenter. + */ +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "iomfb_v14_7_plane.h" + +struct v14_plane_case { + const char *name; + u16 hdisplay, vdisplay; /* the mode */ + u32 fb_w, fb_h; + int crtc_x, crtc_y; + u32 crtc_w, crtc_h; + u32 src_x, src_y, src_w, src_h; /* whole pixels */ + bool external; + bool fits; + u32 shown_w, shown_h; /* clipped source, when it fits */ + u32 src_w_frac; /* 16.16 fraction added to src_w */ +}; + +static const struct v14_plane_case v14_plane_cases[] = { + { "external, exact", 1920, 1080, 1920, 1080, 0, 0, 1920, 1080, + 0, 0, 1920, 1080, true, true, 1920, 1080 }, + /* + * KWin mirroring a 3024x1964 panel at scale 1.7 onto a 1920x1080 + * display: 1663 columns of picture and 129 of border on each side. + */ + { "external, one column past the right edge", 1920, 1080, 1921, 1080, + 0, 0, 1921, 1080, 0, 0, 1921, 1080, true, true, 1920, 1080 }, + { "external, one row past the bottom edge", 1920, 1080, 1920, 1081, + 0, 0, 1920, 1081, 0, 0, 1920, 1081, true, true, 1920, 1080 }, + { "external, past the right and bottom edges", 1920, 1080, 1921, 1081, + 0, 0, 1921, 1081, 0, 0, 1921, 1081, true, true, 1920, 1080 }, + /* + * Clipping rounds the source toward 1:1: 1921 + 1/65536 columns on + * 1921 clip to exactly 1920 << 16, while 1921.5 on 1921 clip to + * (1920 << 16) + 32750, which is scaled. + */ + { "external, past the edge, source a 65536th over 1:1", 1920, 1080, + 1922, 1080, 0, 0, 1921, 1080, 0, 0, 1921, 1080, true, true, + 1920, 1080, .src_w_frac = 1 }, + { "external, past the edge, source half a pixel over 1:1", 1920, 1080, + 1922, 1080, 0, 0, 1921, 1080, 0, 0, 1921, 1080, true, false, + .src_w_frac = 0x8000 }, + { "external, top-left of a larger framebuffer", 1920, 1080, 2560, 1440, + 0, 0, 1920, 1080, 0, 0, 1920, 1080, true, true, 1920, 1080 }, + { "external, starts left of the mode", 1920, 1080, 1921, 1080, + -1, 0, 1921, 1080, 0, 0, 1921, 1080, true, false }, + { "external, starts above the mode", 1920, 1080, 1920, 1081, + 0, -1, 1920, 1081, 0, 0, 1920, 1081, true, false }, + { "external, offset into the framebuffer", 1920, 1080, 1921, 1080, + 0, 0, 1920, 1080, 1, 0, 1920, 1080, true, false }, + { "external, scaled to the mode", 1920, 1080, 1921, 1080, + 0, 0, 1920, 1080, 0, 0, 1921, 1080, true, false }, + { "external, narrower than the mode", 1920, 1080, 1919, 1080, + 0, 0, 1919, 1080, 0, 0, 1919, 1080, true, false }, + { "external, positioned inside the mode", 1920, 1080, 1920, 1080, + 1, 0, 1919, 1080, 0, 0, 1919, 1080, true, false }, + { "panel, exact", 3024, 1964, 3024, 1964, 0, 0, 3024, 1964, + 0, 0, 3024, 1964, false, true, 3024, 1964 }, + { "panel, larger framebuffer", 3024, 1964, 3025, 1964, 0, 0, 3025, 1964, + 0, 0, 3025, 1964, false, false }, +}; + +static void v14_plane_case_desc(const struct v14_plane_case *c, char *desc) +{ + strscpy(desc, c->name, KUNIT_PARAM_DESC_SIZE); +} + +KUNIT_ARRAY_PARAM(v14_plane, v14_plane_cases, v14_plane_case_desc); + +static void v14_plane_fits_mode(struct kunit *test) +{ + const struct v14_plane_case *c = test->param_value; + struct drm_plane *plane = kunit_kzalloc(test, sizeof(*plane), GFP_KERNEL); + struct drm_crtc *crtc = kunit_kzalloc(test, sizeof(*crtc), GFP_KERNEL); + struct drm_framebuffer *fb = kunit_kzalloc(test, sizeof(*fb), GFP_KERNEL); + struct drm_crtc_state *crtc_state = + kunit_kzalloc(test, sizeof(*crtc_state), GFP_KERNEL); + struct drm_plane_state p; + u32 shown_w, shown_h; + int ret; + + KUNIT_ASSERT_NOT_NULL(test, plane); + KUNIT_ASSERT_NOT_NULL(test, crtc); + KUNIT_ASSERT_NOT_NULL(test, fb); + KUNIT_ASSERT_NOT_NULL(test, crtc_state); + fb->width = c->fb_w; + fb->height = c->fb_h; + crtc_state->crtc = crtc; + crtc_state->enable = true; + crtc_state->mode.hdisplay = c->hdisplay; + crtc_state->mode.vdisplay = c->vdisplay; + p = (struct drm_plane_state) { + .plane = plane, .crtc = crtc, .fb = fb, + .rotation = DRM_MODE_ROTATE_0, + .crtc_x = c->crtc_x, .crtc_y = c->crtc_y, + .crtc_w = c->crtc_w, .crtc_h = c->crtc_h, + .src_x = c->src_x << 16, .src_y = c->src_y << 16, + .src_w = (c->src_w << 16) + c->src_w_frac, + .src_h = c->src_h << 16, + }; + /* As apple_plane_atomic_check() runs it, before the CRTC is checked. */ + ret = drm_atomic_helper_check_plane_state(&p, crtc_state, + DRM_PLANE_NO_SCALING / 2, + DRM_PLANE_NO_SCALING * 4, + true, true); + KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_ASSERT_TRUE(test, p.visible); + + KUNIT_EXPECT_EQ(test, dcp_v14_plane_fits_mode(&p, c->hdisplay, c->vdisplay, + c->external), c->fits); + if (!c->fits) + return; + /* What iomfb_v14_7_flush() hands the presenter. */ + dcp_v14_plane_scanout_size(&p, c->external, &shown_w, &shown_h); + KUNIT_EXPECT_EQ(test, shown_w, c->shown_w); + KUNIT_EXPECT_EQ(test, shown_h, c->shown_h); +} + +static struct kunit_case v14_plane_test_cases[] = { + KUNIT_CASE_PARAM(v14_plane_fits_mode, v14_plane_gen_params), + {} +}; + +static struct kunit_suite v14_plane_test_suite = { + .name = "apple-dcp-v14-plane", + .test_cases = v14_plane_test_cases, +}; + +kunit_test_suite(v14_plane_test_suite); From 99b2d3a30a7a3415192152537bb4e8fdb9174246 Mon Sep 17 00:00:00 2001 From: Ryan <81541646+RyanTheTide@users.noreply.github.com> Date: Fri, 20 Nov 2026 00:11:35 +1100 Subject: [PATCH 14/14] pmdomain: apple: pmp-report: select the T8122 wait by its PMP and report The T8122 14.x GPU readiness wait was gated three times: by a hidden per-machine Kconfig symbol (APPLE_T8122_GPU_PMP_LINK, selected by the M3 runtime), by the "apple,t8122" machine compatible, and by the hardware itself, an "apple,t8122-pmp-v2" supplier with exactly one available "apple,t8122-pmp-v2-report" node whose "apple,pmp" points back at it. The hardware match is enough. Drop the Kconfig symbol and both machine checks, and try the T8122 wait first for every supplier without a declared report: it returns -ENODEV unless the PMP and its report are there, and the T6030 wait follows as before. Suppliers on other SoCs get the same results as before. On a T8122 whose device tree has the report, the wait now also runs in kernels built without the M3 GPU runtime. The host tests lose their CONFIG_APPLE_T8122_GPU_PMP_LINK=0 define. Signed-off-by: Ryan --- drivers/gpu/drm/asahi/Kconfig | 1 - drivers/pmdomain/apple/pmp-report.c | 17 ++++++++--------- drivers/soc/apple/Kconfig | 9 --------- tools/asahi/t6030-pmp-graph-tests.c | 1 - tools/asahi/t6030-pmp-graph-tests.py | 2 +- tools/asahi/t6030-pmp-supplier-tests.c | 2 +- tools/asahi/t6030-pmp-supplier-tests.py | 3 +-- 7 files changed, 11 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/asahi/Kconfig b/drivers/gpu/drm/asahi/Kconfig index 03939a732fc24..d383802ee8825 100644 --- a/drivers/gpu/drm/asahi/Kconfig +++ b/drivers/gpu/drm/asahi/Kconfig @@ -84,7 +84,6 @@ config DRM_ASAHI_M3_T8122 depends on DRM_ASAHI # The runtime adopts the firmware's UAT through the G15 backend's handoff helpers. depends on DRM_ASAHI_G15 - select APPLE_T8122_GPU_PMP_LINK select CRYPTO_LIB_SHA256 default n help diff --git a/drivers/pmdomain/apple/pmp-report.c b/drivers/pmdomain/apple/pmp-report.c index f544e27f91d1b..466a853266d5a 100644 --- a/drivers/pmdomain/apple/pmp-report.c +++ b/drivers/pmdomain/apple/pmp-report.c @@ -615,19 +615,17 @@ static int apple_pmp_report_wait_t6030_14(struct device *supplier, unsigned int } /* - * The T8122 (M3 MacBook Air) GPU on its 14.8.3 firmware, for the M3 runtime - * (APPLE_T8122_GPU_PMP_LINK): the unique T8122 report linked to this PMP, and - * its display request (DISP, reg 7) READY and acknowledged before AGX, as on - * the 7.1.12 kernel that runtime was qualified with. + * The T8122 (M3 MacBook Air) GPU on its 14.8.3 firmware: the unique T8122 + * report linked to this PMP, and its display request (DISP, reg 7) READY and + * acknowledged before AGX. Selected by the T8122 PMP and its linked report + * node; anything else gets -ENODEV. */ static int apple_pmp_report_wait_t8122_14(struct device *supplier, unsigned int timeout_ms) { struct device_node *np, *report = NULL, *pmp, *entry; int ret; - if (!IS_ENABLED(CONFIG_APPLE_T8122_GPU_PMP_LINK) || - !of_machine_is_compatible("apple,t8122") || - !of_device_is_compatible(supplier->of_node, "apple,t8122-pmp-v2")) + if (!of_device_is_compatible(supplier->of_node, "apple,t8122-pmp-v2")) return -ENODEV; for_each_compatible_node(np, NULL, "apple,t8122-pmp-v2-report") { if (report) { @@ -667,8 +665,9 @@ int apple_pmp_report_wait_supplier_ready(struct device *supplier, unsigned int t /* A declared report always takes the existing native25 path below. */ if (!np && !of_property_present(supplier->of_node, "apple,pmp-report")) { - if (of_machine_is_compatible("apple,t8122")) - return apple_pmp_report_wait_t8122_14(supplier, timeout_ms); + ret = apple_pmp_report_wait_t8122_14(supplier, timeout_ms); + if (ret != -ENODEV) + return ret; return apple_pmp_report_wait_t6030_14(supplier, timeout_ms); } if (!np || !of_device_is_compatible(np, t8132 ? diff --git a/drivers/soc/apple/Kconfig b/drivers/soc/apple/Kconfig index 3c40bf8a41a79..9225b054e7cde 100644 --- a/drivers/soc/apple/Kconfig +++ b/drivers/soc/apple/Kconfig @@ -368,15 +368,6 @@ config APPLE_DISPLAY_GATE Say 'y' if you want the native display on M3 Pro, M3 Max, M3 and M4 Pro Macs. -config APPLE_T8122_GPU_PMP_LINK - bool - depends on APPLE_PMP_REPORT - default n - help - Let T8122 (M3 MacBook Air) GPU power commands wait for the display - request the PMP report acknowledges on the 14.8.3 firmware, as the - M3 runtime of DRM_ASAHI_M3_T8122 requires. - config APPLE_T6030_GPU_PMP_LINK bool depends on APPLE_DISPLAY_GATE diff --git a/tools/asahi/t6030-pmp-graph-tests.c b/tools/asahi/t6030-pmp-graph-tests.c index 89a6ac0efc8e7..e89d982d2d0a6 100644 --- a/tools/asahi/t6030-pmp-graph-tests.c +++ b/tools/asahi/t6030-pmp-graph-tests.c @@ -20,7 +20,6 @@ typedef uint8_t u8; #define BIT(n) (1U << (n)) #define IS_ENABLED(x) (x) #define CONFIG_APPLE_T6030_GPU_PMP_LINK 1 -#define CONFIG_APPLE_T8122_GPU_PMP_LINK 0 #define PMP_REPORT_READY 1 #define GFP_KERNEL 0 #define GENPD_FLAG_ACTIVE_WAKEUP 1 diff --git a/tools/asahi/t6030-pmp-graph-tests.py b/tools/asahi/t6030-pmp-graph-tests.py index c8a58b302e727..cedb28929a5b9 100644 --- a/tools/asahi/t6030-pmp-graph-tests.py +++ b/tools/asahi/t6030-pmp-graph-tests.py @@ -60,7 +60,7 @@ def main(): 'static int apple_pmp_report_entry_resume_noirq('] offsets = re.search(r'static const struct apple_pmp_report_offsets apple_pmp_offsets_t6030 = \{.*?\n\};', source, re.S)[0] functions = '\n'.join(extract.function(source, n) for n in names) - # The T8122 14.x wait (CONFIG_APPLE_T8122_GPU_PMP_LINK=0 here) precedes the dispatch; it is + # The T8122 14.x wait (no T8122 PMP here, so it returns -ENODEV) precedes the dispatch; it is # added after the mutations are placed, so they target the T6030 path only. t8122 = extract.function(source, 'static int apple_pmp_report_wait_t8122_14(') + '\n' dispatch = 'int apple_pmp_report_wait_supplier_ready(' diff --git a/tools/asahi/t6030-pmp-supplier-tests.c b/tools/asahi/t6030-pmp-supplier-tests.c index 59c2c0d3cd430..8f90264d0bf95 100644 --- a/tools/asahi/t6030-pmp-supplier-tests.c +++ b/tools/asahi/t6030-pmp-supplier-tests.c @@ -574,7 +574,7 @@ int main(void) RUN((void)0, -ENODEV, 0, 0); assert(!find_calls); #endif - /* T8122 current14 remains unsupported by this supplier API. */ + /* A T8122 PMP without a linked T8122 report node is not waited for. */ RUN(machine = "apple,t8122"; supplier_node.compatible = "apple,t8122-pmp-v2", -ENODEV, 0, 0); /* A declared report, including malformed/unresolved data, never falls back. */ diff --git a/tools/asahi/t6030-pmp-supplier-tests.py b/tools/asahi/t6030-pmp-supplier-tests.py index 725e37e24f6cf..a6eff85b7d688 100755 --- a/tools/asahi/t6030-pmp-supplier-tests.py +++ b/tools/asahi/t6030-pmp-supplier-tests.py @@ -56,7 +56,6 @@ def run(out, name, code, compiler, configs=(0, 1)): command = compiler + ["-std=gnu11", "-g", "-O1", "-Wall", "-Wextra", "-Werror", "-fsanitize=address,undefined", "-fno-omit-frame-pointer", f"-DCONFIG_APPLE_T6030_GPU_PMP_LINK={config}", - "-DCONFIG_APPLE_T8122_GPU_PMP_LINK=0", "-I", str(dest), str(ROOT / "tools/asahi/t6030-pmp-supplier-tests.c"), "-o", str(binary)] @@ -149,7 +148,7 @@ def main(): assert code.count(old) == 1, (name, code.count(old)) variants.append((name, code.replace(old, new))) variants.append(("control-after", code)) - # The T8122 14.x wait is built with CONFIG_APPLE_T8122_GPU_PMP_LINK=0 here; it is added to + # The T8122 14.x wait finds no T8122 report node here and returns -ENODEV; it is added to # every variant after the T6030 mutations are placed, so they target the T6030 path only. dispatch = "int apple_pmp_report_wait_supplier_ready(" t8122 = function(report, "static int apple_pmp_report_wait_t8122_14(") + "\n"