summaryrefslogtreecommitdiffstats
path: root/kernel/gsp_phys_booter.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/gsp_phys_booter.c')
-rw-r--r--kernel/gsp_phys_booter.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c
index 9e45937..fdd20db 100644
--- a/kernel/gsp_phys_booter.c
+++ b/kernel/gsp_phys_booter.c
@@ -16254,7 +16254,7 @@ static void gsp_phys_gr_rewrite_data_vars(u32 *w, u32 n_words,
{
u32 rew = 0, k;
- if (!req->n_data_wins)
+ if (!req->n_data)
return;
/* Scan every 4-byte boundary: the demo's bank-4 base pointer sits at
* a 4-aligned (not 8-aligned) offset, which an 8-stride scan misses. */
@@ -16265,12 +16265,11 @@ static void gsp_phys_gr_rewrite_data_vars(u32 *w, u32 n_words,
if (v < 0x10000000ULL || v >= (1ULL << 47) || (v & 3))
continue;
- wb = v & ~0x1fffffULL;
- for (x = 0; x < req->n_data_wins; x++) {
- if (req->data_wins[x].va_base != wb)
+ wb = v & ~0xfffULL;
+ for (x = 0; x < req->n_data; x++) {
+ if (req->data[x].va != wb)
continue;
- v = req->data_wins[x].reloc_base |
- (v & 0x1fffffULL);
+ v = req->data[x].reloc_va | (v & 0xfffULL);
w[k] = (u32)v;
w[k + 1] = (u32)(v >> 32);
rew++;
@@ -16296,20 +16295,30 @@ static int gsp_phys_rmcall_gr_data_map(void __iomem *bar0, u64 va, u64 hpa,
u32 epoch)
{
struct gsp_phys_boot_chunk *pt;
- u32 k, ip;
+ u32 ip;
u64 pte;
(void)bar0;
(void)epoch;
- if (va < GSP_PHYS_RMCALL_VA_GR_DATA_BASE)
+ /*
+ * m110: the engine's SM walker only honours the commit-time tree, so
+ * data pages are relocated into the main small-PT window
+ * (GSP_PHYS_RMCALL_VA_BASE + 0x10000 ..), whose slots above 0x10f are
+ * fresh PTE lines - the proven window-0 pattern. Slot 0x1f0 (VA
+ * 0x1f0000) is reserved for the mail injection; 0x180..0x18f stay
+ * clear of the legacy guest slot.
+ */
+ if (va < GSP_PHYS_RMCALL_VA_BASE + 0x10000ULL ||
+ va >= GSP_PHYS_RMCALL_VA_BASE + 0x200000ULL)
return -ERANGE;
- k = (u32)((va - GSP_PHYS_RMCALL_VA_GR_DATA_BASE) >> 21);
- if (k >= GSP_PHYS_RMCALL_GR_DATA_WINS)
+ ip = (u32)((va >> 12) & 0x1ffu);
+ if (ip < 0x110u || (ip >= 0x180u && ip < 0x190u))
return -ERANGE;
- pt = &boot_stage.rmcall_gr_data_pt[k];
+ pt = &boot_stage.rmcall_chunks[GSP_PHYS_RMCALL_BUF_PT];
+ if (pt->pages)
+ pt = pt;
if (!pt->pages)
return -EIO;
- ip = (u32)((va >> 12) & 0x1ffu);
pte = gsp_phys_rmcall_pte(hpa);
if (gsp_phys_rmcall_gr_pte_kind_value())
pte |= (u64)gsp_phys_rmcall_gr_pte_kind_value() << 56;
@@ -16661,9 +16670,8 @@ int gsp_phys_backend_guest_gr_submit(const struct gsp_phys_gr_submit *req,
boot_stage.rmcall_gr_data_pt
[GSP_PHYS_RMCALL_GR_DATA_WINS - 1].pages);
{
- u64 mva = GSP_PHYS_RMCALL_VA_GR_DATA_BASE +
- (((u64)GSP_PHYS_RMCALL_GR_DATA_WINS - 1)
- << 21);
+ u64 mva = GSP_PHYS_RMCALL_VA_BASE +
+ 0x1f0000ULL;
int mret = -EINVAL;
if (boot_stage.rmcall_gr_mail.pages)