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
5 changes: 5 additions & 0 deletions Documentation/ABI/testing/sysfs-driver-apple-sep
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ Description:
ended without publishing /dev/sep-bio, or
activation failed. Neither is retried before
the next boot.
absent The device tree says the machine has no
fingerprint sensor (apple,no-biometric-sensor
on the SEP node): /dev/sep-bio is not
published. The keybag, trusted keys and
/dev/sep-bio-rearm work as elsewhere.
========= ============================================

There is no read-only install: the xart_writes and
Expand Down
7 changes: 7 additions & 0 deletions Documentation/devicetree/bindings/soc/apple/apple,sep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ properties:
The signed local boot policy of the running boot, added by the
bootloader, for the same purpose.

apple,no-biometric-sensor:
type: boolean
description:
The machine has no fingerprint sensor for the SEP, though the SoC has
the sensor's SPI bus (a desktop without built-in Touch ID). The SEP
runs without biometrics.

status: true

required:
Expand Down
17 changes: 16 additions & 1 deletion arch/arm64/boot/dts/apple/t6041-j575c.dts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
disp0 = &display;
disp0-piodma = &disp0_piodma;
nvram = &nvram;
sep = &sep;
};

chosen {
Expand Down Expand Up @@ -2087,7 +2088,21 @@
#include "t6041-j575c-usbc-dcpext2.dtsi"
#include "t6041-j575c-hdmi.dtsi"

/* Not described: the SEP (no Touch ID sensor). */
/*
* The SEP, as on the J614c and J616c: iBoot hands it over booted (ADT sep
* sepfw-booted, iop-sep,ascwrap-v6) at the t604x.dtsi addresses and
* interrupts, behind dart-sep with the same vm-base and vm-size. The sep
* alias lets the loader reserve the SEP firmware; apple_sep enables the SEP
* and its DART. The ADT has no Touch ID sensor (no spi2/mesa): spi2 and the
* sensor node stay disabled.
*/
&sep {
apple,no-biometric-sensor;
};

&sep_mbox {
status = "okay";
};

/*
* The PMP, as the M4 Max MacBook Pros run it. The pmp alias lets the loader
Expand Down
7 changes: 7 additions & 0 deletions drivers/soc/apple/diag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ extern "C" {
fn sep_diag_set_sensor_result(bind: c_uint, online: bool);
fn sep_diag_set_bio_published();
fn sep_diag_set_touchid(started: bool);
fn sep_diag_set_touchid_absent();
fn sep_diag_set_sensor_attach(state: c_int);
fn sep_diag_set_restore(state: c_int);
fn sep_diag_set_xart_guard(level: c_uint, list_loaded: bool, matching: c_int);
Expand Down Expand Up @@ -246,6 +247,12 @@ pub(crate) fn touchid(started: bool) {
unsafe { sep_diag_set_touchid(started) };
}

/// The machine has no fingerprint sensor: `/dev/sep-bio` is not published.
pub(crate) fn touchid_absent() {
// SAFETY: no preconditions; updates one word.
unsafe { sep_diag_set_touchid_absent() };
}

/// How far the attach of the sensor got, `SEP_DIAG_SENSOR_ATTACH_*`.
pub(crate) fn sensor_attach(state: registration::AttachState) {
// SAFETY: no preconditions; stores one word.
Expand Down
13 changes: 13 additions & 0 deletions drivers/soc/apple/diag_shim.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
#define SEP_DIAG_TOUCHID_UNAVAILABLE 2
#define SEP_DIAG_TOUCHID_STARTED 3
#define SEP_DIAG_TOUCHID_FAILED 4
#define SEP_DIAG_TOUCHID_ABSENT 5

/* The SEP's endpoint numbers are one byte. */
#define SEP_DIAG_MAX_EP 256
Expand Down Expand Up @@ -358,6 +359,9 @@ static ssize_t touchid_show(struct device *dev, struct device_attribute *attr,
case SEP_DIAG_TOUCHID_FAILED:
state = "failed";
break;
case SEP_DIAG_TOUCHID_ABSENT:
state = "absent";
break;
default:
state = "unknown";
break;
Expand Down Expand Up @@ -986,6 +990,15 @@ void sep_diag_set_bio_published(void)
sep_diag_notify_kn(&sep_diag.touchid_kn);
}

/* No sensor on this machine: /dev/sep-bio is never published this boot. */
void sep_diag_set_touchid_absent(void)
{
if (atomic_cmpxchg(&sep_diag.touchid, SEP_DIAG_TOUCHID_PENDING,
SEP_DIAG_TOUCHID_ABSENT) ==
SEP_DIAG_TOUCHID_PENDING)
sep_diag_notify_kn(&sep_diag.touchid_kn);
}

void sep_diag_set_touchid(bool started)
{
int state = started ? SEP_DIAG_TOUCHID_STARTED : SEP_DIAG_TOUCHID_FAILED;
Expand Down
9 changes: 9 additions & 0 deletions drivers/soc/apple/dt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const DMA_RANGE_PROP: &CStr = c"apple,dma-range";
const REGISTERED_PROP: &CStr = c"apple,sep-shmem-registered-iova";
const CHOSEN_PATH: &CStr = c"/chosen";
const PREBOOT_UUID_PROP: &CStr = c"apfs-preboot-uuid";
const NO_SENSOR_PROP: &CStr = c"apple,no-biometric-sensor";

pub(crate) struct DtNode(*mut bindings::device_node);

Expand Down Expand Up @@ -157,6 +158,14 @@ pub(crate) fn sep_node() -> Option<DtNode> {
DtNode::find_compatible(SEP_COMPATIBLE)
}

/// Whether the board's device tree says the machine has no fingerprint
/// sensor on the SEP (`apple,no-biometric-sensor`). The SoC's sensor bus and
/// sensor node can still be described there, disabled; without this property
/// a disabled sensor node is enabled at the first open of `/dev/sep-bio`.
pub(crate) fn no_biometric_sensor() -> bool {
sep_node().is_some_and(|sep| sep.has_property(NO_SENSOR_PROP))
}

pub(crate) fn preboot_uuid() -> Option<[u8; 16]> {
// SAFETY: the path is NUL-terminated; a non-NULL result owns one node
// reference, which `DtNode` releases.
Expand Down
13 changes: 12 additions & 1 deletion drivers/soc/apple/sbio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2348,7 +2348,18 @@ impl SepData {
}
// Either one was already persisted or one has just been.
diag::keybag(diag::Keybag::Present);
if let Err(e) = self.register_bio() {
// With no sensor there is nothing to enrol or match: publishing
// /dev/sep-bio would only have its first open look for one. The keybag
// above still backs the trusted keys, /dev/sep-key and the per-user
// key bags on /dev/sep-bio-rearm.
if dt::no_biometric_sensor() {
dev_info_ratelimited!(
self.dev,
"bringup: the device tree describes no fingerprint sensor; /dev/{} is not published\n",
bio::DEVICE_NAME
);
diag::touchid_absent();
} else if let Err(e) = self.register_bio() {
dev_err_ratelimited!(
self.dev,
"bringup: could not publish /dev/{} after SKS became ready: {:?}\n",
Expand Down
1 change: 1 addition & 0 deletions drivers/soc/apple/shim.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ unsigned int sep_diag_sensor_bind(void);
void sep_diag_set_sensor_result(unsigned int bind, bool online);
void sep_diag_set_bio_published(void);
void sep_diag_set_touchid(bool started);
void sep_diag_set_touchid_absent(void);
void sep_diag_set_sensor_attach(int state);
void sep_diag_set_restore(int state);
void sep_diag_set_xart_guard(unsigned int level, bool list_loaded,
Expand Down
Loading