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 25, 2023
1 parent bd072ef commit 0c7a485
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/efi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,19 @@ pub fn efi_exec(

let wrapped_fs = file::FileSystemWrapper::new(fs, efi_part_id);

// allocate descriptor for RTC on aarch64
#[cfg(target_arch = "aarch64")]
if Status::SUCCESS
!= 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,
)
{
log!("Failed to allocate memory map descriptor for RTC PL031\n");
}

let image = new_image_handle(
crate::efi::EFI_BOOT_PATH,
0 as Handle,
Expand Down

0 comments on commit 0c7a485

Please sign in to comment.