@@ -109,16 +109,17 @@ bool kvm__arch_load_kernel_image(struct kvm *kvm, int fd_kernel, int fd_initrd,
unsigned long guest_addr, kernel_offset;
ssize_t file_size;
+#if __riscv_xlen == 64
+ limit = kvm->ram_start + kvm->ram_size - 1;
+ /* Linux expects to be booted at 2M boundary for RV64 */
+ kernel_offset = 0x200000;
+#else
/*
* Linux requires the initrd and dtb to be mapped inside lowmem,
* so we can't just place them at the top of memory.
*/
limit = kvm->ram_start + min(kvm->ram_size, (u64)SZ_256M) - 1;
-#if __riscv_xlen == 64
- /* Linux expects to be booted at 2M boundary for RV64 */
- kernel_offset = 0x200000;
-#else
/* Linux expects to be booted at 4M boundary for RV32 */
kernel_offset = 0x400000;
#endif
Signed-off-by: Anton Blanchard <antonb@tenstorrent.com> --- riscv/kvm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)