Files
nvdriver/kernel-open/nvidia/rmapi_node.h

41 lines
2.4 KiB
C

/* SPDX-License-Identifier: MIT */
#ifndef NV_RS_RMAPI_NODE_H
#define NV_RS_RMAPI_NODE_H
struct device;
struct pci_dev;
struct nv_rs_gpu_owner;
/* RM API nodes of the Rust driver: the control node /dev/nvidia-rs-rmapi-ctl and one device
* node /dev/nvidia-rs-rmapi-gpu<minor> per listed GPU. They speak the escape protocol of the
* original's nodes as far as the implementation notes say; they do not use the original's
* names or major number. Process context only. */
int nv_rs_rmapi_node_init(void);
void nv_rs_rmapi_node_exit(void);
/* A PCI function this driver has bound becomes visible to NV_ESC_CARD_INFO and the
* probed-GPU controls and gets its device node. `boot0` is PMC_BOOT_0 as the probe read
* it. Returns the minor number assigned to it or a negative errno. */
int nv_rs_rmapi_node_gpu_add(struct pci_dev *pdev, u32 boot0);
/* Register access for the listed GPU: `read32(cookie, offset, &value)` reads one BAR0
* register. It is called under the node lock, only at the first open of the GPU's device
* node, for the read-only registers the Rust side names (the Jtag word 0x1373a0 and the
* display fuse word 0x21c04 of a GV100). `release(cookie)` is called once, outside the lock,
* when the GPU leaves the node (nv_rs_rmapi_node_gpu_remove or node exit). */
int nv_rs_rmapi_node_gpu_reader(struct pci_dev *pdev,
int (*read32)(void *cookie, u64 offset, u32 *value),
void (*release)(void *cookie), void *cookie);
int nv_rs_rmapi_node_gpu_runtime(struct pci_dev *pdev, struct nv_rs_gpu_owner *owner);
void nv_rs_rmapi_node_gpu_remove(struct pci_dev *pdev);
void nv_rs_rmapi_revoke_runtime_userd(u32 gpu_id, bool pm_lost);
void nv_rs_rmapi_runtime_userd_ready(u32 gpu_id, bool verified_pm_resume);
struct device *nv_rs_rmapi_gpu_device_get(u32 gpu_id);
void nv_rs_rmapi_file_post(u64 owner);
void nv_rs_rmapi_gpu_negotiate_dma(u32 gpu_id, unsigned int bits);
void nv_rs_rmapi_update_power_telemetry(u32 gpu_id, u8 idle_mode, u64 transitions,
u64 idle_secs, u32 power_cap_mw);
void nv_rs_rmapi_set_power_cap_mw(u32 gpu_id, u32 power_cap_mw);
void nv_rs_rmapi_set_tensor_fp32_rate(u32 gpu_id, u8 rate);
u32 nv_rs_rmapi_handle_rc_fault(u32 gpu_id, u64 inst_ptr, u64 fault_va, u32 xid_code);
u64 nv_rs_rmapi_os_ctl_fd_owner(s32 descriptor);
int nv_rs_rmapi_kernel_open_gpu(u32 gpu_id);
void nv_rs_rmapi_kernel_close_gpu(u32 gpu_id);
#endif