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
8 changes: 5 additions & 3 deletions arch/arm64/boot/dts/apple/t6040.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -866,15 +866,17 @@

/*
* The GPU (soc-device 13). Without it the running PMP treats
* the GPU as off and holds it at its lowest state.
* the GPU as off and holds it at its lowest state, but claiming
* it while nothing powers the GPU crashes the PMP firmware
* (SError) right after it starts. The GPU node takes it as a
* power domain, so it is on only while the GPU driver runs.
*/
report@d {
pmp_gfx: report@d {
compatible = "apple,t6041-pmp-v2-report-entry",
"apple,t6000-pmp-v2-report-entry";
reg = <0xd>;
label = "pmp-gfx";
#power-domain-cells = <0>;
apple,always-on;
};
};

Expand Down
38 changes: 28 additions & 10 deletions drivers/soc/apple/pmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,34 +654,48 @@ struct PmpHwConfig {
/// Check the firmware's `uuid` header before trusting the boot argument
/// block it points to.
check_bootargs_uuid: bool,
coreanalytics: bool,
/// When the firmware needs system endpoint 7 (CoreAnalytics) started
/// and given its buffer before it acknowledges the IOP power state.
coreanalytics: Ep7,
}

/// Whether a PMP firmware needs endpoint 7 to finish its RTKit boot.
#[derive(Clone, Copy, PartialEq, Eq)]
enum Ep7 {
/// Never started.
No,
/// Only on the retained J713 board.
RetainedBoard,
/// On every board with this SoC.
Always,
}

const HW_CFG_DEFAULT: PmpHwConfig = PmpHwConfig {
dma_mask: None,
check_bootargs_uuid: false,
coreanalytics: false,
coreanalytics: Ep7::No,
};

/// T8140: the DART translates 42 bits and its DMA window starts at 1 TiB.
const HW_CFG_T8140: PmpHwConfig = PmpHwConfig {
dma_mask: Some(DmaMask::new::<42>()),
check_bootargs_uuid: false,
coreanalytics: false,
coreanalytics: Ep7::No,
};

/// T6041: the DART window starts at 1 TiB; the boot argument header is
/// version 5.
/// version 5. The firmware advertises endpoint 7 and does not acknowledge
/// the IOP power state (-ETIME) until it is started and has its buffer.
const HW_CFG_T6041: PmpHwConfig = PmpHwConfig {
dma_mask: Some(DmaMask::new::<42>()),
check_bootargs_uuid: true,
coreanalytics: false,
coreanalytics: Ep7::Always,
};

const HW_CFG_T8132: PmpHwConfig = PmpHwConfig {
dma_mask: None,
check_bootargs_uuid: false,
coreanalytics: true,
coreanalytics: Ep7::RetainedBoard,
};

impl Drop for PmpDriver {
Expand Down Expand Up @@ -747,10 +761,14 @@ impl platform::Driver for PmpDriver {
patches.push((from_fourcc(b"PMCB"), (v >> 3) & 1), GFP_KERNEL)?;
}
data.patch_bootargs(&pmp_mmio, &patches, cfg.check_bootargs_uuid)?;
// EP7 is a qualified startup dependency only on the retained J713 PMP.
// SAFETY: the predicate only reads machine compatibility.
let needs_coreanalytics =
cfg.coreanalytics && unsafe { bindings::apple_pmp_telemetry_retained_board() };
// EP7 is a startup dependency on every T6041 PMP, and on the
// retained J713 PMP among the T8132 boards.
let needs_coreanalytics = match cfg.coreanalytics {
Ep7::No => false,
Ep7::Always => true,
// SAFETY: the predicate only reads machine compatibility.
Ep7::RetainedBoard => unsafe { bindings::apple_pmp_telemetry_retained_board() },
};
let rtkit = if needs_coreanalytics {
rtkit::RtKit::<PmpData>::new_with_coreanalytics(&dev, None, 0, data.clone())?
} else {
Expand Down