mirror of
https://github.com/AsahiLinux/m1n1
synced 2025-02-16 21:58:27 +00:00
hv_vm: Fix CTRR hugepage issue
This is the hypervisor counterpart to da9ceddeac
.
Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
2389fa9d3d
commit
481f662271
1 changed files with 8 additions and 2 deletions
10
src/hv_vm.c
10
src/hv_vm.c
|
@ -14,6 +14,8 @@
|
|||
#include "uartproxy.h"
|
||||
#include "utils.h"
|
||||
|
||||
extern uint64_t ram_base;
|
||||
|
||||
#define PAGE_SIZE 0x4000
|
||||
#define CACHE_LINE_SIZE 64
|
||||
#define CACHE_LINE_LOG2 6
|
||||
|
@ -325,8 +327,12 @@ int hv_map(u64 from, u64 to, u64 size, u64 incr)
|
|||
}
|
||||
|
||||
// L3 mappings to boundary
|
||||
chunk = ALIGN_DOWN(min(size, ALIGN_UP(from, BIT(VADDR_L2_OFFSET_BITS)) - from),
|
||||
BIT(VADDR_L3_OFFSET_BITS));
|
||||
u64 boundary = ALIGN_UP(from, MASK(VADDR_L2_OFFSET_BITS));
|
||||
// CPU CTRR doesn't like L2 mappings crossing CTRR boundaries!
|
||||
// Map everything below the m1n1 base as L3
|
||||
if (boundary >= ram_base && boundary < (u64)_base)
|
||||
boundary = ALIGN_UP((u64)_base, MASK(VADDR_L2_OFFSET_BITS));
|
||||
chunk = ALIGN_DOWN(min(size, boundary - from), BIT(VADDR_L3_OFFSET_BITS));
|
||||
if (chunk) {
|
||||
hv_pt_map_l3(from, to, chunk, incr);
|
||||
from += chunk;
|
||||
|
|
Loading…
Add table
Reference in a new issue