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

49 lines
2.5 KiB
C

/* SPDX-License-Identifier: MIT */
#ifndef NV_RS_GPU_BRIDGE_H
#define NV_RS_GPU_BRIDGE_H
#include <linux/types.h>
struct nv_rs_probe_info {
u16 vendor, device, subvendor, subdevice;
u32 boot0, boot1, boot42;
};
struct nv_rs_pci;
struct nv_rs_gpu_key { u32 index,reserved; u64 generation; };
/* Internal prepared-instance key; neither a CUDA GPU_ID nor readiness. Driver
* base remains owned until retire has unpublished it before final release. */
int nv_rs_gpu_registry_publish(void *storage,struct nv_rs_pci *,struct nv_rs_gpu_key *);
int nv_rs_gpu_registry_retire(void *storage,const struct nv_rs_gpu_key *);
int nv_rs_gpu_first_open(const struct nv_rs_gpu_key *);
bool nv_rs_hardware_inventory(void);
u32 nv_rs_bringup_level(void);
bool nv_rs_bringup_bar1(void);
void nv_rs_bringup_note(struct nv_rs_pci *pci, u32 code, u32 value);
void nv_rs_hardware_inventory_log(struct nv_rs_pci *pci, u32 offset, u32 value);
void nv_rs_hardware_inventory_firmware(struct nv_rs_pci *pci, int error, u32 records, u32 bytes);
int nv_rs_firmware_request(struct nv_rs_pci *pci, const char *name, const u8 **data,
size_t *size, void **handle);
void nv_rs_firmware_release(void *handle);
void nv_rs_rm_api_lock(void);
void nv_rs_rm_api_unlock(void);
unsigned long nv_rs_gpu_registry_lock(void);
void nv_rs_gpu_registry_unlock(unsigned long flags);
size_t nv_rs_gpu_state_size(void);
size_t nv_rs_gpu_state_align(void);
int nv_rs_gpu_prepare(struct nv_rs_pci *, const struct nv_rs_probe_info *, void *storage);
/* Lock/unlock must both be provided or both NULL. NULL makes locked register
* acquisition unsupported. Callback/context lifetime covers every GPU lease. */
int nv_rs_gpu_prepare_owned(struct nv_rs_pci *, const struct nv_rs_probe_info *,
void *storage, void *owner, void (*destroy)(void *), void (*retry)(void *),
int (*lock)(void *), void (*unlock)(void *));
int nv_rs_gpu_close(void *storage);
/* Exclusive successful probe only, before registry publication/lease exposure.
* flags bit0 is Linux is_virtfn; other bits and truncated PCI fields rejected. */
int nv_rs_gpu_set_probe_identity(void *storage,u32 domain,u32 bus,u32 slot,
u32 function,u32 flags);
int nv_rs_gpu_set_cleanup(void *storage, void *owner,
void (*destroy)(void *), void (*retry)(void *));
void nv_rs_gpu_mark_removed(void *storage);
void nv_rs_gpu_release_driver(void *storage);
void nv_rs_gpu_retry_cleanup(void *storage);
int nv_rs_gpu_retry_gp100_hbm_restore(void *storage);
#endif