Files
nvdriver/kernel-open/nvidia/system_memory_bridge.h
Eric Hartford 33ff608a88 Add MIT LICENSE and unify repository SPDX/Cargo/module licensing
- Add root LICENSE (MIT License, Copyright (c) 2026 QuixiAI / Eric Hartford).
- Set license = "MIT" in workspace Cargo.toml and member crates (zero non-MIT dependencies).
- Update all kernel-open/ and tests/vm/ SPDX headers to MIT and EXPORT_SYMBOL_GPL -> EXPORT_SYMBOL.
- Use MODULE_LICENSE("Dual MIT/GPL") in Linux .ko modules so Linux modpost permits linking against the kernel's own EXPORT_SYMBOL_GPL symbols while keeping the repository source 100% MIT.

Closes #12.
2026-12-01 00:20:02 +00:00

44 lines
2.3 KiB
C

/* SPDX-License-Identifier: MIT */
#ifndef NV_RS_SYSTEM_MEMORY_BRIDGE_H
#define NV_RS_SYSTEM_MEMORY_BRIDGE_H
#include <linux/types.h>
/* Internal copied-buffer ABI. Hardware allocation stays gated by the owning
* GPU state's actual readiness; PCI preparation does not satisfy that gate. */
struct nv_rs_pci;
/* Trusted RM/HAL facts only. There is deliberately no readiness flag.
* flags: 1=VGX hypervisor, 2=virtual/fw client, 4=CC, 8=physical contiguous.
* Every owner corresponds to one authenticated root/Device/memory identity. */
struct nv_rs_sysmem_config {
u32 root, parent, object, dma_bits;
u64 max_segment, boundary_mask, os_page, gpu_page;
u32 privilege, cache_mode, flags, reserved;
};
struct nv_rs_sysmem_info {
u32 root, parent, object, attr, attr2, reserved;
u64 size, limit, device_address;
};
size_t nv_rs_sysmem_state_size(void);
size_t nv_rs_sysmem_state_align(void);
size_t nv_rs_sysmem_pin_size(void);
size_t nv_rs_sysmem_pin_align(void);
/* Caller holds GPU registry lifetime lock through lease acquisition. Storage
* must be closed whenever initialized==1, including prepare error returns.
* Acquisition and final close execute in active file/probe/removal or an
* exit-joined worker context, keeping module code live through final put. */
int nv_rs_sysmem_prepare(struct nv_rs_pci *, void *gpu_state,
const struct nv_rs_sysmem_config *, void *storage, u32 *initialized);
/* All buffers are copied kernel allocations, never raw userspace pointers.
* Return is NV_STATUS; allocation also patches NVOS64 status at byte40.
* Calls serialized against each other and owner/pin storage destruction. */
u32 nv_rs_sysmem_allocate(void *, void *request48, size_t, void *params128, size_t);
u32 nv_rs_sysmem_info(const void *, struct nv_rs_sysmem_info *);
/* kind1=mapping,2=inflight. Each successful pin needs one unpin after actual
* GPU completion/quiescence, not merely a CPU/DMA barrier. */
u32 nv_rs_sysmem_pin(void *, u32 kind, void *pin_storage);
u32 nv_rs_sysmem_unpin(void *, void *pin_storage);
/* direction1=for-device,2=for-CPU; CPU/device ownership is caller responsibility. */
u32 nv_rs_sysmem_sync(void *, u32 direction, u64 offset, u64 bytes);
/* Caller retains storage on error and retries; NV_OK releases the GPU lease. */
u32 nv_rs_sysmem_close(void *);
#endif