Skip to content
Closed
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
103 changes: 103 additions & 0 deletions Documentation/arch/arm64/apple-pmp.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
.. SPDX-License-Identifier: GPL-2.0-only OR MIT

T6000 and T8112 PMP boot inputs
==============================

The ``apple,t6000-pmp-v2`` Rust driver starts firmware already loaded in PMP
SRAM. T8112 uses this compatible as a fallback. Linux does not load a PMP
firmware file. The bootloader must preserve the resident image, prepare the
PMP DART protection filter and pass the current boot's calibration.

Inputs read by the driver
-------------------------

* ``compatible`` selects the transport configuration.
* ``reg`` and ``reg-names`` provide ``pmp`` SRAM (at least 0x80000 bytes) and
``asc`` control registers (at least 0x4000 bytes).
* ``mboxes`` index 0 supplies RTKit's mailbox. The binding names it ``mbox``.
* ``iommus`` attaches the PMP to its DART. The power-domain resources of the
PMP, DART, mailbox and report region must remain powered as required.
* ``apple,board-id`` and ``apple,dram-vendor-id`` are required u32 values.
They patch the BDID and DVID integer boot arguments before ASC RUN.
* ``apple,dram-capacity`` (DCAP), ``apple,dram-channel-disable`` (DCHD),
``apple,pmc`` (PMC_), ``apple,pmc-msg-disabled`` (PMCX), and
``apple,soc-chip-variant`` (CVAR) are optional u32 boot arguments.
``apple,pmc-pmgr`` supplies bit 0 as PMCV and bit 3 as PMCB. Missing optional
values leave the corresponding resident firmware argument unchanged; the
protocol defaults are zero. Do not invent later-SoC PMC values for these
targets.
* ``apple,pio-ranges`` is an optional array of u64 address/size pairs used
when firmware requests an IOVA table. T6000's seven pairs are described in
``t6000.dtsi``. T8112 has no PIO mapper table.
* ``apple,tunable-<name>`` supplies opaque bytes when firmware requests an
IORegistry value named ``<name>``. This is an open firmware-driven set,
including tables such as ``soc-device`` and ``ptd-range``. It cannot be
replaced by a fixed list of tunables in DTS. Missing values are returned
as missing, and values larger than the firmware buffer are refused.

There is no extra ``apple,pmp-report`` requirement in the Rust driver's
T6000/T8112 probe path. The report provider has its own compatible, MMIO,
power domain and consumer entries. Its startup report is at offset 0x10.
T6000 request/read/update/ACK offsets are 0xf80/0x107c0/0x1000; T8112 uses
0xa00/0x10500/0xa40. The presence of a report provider alone does not start PMP. Its read-only
``/sys/kernel/debug/apple-pmp-report/<device>`` file exposes ``running`` even
when the provider has no fast-die sensors or deferred-start controller.

Bootloader and static DT responsibilities
----------------------------------------

Aura's Stage 2 ``dt_set_pmp()`` traditionally resolves the ``pmp`` alias,
copies ``/chosen/board-id`` and ``/chosen/dram-vendor-id`` as big-endian DT
u32 cells, optionally copies ``iop-pmp-nub/dram-capacity``, and transfers the
remaining ``/arm-io/pmp/iop-pmp-nub`` properties to ``apple,tunable-*`` without
changing byte order. Transport metadata (compatible, phandle, firmware/segment
and region information, preload marker, name, coredump flag) is excluded.
T6040/J616s and T8140 use this common alias path. It is not a source of fixed
board or DRAM-vendor constants.

T6000 and T8112 normally omit that alias. Stage 2 now finds their existing
PMP node by compatible and publishes the same values, preserving the supplied
status even when an alias exists. Thus a disabled node can carry complete
boot data without starting the coprocessor. Invalid scalar widths are refused.
The raw ADT and calibration values are per-boot data and must not be committed.

``APPLE_USE_PMP`` is an explicit experimental DT build profile. It adds the
alias, enables the PMP node and routes existing DCP/AVD/ISP consumers (and the
T8112 GPU) through their PMP report domains. Compile the entire board DT with
this define; a status-only edit does not select that power-domain graph.
Default DTs remain disabled pending hardware qualification. Compile each
qualified board separately rather than enabling this define for a fleet set.

