/* 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 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); 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); u32 nv_rs_rmapi_handle_rc_fault(u32 gpu_id, u64 inst_ptr, u64 fault_va, u32 xid_code); #endif