booter: build a self-owned LINEAR TLB for the bootvm ASID#81
Conversation
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>
2ef6dea to
e7a876e
Compare
| // Guest window: maps H2K_GUEST_START upward in 16M pages so the booter can read/write guest | ||
| // physical memory directly (memcpy/read/memset in load_vm()) the same way OFFSET translation | ||
| // allowed before this table replaced it. | ||
| va = H2K_GUEST_START >> PAGE_BITS; | ||
| pa = ((unsigned long long)H2K_GUEST_START + __boot_net_phys_offset__) >> PAGE_BITS; | ||
|
|
||
| for (i = 0; i < guest_npages; i++) { | ||
| table[npages + i].raw = 0ULL; | ||
| table[npages + i].ppn = pa; | ||
| table[npages + i].cccc = BOOT_CACHE_ATTR; | ||
| table[npages + i].xwru = URWX; | ||
| table[npages + i].vpn = va; | ||
| table[npages + i].size = SIZE_16M; | ||
|
|
||
| va += 1 << (SIZE_16M * 2); // advance by one 16M page's worth of page-numbers | ||
| pa += 1 << (SIZE_16M * 2); | ||
| } | ||
| table[npages + guest_npages].raw = 0ULL; // end marker (zero raw entry terminates the table) |
There was a problem hiding this comment.
This is unnecessary. While loading the guest image these entries will have to be modified and the translations re-registered anyway, so just zero them here.
There was a problem hiding this comment.
Having zero will break the assumption that 0 row indicates last row. Are you suggesting that the entries will not be added to the linear table until the guest image is being koaded?
There was a problem hiding this comment.
That's exactly the point. 0 is an invalid entry and tells the tlb miss handler to stop searching, which is what you want if the entries are invalid.
As a matter of fact you shouldn't allocate them at all here; just realloc() at the time you need them, i.e. for loading the guest.
|
Did you look at add_linear_trans() to see if it could be repurposed for this? |
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.