``tools/asahi/t6000-t8112-pmp-dt-tests.py`` also emits a separate J413
``pmp-avd-vmax`` test DTB. It keeps AVD on its physical PMGR core and disables
the native AVD report entry, leaving bit 10 unclaimed for the t-4501 runtime
loader's core/perf graph. This is a separate cold-boot profile, not a live
fallback from the full PMP graph. The loader must retain all its normal
running, calibration-layout, provider and module-version checks.

Transport match data
--------------------

``HW_CFG_DEFAULT`` is the original T6000 transport configuration and T8112's
fallback: no DMA mask override, no mandatory UUID-version-5 header check and
no CoreAnalytics endpoint 7. Both use application endpoint 0x20. T6000's
PIO area starts at 0xc0000000; T8112's DART window is below 4 GiB. The newer
42-bit windows and mandatory endpoint-7 handshake are not applicable.
Four T6000 and five T8112 DCS states are report/DRAM-description facts; they
do not require a different RTKit transport or an inferred frequency table.

Qualification and failure boundary
----------------------------------

Test Stage 2 in RAM over a proven tether first, with a recoverable baseline
boot. Require successful RTKit startup, endpoint 0x20, registry confirmation,
``running: 1``, and a successful existing consumer request/ACK before attempting
new performance votes. The running bit is retained state, not a freshness
challenge. Compare idle thermals, frequency policy and kernel errors with the
baseline before running AVD performance tests.

Once ASC RUN is set, firmware can own fabric, memory and thermal controllers.
A failed start, crash, stall or ACK timeout is not permission to unbind PMP,
clear RUN, rewrite DART/PIO mappings or restore the consumer graph in place.
Retain the resource graph and recover by rebooting into the baseline. No new
FAST-DIE, energy, PMC/CLPC or memory-cache client is qualified by this profile.
1 change: 1 addition & 0 deletions Documentation/arch/arm64/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ ARM64 Architecture
aurora-apif-platform
apple-j813
apple-m6-cpu
apple-pmp
arm-acpi
arm-cca
asymmetric-32bit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,18 @@ patternProperties:
The device also has a performance request. While the domain is
powered, after the PMP acknowledges the device, the host writes the
level (with the valid bit) to the entry once; before clearing the
device request it writes level 0.
device request it writes level 0. On T8112, only the AVD request at
entry 0xb0 is qualified; level 2 requests SOC VMAX. The provider
owns the whole request word and preserves other software-owned
request classes.

apple,dvfs-request-class:
$ref: /schemas/types.yaml#/definitions/uint32
const: 0x25
description:
Request class containing the performance level. Class 0x25 uses
bits 51:48. If absent, apple,dvfs retains the default bits 4:0
encoding.

apple,always-on:
type: boolean
Expand All @@ -168,6 +179,27 @@ patternProperties:
switched with interrupts disabled. Setting the state takes a
spinlock and polls the acknowledgment atomically.

allOf:
- if:
properties:
compatible:
contains:
const: apple,t8112-pmp-v2-report-entry
required:
- apple,dvfs
then:
properties:
apple,dvfs:
items:
- const: 0xb0
- const: 2
required:
- apple,dvfs-request-class

dependentRequired:
apple,dvfs-request-class:
- apple,dvfs

required:
- compatible
- reg
Expand Down
13 changes: 10 additions & 3 deletions Documentation/devicetree/bindings/soc/apple/apple,pmp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ description: |
RTKit and supplies calibration copied from the Apple device tree. The
bootloader must initialize the PMP DART address protection filter before
Linux starts the firmware. Firmware-owned PMC power state must be retained.
On T6000 and T8112 the board and DRAM vendor identifiers are required at
runtime, together with the firmware-requested calibration. They are supplied
from the current boot's Apple device tree, not from static board DTS values.

properties:
compatible:
Expand All @@ -26,6 +29,7 @@ properties:
- enum:
- apple,t6030-pmp-v2
- apple,t6031-pmp-v2
- apple,t8112-pmp-v2
- apple,t6041-pmp-v2
- apple,t8122-pmp-v2
- apple,t8132-pmp-v2
Expand Down Expand Up @@ -60,11 +64,11 @@ properties:

apple,board-id:
$ref: /schemas/types.yaml#/definitions/uint32
description: Board identifier copied by the bootloader.
description: Required runtime board identifier copied from ADT /chosen/board-id.

apple,dram-vendor-id:
$ref: /schemas/types.yaml#/definitions/uint32
description: DRAM vendor identifier copied by the bootloader.
description: Required runtime DRAM vendor identifier copied from ADT /chosen/dram-vendor-id.

apple,dram-capacity:
$ref: /schemas/types.yaml#/definitions/uint32
Expand Down Expand Up @@ -95,7 +99,10 @@ properties:
apple,pio-ranges:
$ref: /schemas/types.yaml#/definitions/uint64-array
minItems: 2
description: Host physical address and size pairs mapped into firmware PIO space.
maxItems: 36
description: |
Host physical address and size pairs mapped into firmware PIO space.
T6000 supplies its SoC-specific mapper ranges; T8112 has no PIO table.

patternProperties:
'^apple,tunable-':
Expand Down
5 changes: 5 additions & 0 deletions arch/arm64/boot/dts/apple/t600x-die0.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,12 @@
mbox-names = "mbox";
iommus = <&pmp_dart 0>;
power-domains = <&ps_pmp>;
/* The bootloader supplies board/DRAM IDs and PMP calibration. */
#ifdef APPLE_USE_PMP
status = "okay";
#else
status = "disabled";
#endif
};

pmp_mbox: mbox@28ec08000 {
Expand Down
10 changes: 9 additions & 1 deletion arch/arm64/boot/dts/apple/t8112.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,8 @@
label = "pmp-avd-sys";
#power-domain-cells = <0>;
power-domains = <&ps_avd_sys>;
apple,dvfs = <0xb0 2>;
apple,dvfs-request-class = <0x25>;
};

pmp_report_msr: report@b {
Expand Down Expand Up @@ -1272,7 +1274,12 @@
mbox-names = "mbox";
iommus = <&pmp_dart 0>;
power-domains = <&ps_pmp>;
/* The bootloader supplies board/DRAM IDs and PMP calibration. */
#ifdef APPLE_USE_PMP
status = "okay";
#else
status = "disabled";
#endif
};

pmgr: power-management@23b700000 {
Expand Down Expand Up @@ -1759,7 +1766,8 @@
interrupts = <AIC_IRQ 667 IRQ_TYPE_LEVEL_HIGH>,
<AIC_IRQ 668 IRQ_TYPE_LEVEL_HIGH>;
#ifdef APPLE_USE_PMP
power-domains = <&pmp_report_avd_sys>;
power-domains = <&ps_avd_sys>, <&pmp_report_avd_sys>;
power-domain-names = "core", "perf";
#else
power-domains = <&ps_avd_sys>;
#endif
Expand Down
6 changes: 4 additions & 2 deletions drivers/pmdomain/apple/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ config APPLE_PMC_KUNIT_TEST
registers are simulated in memory. Only useful for kernel developers.

config APPLE_PMP_REPORT_START_KUNIT_TEST
bool "KUnit tests for starting a halted Apple PMP" if !KUNIT_ALL_TESTS
bool "KUnit tests for Apple PMP startup and device DVFS" if !KUNIT_ALL_TESTS
depends on APPLE_PMP_REPORT && KUNIT=y
default KUNIT_ALL_TESTS
help
Expand All @@ -98,7 +98,9 @@ config APPLE_PMP_REPORT_START_KUNIT_TEST
report ready or acknowledge its startup requests, consumers that
time out, and the teardown of the report and its entries while a
start or a consumer waits. The report region is simulated in
memory. Only useful for kernel developers.
memory. Also checks T8112 device DVFS encoding, ACK failures and
idle release using emulated request and update windows.
Only useful for kernel developers.

endif

Expand Down
Loading