summaryrefslogtreecommitdiffstats
path: root/kernel/gsp_sema_service.c
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-07 15:25:31 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-07 15:25:31 -0400
commit406c9ff19d7b3470e938e0ddfee565a709453053 (patch)
tree62fdc98396374df302022f137c7fd491e4f4dd60 /kernel/gsp_sema_service.c
parent64020f17858deabfed229249378ba5104eaf0e7a (diff)
downloadopen-iov-406c9ff19d7b3470e938e0ddfee565a709453053.tar.gz
open-iov-406c9ff19d7b3470e938e0ddfee565a709453053.zip
vgsp: m110 - relocate data into the engine-walkable main-PT window; shrink the demo
All UPDATE_PDE_2 installs (post- or pre-commit) are invisible to the SM walker; the only window it honours is the commit-time main small-PT page (VA 0x100000+, the proven win0/const window). Relocate each candidate data pointer's first 64 pages into slots 0x110..0x1f0 of that window (fresh PTE lines, direct leaf writes), rewrite bank pointers per page record, and put the mail page at the reserved slot 0x1f0 (c[0x4][0x0]=0x1f0000). Shrink victory_mail's buffers (n=1<<15, 128 KB each) to fit the 2 MB window.
Diffstat (limited to 'kernel/gsp_sema_service.c')
-rw-r--r--kernel/gsp_sema_service.c84
1 files changed, 35 insertions, 49 deletions
diff --git a/kernel/gsp_sema_service.c b/kernel/gsp_sema_service.c
index 844d2c9..caaaae3 100644
--- a/kernel/gsp_sema_service.c
+++ b/kernel/gsp_sema_service.c
@@ -9555,7 +9555,13 @@ static bool svc_gr_page_inline_covers(u64 page)
* Resolution only happens on the service thread; the work item turns the
* guest PAs into HPAs and the backend plants the identity PTEs.
*/
-#define SVC_GR_DATA_RELOC_BASE 0x100000000ULL
+#define SVC_GR_DATA_RELOC_BASE 0x110000ULL
+/*
+ * Per candidate pointer, map at most this many pages from the pointer's
+ * page onward (the engine-visible main-PT window has ~220 free 4 KB slots;
+ * the demo buffers are small on the native path).
+ */
+#define SVC_GR_DATA_PAGES_PER_PTR 64u
static void svc_gr_data_fill(struct nv_vgpu_device *vgpu)
{
@@ -9605,62 +9611,42 @@ static void svc_gr_data_fill(struct nv_vgpu_device *vgpu)
wins[n_cand++] = wv;
}
}
+ /* m110: one contiguous run of pages per candidate pointer, relocated
+ * into the engine-walkable main-PT window (0x110000 onward, fresh
+ * PTE lines; the commit-time snapshot only preserves that window). */
for (w = 0; w < n_cand; w++) {
- int wi;
+ u64 base = wins[w] & ~0x1fffffULL;
+ u32 p;
- for (wi = -1; wi <= 16; wi++) {
- u64 wv = wins[w] + (u64)wi * 0x200000ULL;
- u64 rbase;
- u32 got = 0, p, x;
+ for (p = 0; p < SVC_GR_DATA_PAGES_PER_PTR; p++) {
+ u64 va = wins[w] + (u64)p * SEMA_PAGE_SIZE;
+ u64 pa = 0;
+ u32 ap = 0, x;
+ struct svc_gr_data *rec;
- if (wi < 0 && wins[w] < 0x200000ULL)
- continue;
- if (wv >= (1ULL << 47))
+ if (va >= (1ULL << 47))
break;
- for (x = 0; x < svc_fwd_req.gr_n_data_wins; x++)
- if (svc_fwd_req.gr_data_wins[x].va_base == wv)
+ for (x = 0; x < svc_fwd_req.gr_n_data; x++)
+ if (svc_fwd_req.gr_data[x].va == va)
break;
- if (x == svc_fwd_req.gr_n_data_wins) {
- if (svc_fwd_req.gr_n_data_wins >=
- SVC_GR_DATA_WINS_MAX)
- return;
- svc_fwd_req.gr_data_wins[x].va_base = wv;
- rbase = SVC_GR_DATA_RELOC_BASE +
- ((u64)svc_fwd_req.gr_n_data_wins <<
- 21);
- svc_fwd_req.gr_data_wins[x].reloc_base =
- rbase;
- svc_fwd_req.gr_n_data_wins++;
- } else {
- rbase =
- svc_fwd_req.gr_data_wins[x].reloc_base;
- }
- for (p = 0; p < 512; p++) {
- u64 va = wv + (u64)p * SEMA_PAGE_SIZE;
- u64 pa = 0;
- u32 ap = 0;
- struct svc_gr_data *rec;
-
- if (svc_resolve_va(vgpu, va, &pa, &ap))
- continue;
- if (svc_fwd_req.gr_n_data >= SVC_GR_DATA_MAX)
- return;
- rec = &svc_fwd_req.gr_data
- [svc_fwd_req.gr_n_data++];
- rec->va = va;
- rec->pa = pa & ~(u64)(SEMA_PAGE_SIZE - 1);
- rec->reloc_va = rbase + (va & 0x1fffffULL);
- rec->ap = (u8)svc_ap_of(ap);
- got++;
- }
- if (!got && wi > 0)
+ if (x < svc_fwd_req.gr_n_data)
+ continue; /* already mapped */
+ if (svc_resolve_va(vgpu, va, &pa, &ap))
break;
if (svc_fwd_req.gr_n_data >= SVC_GR_DATA_MAX)
return;
- }
- }
- pr_info("vgsp-sema: svc-gr data fill: %u candidate ptrs, %u windows, %u pages resolved\n",
- n_cand, svc_fwd_req.gr_n_data_wins, svc_fwd_req.gr_n_data);
+ rec = &svc_fwd_req.gr_data[svc_fwd_req.gr_n_data];
+ rec->va = va;
+ rec->pa = pa & ~(u64)(SEMA_PAGE_SIZE - 1);
+ rec->reloc_va = SVC_GR_DATA_RELOC_BASE +
+ ((u64)svc_fwd_req.gr_n_data << 12);
+ rec->ap = (u8)svc_ap_of(ap);
+ svc_fwd_req.gr_n_data++;
+ }
+ (void)base;
+ }
+ pr_info("vgsp-sema: svc-gr data fill: %u candidate ptrs, %u pages resolved (reloc 0x%llx+)\n",
+ n_cand, svc_fwd_req.gr_n_data, (u64)SVC_GR_DATA_RELOC_BASE);
}
static int svc_gr_req_fill(struct nv_vgpu_device *vgpu,