From 5351f41ea3b0d72f85e5acc8b802cff8816c0e41 Mon Sep 17 00:00:00 2001 From: DjDeveloperr Date: Wed, 2 Dec 2026 09:02:45 -0500 Subject: [PATCH] selftests: apple-dcp: stub the T6030 firmware 27.2 sleep state in host fixtures Since "drm/apple: restore the T6030 firmware 27.2 display after sleep" and "drm/apple: dcp: enable AFK init-prop name fallback on T6030 internal DCP", the production functions these host fixtures extract read state that their stub structs don't declare, so seven fixtures no longer compile: - display-sleep-merge-tests: dcp_platform_prepare() returns early for a 27.2 idle-only dcpext (dcp->ext272). - apple-dcp v27-panel-handoff: the T6030 profile names dcp_s2r_t6030 and sets afk_name_fallback and v27_early_stop. - apple-dcp t6041-v27-admission and t8122-dcpext-v27-admission: dcp_check_firmware_version() calls dcp_ext272_admitted(). - apple-dcp service-rebind: afk_recv_handle_init() reads hw.afk_name_fallback, and afk_v2_receive() reads ep->j516s_panel_service and the sleep_v27_closed gate (now an enum) and logs with dev_info_ratelimited(). - apple-dcp provider-admission and ordered-rx: dcp_afkep() also looks up dcp->v27_early_svc_ep[]. Declare the new fields in the stubs, take dcp_ext272_admitted() and the profiles' sleep layouts from the driver, and count dev_info_ratelimited() like dev_info(). No scenario sets the new state, so every fixture checks the same paths as before. Fixes: 7d82fde95f17 ("drm/apple: restore the T6030 firmware 27.2 display after sleep") Fixes: f35156ebd468 ("drm/apple: dcp: enable AFK init-prop name fallback on T6030 internal DCP") Signed-off-by: DjDeveloperr --- tools/asahi/display-sleep-merge-tests.py | 2 +- .../testing/selftests/drivers/gpu/apple-dcp/boot.py | 12 +++++++++++- .../testing/selftests/drivers/gpu/apple-dcp/edid.py | 12 +++++++++--- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/tools/asahi/display-sleep-merge-tests.py b/tools/asahi/display-sleep-merge-tests.py index 47c87321c0ab0..302ae5875d8ba 100644 --- a/tools/asahi/display-sleep-merge-tests.py +++ b/tools/asahi/display-sleep-merge-tests.py @@ -56,7 +56,7 @@ def run(name, code, negative=False, extra=()): pre = common + r''' #define READ_ONCE(x) (x) #define WRITE_ONCE(x,v) ((x)=(v)) -struct apple_dcp { bool v27, native26, crashed, sleep_cold_stopped, ext26_blocked, ext26_pm_preparing, ext26_pm_work_off; int ext26_blank_work; }; +struct apple_dcp { bool v27, native26, crashed, sleep_cold_stopped, ext26_blocked, ext26_pm_preparing, ext26_pm_work_off; int ext26_blank_work; struct dcp_ext272 *ext272; }; struct device { struct apple_dcp *d; }; static int invalidations, cancellations, disables; static bool firmware; static void *dev_get_drvdata(struct device *v) { return v->d; } diff --git a/tools/testing/selftests/drivers/gpu/apple-dcp/boot.py b/tools/testing/selftests/drivers/gpu/apple-dcp/boot.py index a5dfa49526315..92e7f09277cab 100644 --- a/tools/testing/selftests/drivers/gpu/apple-dcp/boot.py +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/boot.py @@ -1,6 +1,8 @@ # SPDX-License-Identifier: GPL-2.0-only OR MIT # Copyright 2026 Ryan Murray """RTKit event dispatch and ACK policies with public synthetic messages.""" +import re + from common import block def oslog(root): @@ -259,6 +261,7 @@ def _v27_prelude(root): 'static enum dcp_firmware_version dcp_v27_method_table(', 'enum dcp_v27_admission dcp_v27_admission(', 'static bool dcp_firmware_27(', + 'static bool dcp_ext272_admitted(', 'static enum dcp_firmware_version dcp_check_firmware_version(', )) return r''' @@ -399,6 +402,10 @@ def v27_panel_handoff(root): match = '\n'.join(block(source, f'static const struct apple_dcp_hw_data apple_dcp_hw_{soc} =') + ';' for soc in profiles) profile = block(source, 'static void dcp_apply_dt_profile(') + internal = (root / 'drivers/gpu/drm/apple/dcp-internal.h').read_text() + layouts = block(internal, 'struct dcp_s2r_layout {') + ';\n' + ''.join( + block(source, f'static const struct dcp_s2r_layout {name} =') + ';\n' + for name in sorted(set(re.findall(r'\.s2r_layout = &(\w+),', match)))) return r''' #include #include @@ -418,6 +425,9 @@ def v27_panel_handoff(root): const char *iboot_handoff; unsigned num_dptx_ports; u8 firmware_dma_bits; + /* Set in the T6030 profile, not read by dcp_apply_dt_profile(). */ + bool afk_name_fallback, v27_early_stop; + const struct dcp_s2r_layout *s2r_layout; }; struct apple_dcp { struct device *dev; @@ -441,7 +451,7 @@ def v27_panel_handoff(root): /* All probes see the same DART aperture and panel-only topology. */ static u8 dcp_dart_dma_bits(struct device_node *np) { return 41; } static bool dcp_is_internal_panel_only(struct apple_dcp *dcp) { return true; } -''' + match + '\n' + profile + r''' +''' + layouts + match + '\n' + profile + r''' static void check(struct apple_dcp_hw_data hw, struct device_node node, bool live) { struct device dev = { .of_node = &node }; diff --git a/tools/testing/selftests/drivers/gpu/apple-dcp/edid.py b/tools/testing/selftests/drivers/gpu/apple-dcp/edid.py index f0e2eafd41950..ddf651f67fbc0 100644 --- a/tools/testing/selftests/drivers/gpu/apple-dcp/edid.py +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/edid.py @@ -47,6 +47,7 @@ def function(file,signature): #define dev_err(...) do { diagnostic_errors++; } while (0) #define dev_dbg(dev,fmt,...) do { if(!strcmp(fmt,"DCPAVSERV: legacy EDID service published\n")) legacy_publishes++; } while (0) #define dev_info(...) do { diagnostic_information++; } while (0) +#define dev_info_ratelimited(...) do { diagnostic_information++; } while (0) static unsigned diagnostic_errors,diagnostic_information,legacy_publishes; #define DCP_FIRMWARE_H17P 17 @@ -94,19 +95,20 @@ def function(file,signature): struct { u64 generation,epoch; } admission;void *cookie; bool pending_open;const char *pending_name,*pending_class;s64 pending_unit; }; -/* v27_closed_teardown: set only by a J714s firmware 27 sleep. */ -struct apple_dcp_afkep { u8 *command_tags;bool lock,stopping;void *wq;struct work_struct service_work;struct apple_dcp *dcp;const struct apple_epic_service_ops *ops,*unmatched_ops;bool wire_v2,inline_v2,match_epic_name,v27_closed_teardown;u32 endpoint;unsigned int num_channels;int service_wq;struct apple_epic_service services[AFK_MAX_CHANNEL]; }; +/* v27_closed_teardown: set only by a J714s firmware 27 sleep; j516s_panel_service only by a T6030 one. */ +struct apple_dcp_afkep { u8 *command_tags;bool lock,stopping;void *wq;struct work_struct service_work;struct apple_dcp *dcp;const struct apple_epic_service_ops *ops,*unmatched_ops;bool wire_v2,inline_v2,match_epic_name,v27_closed_teardown,j516s_panel_service;u32 endpoint;unsigned int num_channels;int service_wq;struct apple_epic_service services[AFK_MAX_CHANNEL]; }; #define wake_up_all(q) ((void)(q)) struct apple_connector { void *dcp;bool connected,edid_invalidation_pending;struct { int registration_state; } base;unsigned int hotplug_wq; }; struct apple_dcp { void *dev;int fw_compat;struct apple_dcp_afkep *dcpavservep;struct apple_connector *connector; void *desktop; bool external_physically_absent,hpd_mutex,quiescing,typec_cable_connected;u64 typec_generation;unsigned int nr_modes; - struct { int iomfb_method_profile,firmware_compat; bool fw_14_7_endpoints,afk_announced_names; unsigned int num_dptx_ports; unsigned char dptx_endpoint; } hw; bool ext_dead,external_native; + struct { int iomfb_method_profile,firmware_compat; bool fw_14_7_endpoints,afk_announced_names,afk_name_fallback; unsigned int num_dptx_ports; unsigned char dptx_endpoint; } hw; bool ext_dead,external_native; struct { bool lock,enabled;u64 epoch;int enable_completion;struct apple_epic_service *service,*opened; u64 opened_epoch,close_gen,terminated_epoch,close_epoch;bool opening;struct work_struct close_wq; } dcpavserv; /* A J714s firmware 27 processor's: this one is not. */ bool v27_j714s, v27_sleep_transport; struct apple_dcp_afkep *sleep_v27_ep[0x20], *panelav[0x20]; + enum { DCP_V27_TX_LIVE, DCP_V27_TX_REPLIES, DCP_V27_TX_PANEL_OPEN } sleep_v27_closed; /* Not a dcpext and no external output: none of these scenarios is an external processor. */ bool dcpext; unsigned int nr_typec_routes; void *fixed_phy; }; @@ -719,6 +721,8 @@ def function(file, signature): /* A J714s firmware 27 processor's: none is one here. */ bool v27_j714s, v27_sleep_transport, sleep_v27_unhandled; struct apple_dcp_afkep *sleep_v27_ep[0x20], *panelav[0x20]; + /* The T6030 firmware 27 service endpoints: none is started here. */ + struct apple_dcp_afkep *v27_early_svc_ep[0x20]; }; struct drm_edid { int identity; }; '''+internal_inline(root,'dcp_is_v14_7_external')+r'''static unsigned int reads, allocations, legacy_reads, receives; @@ -1001,6 +1005,8 @@ def function(text, signature): /* A J714s firmware 27 processor's: this one is not. */ bool v27_j714s, v27_sleep_transport, sleep_v27_unhandled; struct apple_dcp_afkep *sleep_v27_ep[0x20], *panelav[0x20]; + /* The T6030 firmware 27 service endpoints: none is started here. */ + struct apple_dcp_afkep *v27_early_svc_ep[0x20]; }; struct afk_receive_message_work { struct apple_dcp_afkep *ep; u64 message; struct work_struct work; }; struct apple_rtkit_ops { void (*recv_message)(void *,u8,u64); void (*recv_message_timed)(void *,u8,u64,u64); };