mirror of
https://github.com/QuixiAI/nvdriver.git
synced 2026-12-06 14:38:47 +00:00
Add an open_trace module parameter (default off) that emits open-trace lines around the misc-open glue and the PCI remove path, plus notes 0x4c4700f0 0x02-0x06 between the device-node open and the first legacy bring-up note. Gated behind the parameter so production opens and removes stay silent. Co-authored-by: almharba <almharba@users.noreply.github.com>
104 lines
5.9 KiB
C
104 lines
5.9 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;
|
|
/* Open/remove path tracing (bring-up diagnostics, issue #24). */
|
|
int nv_rs_open_trace_enabled(void);
|
|
void nv_rs_open_trace(const char *where);
|
|
/* 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);
|
|
bool nv_rs_is_runtime_kthread(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_p0_gpc_clamp_log(u32 gpu_id, u32 req_ndiv, u32 req_khz, u32 applied_ndiv, u32 applied_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_stop_bounded(struct nv_rs_gpu_owner *owner, unsigned int timeout_ms);
|
|
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
|