Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ properties:
bypass. The host continues servicing system endpoints without restarting
the coprocessor or taking it to QUIESCED.

apple,rtkit-keep-running:
type: boolean
description: |
The helper's firmware cannot be restarted once it has been taken to
QUIESCED, so a boot stage that starts it hands its first RTKit epoch to
the OS running, with apple,rtkit-handoff, instead of stopping it. Set by
the board device tree for the firmware it describes. The OS does not
read it.

apple,rtkit-buffers:
oneOf:
- type: boolean
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/boot/dts/apple/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ dtb-$(CONFIG_ARCH_APPLE) += t6050-k114s.dtb
dtb-$(CONFIG_ARCH_APPLE) += t6050-k116c.dtb
dtb-$(CONFIG_ARCH_APPLE) += t6050-k116s.dtb
dtb-$(CONFIG_ARCH_APPLE) += t8112-j413.dtb
dtb-$(CONFIG_ARCH_APPLE) += t8112-j413-fw27.dtb
dtb-$(CONFIG_ARCH_APPLE) += t8112-j415.dtb
dtb-$(CONFIG_ARCH_APPLE) += t8112-j473.dtb
dtb-$(CONFIG_ARCH_APPLE) += t8112-j493.dtb
Expand Down
18 changes: 18 additions & 0 deletions arch/arm64/boot/dts/apple/t8112-j413-fw27.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: GPL-2.0+ OR MIT
/* J413 with macOS 27 system firmware (27.2 stub). */
#include "t8112-j413.dts"

/*
* The 27.x MTP firmware cannot be restarted once quiesced: a boot stage that
* starts it hands it over running (apple,rtkit-handoff).
*/
&mtp {
apple,rtkit-keep-running;
};

/* The 27.x trackpad firmware answers only the two-stage power command. */
&mtp_hid {
multi-touch {
apple,power-method = <2>;
};
};
5 changes: 5 additions & 0 deletions arch/arm64/boot/dts/apple/t8122-j613.dts
Original file line number Diff line number Diff line change
Expand Up @@ -432,3 +432,8 @@
/* Per-device factory data from this Mac's own iBoot system container. */
firmware-name = "apple/mesacal-j613.bin";
};

/* The J613 MTP firmware cannot be restarted once quiesced: hand it over running. */
&mtp {
apple,rtkit-keep-running;
};
9 changes: 6 additions & 3 deletions drivers/iommu/apple-dart.c
Original file line number Diff line number Diff line change
Expand Up @@ -5833,9 +5833,12 @@ static int apple_dart_probe(struct platform_device *pdev)
ret = -EINVAL;
goto err_clk_disable;
}
if (stream && (!of_machine_is_compatible("apple,j613") ||
!of_device_is_compatible(dev->of_node, "apple,t8122-dart") ||
res->start != 0x2fa808000ULL || !dart->supports_bypass ||
/*
* Inherit the stream only if this DART can bypass and the boot
* stage really left that stream in bypass: the TCR read back is
* the hardware's own statement of the handoff, on any board.
*/
if (stream && (!dart->supports_bypass ||
stream != 1 || stream >= dart->num_streams ||
apple_dart_readl(dart, DART_TCR(dart, stream)) != dart->hw->tcr_bypass)) {
ret = -EINVAL;
Expand Down
8 changes: 6 additions & 2 deletions drivers/soc/apple/rtkit-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,11 @@ static int __maybe_unused apple_rtkit_helper_suspend(struct device *dev)

if (helper->adopted && pm_suspend_target_state != PM_SUSPEND_TO_IDLE)
return -EBUSY;
if (!helper->adopted || !of_machine_is_compatible("apple,j613"))
/*
* An adopted session (apple,rtkit-handoff) was handed over running
* because it cannot be restarted, whatever the board.
*/
if (!helper->adopted)
return 0;
if (!(readl(helper->asc_base + APPLE_ASC_CPU_CONTROL) & APPLE_ASC_CPU_CONTROL_RUN))
return -EHOSTDOWN;
Expand All @@ -559,7 +563,7 @@ static int __maybe_unused apple_rtkit_helper_resume(struct device *dev)

/* After a firmware-driven suspend's idle notice; nothing otherwise. */
apple_rtkit_helper_ap_on(helper);
if (!helper->adopted || !of_machine_is_compatible("apple,j613"))
if (!helper->adopted)
return 0;
if (!(readl(helper->asc_base + APPLE_ASC_CPU_CONTROL) & APPLE_ASC_CPU_CONTROL_RUN)) {
dev_err(dev, "adopted MTP lost ASC RUN; refusing firmware restart\n");
Expand Down
9 changes: 8 additions & 1 deletion scripts/dtc/apple-dt-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
# and fail when HEAD has a warning BASE does not. Also runs dt_binding_check on every binding HEAD
# changes. Phandle values in the messages are masked, so renumbering is not a new warning, and so
# is the pattern list of a "does not match any of the regexes" message, which grows with every
# vendor prefix the bindings add.
# vendor prefix the bindings add. A firmware-profile variant (a .dts that includes another board's
# .dts, such as t8122-j613-25g83) is reported under its base board's name, so the base's existing
# warnings are not new warnings of the variant; anything the variant adds still is.
# Needs dtschema (dt-validate), clang/lld (LLVM=1), flex, bison. Prints a summary.
set -u
BASE=$1 HEAD=$2 W=$3
Expand All @@ -17,8 +19,13 @@ warnings() { # rev tag
local dtbs; dtbs=$(cd "$t/arch/arm64/boot/dts" && ls apple/*.dts | sed 's/dts$/dtb/')
make -C "$t" O="$o" -j"$(nproc)" CHECK_DTBS=y $dtbs > "$W/$2.log" 2>&1
local rc=$?
local variants; variants=$(cd "$t/arch/arm64/boot/dts" &&
grep -l '^#include "[^"]*\.dts"' apple/*.dts 2>/dev/null | while read -r v; do
sed -nE 's#^\#include "([^"]*)\.dts".*#s|^'"${v%.dts}"'\\.dtb: |apple/\1.dtb: |;#p' "$v" | head -1
done)
grep -E '\.dtb: |[Ww]arning|rror' "$W/$2.log" | grep -v '^ ' |
sed -E "s#$t/##g; s#$o/##g" |
sed -E "s#arch/arm64/boot/dts/##; $variants" | sed -E 's#^apple/#arch/arm64/boot/dts/apple/#' |
perl -pe 's{(\[\[[^:]*?\]\])}{(my $x = $1) =~ s/\d+/N/g; $x}ge; s{b\x27(?:\\.|[^\x27])*\x27}{b\x27N\x27}g; s{( not match any of the regexes): .*}{$1: ...}' |
sort -u > "$W/$2.warn"
echo "$2: make rc=$rc, $(wc -l < "$W/$2.warn") warning lines, $(echo $dtbs | wc -w) DTBs"
Expand Down
1 change: 0 additions & 1 deletion tools/asahi/j613-mtp-s2idle-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def fn(s,n):
static unsigned forced_suspend,forced_resume;
static int pm_runtime_force_suspend(struct device *d){forced_suspend++;return 7;}
static int pm_runtime_force_resume(struct device *d){forced_resume++;return 8;}
static bool of_machine_is_compatible(const char *s){return true;}
static unsigned readl(void *p){return *(unsigned *)p;}
/* #1445: only a firmware-driven (T8140 S2R) sleep takes the noirq or AP-idle paths. */
static bool pm_suspend_via_firmware(void){return false;}
Expand Down
Loading