diff options
Diffstat (limited to 'kernel/gsp_phys_booter.h')
| -rw-r--r-- | kernel/gsp_phys_booter.h | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/kernel/gsp_phys_booter.h b/kernel/gsp_phys_booter.h index f462c4e..73c21ad 100644 --- a/kernel/gsp_phys_booter.h +++ b/kernel/gsp_phys_booter.h @@ -296,6 +296,92 @@ void gsp_phys_backend_relay_counters(u64 *requested, u64 *ok, u64 *verify_fail, u64 *refused, u64 *pool_exhausted); /* + * GR (compute) guest forwarding (gsp_phys_gr_forward=1 AND + * gsp_phys_guest_mem=1; both default off). The caller has already decoded a + * guest GR launch, resolved the guest VAs of the QMD's program/parameter/ + * pointer pages to guest PAs, and resolved those PAs to host PAs. + * + * gsp_phys_gr_page describes one page the launch references: its guest VA + * (where Tier 1 maps the HPA), the host PA (0 = unresolved) and the QMD word + * index of the 64-bit pointer pair that names it (qmd_word < 48, 32 for the + * parameter bank, 48 for the program, GSP_PHYS_GR_QMD_WORD_NONE when no QMD + * word points at the page). A page with an unresolved HPA can still be + * submitted through Tier 2 when the caller supplies captured inline-write + * bytes for it and qmd_word points at it: the backend allocates a ladder + * shadow page, copies the captured bytes and rewrites that QMD word pair. + * + * gsp_phys_gr_inline is one captured GRCE inline write: the destination guest + * VA and its captured payload bytes. + * + * gsp_phys_gr_submit is one launch: the 64 rewritten-QMD source words, the + * optional guest-visible release page for QMD release0 (rel_hpa/rel_off/ + * rel_payload; zero rel_hpa points release0 at the module semaphore), the + * optional guest-visible channel release page (sem_hpa/sem_off/sem_payload; + * zero sem_hpa points the REPORT_SEMAPHORE block at the module semaphore) and + * push identity for logging. + * + * gsp_phys_backend_gr_submit() consumes only the fresh, never-reused 128 B + * PTE fetch lines (one per shadowed page and one per guest release page; the + * GMMU caches PTE fetches at 128 B with no invalidate), refuses unless the + * GR exec gate is latched and the guest-RAM/identity-domain gates are open, + * builds SET_OBJECT + the inline-QMD loader + REPORT_SEMAPHORE on the compute + * subchannel, publishes the GPFIFO entry/USERD/doorbell and polls the module + * semaphore (and the QMD release word when rewritten to a ladder VA). On + * timeout it drains the epoch-gated fault queue into out->fault, exactly like + * the CE relay path. Every failure returns an errno the sema service falls + * back to; no guest state is lost. Returns 0 on a completed launch. + */ +#define GSP_PHYS_GR_MAX_PAGES 16u +#define GSP_PHYS_GR_MAX_INLINE 8u +#define GSP_PHYS_GR_INLINE_BYTES 64u +#define GSP_PHYS_GR_QMD_WORDS 64u +#define GSP_PHYS_GR_QMD_WORD_NONE 0xffffffffu + +struct gsp_phys_gr_page { + u64 guest_va; /* guest VA (page aligned) */ + u64 hpa; /* host PA (page aligned; 0 = unresolved) */ + u32 qmd_word; /* QMD word of the pointer pair, or NONE */ + u32 reserved; +}; + +struct gsp_phys_gr_inline { + u64 dst_va; /* captured GRCE inline-write destination */ + u32 len; /* payload bytes (<= GSP_PHYS_GR_INLINE_BYTES) */ + u8 data[GSP_PHYS_GR_INLINE_BYTES]; +}; + +struct gsp_phys_gr_submit { + const u32 *qmd; /* 64 rewritten-QMD source words */ + u32 qmd_words; /* must be GSP_PHYS_GR_QMD_WORDS */ + u64 qmd_va; /* guest VA of the QMD (logging only) */ + const struct gsp_phys_gr_page *pages; + u32 n_pages; + const struct gsp_phys_gr_inline *inl; + u32 n_inl; + u64 rel_hpa; /* guest-visible QMD release0 page, or 0 */ + u32 rel_off; + u32 rel_payload; + u64 sem_hpa; /* guest-visible channel release page, or 0 */ + u32 sem_off; + u32 sem_payload; + u64 push_va; /* guest push identity (logging only) */ + u32 push_len; + u32 h_object; /* guest GR channel handle (logging only) */ +}; + +/* True when gsp_phys_gr_forward is set and the ladder is a live GR channel + * whose boot submission proved out (rmcall_gr_exec_ok). */ +bool gsp_phys_backend_gr_ready(void); + +int gsp_phys_backend_guest_gr_submit(const struct gsp_phys_gr_submit *req, + struct gsp_phys_backend_copy_result *out); + +/* GR forwarding counters (submitted/verified/cancelled), plain reads. */ +void gsp_phys_backend_gr_counters(u64 *submitted, u64 *ok, u64 *refused, + u64 *timed_out, u64 *pool_exhausted); + + +/* * P6c C3 fault observation/relay (gsp_phys_fault_relay=1; default off). * * gsp_phys_status_drain_fault() walks the unconsumed status-queue records with |
