diff options
| author | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-10-05 20:04:05 -0400 |
|---|---|---|
| committer | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-10-05 20:04:05 -0400 |
| commit | 52266aa4c59b1b551862cf26d66134300997fd40 (patch) | |
| tree | 24521bc6602324100251e4a3acb46f18cd79cc87 /kernel | |
| parent | 4da11e8c343576485f99d5981dddbe1ceed62a85 (diff) | |
| download | open-iov-52266aa4c59b1b551862cf26d66134300997fd40.tar.gz open-iov-52266aa4c59b1b551862cf26d66134300997fd40.zip | |
vgsp: golden9j - FBMEM backing + VAS mappings for the four 3D global ctx buffers
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/gsp_phys_booter.c | 133 |
1 files changed, 128 insertions, 5 deletions
diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c index 75b00d1..6a9542b 100644 --- a/kernel/gsp_phys_booter.c +++ b/kernel/gsp_phys_booter.c @@ -400,19 +400,29 @@ bool gsp_phys_boot_requested(void) #define GSP_PHYS_RMCALL_VA_GOLDEN9_FECS (GSP_PHYS_RMCALL_VA_GR_CTX + 0x150000ULL) #define GSP_PHYS_RMCALL_VA_GOLDEN9_PRIV (GSP_PHYS_RMCALL_VA_GR_CTX + 0x151000ULL) #define GSP_PHYS_RMCALL_VA_GOLDEN9_UNR (GSP_PHYS_RMCALL_VA_GR_CTX + 0x152000ULL) -#define GSP_PHYS_RMCALL_VA_GOLDEN9_BUNDLE_CB (GSP_PHYS_RMCALL_VA_GR_CTX + 0x153000ULL) -#define GSP_PHYS_RMCALL_VA_GOLDEN9_PAGEPOOL (GSP_PHYS_RMCALL_VA_GR_CTX + 0x154000ULL) -#define GSP_PHYS_RMCALL_VA_GOLDEN9_ATTRIBUTE_CB (GSP_PHYS_RMCALL_VA_GR_CTX + 0x155000ULL) -#define GSP_PHYS_RMCALL_VA_GOLDEN9_RTV_CB_GLOBAL (GSP_PHYS_RMCALL_VA_GR_CTX + 0x156000ULL) +#define GSP_PHYS_RMCALL_VA_GOLDEN9_BUNDLE_CB (GSP_PHYS_RMCALL_VA_GR_CTX + 0x160000ULL) +#define GSP_PHYS_RMCALL_VA_GOLDEN9_PAGEPOOL (GSP_PHYS_RMCALL_VA_GR_CTX + 0x170000ULL) +#define GSP_PHYS_RMCALL_VA_GOLDEN9_ATTRIBUTE_CB (GSP_PHYS_RMCALL_VA_GR_CTX + 0x180000ULL) +#define GSP_PHYS_RMCALL_VA_GOLDEN9_RTV_CB_GLOBAL (GSP_PHYS_RMCALL_VA_GR_CTX + 0x190000ULL) /* * Golden9e server FBMEM allocations for the small promoted buffers (PATCH is * sized by the PATCH engine geometry query; FECS/PRIV/UNR are one 4 KB page - * each). The real golden wire carried all of them in FBMEM. + * each). The real golden wire carried all of them in FBMEM. Golden9j adds the + * four 3D globals (BUNDLE_CB/PAGEPOOL/ATTRIBUTE_CB/RTV_CB_GLOBAL): the real + * client allocated them, promoted their VAs (VA-only entries) and mapped them + * in its VAS, so the ctx-init bundle can read/write them; the ladder promoted + * the VAs with no backing at all until now. */ #define GSP_PHYS_RMCALL_HANDLE_GOLDEN_FB_PATCH 0xcaf00064u #define GSP_PHYS_RMCALL_HANDLE_GOLDEN_FB_FECS 0xcaf00068u #define GSP_PHYS_RMCALL_HANDLE_GOLDEN_FB_PRIV 0xcaf0006cu #define GSP_PHYS_RMCALL_HANDLE_GOLDEN_FB_UNR 0xcaf00070u +#define GSP_PHYS_RMCALL_HANDLE_GOLDEN_FB_BUNDLE 0xcaf00074u +#define GSP_PHYS_RMCALL_HANDLE_GOLDEN_FB_PAGEPOOL 0xcaf00078u +#define GSP_PHYS_RMCALL_HANDLE_GOLDEN_FB_ATTR 0xcaf0007cu +#define GSP_PHYS_RMCALL_HANDLE_GOLDEN_FB_RTV 0xcaf00080u +#define GSP_PHYS_RMCALL_GR_GLOBAL_SLOT 0x10000u +#define GSP_PHYS_RMCALL_GR_GLOBAL_MAX_PAGES 16u /* GR context-promote bisection modes (gsp_phys_rmcall_gr_promote). */ #define GSP_PHYS_RMCALL_GR_PROMOTE_OFF 0u @@ -1586,6 +1596,15 @@ static struct gsp_phys_boot_stage { u64 rmcall_fecs_pa; u64 rmcall_priv_pa; u64 rmcall_unrestricted_pa; + /* golden9j: FBMEM backing for the four promoted 3D globals */ + u64 rmcall_bundle_pa; + u64 rmcall_pagepool_pa; + u64 rmcall_attr_pa; + u64 rmcall_rtv_pa; + u32 rmcall_bundle_size; + u32 rmcall_pagepool_size; + u32 rmcall_attr_size; + u32 rmcall_rtv_size; /* * GR context-promote bisection snapshot (stage 3, GR0 only): the 0..3 * gsp_phys_rmcall_gr_promote value, the number of accepted promote @@ -8494,6 +8513,59 @@ static void gsp_phys_rmcall_pdb_build(void) gsp_phys_rmcall_pte_vid( boot_stage.rmcall_unrestricted_pa), ptv + (size_t)slot * 8); + /* + * Golden9j: back and map the four 3D globals at their + * promoted VAs (the promote entries stay VA-only, as + * captured). Each VA slot holds up to 16 pages. + */ + slot = (u32)((GSP_PHYS_RMCALL_VA_GOLDEN9_BUNDLE_CB >> + 12) & 0x1ffu); + npages = min_t(u32, + DIV_ROUND_UP(boot_stage.rmcall_bundle_size, + GSP_PHYS_PAGE_SIZE), + GSP_PHYS_RMCALL_GR_GLOBAL_MAX_PAGES); + for (i = 0; i < npages; i++) + put_unaligned_le64( + gsp_phys_rmcall_pte_vid( + boot_stage.rmcall_bundle_pa + + (u64)i * GSP_PHYS_PAGE_SIZE), + ptv + (size_t)(slot + i) * 8); + slot = (u32)((GSP_PHYS_RMCALL_VA_GOLDEN9_PAGEPOOL >> + 12) & 0x1ffu); + npages = min_t(u32, + DIV_ROUND_UP(boot_stage.rmcall_pagepool_size, + GSP_PHYS_PAGE_SIZE), + GSP_PHYS_RMCALL_GR_GLOBAL_MAX_PAGES); + for (i = 0; i < npages; i++) + put_unaligned_le64( + gsp_phys_rmcall_pte_vid( + boot_stage.rmcall_pagepool_pa + + (u64)i * GSP_PHYS_PAGE_SIZE), + ptv + (size_t)(slot + i) * 8); + slot = (u32)((GSP_PHYS_RMCALL_VA_GOLDEN9_ATTRIBUTE_CB >> + 12) & 0x1ffu); + npages = min_t(u32, + DIV_ROUND_UP(boot_stage.rmcall_attr_size, + GSP_PHYS_PAGE_SIZE), + GSP_PHYS_RMCALL_GR_GLOBAL_MAX_PAGES); + for (i = 0; i < npages; i++) + put_unaligned_le64( + gsp_phys_rmcall_pte_vid( + boot_stage.rmcall_attr_pa + + (u64)i * GSP_PHYS_PAGE_SIZE), + ptv + (size_t)(slot + i) * 8); + slot = (u32)((GSP_PHYS_RMCALL_VA_GOLDEN9_RTV_CB_GLOBAL >> + 12) & 0x1ffu); + npages = min_t(u32, + DIV_ROUND_UP(boot_stage.rmcall_rtv_size, + GSP_PHYS_PAGE_SIZE), + GSP_PHYS_RMCALL_GR_GLOBAL_MAX_PAGES); + for (i = 0; i < npages; i++) + put_unaligned_le64( + gsp_phys_rmcall_pte_vid( + boot_stage.rmcall_rtv_pa + + (u64)i * GSP_PHYS_PAGE_SIZE), + ptv + (size_t)(slot + i) * 8); pr_info("vgsp-boot: rm-call: GOLDEN9E PDB aux mapped: patch va=0x%llx pages=%u (pa=0x%llx) fecs va=0x%llx (pa=0x%llx) priv va=0x%llx (pa=0x%llx) unr va=0x%llx (pa=0x%llx) (VIDMEM PTEs)\n", GSP_PHYS_RMCALL_VA_GR_PATCH, npages, boot_stage.rmcall_patch_pa, @@ -8503,6 +8575,15 @@ static void gsp_phys_rmcall_pdb_build(void) boot_stage.rmcall_priv_pa, GSP_PHYS_RMCALL_VA_GOLDEN9_UNR, boot_stage.rmcall_unrestricted_pa); + pr_info("vgsp-boot: rm-call: GOLDEN9J globals mapped: bundle va=0x%llx (pa=0x%llx) pagepool va=0x%llx (pa=0x%llx) attr va=0x%llx (pa=0x%llx) rtv va=0x%llx (pa=0x%llx) (VIDMEM PTEs, one page each)\n", + GSP_PHYS_RMCALL_VA_GOLDEN9_BUNDLE_CB, + boot_stage.rmcall_bundle_pa, + GSP_PHYS_RMCALL_VA_GOLDEN9_PAGEPOOL, + boot_stage.rmcall_pagepool_pa, + GSP_PHYS_RMCALL_VA_GOLDEN9_ATTRIBUTE_CB, + boot_stage.rmcall_attr_pa, + GSP_PHYS_RMCALL_VA_GOLDEN9_RTV_CB_GLOBAL, + boot_stage.rmcall_rtv_pa); } pr_info("vgsp-boot: rm-call: GR ctx PDB mapped: va=0x%llx size=0x%x pages=%u ptPages=%u pd0Entries=%u..%u (%s; fresh slots above the scratch pool; no fetched line rewritten)\n", GSP_PHYS_RMCALL_VA_GR_CTX, boot_stage.rmcall_ctx_size, @@ -8629,11 +8710,53 @@ static int gsp_phys_rmcall_golden9_fb_aux_prepare(void __iomem *bar0) return ret; boot_stage.rmcall_unrestricted_pa = fb; + /* + * Golden9j: the four 3D globals. The real client allocated each one + * with the size its own geometry query returned and mapped it in the + * channel VAS; the promote carries the VAs (bInitialize=0, no PA), so + * the ctx-init bundle reads and writes them through the page tables. + * Sizes are clamped to one 16-page slot per VA constant. + */ + ret = gsp_phys_rmcall_alloc_fb_mem(bar0, + GSP_PHYS_RMCALL_HANDLE_GOLDEN_FB_BUNDLE, 0x1000, &fb, + "GOLDEN9J BUNDLE_CB"); + if (ret) + return ret; + boot_stage.rmcall_bundle_pa = fb; + boot_stage.rmcall_bundle_size = 0x1000; + + ret = gsp_phys_rmcall_alloc_fb_mem(bar0, + GSP_PHYS_RMCALL_HANDLE_GOLDEN_FB_PAGEPOOL, 0x1000, &fb, + "GOLDEN9J PAGEPOOL"); + if (ret) + return ret; + boot_stage.rmcall_pagepool_pa = fb; + boot_stage.rmcall_pagepool_size = 0x1000; + + ret = gsp_phys_rmcall_alloc_fb_mem(bar0, + GSP_PHYS_RMCALL_HANDLE_GOLDEN_FB_ATTR, 0x1000, &fb, + "GOLDEN9J ATTRIBUTE_CB"); + if (ret) + return ret; + boot_stage.rmcall_attr_pa = fb; + boot_stage.rmcall_attr_size = 0x1000; + + ret = gsp_phys_rmcall_alloc_fb_mem(bar0, + GSP_PHYS_RMCALL_HANDLE_GOLDEN_FB_RTV, 0x1000, &fb, + "GOLDEN9J RTV_CB_GLOBAL"); + if (ret) + return ret; + boot_stage.rmcall_rtv_pa = fb; + boot_stage.rmcall_rtv_size = 0x1000; + boot_stage.rmcall_golden_fb_aux = true; pr_info("vgsp-boot: rm-call: GOLDEN9E FBMEM aux buffers ready: patch pa=0x%llx size=0x%x fecs=0x%llx priv=0x%llx unr=0x%llx (server FBMEM, all mapped in the ctx PDB window)\n", boot_stage.rmcall_patch_pa, boot_stage.rmcall_patch_size, boot_stage.rmcall_fecs_pa, boot_stage.rmcall_priv_pa, boot_stage.rmcall_unrestricted_pa); + pr_info("vgsp-boot: rm-call: GOLDEN9J global buffers ready: bundle=0x%llx pagepool=0x%llx attr=0x%llx rtv=0x%llx (server FBMEM, one page each, mapped at the promoted VAs)\n", + boot_stage.rmcall_bundle_pa, boot_stage.rmcall_pagepool_pa, + boot_stage.rmcall_attr_pa, boot_stage.rmcall_rtv_pa); return 0; } |
