Skip to content

booter: build a self-owned LINEAR TLB for the bootvm ASID - #81

Open
stzahi1 wants to merge 3 commits into
masterfrom
booter_linear_tlb
Open

booter: build a self-owned LINEAR TLB for the bootvm ASID#81
stzahi1 wants to merge 3 commits into
masterfrom
booter_linear_tlb

Conversation

@stzahi1

@stzahi1 stzahi1 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Replace the kernel's OFFSET translation with a LINEAR table the booter builds and installs itself via h2_vmtrap_newmap(), covering its own footprint (image + heap + stack) sized from BOOT_TLB_PGSIZE and PAGE_BITS.

Add a GUEST_WINDOW_PAGES-sized (16M-page) window starting at H2K_GUEST_START, since load_vm() accesses guest physical memory directly through the booter's own map and needs coverage beyond the booter's footprint entries.

@github-actions github-actions Bot added the untested Mark untested PRs label Jul 20, 2026
@stzahi1
stzahi1 force-pushed the booter_linear_tlb branch from 2ef6dea to e7a876e Compare July 20, 2026 12:45
Comment thread booter/booter.c Outdated
Comment thread booter/booter.c Outdated
@bryanb-h2

Copy link
Copy Markdown
Contributor

Did you look at add_linear_trans() to see if it could be repurposed for this?

stzahi1 added 2 commits July 29, 2026 16:53
Replace the kernel's OFFSET translation with a LINEAR table the
booter builds and installs itself via h2_vmtrap_newmap(), covering
its own footprint (image + heap + stack) sized from BOOT_TLB_PGSIZE
and PAGE_BITS.

Add a GUEST_WINDOW_PAGES-sized (16M-page) window starting at
H2K_GUEST_START, since load_vm() accesses guest physical memory
directly through the booter's own map and needs coverage beyond the
booter's footprint entries.

Signed-off-by: Tzahi Sabo <stzahi@qti.qualcomm.com>
…xed guess

booter_self_map() used to install a fixed GUEST_WINDOW_PAGES (5 x 16M)
guest window before any guest ELF was even opened, silently capping how
much guest memory the booter could read/write directly via load_vm()/
copy_vm(). Move that mapping into load_vm() itself, growing the booter's
persistent LINEAR table on demand (booter_grow_guest_window()) at each
point where the actual required size becomes known: the phdr load loop,
the clone-path copy_vm(), and the stash-path copy_vm(). Window growth is
sized per-VM using vm_params[idx].page_size instead of a hardcoded
constant.

booter_self_map() now builds footprint-only entries; GUEST_WINDOW_PAGES
is removed.

Signed-off-by: Tzahi Sabo <stzahi@qti.qualcomm.com>
@stzahi1
stzahi1 force-pushed the booter_linear_tlb branch from ab9a2b3 to e461872 Compare July 29, 2026 13:53
guest_base + pre_total_size was computed in 32-bit arithmetic before
being passed to booter_grow_guest_window()'s unsigned long long
parameter. For high guest_base values (e.g. opt_si's 0x87000000) the
addition could wrap, silently under-growing or no-op'ing the guest
LINEAR window instead of sizing it correctly.

Signed-off-by: Tzahi Sabo <stzahi@qti.qualcomm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

untested Mark untested PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants