From a5b034dc1a7822590471190f0d11e7c254c25634 Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Mon, 26 Oct 2026 09:25:33 +1100 Subject: [PATCH 1/2] selftests: apple-dcp: keep host errno and make namespaces native The Type-C PM adapter left linux/errno.h in the extracted unit. That picked up the AFK shim's Linux errno numbers after the native errno.h, which fails strict compilation on Darwin. Translate the include at the host boundary instead. Give the power-reply fixture a local EREMOTEIO when libc does not define it; its status never crosses a host API. The errno namespace gaps were present in the fixtures added in a7a7e2f37796. Their later replug and dropped-swap derivatives retain the same gap. Keep all ownership, ordering, retry and reply assertions unchanged. Use an explicitly selected MAKE command, or prefer gmake when installed, for the real Kconfig producer. This avoids accidentally invoking the stock macOS GNU Make 3.81 against Kbuild, which requires GNU Make 4. Document the producer dependency without skipping the Kconfig checks. Fixes: a7a7e2f37796 ("drm/apple: Compose the qualified J700 external display path") Signed-off-by: Ryan Murray --- tools/testing/selftests/drivers/gpu/apple-dcp/README | 8 +++++++- tools/testing/selftests/drivers/gpu/apple-dcp/common.py | 2 ++ .../testing/selftests/drivers/gpu/apple-dcp/lifecycle.py | 4 ++++ tools/testing/selftests/drivers/gpu/apple-dcp/pm.py | 5 +++-- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/drivers/gpu/apple-dcp/README b/tools/testing/selftests/drivers/gpu/apple-dcp/README index c49b2d48949af..ffd0ecfcb852c 100644 --- a/tools/testing/selftests/drivers/gpu/apple-dcp/README +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/README @@ -12,7 +12,13 @@ Or keep translation units, commands, failure logs and source hashes: An installed copy needs --source /path/to/kernel. --group edid, rate, phy or lifecycle or boot selects one group. HOSTCC selects the host compiler (default clang). Python 3 and a compiler supporting AddressSanitizer/UndefinedBehaviorSanitizer -are required. No target access, firmware command, captured fixture or kernel +are required. The usb-kconfig producer also needs GNU Make 4 or newer. The +runner uses MAKE when set, otherwise gmake if available, then make. On macOS, +install GNU Make or select an existing producer with KCONFIG_CONF. The host +fixtures use native errno definitions; Linux-only reply statuses stay local +to the synthetic callback test. + +No target access, firmware command, captured fixture or kernel configuration is required. One TAP entry point uses shared production extraction and compiler handling. diff --git a/tools/testing/selftests/drivers/gpu/apple-dcp/common.py b/tools/testing/selftests/drivers/gpu/apple-dcp/common.py index cdf20256dfa4f..918a9d91fa30f 100644 --- a/tools/testing/selftests/drivers/gpu/apple-dcp/common.py +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/common.py @@ -47,6 +47,8 @@ def source_defines(source): def tipd_pm_header(root): """CD321x PM state machine for host units, with a host clamp() for minmax.h.""" header = (root / 'drivers/usb/typec/tipd/cd321x-pm.h').read_text() + # Use the host errno namespace, not the AFK Linux-numbered shim. + header = header.replace('#include ', '#include ') # Host integer types; a repeated identical typedef is valid C11. header = header.replace('#include ', '#include \ntypedef uint32_t u32;') diff --git a/tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py b/tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py index d7485a6681747..21a962fb10cb3 100644 --- a/tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py @@ -1770,6 +1770,10 @@ def power_reply(root): #include #include #include +/* Darwin has no EREMOTEIO; this synthetic status is never passed to libc. */ +#ifndef EREMOTEIO +#define EREMOTEIO 121 +#endif typedef uint32_t u32; typedef uint64_t u64; #define WRITE_ONCE(p,v) ((p)=(v)) #define container_of(p,t,m) ((t *)((char *)(p)-offsetof(t,m))) diff --git a/tools/testing/selftests/drivers/gpu/apple-dcp/pm.py b/tools/testing/selftests/drivers/gpu/apple-dcp/pm.py index 75fe10221fcc9..d5b3890d30861 100644 --- a/tools/testing/selftests/drivers/gpu/apple-dcp/pm.py +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/pm.py @@ -2,7 +2,7 @@ # Copyright 2026 Ryan Murray """Actual PM/HCD/mux/probe boundaries using the shared PHY extraction fixture.""" from pathlib import Path -import os, re, subprocess +import os, re, shlex, shutil, subprocess import phy from common import block, tipd_pm_header, atc_function @@ -681,7 +681,8 @@ def kconfig(root, output): 'config PHY_APPLE_ATC\n\ttristate "PHY"\n\t' + dependency + '\n') compiler = Path(os.environ.get('KCONFIG_CONF', root / 'scripts/kconfig/conf')) if not compiler.is_file(): - subprocess.run(['make', '-C', str(root), 'O=' + str(directory / 'producer'), + make = shlex.split(os.environ.get('MAKE', shutil.which('gmake') or 'make')) + subprocess.run(make + ['-C', str(root), 'O=' + str(directory / 'producer'), 'ARCH=arm64', 'LLVM=1', 'allnoconfig'], check=True) compiler = directory / 'producer/scripts/kconfig/conf' for usb, phy_setting in [('n', 'y'), ('y', 'y'), ('m', 'y'), ('m', 'm')]: From 5269f2bdc0854bc277b83b89c9ce72f962e9cfb4 Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Mon, 26 Oct 2026 09:27:27 +1100 Subject: [PATCH 2/2] selftests: apple-dcp: initialize the lifetime endpoint command list AFK quiesce now cancels commands before destroying the endpoint queues. The AV lifetime fixtures construct endpoints without afk_init(), so their zeroed compact_cmds list is not a valid empty list. The devres-order case faults in the real cancellation path before its ordering assertions finish. Initialize that list at both fixture endpoint allocation sites, as the real endpoint initializer does. Keep the real teardown, blocked owner work and all release-order assertions in place. Signed-off-by: Ryan Murray --- drivers/gpu/drm/apple/av-lifetime-test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/apple/av-lifetime-test.c b/drivers/gpu/drm/apple/av-lifetime-test.c index 0232dfb670bbd..193358ce2bfba 100644 --- a/drivers/gpu/drm/apple/av-lifetime-test.c +++ b/drivers/gpu/drm/apple/av-lifetime-test.c @@ -155,6 +155,7 @@ static struct av_life_test *av_life_setup(struct kunit *test, work_func_t owner_ t->dcp->dev = t->dev; dev_set_drvdata(t->dev, t->dcp); spin_lock_init(&t->ep->lock); + INIT_LIST_HEAD(&t->ep->compact_cmds); init_rwsem(&t->asrv->srv_rwsem); INIT_WORK(&t->asrv->start_av_service_wq, owner_fn); INIT_WORK(&t->asrv->terminate_wq, owner_fn); @@ -484,6 +485,7 @@ static struct av_life_test *av_life_group_setup(struct kunit *test, t->ep = devm_kzalloc(t->dev, sizeof(*t->ep), GFP_KERNEL); KUNIT_ASSERT_NOT_NULL(test, t->ep); spin_lock_init(&t->ep->lock); + INIT_LIST_HEAD(&t->ep->compact_cmds); t->ep->dcp = t->dcp; t->wq = alloc_ordered_workqueue("av-lifetime-devres", 0); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, t->wq);