mirror of
https://github.com/QuixiAI/nvdriver.git
synced 2026-12-06 06:28:39 +00:00
* gv100/hbm: log every HBM2 session outcome, not only a verified unlock
On a CMP 100-210 (10de:1df4, 12 GB) FBPA 0..=3 answer with a PRI bus
error, so survey_gv100_hbm() refuses the card. HbmSession::begin() then
returns FailedRolledBack in state SurveyFailed, and pmu_bringup only
logged the Unlocked case: v100_hbm_ndiv=82 did nothing and dmesg said
nothing. The session is write-inhibited from then on, so a later sysfs
write to v100_hbm_ndiv was dropped without a line as well. A PLL that
would not take the new NDIV and was rolled back was equally silent, and
indistinguishable from the survey failure in HbmUnlockStatus.
Core (hbm_clock.rs):
- survey_gv100_hbm_checked() does the same reads in the same order as
survey_gv100_hbm() and returns the first failed check as an
HbmSurveyFault { kind, fbpa, value }: canary mismatch, cfg or coeff
unreadable, PLL not locked, coeff mismatch. survey_gv100_hbm() is now
its .ok(); HbmSession keeps the fault of the start survey.
- HbmSession::outcome() names what a start or live step did: Disabled,
NonStockPll, AlreadyAtTarget, Unlocked, SurveyFailed, RolledBack,
ClockUnknown, WriteInhibited.
Kernel glue (pmu_bringup.rs, gpu_owner.c): every start outcome other
than Unlocked, every live step that does not end in a verified new
clock, and a sysfs write dropped by a write-inhibited session now go to
nv_rs_hbm_clock_outcome_log(). The survey line carries the partition
and raw word, e.g. "survey failed (FBPA 0 PLL config unreadable
(0xbadf2010))". Requested-but-failed outcomes are pr_warn, an
unverified rollback is pr_err, the rest pr_info. The existing unlock
and backoff lines are unchanged. No register is read or written that
was not read or written before.
This reports the failure; it does not make the survey accept a card
with fused-off FBPAs. The GP100/GA100 MultiGenHbmSession path is not
touched.
Tests (host): hbm_survey_reports_the_first_failed_check and
hbm_session_outcome_names_every_start_and_step_result, the latter with
the #399 register values (FBPA 0..=3 = 0xbadf2010, 4..=15 cfg 0x29,
coeff 0x14102) and a PLL mock that drops or loses lock on a write. On
master they do not compile: HbmOutcome, HbmSurveyFault and
HbmSession::outcome do not exist.
Not run: QEMU EDU guest tests (need sudo here), any GPU.
Refs #399
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* gv100/hbm: keep the failed phase in the logged HBM2 outcome
Review of #451 found three session results that were logged as something
else. A start or step whose target did not lock, whose rollback was
verified, and whose survey after the rollback then failed was reported as
"the rollback could not be verified". A survey that refused the card
before any PLL write was reported as "did not lock or read back; rolled
back" when the survey after it passed. And a start whose PMC_BOOT_0
canary read failed right after a good baseline survey was reported as
"PLL is not at a stock coefficient".
The unlock and step helpers now hand the session the read that stopped
them before a write, taken from the reads they already do, so the
register access order is unchanged. A refusal before any write puts the
session in SurveyFailed with that fault. A verified rollback followed by
a failed survey is the new outcome RolledBackSurveyLost (8): the clock
stays unknown and writes stay inhibited, and the log names the survey
fault. A failed canary is the new outcome CanaryFailed (9); NonStockPll
is left for a coefficient the unlock really rejected. The public
unlock_gv100_hbm and set_gv100_hbm_ndiv signatures and results are the
same as before.
Three host tests script the failing read with a mock and fail on the
previous commit.
Refs #399
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* gv100/hbm: keep a canary refusal before the target write out of RolledBack
program_coeff checks the PMC_BOOT_0 canary before it writes the target
coefficient. When that check failed, the caller still ran the rollback
(which rewrites the unchanged baseline), and a verified rollback was then
logged as "did not lock or read back; rolled back", although the target
was never written.
program_coeff now returns the canary fault when it refuses before the
write. unlock_gv100_hbm_noted and set_gv100_hbm_ndiv_noted run the same
rollback as before and pass that fault on, so HbmSession reports the step
as SurveyFailed with the CanaryMismatch fault (the existing "refused
before the target write" path) instead of RolledBack. Register accesses
and their order are unchanged; the public functions keep their
signatures. A host test fails the canary once, just before the target
write, for both the initial unlock and a live step, and checks that the
rollback succeeds and the outcome is SurveyFailed, not RolledBack.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* gv100/hbm: say "target coefficient not written" for a survey refusal
The SurveyFailed log line said "clock not touched". Since a canary
refusal just before the target write is reported as SurveyFailed, and
the rollback in that path still rewrites the unchanged baseline
coefficient, that was true of the clock value but not of every PLL
register write. The line now says "target coefficient not written",
which holds in every SurveyFailed case, and the HbmOutcome::SurveyFailed
doc comment says the same.
Log text and a doc comment only; no change to register access, session
state or outcome mapping.
Refs #399
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* gv100/hbm: classify a refused baseline restoration by its skip reason
outcome() reported Disabled whenever the v100_hbm_ndiv value was 0, but
on_user_write(0) with a surveyed baseline steps to the baseline NDIV; a
non-stock coefficient refuses that with Skipped and no fault, and the log
then said "disabled" instead of the refusal. The session now records the
NDIV each start or step acted on (target_ndiv), and outcome() reserves
Disabled for a zero effective target; its requested_ndiv argument, which
only approximated that, is gone.
Test: start at MDIV 3 / NDIV 65, request 80 (rejected), then 0 (baseline
restore, rejected) -> NonStockPll. It fails if step_to stops recording
the target.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: Scott <scottbphone12@gmail.com>
98 lines
5.5 KiB
C
98 lines
5.5 KiB
C
/* SPDX-License-Identifier: MIT */
|
|
#ifndef NV_RS_GPU_OWNER_H
|
|
#define NV_RS_GPU_OWNER_H
|
|
#include "gpu_bridge.h"
|
|
struct nv_rs_gpu_owner;
|
|
/* External GPU references pin module text; driver base refs do not. The final
|
|
* put runs in active VFS/probe or exit-joined work context, which keeps current
|
|
* callback code alive through the return after module_put. */
|
|
bool nv_rs_gpu_module_get(void);
|
|
void nv_rs_gpu_module_put(void);
|
|
int nv_rs_gpu_owner_queue_init(void);
|
|
/* Stop new owner creation first. Waits retained cleanup owners/timers, then
|
|
* joins workers. Persistent cleanup errors deliberately prevent teardown. */
|
|
void nv_rs_gpu_owner_queue_destroy(void);
|
|
/* Takes the caller's PCI lease only on success; engine/IRQ state is quiescent. */
|
|
int nv_rs_gpu_owner_create(struct nv_rs_pci *, const struct nv_rs_probe_info *, struct nv_rs_gpu_owner **);
|
|
/* Exclusive probe owns a newly published owner through registration. */
|
|
int nv_rs_gpu_owner_register_open(struct nv_rs_gpu_owner *);
|
|
/* Process context only; retires the prepared registry key, then may sleep
|
|
* waiting for a sequence mutex. Caller holds no lock a sequence needs.
|
|
* No owner access after return. Hardware must already be quiescent. */
|
|
void nv_rs_gpu_owner_remove(struct nv_rs_gpu_owner *);
|
|
/* Caller holds registry/removal serialization until acquiring its Rust lease. */
|
|
void *nv_rs_gpu_owner_state(struct nv_rs_gpu_owner *);
|
|
struct nv_rs_pci *nv_rs_gpu_owner_pci_get(struct nv_rs_gpu_owner *);
|
|
unsigned int nv_rs_gpu_owner_pending(void);
|
|
unsigned int nv_rs_gpu_owner_retries(void);
|
|
/* Requires a retained owner. Diagnostic for operation/removal waiters. */
|
|
unsigned int nv_rs_gpu_owner_waiters(struct nv_rs_gpu_owner *);
|
|
/* Opt-in persistent runtime bring-up lifecycle (`runtime_engines=1`). */
|
|
bool nv_rs_runtime_engines(void);
|
|
/* Opt-in storm-guarded PGRAPH-only PCI IRQ arming (`live_pci_irq=1`). */
|
|
bool nv_rs_live_pci_irq(void);
|
|
bool nv_rs_unlock_ada_tensor(void);
|
|
void nv_rs_ada_tensor_unlock_log(u32 gpu_id, u8 status, u32 plm, u32 ss0, u32 ss1);
|
|
bool nv_rs_dyn_bar1_p2p(void);
|
|
bool nv_rs_disable_ecc(void);
|
|
bool nv_rs_unpriv_profiling(void);
|
|
u32 nv_rs_v100_hbm_ndiv(void);
|
|
size_t nv_rs_v100_hbm_ndiv_map_copy(u8 *out, size_t cap);
|
|
void nv_rs_hbm_clock_log(u32 from_khz, u32 to_khz, u32 from_ndiv, u32 to_ndiv, u32 lock_us);
|
|
void nv_rs_hbm_clock_backoff_log(u32 from_khz, u32 to_khz, u32 from_ndiv, u32 to_ndiv,
|
|
u32 lock_us, u32 reason_mask);
|
|
void nv_rs_hbm_clock_outcome_log(u32 outcome, u32 requested_ndiv, u32 current_khz,
|
|
u32 fault_kind, u32 fault_fbpa, u32 fault_value);
|
|
u32 nv_rs_v100_hbm_ndiv_gen(void);
|
|
u32 nv_rs_v100_hbm_ndiv_map_gen(void);
|
|
u32 nv_rs_v100_p0_gpc_ndiv(void);
|
|
size_t nv_rs_v100_p0_gpc_ndiv_map_copy(u8 *out, size_t cap);
|
|
u32 nv_rs_v100_p0_volt_uv(void);
|
|
bool nv_rs_v100_pmu_power(void);
|
|
void nv_rs_pmu_power_log(u32 gpu_id, u32 stage, u32 a, u32 b, u32 c);
|
|
u32 nv_rs_force_pcie_gen(void);
|
|
bool nv_rs_idle_pstate(void);
|
|
u32 nv_rs_idle_pstate_delay_s(void);
|
|
u32 nv_rs_idle_pstate_gpc_khz(void);
|
|
u32 nv_rs_vram_limit_mb(void);
|
|
void nv_rs_p0_boost_log(u32 gpc_from_khz, u32 gpc_to_khz, u32 xbar_to_khz);
|
|
void nv_rs_volt_scale_log(u32 gpu_id, u32 load_st, u32 get_st, u32 set_st,
|
|
u32 boot_uv, u32 target_uv, u32 pwm_before, u32 pwm_after);
|
|
void nv_rs_pmgr_power_log(u32 gpu_id, u32 load_st, u32 poll_st, u32 ch0_mw, u32 ch7_mw);
|
|
bool nv_rs_nvlink_enabled(void);
|
|
void nv_rs_ada_tensor_unlock_log(u32 gpu_id, u8 status, u32 plm, u32 ss0, u32 ss1);
|
|
void nv_rs_nvlink_boot_log(u32 gpu_id, bool booted, u32 status, u32 dlcmd_mask, u32 safe_mask,
|
|
u32 cmd0_pll, u32 cmd0_phy);
|
|
void nv_rs_nvlink_link_log(u32 gpu_a, u32 link_a, u32 gpu_b, u32 link_b, u32 state_a, u32 state_b);
|
|
void nv_rs_nvlink_hshub_log(u32 gpu_id, u32 peer_id, u32 link_mask, u32 cfg0, u32 cfg1, u32 cfg2);
|
|
int nv_rs_gpu_owner_runtime_start(struct nv_rs_gpu_owner *owner);
|
|
void nv_rs_gpu_owner_runtime_stop(struct nv_rs_gpu_owner *owner);
|
|
bool nv_rs_gpu_owner_runtime_active(struct nv_rs_gpu_owner *owner);
|
|
void nv_rs_gpu_owner_set_aer_recovering(struct nv_rs_gpu_owner *owner, bool recovering);
|
|
void nv_rs_runtime_park(struct nv_rs_pci *pci);
|
|
int nv_rs_runtime_park_wait(struct nv_rs_pci *pci);
|
|
void nv_rs_runtime_gr_reset_complete(struct nv_rs_pci *pci, int rc);
|
|
int nv_rs_runtime_request_gr_reset(struct nv_rs_pci *pci);
|
|
void nv_rs_runtime_hshub_get_args(struct nv_rs_pci *pci, u32 *out_cfg4);
|
|
void nv_rs_runtime_hshub_complete(struct nv_rs_pci *pci, int rc);
|
|
int nv_rs_runtime_request_hshub_update(struct nv_rs_pci *pci, u32 cfg0, u32 cfg1, u32 cfg2, u32 cfg6);
|
|
u32 nv_rs_pci_gpu_id(struct nv_rs_pci *pci);
|
|
bool nv_rs_pci_bdf(struct nv_rs_pci *pci, u16 *domain, u8 *bus, u8 *dev, u8 *func);
|
|
u32 nv_rs_vram_limit_mb(void);
|
|
size_t nv_rs_vram_limit_mb_map_copy(u8 *out, size_t cap);
|
|
u64 nv_rs_pci_dsn(struct nv_rs_pci *pci);
|
|
u32 nv_rs_p100_hbm_ndiv(void);
|
|
size_t nv_rs_p100_hbm_ndiv_map_copy(u8 *out, size_t cap);
|
|
u32 nv_rs_ga100_hbm_ndiv(void);
|
|
size_t nv_rs_ga100_hbm_ndiv_map_copy(u8 *out, size_t cap);
|
|
void nv_rs_hbm_clock_arch_log(u32 arch_id, u32 from_khz, u32 to_khz, u32 from_ndiv, u32 to_ndiv, u32 lock_us);
|
|
u32 nv_rs_force_pcie_gen(void);
|
|
size_t nv_rs_force_pcie_gen_map_copy(u8 *out, size_t cap);
|
|
u32 nv_rs_pci_upstream_max_gen(struct nv_rs_pci *pci);
|
|
u32 nv_rs_pci_upstream_get_target_gen(struct nv_rs_pci *pci);
|
|
int nv_rs_pci_upstream_set_target_gen(struct nv_rs_pci *pci, u32 target_gen);
|
|
u32 nv_rs_gddr5x_timing_profile(void);
|
|
size_t nv_rs_gddr5x_timing_map_copy(u8 *out, size_t cap);
|
|
void nv_rs_gddr5x_timing_log(u32 profile, u32 from_t0, u32 to_t0, u32 from_t1, u32 to_t1);
|
|
#endif
|