From ad6804d6af9b1a49604697ec775181d6e8f96fa1 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Thu, 1 Oct 2026 21:59:42 -0400 Subject: gsp-phys: backend session API skeleton (P0, inert) --- kernel/gsp_phys_booter.h | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'kernel/gsp_phys_booter.h') diff --git a/kernel/gsp_phys_booter.h b/kernel/gsp_phys_booter.h index 0902830..15068ff 100644 --- a/kernel/gsp_phys_booter.h +++ b/kernel/gsp_phys_booter.h @@ -89,6 +89,60 @@ void gsp_phys_boot_rmwait(struct gsp_phys_boot *boot, void __iomem *bar0, void gsp_phys_boot_quiesce(void __iomem *bar0); void gsp_phys_boot_staging_free(struct pci_dev *pdev); +/* + * Backend session transport API (P0 skeleton; inert until the guest plane + * forwards). The session state/refcount/owner live in gsp_phys_gpu.c; these + * entry points share gsp_phys_rm_lock with the boot/probe/ladder paths so + * there is one real-GSP RPC at a time. Callers check gsp_phys_backend_state() + * first and call here; this file never takes the session lock itself (lock + * order: session lock outermost, rm lock inner). + * + * gsp_phys_backend_rpc() re-checks READY and the generation under the rm + * lock and refuses (-EAGAIN) without touching the device when the session is + * not live. On success *reply owns a kmalloc'd copy of the reply payload + * (*reply_len bytes, NULL/0 for an empty payload, caller frees). + * + * gsp_phys_backend_static_snapshot() returns the cached static-config fields + * decoded from the function-65 reply; the cache is filled at READY in a + * later phase, so it currently reports -ENODATA. + */ +#define GSP_PHYS_BACKEND_GPU_NAME_LEN 64 + +struct gsp_phys_backend_static_config { + bool valid; /* cache holds a decoded function-65 reply */ + u32 fw_crc32; /* cache key: loaded firmware image */ + u32 payload_len; /* decoded reply payload bytes */ + u32 h_internal_client; + u32 h_internal_device; + u32 h_internal_subdevice; + u64 bar1_pde_base; + u64 bar2_pde_base; + u64 fb_length; + u64 fbio_mask; + u64 fbp_mask; + u32 fb_bus_width; + u32 fb_ram_type; + u32 l2_cache_size; + u32 engine_caps[3]; + char gpu_name[GSP_PHYS_BACKEND_GPU_NAME_LEN + 1]; + char gpu_short_name[GSP_PHYS_BACKEND_GPU_NAME_LEN + 1]; + u32 sriov_max_gfid; + u32 vbios_sub_vendor; + u32 vbios_sub_device; + u8 b_vbios_valid; + u8 b_page_retirement; + u8 b_split_vas; + u8 b_self_hosted; + u8 b_ats_supported; + u8 b_poison_fuse; + u8 b_gpu_uefi; + u8 b_efi_init; +}; + +int gsp_phys_backend_rpc(u32 function, const void *req, u32 req_len, + void **reply, u32 *reply_len, u32 timeout_ms); +int gsp_phys_backend_static_snapshot(struct gsp_phys_backend_static_config *out); + /* * Command-queue TX: build a msgq record with the 570.144 element/rpc header * layout, splitting it into 1..16 4 KB elements when it does not fit one -- cgit v1.2.3