Skip to content

Commit

Permalink
aarch64: fix get time runtime service failure
Browse files Browse the repository at this point in the history
When enable efi_rtc inside guest kernel, a warning occurs:

[    0.764401] [Firmware Bug]: Unable to handle paging request in EFI runtime service
[    0.770671] ------------[ cut here ]------------
[    0.772014] WARNING: CPU: 0 PID: 1 at drivers/firmware/efi/runtime-wrappers.c:262 virt_efi_get_time+0x12c/0x17c

It derives from that there is lack of memory map descriptor for IO address
of RTC_PL031 passed to kernel. Allocate IO Map for it before execute
kernel/bootloader can avoid this failure and then we can get the right
time inside guest.

Fixes: #289
Signed-off-by: Jianyong Wu <[email protected]>
  • Loading branch information
jongwu committed Oct 27, 2023
1 parent bd072ef commit bb6b752
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/efi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,15 @@ fn populate_allocator(info: &dyn bootinfo::Info, image_address: u64, image_size:
);
}

// Add IO map for RTC PL031 on aarch64
#[cfg(target_arch = "aarch64")]
ALLOCATOR.borrow_mut().add_initial_allocation(
efi::MEMORY_MAPPED_IO,
1,
crate::arch::aarch64::layout::map::mmio::PL031_START as u64,
r_efi::efi::MEMORY_RUNTIME,
);

// Add the loaded binary
ALLOCATOR.borrow_mut().allocate_pages(
efi::ALLOCATE_ADDRESS,
Expand Down

0 comments on commit bb6b752

Please sign in to comment.