diff --git a/drivers/gpu/drm/asahi/driver.rs b/drivers/gpu/drm/asahi/driver.rs index 80582ece5d2391..afce767ac3e3c8 100644 --- a/drivers/gpu/drm/asahi/driver.rs +++ b/drivers/gpu/drm/asahi/driver.rs @@ -231,6 +231,9 @@ impl platform::Driver for AsahiPlatformDriver { _pdev: &'bound platform::Device>, this: Pin<&Self::Data<'bound>>, ) { + // SAFETY: Takes no arguments, process context. Clears the T6001 AGX request in the PMP report if the pmp_report.agx_vote + // parameter set it; a no-op everywhere else. + unsafe { bindings::apple_pmp_agx_activity_release() }; if let Some(gpu) = this.g17.as_ref() { // Driver data is dropped after devres, so CPU control must happen in unbind. gpu.shutdown(); @@ -249,6 +252,9 @@ impl platform::Driver for AsahiPlatformDriver { ) -> impl PinInit, Error> + 'bound { debug::update_debug_flags(); + // SAFETY: Takes no arguments, process context. Lets the T6001 AGX vote run again after an earlier unbind released it; a no-op everywhere else. + unsafe { bindings::apple_pmp_agx_activity_resume() }; + dev_info!(pdev.as_ref(), "Probing...\n"); let cfg = match info.ok_or(ENODEV)? { diff --git a/drivers/gpu/drm/asahi/gpu.rs b/drivers/gpu/drm/asahi/gpu.rs index 84d82bb1880ef2..60acb7a2d5b376 100644 --- a/drivers/gpu/drm/asahi/gpu.rs +++ b/drivers/gpu/drm/asahi/gpu.rs @@ -1284,6 +1284,9 @@ impl GpuManager::ver { .with(|raw, _inner| raw.pending_submissions.fetch_add(1, Ordering::Acquire)); mod_dev_dbg!(self.dev, "OP start (pending: {})\n", val + 1); + // SAFETY: Takes no arguments and does nothing unless pmp_report.agx_vote is set on a T6001. The matching end call is made + // by OpGuard's Drop, and the guard is created right below, so every path out of here (including a failed kick) pairs it. + unsafe { kernel::bindings::apple_pmp_agx_activity_begin() }; let guard = OpGuard(self.clone()); self.kick_firmware()?; Ok(guard) @@ -1804,5 +1807,7 @@ impl GpuManagerPriv for GpuManager::ver { .with(|raw, _inner| raw.pending_submissions.fetch_sub(1, Ordering::Release)); mod_dev_dbg!(self.dev, "OP end (pending: {})\n", val - 1); + // SAFETY: Pairs with the begin call in start_op(); callable from any context. + unsafe { kernel::bindings::apple_pmp_agx_activity_end() }; } } diff --git a/drivers/gpu/drm/asahi/queue/mod.rs b/drivers/gpu/drm/asahi/queue/mod.rs index 4abdd3e485f726..a53a8f77a8a779 100644 --- a/drivers/gpu/drm/asahi/queue/mod.rs +++ b/drivers/gpu/drm/asahi/queue/mod.rs @@ -697,12 +697,6 @@ impl Queue for Queue::ver { return Err(ENODEV); } - let op_guard = if in_sync_count > 0 { - Some(gpu.start_op()?) - } else { - None - }; - let mut events: [KVec>; SQ_COUNT] = Default::default(); @@ -791,7 +785,10 @@ impl Queue for Queue::ver { QueueJob::ver { dev: self.dev.clone(), vm_bind, - op_guard, + // The AGX activity guard is taken where the job reaches the firmware + // (the deferred start_op in run_job), not at ioctl time: a job blocked on + // input syncs would otherwise hold bit 9 while the GPU is idle. + op_guard: None, sj_vtx: self .q_vtx .as_mut() diff --git a/drivers/pmdomain/apple/pmp-agx-vote.h b/drivers/pmdomain/apple/pmp-agx-vote.h new file mode 100644 index 00000000000000..f3385eb7528a5f --- /dev/null +++ b/drivers/pmdomain/apple/pmp-agx-vote.h @@ -0,0 +1,180 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR MIT */ +/* + * When the T6001 AGX request (PS-REQ bit 9 of the PMP report) is set and cleared. + * + * The GPU driver counts operations in flight (begin/end). The request is set when the first operation starts and cleared + * idle_ms after the last one ends, so a decode stream (a burst every ~10 ms) holds one vote and an idle GPU drops it. All state + * changes are in these functions; the caller serializes them with one spinlock and does the register write between + * agx_vote_decide() and agx_vote_applied(). Times are milliseconds from any wrapping clock. + */ +#ifndef PMP_AGX_VOTE_H +#define PMP_AGX_VOTE_H + +#ifdef __KERNEL__ +#include +/* jiffies_to_msecs() returns u32: the clock wraps every 49.7 days, and every compare below is done in 32 bits. */ +typedef u32 agx_ms_t; +typedef s32 agx_sms_t; +#else +#include +#include +typedef uint32_t agx_ms_t; +typedef int32_t agx_sms_t; +#endif + +/* Stop reasons. Each owner sets and clears only its own bit: a resume from one (PM_POST_SUSPEND after a sleep) + * must not re-enable votes another still refuses (a GPU unbind), and the reverse. */ +#define AGX_STOP_GPU (1u << 0) /* the GPU driver released (unbind) */ +#define AGX_STOP_REPORT (1u << 1) /* this report is being removed */ +#define AGX_STOP_SLEEP (1u << 2) /* the system is suspending or hibernating */ + +/* How long the request is held after the last operation ends. w7X measured idle gaps of up to 111.5 ms inside one 9B generation, so 100 ms + * was not enough; 250 ms is about 2.2 times the largest gap seen. The parameter pmp_report.agx_vote_idle_ms overrides it at run time. */ +#define AGX_VOTE_IDLE_MS_DEFAULT 250 + +/* After a set that was not acknowledged (or a PMP that is not running), wait this long before trying again. */ +#define AGX_VOTE_RETRY_MS 1000 + +struct agx_vote { + bool enabled; /* the module parameter */ + bool voted; /* bit 9 is set and was acknowledged */ + unsigned int stopped; /* AGX_STOP_* bits set by release/refuse: no new vote until every reason's resume() */ + unsigned int users; /* GPU operations in flight */ + agx_ms_t idle_ms; /* keep the vote this long after the last operation ends */ + agx_ms_t idle_at; /* when users last fell to 0 */ + unsigned int failures; /* consecutive failed sets; the backoff applies only while this is nonzero */ + agx_ms_t retry_at; /* with failures: no new set before this */ +}; + +enum agx_vote_action { + AGX_VOTE_NONE, + AGX_VOTE_SET, + AGX_VOTE_CLEAR, +}; + +static inline bool agx_vote_reached(agx_ms_t now, agx_ms_t t) +{ + return (agx_sms_t)(now - t) >= 0; +} + +/* A retry deadline more than one backoff window in the future cannot be real: an idle gap beyond half the + * 32-bit millisecond range makes the wrapped arithmetic read an expired deadline as future. Treat it as expired. */ +static inline bool agx_vote_retry_reached(const struct agx_vote *v, agx_ms_t now) +{ + return agx_vote_reached(now, v->retry_at) + || (agx_ms_t)(v->retry_at - now) > AGX_VOTE_RETRY_MS; +} + +/* An operation starts. now is the operation's start time in ms (any wrapping clock; the caller reads it + * under its lock). Returns the delay in ms until the reconcile step must run, in the same terms as + * agx_vote_end(): 1 runs it now, 0 means nothing is pending. A begin during a failed-set backoff returns the + * remaining backoff (retry_at - now): the reconcile is already armed for the retry, so a later begin shortens + * the wait but never postpones it. It returns 1 once the deadline has passed. */ +static inline agx_ms_t agx_vote_begin(struct agx_vote *v, agx_ms_t now) +{ + v->users++; + if (!v->enabled || v->stopped) + return 0; + if (v->voted) + return 0; + return (!v->failures || agx_vote_retry_reached(v, now)) ? 1 : v->retry_at - now; +} + +/* An operation ends. Returns the delay in ms after which the reconcile step must run, 0 when none is needed. */ +static inline agx_ms_t agx_vote_end(struct agx_vote *v, agx_ms_t now) +{ + if (!v->users) /* unbalanced end: ignored */ + return 0; + if (--v->users) + return 0; + v->idle_at = now; + if (!v->enabled || !v->voted) + return 0; + return v->idle_ms ? v->idle_ms : 1; +} + +/* What the reconcile step must do now. */ +static inline enum agx_vote_action agx_vote_decide(const struct agx_vote *v, agx_ms_t now) +{ + if (!v->enabled || v->stopped) + return v->voted ? AGX_VOTE_CLEAR : AGX_VOTE_NONE; + if (v->users) + return !v->voted && (!v->failures || agx_vote_retry_reached(v, now)) ? AGX_VOTE_SET : AGX_VOTE_NONE; + if (v->voted && agx_vote_reached(now, v->idle_at + v->idle_ms)) + return AGX_VOTE_CLEAR; + return AGX_VOTE_NONE; +} + +/* + * Delay in ms until the reconcile step must run again, 0 when no timer is needed. 1 when work is due now: an + * operation began while a clear was being written (begin saw voted still true and did not kick), or an end + * landed inside the SET write so the vote is set with an already-reached idle deadline. The caller must run the + * reconcile those cases would otherwise skip; it cannot read 1 as "nothing pending". + */ +static inline agx_ms_t agx_vote_next(const struct agx_vote *v, agx_ms_t now) +{ + agx_ms_t at; + + if (!v->enabled || v->stopped) + return 0; + if (v->users && !v->voted && !v->failures) + return 1; + if (v->users && !v->voted && v->failures) + at = agx_vote_retry_reached(v, now) ? now : v->retry_at; + else if (!v->users && v->voted) + at = v->idle_at + v->idle_ms; + else if (!v->users && !v->voted && v->failures) + /* The write outlasted the operation: arm the retry from the failure state + * itself. The caller clears failures when this reconcile finds nobody waiting + * (decide returns NONE), so it fires once. */ + at = agx_vote_retry_reached(v, now) ? now : v->retry_at; + else + return 0; + /* An already-reached deadline returns 1: there is work, due now. The SET-write race leaves exactly + * this state (voted, no user, deadline passed), and 0 here would strand the vote set forever. */ + return agx_vote_reached(now, at) ? 1 : at - now; +} + +/* Record the outcome of the register write for `action` (ret 0: acknowledged). */ +static inline void agx_vote_applied(struct agx_vote *v, enum agx_vote_action action, int ret, agx_ms_t now) +{ + if (action == AGX_VOTE_SET) { + if (ret) { + v->failures++; + v->retry_at = now + AGX_VOTE_RETRY_MS; + } else { + v->voted = true; + v->failures = 0; + } + } else if (action == AGX_VOTE_CLEAR) { + v->voted = false; /* the write was made; the caller logs an unacknowledged clear */ + } +} + +/* + * The GPU driver unbinds, the report goes away, or the system sleeps: drop the vote now and refuse new ones. True when bit 9 is set and the caller must + * write the clear. An operation that begins afterwards (an ioctl already past the unplug check) counts as a user but does not vote. + */ +static inline bool agx_vote_release(struct agx_vote *v, unsigned int reason) +{ + bool was_voted = v->voted; + + v->voted = false; + v->stopped |= reason; + return was_voted; +} + +/* Refuse new votes without touching the one that is set (the first step of a release, before the work item is waited out). */ +static inline void agx_vote_refuse(struct agx_vote *v, unsigned int reason) +{ + v->stopped |= reason; +} + +/* The GPU probes (or the report comes back, or the system resumes): votes are allowed again. True when work is already in flight and the caller must run the reconcile step. */ +static inline bool agx_vote_resume(struct agx_vote *v, unsigned int reason) +{ + v->stopped &= ~reason; + return v->enabled && v->users && !v->voted && !v->stopped; +} + +#endif /* PMP_AGX_VOTE_H */ diff --git a/drivers/pmdomain/apple/pmp-report.c b/drivers/pmdomain/apple/pmp-report.c index 9aac3ced17cda1..9d6905716c29ba 100644 --- a/drivers/pmdomain/apple/pmp-report.c +++ b/drivers/pmdomain/apple/pmp-report.c @@ -27,10 +27,12 @@ #include #include #include +#include #include #include #include +#include "pmp-agx-vote.h" #include "pmp-report-validation.h" #define PMP_REPORT_READY 0x1 @@ -80,6 +82,19 @@ struct apple_pmp_report { }; static const struct apple_pmp_report_offsets apple_pmp_offsets_t6030; +static const struct apple_pmp_report_offsets apple_pmp_offsets_t600x; + +/* T6001 AGX request (see the engine below set_state): AGX is soc-device record 9 on the T6001. */ +#define APPLE_PMP_T6001_AGX_ID 9 +static bool agx_vote; +static struct agx_vote apple_pmp_agx_vote_state = {.idle_ms = AGX_VOTE_IDLE_MS_DEFAULT}; +static DEFINE_SPINLOCK(apple_pmp_agx_vote_lock); +/* Serializes the vote work, the unbind release and the report's removal. */ +static DEFINE_MUTEX(apple_pmp_agx_vote_mutex); +static void apple_pmp_agx_vote_fn(struct work_struct *work); +static DECLARE_DELAYED_WORK(apple_pmp_agx_vote_work, apple_pmp_agx_vote_fn); +static void apple_pmp_agx_vote_stop(void); +static void apple_pmp_agx_vote_stop_new(void); /* Bound report regions, protected by RCU until managed teardown drains readers. */ static LIST_HEAD(apple_pmp_reports); @@ -168,6 +183,12 @@ static void apple_pmp_report_release(void *data) /* Withdraw child providers while their power callbacks can still use MMIO. */ of_platform_depopulate(rep->dev); + if (rep->offsets == &apple_pmp_offsets_t600x) { + apple_pmp_agx_vote_stop_new(AGX_STOP_REPORT); + cancel_delayed_work_sync(&apple_pmp_agx_vote_work); + guard(mutex)(&apple_pmp_agx_vote_mutex); + apple_pmp_agx_vote_stop(AGX_STOP_REPORT); + } mutex_lock(&apple_pmp_reports_lock); if (!list_empty(&rep->list)) list_del_rcu(&rep->list); @@ -1133,6 +1154,10 @@ static int apple_pmp_report_probe(struct platform_device *pdev) list_add_tail_rcu(&rep->list, &apple_pmp_reports); mutex_unlock(&apple_pmp_reports_lock); + /* A report that comes back (rebind) takes votes again; its removal refused them. */ + if (rep->offsets == &apple_pmp_offsets_t600x) + apple_pmp_agx_vote_resume_reason(AGX_STOP_REPORT); + if (rep->offsets->fast_die || rep->start) rep->debugfs = debugfs_create_file(dev_name(dev), 0400, apple_pmp_report_debugfs, rep, @@ -1295,6 +1320,246 @@ static int apple_pmp_report_set_state(struct apple_pmp_report *rep, u32 id, 50000); } +/* + * T6001 AGX request. T2 showed that setting PS-REQ bit 9 (AGX, soc-device record 9) lifts the GPU read roof from 241 to 368 GB/s: the PMP + * leaves memory at its idle floor for a GPU that is busy but has not asked. The GPU driver reports operations in flight + * (apple_pmp_agx_activity_begin/end); the request is set while any operation runs and cleared agx_vote_idle_ms after the last one ends, at + * GPU unbind and when this report goes away. The decisions are in pmp-agx-vote.h (unit tested); this is the glue. + * Off by default (pmp_report.agx_vote): with it off nothing is written. + */ +static unsigned int agx_vote_idle_ms = AGX_VOTE_IDLE_MS_DEFAULT; + +static agx_ms_t apple_pmp_agx_now_ms(void) +{ + return jiffies_to_msecs(jiffies); +} + +/* + * Queue the reconcile step. agx_vote=1 on the kernel command line runs the parameter setter from parse_args(), before workqueue_init_early() has + * created system_dfl_wq; queueing on the NULL workqueue would oops in start_kernel(). Nothing is owed then: begin() and the work function read the + * parameter themselves, so the first GPU operation kicks. + */ +static void apple_pmp_agx_vote_kick(unsigned long delay_ms) +{ + struct workqueue_struct *wq = READ_ONCE(system_dfl_wq); + struct delayed_work *dw = &apple_pmp_agx_vote_work; + unsigned long expiry; + + if (!wq) + return; + /* mod_delayed_work() overwrites a pending timer even with a later expiry, so every unvoted begin() would + * push the owed set out another tick. A due-now kick re-arms to 0, which can only pull earlier; a later + * deadline re-arms only when it shortens the pending one. A running work item is not pending: its own + * agx_vote_next() call decides whether another pass is owed. */ + if (delay_ms <= 1) { + mod_delayed_work(wq, dw, 0); + return; + } + expiry = jiffies + msecs_to_jiffies(delay_ms); + if (!delayed_work_pending(dw) || time_before(expiry, dw->timer.expires)) + mod_delayed_work(wq, dw, msecs_to_jiffies(delay_ms)); +} + +static int apple_pmp_agx_vote_param_set(const char *val, const struct kernel_param *kp) +{ + int ret = param_set_bool(val, kp); + + if (!ret) + apple_pmp_agx_vote_kick(0); /* switching off clears at once, switching on votes if the GPU is busy */ + return ret; +} + +static const struct kernel_param_ops apple_pmp_agx_vote_ops = { + .set = apple_pmp_agx_vote_param_set, + .get = param_get_bool, +}; +module_param_cb(agx_vote, &apple_pmp_agx_vote_ops, &agx_vote, 0644); +MODULE_PARM_DESC(agx_vote, "T6001: set the AGX power request in the PMP report while the GPU has work in flight (default: off)"); +module_param(agx_vote_idle_ms, uint, 0644); +MODULE_PARM_DESC(agx_vote_idle_ms, "Keep the AGX request this many ms after the last GPU operation ends (default: 250)"); + +/* Write the AGX request of the bound T6001 report: -ENODEV without one, -EAGAIN (nothing written) when the PMP does not run. */ +static int apple_pmp_agx_write(bool enable, bool no_ack) +{ + struct apple_pmp_report *rep; + int ret = -ENODEV; + + if (!of_machine_is_compatible("apple,t6001")) + return ret; + rcu_read_lock(); + list_for_each_entry_rcu(rep, &apple_pmp_reports, list) { + if (rep->offsets != &apple_pmp_offsets_t600x) + continue; + if (enable && !(readq(rep->base + rep->offsets->status) & PMP_REPORT_READY)) + ret = -EAGAIN; + else + ret = apple_pmp_report_set_state(rep, APPLE_PMP_T6001_AGX_ID, enable, no_ack); + break; + } + rcu_read_unlock(); + return ret; +} + +/* Refuse new votes for one reason (the stopped mask), without writing anything. */ +static void apple_pmp_agx_vote_stop_new(unsigned int reason) +{ + unsigned long flags; + + spin_lock_irqsave(&apple_pmp_agx_vote_lock, flags); + agx_vote_refuse(&apple_pmp_agx_vote_state, reason); + spin_unlock_irqrestore(&apple_pmp_agx_vote_lock, flags); +} + +/* Clear a request that is still set and record the stop reason. Caller holds apple_pmp_agx_vote_mutex. */ +static void apple_pmp_agx_vote_stop(unsigned int reason) +{ + unsigned long flags; + bool voted; + + spin_lock_irqsave(&apple_pmp_agx_vote_lock, flags); + voted = agx_vote_release(&apple_pmp_agx_vote_state, reason); + spin_unlock_irqrestore(&apple_pmp_agx_vote_lock, flags); + if (voted) + apple_pmp_agx_write(false, true); +} + +static void apple_pmp_agx_vote_fn(struct work_struct *work) +{ + struct agx_vote *v = &apple_pmp_agx_vote_state; + enum agx_vote_action act; + unsigned long flags; + agx_ms_t now, next = 0; + int ret = 0; + + guard(mutex)(&apple_pmp_agx_vote_mutex); + spin_lock_irqsave(&apple_pmp_agx_vote_lock, flags); + v->enabled = READ_ONCE(agx_vote); + v->idle_ms = READ_ONCE(agx_vote_idle_ms); + now = apple_pmp_agx_now_ms(); + act = agx_vote_decide(v, now); + if (act == AGX_VOTE_NONE && v->failures && !v->users && !v->voted && + agx_vote_retry_reached(v, now)) + v->failures = 0; /* the backoff fired with nobody waiting: it is spent */ + spin_unlock_irqrestore(&apple_pmp_agx_vote_lock, flags); + + if (act != AGX_VOTE_NONE) { + const bool set = act == AGX_VOTE_SET; + + ret = apple_pmp_agx_write(set, false); + if (ret == -ETIMEDOUT) { + pr_err("pmp_report: AGX request %s not acknowledged, clearing\n", set ? "set" : "clear"); + apple_pmp_agx_write(false, true); + } + if (!set) + ret = 0; /* a clear is final: the state is "not voted" whatever happened */ + spin_lock_irqsave(&apple_pmp_agx_vote_lock, flags); + agx_vote_applied(v, act, ret, now); + next = agx_vote_next(v, apple_pmp_agx_now_ms()); + spin_unlock_irqrestore(&apple_pmp_agx_vote_lock, flags); + } else { + spin_lock_irqsave(&apple_pmp_agx_vote_lock, flags); + next = agx_vote_next(v, now); + spin_unlock_irqrestore(&apple_pmp_agx_vote_lock, flags); + } + if (next) + apple_pmp_agx_vote_kick(next); +} + +void apple_pmp_agx_activity_begin(void) +{ + struct agx_vote *v = &apple_pmp_agx_vote_state; + unsigned long flags; + agx_ms_t delay; + + spin_lock_irqsave(&apple_pmp_agx_vote_lock, flags); + v->enabled = READ_ONCE(agx_vote); + delay = agx_vote_begin(v, apple_pmp_agx_now_ms()); + spin_unlock_irqrestore(&apple_pmp_agx_vote_lock, flags); + if (delay) + apple_pmp_agx_vote_kick(delay); +} +EXPORT_SYMBOL_GPL(apple_pmp_agx_activity_begin); + +void apple_pmp_agx_activity_end(void) +{ + struct agx_vote *v = &apple_pmp_agx_vote_state; + unsigned long flags; + agx_ms_t delay; + + spin_lock_irqsave(&apple_pmp_agx_vote_lock, flags); + v->enabled = READ_ONCE(agx_vote); + v->idle_ms = READ_ONCE(agx_vote_idle_ms); + delay = agx_vote_end(v, apple_pmp_agx_now_ms()); + spin_unlock_irqrestore(&apple_pmp_agx_vote_lock, flags); + if (delay) + apple_pmp_agx_vote_kick(delay); +} +EXPORT_SYMBOL_GPL(apple_pmp_agx_activity_end); + +/* + * The GPU driver unbinds: clear the request now instead of waiting out the idle time, so it is never left set past the GPU's + * power-domain release (the T6030 fix clears before it releases its vote). Process context. + */ +static void apple_pmp_agx_vote_release_reason(unsigned int reason) +{ + /* Stop first so that a begin() from now on cannot queue a set, then wait out a work item that already decided, then clear what it set. */ + apple_pmp_agx_vote_stop_new(reason); + cancel_delayed_work_sync(&apple_pmp_agx_vote_work); + guard(mutex)(&apple_pmp_agx_vote_mutex); + apple_pmp_agx_vote_stop(reason); +} + +void apple_pmp_agx_activity_release(void) +{ + apple_pmp_agx_vote_release_reason(AGX_STOP_GPU); +} +EXPORT_SYMBOL_GPL(apple_pmp_agx_activity_release); + +/* The GPU probes again, the report comes back or the system resumes: allow votes, and vote now if operations are already in flight. Process context. */ +static void apple_pmp_agx_vote_resume_reason(unsigned int reason) +{ + struct agx_vote *v = &apple_pmp_agx_vote_state; + unsigned long flags; + bool kick; + + spin_lock_irqsave(&apple_pmp_agx_vote_lock, flags); + v->enabled = READ_ONCE(agx_vote); + kick = agx_vote_resume(v, reason); + spin_unlock_irqrestore(&apple_pmp_agx_vote_lock, flags); + if (kick) + apple_pmp_agx_vote_kick(0); +} + +void apple_pmp_agx_activity_resume(void) +{ + apple_pmp_agx_vote_resume_reason(AGX_STOP_GPU); +} +EXPORT_SYMBOL_GPL(apple_pmp_agx_activity_resume); + +/* + * System sleep: withdraw the request before the devices suspend and decide again after resume. Whether bit 9 held through s2idle costs power is not + * measured (a held display request cost about 0.25 W on J514S), and the PMP may drop the word across sleep, which would leave voted true with nothing + * on the wire. Clearing and re-voting covers both. + */ +static int apple_pmp_agx_pm_notify(struct notifier_block *nb, unsigned long action, void *data) +{ + switch (action) { + case PM_SUSPEND_PREPARE: + case PM_HIBERNATION_PREPARE: + apple_pmp_agx_vote_release_reason(AGX_STOP_SLEEP); + break; + case PM_POST_SUSPEND: + case PM_POST_HIBERNATION: + apple_pmp_agx_vote_resume_reason(AGX_STOP_SLEEP); + break; + } + return NOTIFY_DONE; +} + +static struct notifier_block apple_pmp_agx_pm_nb = { + .notifier_call = apple_pmp_agx_pm_notify, +}; + /* Find and check the report before taking the GPU vote; optionally update it. */ static int apple_pmp_report_t6030_gfx(struct device *supplier, const bool *enable) { @@ -1351,6 +1616,55 @@ int apple_pmp_report_set_t6030_gfx(struct device *supplier, bool enable) } EXPORT_SYMBOL_GPL(apple_pmp_report_set_t6030_gfx); +/** + * apple_pmp_report_set_request() - set or clear one bit of the PMP power request word of a bound report + * @report_np: device tree node of the report region (compatible apple,t6000-pmp-v2-report and its + * siblings) + * @id: bit number of the request, the index of the soc-device record, 0 to 63 (ANE0 is 10 and AGX + * is 9 on the T6001) + * @enable: set or clear the bit + * @no_ack: do not wait for the acknowledge + * + * One read-modify-write of the word, made under the report's lock: the same lock every report + * entry and the AGX vote take, so requests for different bits cannot lose each other. Unless + * @no_ack, waits (atomic poll, at most 50 ms) until the acknowledge word shows the bit as + * requested. A PMP that does not run has nothing to acknowledge: the request is written and 0 is + * returned, as for a report entry. + * + * The caller owns the bit it requests; this function does not arbitrate between callers of the + * same bit. On a machine compatible with apple,t6001 bit 9 belongs to the AGX vote + * (pmp_report.agx_vote) and is refused here with -EBUSY; other t600x reports share the offsets but + * have no vote, so their bit 9 is not reserved. After -ETIMEDOUT the request was written but not acknowledged and stays in the + * word: the caller must clear it (@enable false, @no_ack true) before giving up. + * + * Context: process context (the acknowledge wait is a busy poll of up to 50 ms). + * Return: 0, -ENODEV if no report is bound to @report_np, -EINVAL if @id is out of range, + * -EBUSY for the T6001 AGX bit, -ETIMEDOUT if the acknowledge did not follow. + */ +int apple_pmp_report_set_request(const struct device_node *report_np, unsigned int id, + bool enable, bool no_ack) +{ + struct apple_pmp_report *rep; + int ret = -ENODEV; + + if (id > 63) + return -EINVAL; + rcu_read_lock(); + list_for_each_entry_rcu(rep, &apple_pmp_reports, list) { + if (rep->dev->of_node == report_np) { + if (id == APPLE_PMP_T6001_AGX_ID && rep->offsets == &apple_pmp_offsets_t600x && + of_machine_is_compatible("apple,t6001")) + ret = -EBUSY; /* the AGX vote owns this bit on T6001 */ + else + ret = apple_pmp_report_set_state(rep, id, enable, no_ack); + break; + } + } + rcu_read_unlock(); + return ret; +} +EXPORT_SYMBOL_GPL(apple_pmp_report_set_request); + static int apple_pmp_report_entry_set_state(struct generic_pm_domain *genpd, bool enable) { struct apple_pmp_report_entry *ent = genpd_to_apple_pmp_report_entry(genpd); @@ -1610,6 +1924,7 @@ MODULE_DEVICE_TABLE(of, apple_pmp_report_entry_of_match); static int __init apple_pmp_report_init(void) { + register_pm_notifier(&apple_pmp_agx_pm_nb); apple_pmp_report_debugfs = debugfs_create_dir("apple-pmp-report", NULL); platform_driver_register(&apple_pmp_report_entry_driver); platform_driver_register(&apple_pmp_report_driver); @@ -1618,6 +1933,7 @@ static int __init apple_pmp_report_init(void) static void __exit apple_pmp_report_exit(void) { + unregister_pm_notifier(&apple_pmp_agx_pm_nb); debugfs_remove_recursive(apple_pmp_report_debugfs); platform_driver_unregister(&apple_pmp_report_entry_driver); platform_driver_unregister(&apple_pmp_report_driver); diff --git a/include/linux/soc/apple/pmp-report.h b/include/linux/soc/apple/pmp-report.h index 1d0689f31c2039..25049fcd7339c1 100644 --- a/include/linux/soc/apple/pmp-report.h +++ b/include/linux/soc/apple/pmp-report.h @@ -21,7 +21,38 @@ int apple_pmp_report_set_t6030_gfx(struct device *supplier, bool enable); int apple_pmp_report_wait_ready(struct device_node *entry, unsigned long timeout); int apple_pmp_report_fast_die_effort(const struct device_node *np, unsigned int lane, u8 *effort); +/* + * Set or clear one bit of the PMP power request word of the report bound to @report_np, under the + * report's lock, with the acknowledge wait (see pmp-report.c). + */ +int apple_pmp_report_set_request(const struct device_node *report_np, unsigned int id, + bool enable, bool no_ack); +/* + * T6001: the GPU driver reports each operation in flight. With the pmp_report.agx_vote parameter set, the AGX request (PS-REQ bit 9) is + * set while any operation runs and cleared agx_vote_idle_ms after the last one ends. Parameter off: no effect. Both may be called from + * any context. release() clears the request at once (GPU driver unbind), process context. + */ +void apple_pmp_agx_activity_begin(void); +void apple_pmp_agx_activity_end(void); +void apple_pmp_agx_activity_release(void); +void apple_pmp_agx_activity_resume(void); #else +static inline void apple_pmp_agx_activity_begin(void) +{ +} + +static inline void apple_pmp_agx_activity_end(void) +{ +} + +static inline void apple_pmp_agx_activity_resume(void) +{ +} + +static inline void apple_pmp_agx_activity_release(void) +{ +} + static inline int apple_pmp_report_wait_supplier_ready(struct device *supplier, unsigned int timeout_ms) { @@ -49,6 +80,12 @@ static inline int apple_pmp_report_fast_die_effort(const struct device_node *np, { return -ENODEV; } + +static inline int apple_pmp_report_set_request(const struct device_node *report_np, + unsigned int id, bool enable, bool no_ack) +{ + return -ENODEV; +} #endif #endif /* _LINUX_SOC_APPLE_PMP_REPORT_H_ */ diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h index f981774335c7ca..15046badff5f37 100644 --- a/rust/bindings/bindings_helper.h +++ b/rust/bindings/bindings_helper.h @@ -102,6 +102,7 @@ #include #include #include +#include #include #include #include diff --git a/tools/asahi/pmp-agx-vote-tests.c b/tools/asahi/pmp-agx-vote-tests.c new file mode 100644 index 00000000000000..2ff9e1d7e1b4a6 --- /dev/null +++ b/tools/asahi/pmp-agx-vote-tests.c @@ -0,0 +1,528 @@ +// Unit test and simulation of pmp-agx-vote.h: the policy that decides when the T6001 AGX request (PS-REQ bit 9) is set and cleared. +// A fake clock, a fake PMP bit and a fake timer drive the same transition functions the kernel glue calls. No kernel, no hardware. +#include +#include +#include +#include + +#include "pmp-agx-vote.h" + +struct sim { + struct agx_vote v; + uint32_t now; + bool bit; // the PMP's PS-REQ bit 9 + int sets, clears; // register writes that tried to set / clear it + int fail_sets; // the next N set attempts are not acknowledged + bool armed; + uint32_t timer_at; + int begin_in_write; // begin this many operations while the register write of the next reconcile is in progress + int end_in_write; // end this many operations while the register write of the next reconcile is in progress + int kicks; // reconciliations the operations asked for +}; + +/* The kernel's mod_delayed_work() overwrites a pending timer, even with a later expiry. */ +static void arm(struct sim *s, uint32_t delay_ms) +{ + s->armed = true; + s->timer_at = s->now + delay_ms; +} + +/* The kernel glue: delay <= 1 ms is "due now" and re-arms to 0; a later deadline re-arms only + * when it shortens the pending one. A running work item is not pending, so a kick from inside + * reconcile always re-arms. */ +static void kick(struct sim *s, uint32_t delay_ms) +{ + if (delay_ms <= 1) { + arm(s, 0); + return; + } + if (!s->armed || (int32_t)(s->now + delay_ms - s->timer_at) < 0) + arm(s, delay_ms); +} + +static void begin(struct sim *s); +static void end(struct sim *s); + +// What the kernel work function does. +static void reconcile(struct sim *s) +{ + enum agx_vote_action act = agx_vote_decide(&s->v, s->now); + int ret = 0; + + s->armed = false; + if (act == AGX_VOTE_SET) { + s->sets++; + if (s->fail_sets > 0) { + s->fail_sets--; + ret = -110; + s->bit = false; // glue force-clears a request that was not acknowledged + } else { + s->bit = true; + } + } else if (act == AGX_VOTE_CLEAR) { + s->clears++; + s->bit = false; + } else if (s->v.failures && !s->v.users && !s->v.voted && + agx_vote_retry_reached(&s->v, s->now)) { + s->v.failures = 0; // the glue clears a spent backoff when the retry fires idle + } + while (s->end_in_write > 0) { + s->end_in_write--; + end(s); + } + while (s->begin_in_write > 0) { + s->begin_in_write--; + begin(s); + } + if (act != AGX_VOTE_NONE) + agx_vote_applied(&s->v, act, ret, s->now); + uint32_t next = agx_vote_next(&s->v, s->now); + if (next) + kick(s, next); +} + +static void begin(struct sim *s) +{ + agx_ms_t d = agx_vote_begin(&s->v, s->now); + if (d) { + s->kicks++; + kick(s, d); + } +} + +static void end(struct sim *s) +{ + uint32_t d = agx_vote_end(&s->v, s->now); + if (d) + kick(s, d); +} + +static void advance_to(struct sim *s, uint32_t t) +{ + int stuck = 0; + + while (s->armed && (int32_t)(s->timer_at - t) <= 0) { + if ((int32_t)(s->timer_at - s->now) > 0) { + s->now = s->timer_at; + stuck = 0; + } else if (++stuck > 1000) { + /* a re-arm at the same instant is the owed-set kick; a mutant that re-arms + * forever is a hot spin in the kernel too: fail it, do not hang */ + fprintf(stderr, "FAIL: reconcile re-armed without advancing past %u\n", s->now); + exit(1); + } + reconcile(s); + } + s->now = t; +} + +static struct sim fresh(bool enabled, unsigned long idle_ms, uint32_t start) +{ + struct sim s = {.now = start}; + s.v.enabled = enabled; + s.v.idle_ms = idle_ms; + return s; +} + +#define CHECK(cond) do { if (!(cond)) { fprintf(stderr, "FAIL line %d: %s\n", __LINE__, #cond); exit(1); } } while (0) + +int main(void) +{ + // 1. parameter off: nothing is ever written, however much the GPU runs + { + struct sim s = fresh(false, 100, 1000); + for (int i = 0; i < 50; i++) { begin(&s); advance_to(&s, s.now + 4); end(&s); advance_to(&s, s.now + 7); } + advance_to(&s, s.now + 1000); + CHECK(s.sets == 0 && s.clears == 0 && !s.bit); + } + // 2. one operation: set at once, kept for idle_ms, then cleared + { + struct sim s = fresh(true, 100, 1000); + begin(&s); advance_to(&s, 1000); + CHECK(s.bit && s.sets == 1); + advance_to(&s, 1004); end(&s); + advance_to(&s, 1103); CHECK(s.bit); // 99 ms after the end: still voted + advance_to(&s, 1104); CHECK(!s.bit && s.clears == 1); // 100 ms after the end: dropped + } + // 3. decode-like bursts every 10.58 ms for one second: one set, no clear until the idle time after the last burst + { + struct sim s = fresh(true, 100, 5000); + uint32_t last_end = 0; + for (int i = 0; i < 95; i++) { + uint32_t t0 = 5000 + (uint32_t)(i * 10.58); + advance_to(&s, t0); begin(&s); + advance_to(&s, t0 + 4); end(&s); last_end = s.now; + } + CHECK(s.sets == 1 && s.clears == 0 && s.bit); + advance_to(&s, last_end + 99); CHECK(s.bit); + advance_to(&s, last_end + 100); CHECK(!s.bit && s.clears == 1 && s.sets == 1); + } + // 4. work arrives while the drop is pending: the drop is cancelled, then rescheduled from the new end + { + struct sim s = fresh(true, 100, 0); + begin(&s); advance_to(&s, 0); end(&s); + advance_to(&s, 50); begin(&s); + advance_to(&s, 100); CHECK(s.bit && s.clears == 0); + advance_to(&s, 120); end(&s); + advance_to(&s, 219); CHECK(s.bit); + advance_to(&s, 220); CHECK(!s.bit && s.clears == 1 && s.sets == 1); + } + // 5. a set that is not acknowledged is cleared again, not retried in a hot loop, and retried after the backoff + { + struct sim s = fresh(true, 100, 0); + s.fail_sets = 1; + begin(&s); advance_to(&s, 0); + CHECK(s.sets == 1 && !s.bit && !s.v.voted && s.v.failures == 1); + advance_to(&s, AGX_VOTE_RETRY_MS - 1); CHECK(s.sets == 1); + advance_to(&s, AGX_VOTE_RETRY_MS); CHECK(s.sets == 2 && s.bit && s.v.voted && s.v.failures == 0); + } + // 6. an end without a begin is ignored: no underflow, the next begin still works + { + struct sim s = fresh(true, 100, 0); + end(&s); end(&s); + CHECK(s.v.users == 0 && !s.armed); + begin(&s); advance_to(&s, 0); + CHECK(s.v.users == 1 && s.bit); + } + // 7. the parameter is switched off while voted and busy: cleared at the next reconcile, even with work in flight + { + struct sim s = fresh(true, 100, 0); + begin(&s); advance_to(&s, 0); CHECK(s.bit); + s.v.enabled = false; arm(&s, 0); advance_to(&s, 1); + CHECK(!s.bit && s.clears == 1 && !s.v.voted); + s.v.enabled = true; arm(&s, 0); advance_to(&s, 2); // switched on again with work still in flight + CHECK(s.bit && s.sets == 2); + } + // 8. zero idle time still waits one tick (no clear inside the end call's own tick) + { + struct sim s = fresh(true, 0, 0); + begin(&s); advance_to(&s, 0); end(&s); + CHECK(s.armed && s.bit); + advance_to(&s, 1); CHECK(!s.bit); + } + // 9. the millisecond clock wraps: idle_at + idle_ms overflows, the decision stays right + { + struct sim s = fresh(true, 100, UINT32_MAX - 50); + begin(&s); advance_to(&s, s.now); end(&s); + advance_to(&s, s.now + 99); CHECK(s.bit); + advance_to(&s, s.now + 1); CHECK(!s.bit && s.clears == 1); + } + // 10. release (GPU driver unbind): a held vote is cleared once, at once, and the idle timer is not needed afterwards + { + struct sim s = fresh(true, 100, 0); + begin(&s); advance_to(&s, 0); end(&s); + CHECK(s.bit && s.armed); + if (agx_vote_release(&s.v, AGX_STOP_GPU)) { s.clears++; s.bit = false; } + CHECK(!s.bit && s.clears == 1 && !s.v.voted); + advance_to(&s, 500); // the pending timer fires and finds nothing to do + CHECK(s.clears == 1 && !s.armed); + CHECK(!agx_vote_release(&s.v, AGX_STOP_GPU)); // a second release writes nothing + } + // 11. w7X's reproduction: jiffies_to_msecs is 32 bits wide, so a vote whose last operation ended at 0xFFFFFFF0 must still clear + // 100 ms later, after the clock has wrapped to 0x54 (a 64-bit compare of idle_at + idle_ms never decided it) + { + struct sim s = fresh(true, 100, 0xFFFFFFF0u); + begin(&s); advance_to(&s, s.now); end(&s); + CHECK(s.v.idle_at == 0xFFFFFFF0u); + advance_to(&s, 0xFFFFFFF0u + 99u); CHECK(s.bit && s.now == 0x53u); + advance_to(&s, 0x54u); CHECK(!s.bit && s.clears == 1); + CHECK(agx_vote_next(&s.v, s.now) == 0); + } + // 12. a retry deadline across the same wrap + { + struct sim s = fresh(true, 100, 0xFFFFFC00u); + s.fail_sets = 1; + begin(&s); advance_to(&s, s.now); + CHECK(s.sets == 1 && !s.bit); + advance_to(&s, 0xFFFFFC00u + AGX_VOTE_RETRY_MS - 1u); CHECK(s.sets == 1); + advance_to(&s, 0xFFFFFC00u + AGX_VOTE_RETRY_MS); CHECK(s.sets == 2 && s.bit); + } + // 13. the shipped default hold: w7X measured gaps of up to 111.5 ms inside one 9B generation (ctx 8192, once per process), over the old + // 100 ms hold. The default must ride through that gap with one vote, and still drop the vote after a long idle. + { + struct sim s = fresh(true, AGX_VOTE_IDLE_MS_DEFAULT, 1000); + CHECK(AGX_VOTE_IDLE_MS_DEFAULT >= 250); + begin(&s); advance_to(&s, s.now); end(&s); + advance_to(&s, s.now + 112); // the 111.5 ms interval rounded up + begin(&s); advance_to(&s, s.now); end(&s); + CHECK(s.sets == 1 && s.clears == 0 && s.bit); + advance_to(&s, s.now + AGX_VOTE_IDLE_MS_DEFAULT - 1); CHECK(s.bit); + advance_to(&s, s.now + 1); CHECK(!s.bit && s.clears == 1); + } + // 14. review finding 2: an operation begins while the clear is being written (voted is still true, so begin does not kick). After the clear is + // applied the vote must be set again without waiting for another operation. + { + struct sim s = fresh(true, 100, 0); + begin(&s); advance_to(&s, 0); end(&s); + CHECK(s.bit && s.armed); + s.begin_in_write = 1; + advance_to(&s, 100); // the idle hold expires: reconcile decides CLEAR, begin lands inside the write + CHECK(s.v.users == 1); + advance_to(&s, 101); // the owed set runs + CHECK(s.bit && s.v.voted && s.sets == 2 && s.clears == 1); + // the header alone, as the reviewer reproduced it: decide (CLEAR), begin, applied, next + struct agx_vote v = {.enabled = true, .voted = true, .idle_ms = 100, .idle_at = 0}; + CHECK(agx_vote_decide(&v, 100) == AGX_VOTE_CLEAR); + CHECK(!agx_vote_begin(&v, 100)); + agx_vote_applied(&v, AGX_VOTE_CLEAR, 0, 100); + CHECK(v.users == 1 && !v.voted); + CHECK(agx_vote_next(&v, 100) == 1); // not 0: a set is owed + CHECK(agx_vote_decide(&v, 101) == AGX_VOTE_SET); + } + // 15. review finding 3: after release (GPU unbind or report removal) no begin may vote again, until the GPU probes again + { + struct sim s = fresh(true, 100, 0); + begin(&s); advance_to(&s, 0); + CHECK(s.bit && s.v.users == 1); + if (agx_vote_release(&s.v, AGX_STOP_GPU)) { s.clears++; s.bit = false; } + CHECK(!s.bit && s.v.stopped && s.clears == 1); + end(&s); begin(&s); advance_to(&s, 50); // an ioctl already past the unplug check starts an operation + CHECK(!s.bit && s.sets == 1 && !s.armed); + CHECK(agx_vote_decide(&s.v, 50) == AGX_VOTE_NONE); + CHECK(agx_vote_next(&s.v, 50) == 0); + // a work item that was queued before the release finds nothing to set + arm(&s, 0); advance_to(&s, 51); + CHECK(!s.bit && s.sets == 1); + // the GPU probes again: the vote is allowed, and the operation still in flight gets its set + CHECK(agx_vote_resume(&s.v, AGX_STOP_GPU)); + arm(&s, 0); advance_to(&s, 52); + CHECK(s.bit && s.sets == 2 && !s.v.stopped); + } + // 16. review finding 4: system sleep. The vote is withdrawn before suspend and re-decided on resume: with work still in flight it is set + // again (the PMP may have dropped the word), with an idle GPU nothing is written. + { + struct sim s = fresh(true, 250, 0); + begin(&s); advance_to(&s, 0); + CHECK(s.bit); + if (agx_vote_release(&s.v, AGX_STOP_SLEEP)) { s.clears++; s.bit = false; } // suspend prepare + CHECK(!s.bit && s.v.stopped && s.clears == 1); + if (agx_vote_resume(&s.v, AGX_STOP_SLEEP)) arm(&s, 0); // resume + advance_to(&s, 10); + CHECK(s.bit && s.sets == 2 && s.v.voted); + end(&s); + if (agx_vote_release(&s.v, AGX_STOP_SLEEP)) { s.clears++; s.bit = false; } // a second sleep while idle inside the hold + CHECK(!s.bit && s.clears == 2); + CHECK(!agx_vote_resume(&s.v, AGX_STOP_SLEEP)); // idle: nothing is owed + advance_to(&s, 1000); + CHECK(!s.bit && s.sets == 2 && s.clears == 2); + begin(&s); advance_to(&s, 1001); // the next operation after resume votes as usual + CHECK(s.bit && s.sets == 3); + } + // 17. disabled and stopped never set, whatever begins + { + struct sim s = fresh(false, 100, 0); + s.v.stopped = AGX_STOP_GPU; + begin(&s); advance_to(&s, 1); + CHECK(!s.bit && s.sets == 0 && !s.armed); + CHECK(!agx_vote_resume(&s.v, AGX_STOP_GPU)); // disabled: resume owes nothing + } + // 18. mutants that survived the first review: begin() must itself refuse while stopped (not only decide()), a failed set must schedule the retry + // deadline and not the 1 ms owed-set kick (a 1 kHz spin for the whole 1000 ms window otherwise), and agx_vote_refuse() must stop votes. + { + struct agx_vote v = {.enabled = true, .idle_ms = 100}; + agx_vote_refuse(&v, AGX_STOP_GPU); + CHECK(v.stopped && !v.voted); + CHECK(!agx_vote_begin(&v, 0)); // a user, but no kick + CHECK(agx_vote_decide(&v, 0) == AGX_VOTE_NONE && agx_vote_next(&v, 0) == 0); + CHECK(agx_vote_resume(&v, AGX_STOP_GPU)); // work in flight: the reconcile step must run + struct agx_vote w = {.enabled = true, .idle_ms = 100}; + CHECK(agx_vote_begin(&w, 0)); + agx_vote_applied(&w, AGX_VOTE_SET, -110, 500); // the set was not acknowledged + CHECK(w.failures == 1 && w.retry_at == 500 + AGX_VOTE_RETRY_MS); + CHECK(agx_vote_next(&w, 500) == AGX_VOTE_RETRY_MS); // the retry deadline, not 1 ms + CHECK(agx_vote_next(&w, 500 + AGX_VOTE_RETRY_MS - 1) == 1); + } + // 19. w7X's wrap mutant: reached() must compare in signed 32-bit arithmetic, so a deadline that has + // wrapped into the low range is not "already reached" on the pre-wrap side + { + struct agx_vote v = {.enabled = true, .voted = true, .idle_ms = 100, .idle_at = 0xFFFFFFF0u}; + CHECK(agx_vote_decide(&v, 0xFFFFFFF8u) == AGX_VOTE_NONE); + CHECK(agx_vote_next(&v, 0xFFFFFFF8u) == 0x5Cu); + struct agx_vote w = {.enabled = true, .idle_ms = 100, .users = 1, .failures = 1, .retry_at = 0x54u}; + CHECK(agx_vote_decide(&w, 0xFFFFFFF8u) == AGX_VOTE_NONE); + } + // 20. chriskearney's race: the last end lands between decide (SET) and applied. end saw voted false and + // armed nothing; applied then sets the vote with no user and an already-reached idle deadline. The + // caller must still be told to run the reconcile that clears it. + { + // exactly the reviewer's interleaving, on the header alone: decide, then end, then the write lands + struct agx_vote v = {.enabled = true, .idle_ms = 0}; + CHECK(agx_vote_begin(&v, 5000) && v.users == 1); + CHECK(agx_vote_decide(&v, 5000) == AGX_VOTE_SET); + CHECK(agx_vote_end(&v, 5001) == 0); // the end during the write sees voted false: no timer + CHECK(v.users == 0); + agx_vote_applied(&v, AGX_VOTE_SET, 0, 5000); + CHECK(v.voted && v.users == 0); + CHECK(agx_vote_next(&v, 5001) == 1); // an already-reached deadline is due now, not "nothing" + CHECK(agx_vote_decide(&v, 5001) == AGX_VOTE_CLEAR); + agx_vote_applied(&v, AGX_VOTE_CLEAR, 0, 5001); + CHECK(!v.voted && agx_vote_next(&v, 5001) == 0); // and it settles + } + // 21. chriskearney's bound: an idle gap beyond half the 32-bit millisecond range makes the wrapped + // arithmetic read an expired retry deadline as future, which would keep the vote off for days. A retry + // deadline more than one backoff window in the future cannot be real, so it counts as reached. + { + struct sim s = fresh(true, 100, 0); + s.fail_sets = 1; + begin(&s); advance_to(&s, 0); + CHECK(s.v.failures == 1); + s.v.retry_at = 0x54u; + advance_to(&s, 0x54u + 0x80000005u); // the timer fires absurdly late + CHECK(s.bit && s.sets == 2 && s.v.failures == 0); // the vote is set again at once + // the header alone + struct agx_vote w = {.enabled = true, .users = 1, .failures = 1, .retry_at = 0x54u}; + CHECK(agx_vote_decide(&w, 0x54u + 0x80000005u) == AGX_VOTE_SET); + CHECK(agx_vote_next(&w, 0x54u + 0x80000005u) == 1); + CHECK(agx_vote_decide(&w, 0x54u + 0x80000000u) == AGX_VOTE_SET); + CHECK(agx_vote_next(&w, 0x54u + 0x80000000u) == 1); + } + // 22. the same review: during backoff begin must not ask for a reconciliation decide would refuse + // (every begin during the window kicked a NONE reconcile and the retry timer did the work anyway) + { + struct sim s = fresh(true, 100, 0); + s.fail_sets = 1; + begin(&s); advance_to(&s, 0); + CHECK(s.v.failures == 1 && s.armed); + int kicks = s.kicks; + uint32_t armed_at = s.timer_at; + for (int i = 0; i < 5; i++) + begin(&s); + CHECK(s.kicks == kicks + 5 && s.sets == 1); // each begin arms the same deadline, none reconciles early + CHECK(s.armed && s.timer_at == armed_at); // mod_delayed_work can only pull the deadline earlier + advance_to(&s, AGX_VOTE_RETRY_MS); + CHECK(s.sets == 2 && s.bit && s.v.failures == 0); + // the header alone + struct agx_vote v = {.enabled = true, .failures = 1, .retry_at = 100}; + CHECK(agx_vote_begin(&v, 0) == 100); // arms the remaining delay + CHECK(agx_vote_begin(&v, 100) == 1); // past the deadline: now + } + // 23. w7X's regression repro for the first cut of the backoff gate: a failed set whose retry timer fires + // while the GPU is idle left failures set forever, and begin never asked for the set again. The kick + // must come back once the deadline has passed. + { + struct sim s = fresh(true, 100, 0); + s.fail_sets = 1; + begin(&s); advance_to(&s, 0); + CHECK(s.v.failures == 1 && s.armed); + end(&s); // the operation ends long before the retry + advance_to(&s, AGX_VOTE_RETRY_MS); // the timer fires idle: nothing to do + CHECK(s.v.failures == 0 && !s.armed && !s.bit); // the spent backoff cleared at the idle fire + int kicks = s.kicks; + begin(&s); // a later operation: the kick must come back + advance_to(&s, s.now + 1); + CHECK(s.kicks == kicks + 1 && s.sets == 2 && s.bit && s.v.failures == 0); + // the header alone: inside the window no kick, past it the kick returns + struct agx_vote v = {.enabled = true, .failures = 1, .retry_at = 100}; + CHECK(agx_vote_begin(&v, 50) == 50); // arms the remaining delay + CHECK(agx_vote_begin(&v, 100) == 1); + } + // 24. chriskearney's second race at efff25c1: the last operation ends during a SET ack that then times + // out. applied records the failure with no user and no timer (next returns 0 on that path), and a begin + // before the retry deadline must arm the remaining delay instead of returning "no kick", or the retry + // never runs. The release/resume cycle must not drop it either. + { + struct agx_vote v = {.enabled = true, .idle_ms = 100}; + CHECK(agx_vote_begin(&v, 5000) == 1); + CHECK(agx_vote_decide(&v, 5000) == AGX_VOTE_SET); + CHECK(agx_vote_end(&v, 5001) == 0); // the end during the ack: no timer + agx_vote_applied(&v, AGX_VOTE_SET, -110, 5000); // the ack times out + CHECK(v.failures == 1 && agx_vote_next(&v, 5001) == 999); // next arms the retry from the failure state + unsigned delay = agx_vote_begin(&v, 5002); + CHECK(delay == 998); // the begin arms the remaining delay + CHECK(v.users == 1); + CHECK(agx_vote_decide(&v, 6000) == AGX_VOTE_SET); // the retry lands and sets + agx_vote_applied(&v, AGX_VOTE_SET, 0, 6000); + CHECK(v.voted && v.failures == 0 && agx_vote_next(&v, 6000) == 0); + // the cancel-on-release/resume variant: the retry survives the cycle + struct agx_vote w = {.enabled = true, .failures = 1, .retry_at = 6000}; + CHECK(!agx_vote_release(&w, AGX_STOP_GPU)); // idle release: no clear write + CHECK(!agx_vote_resume(&w, AGX_STOP_GPU)); // idle resume: still no immediate kick + CHECK(agx_vote_begin(&w, 6100) == 1); // past the deadline the kick is back + } + // 25. the residual w7X flagged on the delay contract: the end lands inside a failed SET write and no new + // operation starts. The write path arms nothing (users is already 0 when applied runs), so the work + // function must arm the retry from the failure state itself, and when the retry fires with nobody + // waiting it must clear the backoff instead of re-arming forever. + { + struct sim s = fresh(true, 100, 0); + s.fail_sets = 1; + s.end_in_write = 1; // the op ends inside the ack + begin(&s); advance_to(&s, 0); + CHECK(s.v.failures == 1 && s.v.users == 0 && s.bit == false); + CHECK(s.armed); // the retry is armed from the failure state + advance_to(&s, AGX_VOTE_RETRY_MS); + CHECK(s.v.failures == 0 && !s.armed && !s.bit); // the idle fire clears the backoff, once + advance_to(&s, AGX_VOTE_RETRY_MS + 500); + CHECK(!s.armed && s.sets == 1); // no re-arm, no hot loop + begin(&s); advance_to(&s, s.now + 1); + CHECK(s.sets == 2 && s.bit); // and a later operation votes as usual + // the header alone: next arms the remaining delay with no user and no pending timer + struct agx_vote v = {.enabled = true, .failures = 1, .retry_at = 6000}; + CHECK(agx_vote_next(&v, 5500) == 500); + CHECK(agx_vote_next(&v, 6000) == 1); + } + // 26. chriskearney's missing-retry-timer repro at c3487a52: the end lands inside a failed SET ack + // (no timer exists: applied ran with users 0) and the next operation begins before the retry + // deadline. The begin arms the remaining delay, the deadline is never pulled later, and the + // vote lands inside the new operation. A begin during the window cannot strand the retry even + // when the glue timer is already armed. + { + struct sim s = fresh(true, 250, 0); + s.fail_sets = 1; + s.end_in_write = 1; // the last end lands inside the ack poll + begin(&s); advance_to(&s, 0); + CHECK(s.v.failures == 1 && s.v.users == 0 && !s.bit); // the reviewer's steps 1 to 3 + advance_to(&s, AGX_VOTE_RETRY_MS); // the retry fires idle: spent backoff clears + CHECK(s.v.failures == 0 && !s.armed && !s.bit); + begin(&s); // step 4: the new sole operation, before any deadline + advance_to(&s, s.now + AGX_VOTE_RETRY_MS + 5000); // far past where the vote must have landed + CHECK(s.bit && s.v.voted && s.v.users == 1 && s.v.failures == 0); + // the header alone: begin inside the window arms the remaining delay (never 0), and a second + // begin cannot push the deadline later (mod_delayed_work only pulls it earlier) + struct agx_vote v = {.enabled = true, .failures = 1, .retry_at = 6000}; + CHECK(agx_vote_begin(&v, 5500) == 500); + CHECK(v.users == 1); + CHECK(agx_vote_begin(&v, 5500) == 500); // same begin time: the deadline is unchanged + CHECK(agx_vote_begin(&v, 6000) == 1); // at the deadline: reconcile now + // 1 ms before the deadline + struct agx_vote w = {.enabled = true, .failures = 1, .retry_at = 6000}; + CHECK(agx_vote_begin(&w, 5999) == 1); + } + // 27. Marcelo's re-arm review: several begins before the worker runs must not postpone the set. + // mod_delayed_work overwrites, so an unvoted begin that re-armed to now+1 each time would slide + // the set out one tick per begin; the glue's due-now kick can only pull earlier. + { + struct sim s = fresh(true, 100, 0); + for (int i = 0; i < 5; i++) + begin(&s); // five begins before the worker ever runs + CHECK(s.armed && s.timer_at == 0); // every due-now kick armed 0; none pushed later + advance_to(&s, 1); + CHECK(s.sets == 1 && s.bit && s.v.voted && s.v.users == 5); + CHECK(!s.armed); // nothing left pending from the pile-up + } + // 28. Marcelo's stop-reason review: the stop mask is per owner. PM_POST_SUSPEND after a GPU + // unbind must not re-enable the vote, and a GPU re-probe does not cancel a sleep stop. + { + struct agx_vote v = {.enabled = true, .idle_ms = 100, .users = 1}; + CHECK(agx_vote_release(&v, AGX_STOP_GPU) == false); // unvoted unbind: nothing written + CHECK(!agx_vote_resume(&v, AGX_STOP_SLEEP)); // post-suspend: the GPU stop still holds + CHECK(v.stopped == AGX_STOP_GPU); + CHECK(agx_vote_decide(&v, 0) == AGX_VOTE_NONE); + CHECK(!agx_vote_resume(&v, AGX_STOP_REPORT)); // a report rebind: still held by the GPU stop + CHECK(v.stopped == AGX_STOP_GPU); + CHECK(agx_vote_resume(&v, AGX_STOP_GPU)); // the GPU probes again: work in flight kicks + CHECK(!v.stopped); + } + { + struct agx_vote v = {.enabled = true, .idle_ms = 100, .users = 1}; + agx_vote_refuse(&v, AGX_STOP_GPU); + agx_vote_refuse(&v, AGX_STOP_SLEEP); + CHECK(v.stopped == (AGX_STOP_GPU | AGX_STOP_SLEEP)); + CHECK(!agx_vote_resume(&v, AGX_STOP_GPU)); // sleep still holds + CHECK(v.stopped == AGX_STOP_SLEEP); + CHECK(agx_vote_resume(&v, AGX_STOP_SLEEP)); // both cleared: owed kick + CHECK(!v.stopped); + } + printf("AGX-VOTE-SELFCHECK-OK\n"); + return 0; +} diff --git a/tools/asahi/pmp-agx-vote-tests.py b/tools/asahi/pmp-agx-vote-tests.py new file mode 100755 index 00000000000000..0ba272595c5879 --- /dev/null +++ b/tools/asahi/pmp-agx-vote-tests.py @@ -0,0 +1,145 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0-only +"""Host test for the T6001 AGX vote policy (drivers/pmdomain/apple/pmp-agx-vote.h). + +The policy is a header of static inline transition functions, so the suite +compiles tools/asahi/pmp-agx-vote-tests.c against a copy of that header: a +fake clock, a fake PMP bit and a fake timer drive the same begin, decide, +next and applied calls the kernel glue makes. No kernel, no hardware. + +--mutation NAME / --mutations apply textual mutants to the header copy and +require the suite to fail; like the other self-checking suites, exit status 0 +means every mutant was caught. --ref reads the header at a Git revision (a +pre-fix header fails the suite itself, which is the point of those cases). +""" +import argparse +import hashlib +import json +import os +from pathlib import Path +import shlex +import shutil +import subprocess + +ROOT = Path(__file__).resolve().parents[2] +HEADER = 'drivers/pmdomain/apple/pmp-agx-vote.h' + +# Each mutant removes one guard. The first two are the mutants that survived +# the first review round, when begin() did not refuse while stopped and the +# retry deadline was not distinguished from the 1 ms owed-set kick. +CONTROLS = [ + ('owed-set-branch', '\tif (v->users && !v->voted && !v->failures)\n\t\treturn 1;\n', ''), + ('owed-failures', 'if (v->users && !v->voted && !v->failures)\n\t\treturn 1;', 'if (v->users && !v->voted)\n\t\treturn 1;'), + ('stopped-in-begin', 'v->users++;\n if (!v->enabled || v->stopped)\n return 0;', 'v->users++;\n if (!v->enabled)\n return 0;'), + ('stopped-in-decide', 'if (!v->enabled || v->stopped)\n\t\treturn v->voted ? AGX_VOTE_CLEAR : AGX_VOTE_NONE;', + 'if (!v->enabled)\n\t\treturn v->voted ? AGX_VOTE_CLEAR : AGX_VOTE_NONE;'), + ('wrap-reached', 'return (agx_sms_t)(now - t) >= 0;', 'return now >= t;'), + ('set-write-ends', 'return agx_vote_reached(now, at) ? 1 : at - now;', 'return agx_vote_reached(now, at) ? 0 : at - now;'), + ('retry-dropped-when-idle', + '\telse if (!v->users && !v->voted && v->failures)\n' + '\t\t/* The write outlasted the operation: arm the retry from the failure state\n' + '\t\t * itself. The caller clears failures when this reconcile finds nobody waiting\n' + '\t\t * (decide returns NONE), so it fires once. */\n' + '\t\tat = agx_vote_retry_reached(v, now) ? now : v->retry_at;\n', ''), + ('begin-backoff-kick', 'return (!v->failures || agx_vote_retry_reached(v, now)) ? 1 : v->retry_at - now;', 'return (void)now, 1;'), + ('begin-no-retry-arm', 'return (!v->failures || agx_vote_retry_reached(v, now)) ? 1 : v->retry_at - now;', 'return (void)now, 0;'), + ('begin-drops-users', ' v->users++;\n if (!v->enabled || v->stopped)', ' if (!v->enabled || v->stopped)'), + ('retry-revival', '|| (agx_ms_t)(v->retry_at - now) > AGX_VOTE_RETRY_MS', ''), +] + + +def header_text(ref): + if ref: + return subprocess.check_output(['git', '-C', str(ROOT), 'show', f'{ref}:{HEADER}'], text=True) + return (ROOT / HEADER).read_text() + + +_ASLR_PREFIX = None + + +def aslr_prefix(): + """['setarch', '-R'] when it actually works here; [] when absent or personality() is blocked.""" + global _ASLR_PREFIX + if _ASLR_PREFIX is None: + _ASLR_PREFIX = [] + if shutil.which('setarch'): + probe = subprocess.run(['setarch', '-R', 'true'], capture_output=True) + if probe.returncode == 0: + _ASLR_PREFIX = ['setarch', '-R'] + return _ASLR_PREFIX + + +def compile_and_run(out, text): + out.mkdir(parents=True, exist_ok=True) + (out / 'pmp-agx-vote.h').write_text(text) + compiler = shlex.split(os.environ.get('CC', 'clang')) + command = compiler + ['-std=gnu11', '-g', '-O1', '-Wall', '-Wextra', '-Werror', + '-fsanitize=address,undefined', '-fno-omit-frame-pointer', + '-I', str(out), str(ROOT / 'tools/asahi/pmp-agx-vote-tests.c'), + '-o', str(out / 'vote')] + built = subprocess.run(command, capture_output=True, text=True) + (out / 'build.log').write_text(built.stdout + built.stderr) + if built.returncode: + return {'build_rc': built.returncode, 'run_rc': None, 'note': 'compilation failure is not regression evidence'} + prefix = aslr_prefix() # ASan startup can crash under ASLR on a loaded host + ran = subprocess.run(prefix + [str(out / 'vote')], capture_output=True, text=True) + (out / 'run.log').write_text(ran.stdout + ran.stderr) + return {'build_rc': 0, 'run_rc': ran.returncode} + + +def main(): + p = argparse.ArgumentParser(description=__doc__) + p.add_argument('--ref', help='read the header at a Git revision (negative control)') + p.add_argument('--mutation', help='apply one named mutant and require the suite to fail') + p.add_argument('--mutations', action='store_true', help='apply every mutant and require each to fail') + p.add_argument('--output', required=True, type=Path) + args = p.parse_args() + args.output.mkdir(parents=True, exist_ok=False) + text = header_text(args.ref) + + base = compile_and_run(args.output, text) + print(Path(args.output / 'run.log').read_text() if base['run_rc'] is not None else Path(args.output / 'build.log').read_text()) + + mutations = [] + if args.mutations or args.mutation: + # A base failure would fail every mutant at the same case and read as caught. + # The negative control (--ref) has no passing base: the pre-fix header cannot compile this suite. + if not args.ref: + assert base['run_rc'] == 0, base + names = [c[0] for c in CONTROLS] if args.mutations else [args.mutation] + for name in names: + old, new = next((c[1], c[2]) for c in CONTROLS if c[0] == name) + count = text.count(old) + result = {} + result['applied'] = count == 1 + if count == 1: + result.update(compile_and_run(args.output / name, text.replace(old, new))) + else: + # A guard that does not exist in this revision cannot be removed: the + # behaviour the guard carries is absent, so the mutant survives there. + result.update({'build_rc': None, 'run_rc': 0, 'note': f'{HEADER} at this revision has no such line ({count} matches)'}) + result['name'] = name + mutations.append(result) + caught = result['applied'] and result['build_rc'] == 0 and result['run_rc'] not in (0, None) + log = args.output / name / ('run.log' if result.get('run_rc') is not None else 'build.log') + detail = log.read_text().strip().splitlines()[-1][:150] if log.exists() else result.get('note', '') + print(f"{name}: {'CAUGHT' if caught else 'SURVIVED'} | {detail}") + + if args.mutations: + assert all(m['applied'] and m['build_rc'] == 0 and m['run_rc'] not in (0, None) for m in mutations), mutations + print('PASS: every vote-policy case passed and every mutant caught') + return 0 + if args.mutation: + m = mutations[0] + assert m['applied'] and m['build_rc'] == 0 and m['run_rc'] not in (0, None), m + return 0 + + (args.output / 'receipt.json').write_text(json.dumps({ + 'source_ref': args.ref, 'source_sha256': hashlib.sha256(text.encode()).hexdigest(), + 'command': [], 'returncode': base['run_rc'] if base['run_rc'] is not None else base['build_rc'], + 'mutations': mutations}, indent=2) + '\n') + return bool(base['run_rc']) if base['run_rc'] is not None else bool(base['build_rc']) + + +if __name__ == '__main__': + raise SystemExit(main()) diff --git a/tools/asahi/t6030-pmp-graph-tests.c b/tools/asahi/t6030-pmp-graph-tests.c index d7d079a9673a64..38d10db8855aec 100644 --- a/tools/asahi/t6030-pmp-graph-tests.c +++ b/tools/asahi/t6030-pmp-graph-tests.c @@ -584,6 +584,10 @@ static const struct apple_pmp_start_ops apple_pmp_start_hw_ops = { hw_check, hw_bound }; static const struct apple_pmp_start_timing apple_pmp_start_timing = { 2, 0, 2, 2 }; +/* The extracted probe compares rep->offsets with the T6001 table and tells the AGX vote that a report came back. This harness has neither: the table is empty and + * never matches, and the call does nothing. */ +static const struct apple_pmp_report_offsets apple_pmp_offsets_t600x; +static void apple_pmp_agx_activity_resume(void) {} #include "production.h" static const struct apple_pmp_report_offsets * of_device_get_match_data(struct device *d) diff --git a/tools/aurora-ci/host-tests.json b/tools/aurora-ci/host-tests.json index a1b93d695dfd6e..136a45da2bb0c3 100644 --- a/tools/aurora-ci/host-tests.json +++ b/tools/aurora-ci/host-tests.json @@ -2238,6 +2238,184 @@ ], "note": "Compile J514S/J516S default and static PMP profiles; check supplier nodes and alias in the resulting DTBs." }, + { + "name": "tools/asahi/pmp-agx-vote-tests.py", + "group": "tools", + "argv": [ + "python3", + "tools/asahi/pmp-agx-vote-tests.py", + "--output", + "{output}" + ], + "note": "T6001 AGX vote policy host suite: fake clock, PMP bit and timer against the static inline header; --mutations self-checks the guards" + }, + { + "name": "tools/asahi/pmp-agx-vote-tests.py --mutations", + "group": "tools", + "argv": [ + "python3", + "tools/asahi/pmp-agx-vote-tests.py", + "--mutations", + "--output", + "{output}" + ], + "expect": "pass", + "note": "self-checking: exits 0 when every mutant aborts" + }, + { + "name": "tools/asahi/pmp-agx-vote-tests.py --mutation owed-set-branch", + "group": "tools", + "argv": [ + "python3", + "tools/asahi/pmp-agx-vote-tests.py", + "--mutation", + "owed-set-branch", + "--output", + "{output}" + ], + "expect": "pass", + "note": "self-checking: exits 0 when the mutant aborts" + }, + { + "name": "tools/asahi/pmp-agx-vote-tests.py --mutation owed-failures", + "group": "tools", + "argv": [ + "python3", + "tools/asahi/pmp-agx-vote-tests.py", + "--mutation", + "owed-failures", + "--output", + "{output}" + ], + "expect": "pass", + "note": "self-checking: exits 0 when the mutant aborts" + }, + { + "name": "tools/asahi/pmp-agx-vote-tests.py --mutation stopped-in-begin", + "group": "tools", + "argv": [ + "python3", + "tools/asahi/pmp-agx-vote-tests.py", + "--mutation", + "stopped-in-begin", + "--output", + "{output}" + ], + "expect": "pass", + "note": "self-checking: exits 0 when the mutant aborts" + }, + { + "name": "tools/asahi/pmp-agx-vote-tests.py --mutation stopped-in-decide", + "group": "tools", + "argv": [ + "python3", + "tools/asahi/pmp-agx-vote-tests.py", + "--mutation", + "stopped-in-decide", + "--output", + "{output}" + ], + "expect": "pass", + "note": "self-checking: exits 0 when the mutant aborts" + }, + { + "name": "tools/asahi/pmp-agx-vote-tests.py --mutation wrap-reached", + "group": "tools", + "argv": [ + "python3", + "tools/asahi/pmp-agx-vote-tests.py", + "--mutation", + "wrap-reached", + "--output", + "{output}" + ], + "expect": "pass", + "note": "self-checking: exits 0 when the mutant aborts" + }, + { + "name": "tools/asahi/pmp-agx-vote-tests.py --mutation set-write-ends", + "group": "tools", + "argv": [ + "python3", + "tools/asahi/pmp-agx-vote-tests.py", + "--mutation", + "set-write-ends", + "--output", + "{output}" + ], + "expect": "pass", + "note": "self-checking: exits 0 when the mutant aborts" + }, + { + "name": "tools/asahi/pmp-agx-vote-tests.py --mutation begin-backoff-kick", + "group": "tools", + "argv": [ + "python3", + "tools/asahi/pmp-agx-vote-tests.py", + "--mutation", + "begin-backoff-kick", + "--output", + "{output}" + ], + "expect": "pass", + "note": "self-checking: exits 0 when the mutant aborts" + }, + { + "name": "tools/asahi/pmp-agx-vote-tests.py --mutation retry-dropped-when-idle", + "group": "tools", + "argv": [ + "python3", + "tools/asahi/pmp-agx-vote-tests.py", + "--mutation", + "retry-dropped-when-idle", + "--output", + "{output}" + ], + "expect": "pass", + "note": "self-checking: exits 0 when the mutant aborts" + }, + { + "name": "tools/asahi/pmp-agx-vote-tests.py --mutation begin-no-retry-arm", + "group": "tools", + "argv": [ + "python3", + "tools/asahi/pmp-agx-vote-tests.py", + "--mutation", + "begin-no-retry-arm", + "--output", + "{output}" + ], + "expect": "pass", + "note": "self-checking: exits 0 when the mutant aborts" + }, + { + "name": "tools/asahi/pmp-agx-vote-tests.py --mutation retry-revival", + "group": "tools", + "argv": [ + "python3", + "tools/asahi/pmp-agx-vote-tests.py", + "--mutation", + "retry-revival", + "--output", + "{output}" + ], + "expect": "pass", + "note": "self-checking: exits 0 when the mutant aborts" + }, + { + "name": "tools/asahi/pmp-agx-vote-tests.py --mutation begin-drops-users", + "group": "tools", + "argv": [ + "python3", + "tools/asahi/pmp-agx-vote-tests.py", + "--mutation", + "begin-drops-users", + "--output", + "{output}" + ], + "expect": "pass", + "note": "self-checking: exits 0 when the mutant aborts" + }, { "name": "tools/asahi/t6030-pmp-graph-tests.py", "group": "tools", @@ -2289,7 +2467,8 @@ "tools/testing/selftests/drivers/gpu/asahi-g15/uat-owner.c": "compiled and executed by the registered asahi-g15/run.py actual reservation-owner fixture", "tools/testing/selftests/drivers/gpu/asahi-g15/pmp-bridge.c": "compiled and executed by the registered asahi-g15/run.py maintained PMP fixture", "tools/asahi/t6030-pmp-graph-tests.c": "compiled and executed by the corresponding registered Python actual-body host suite", - "tools/asahi/t6030-display-admission-tests.c": "compiled and executed by the corresponding registered Python actual-body host suite" + "tools/asahi/t6030-display-admission-tests.c": "compiled and executed by the corresponding registered Python actual-body host suite", + "tools/asahi/pmp-agx-vote-tests.c": "compiled and executed by the registered pmp-agx-vote-tests.py policy suite" }, "excluded": { "tools/aurora-sep/tests/coordinator/runtime-check.sh": "Needs /dev/sep-bio, a running kernel booted with trusted.source=applesep, the hw_random sysfs interface and fprintd. Coordinator payload for an approved device.",