-
Notifications
You must be signed in to change notification settings - Fork 62
Add UEFI image loader for arm64. #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really know much about UEFI. Do you also have an example of how this is used?
Can you also add some tests?
src/loader/aarch64/pe/mod.rs
Outdated
| /// uefi image for virtual machine on arm64 is not formatted, so | ||
| /// a special loader for it is needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this needs to be part of the public interface documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I will remove it.
src/loader/aarch64/pe/mod.rs
Outdated
| } | ||
| } | ||
|
|
||
| /// load uefi for aarch64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can you format the comment similar to how other comments are formatted: Load UEFI image in guest memory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thanks
| /// * `guest_addr` - The offset in guest_mem from which the UEFI image will be loaded. | ||
| /// * `uefi_image` - The UEFI image | ||
| #[cfg(target_arch = "aarch64")] | ||
| pub fn load_uefi<F, M: GuestMemory>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code of this functions is rather similar to load_dtb, can you refactor to reduce some duplicate code?
|
@andreeaflorescu -, Thanks for reply. |
|
For loading a UEFI/OVMF on Cloud Hypervisor with x86-64 we used the PVH (like Xen) support so that we didn't need to modify linux-loader or the VMM. I see that ArmVirtPkg also supports Xen: https://github.com/tianocore/edk2/blob/master/ArmVirtPkg/ArmVirtXen.fdf If you can make that work then I think that would a a cleaner approach. |
Oh, I think i misunderstood. This is a loader for the UEFI PE format rather than for a UEFI firmware blob. What's your use case for this? |
|
Hello @rbradford -, for now, the UEFI image on arm64 virtual platform (eg, qemu, kvmtool) is not formatted, not a pe or elf. Unfortunately, we have no such a loader to load a file without header in it. |
UEFI image for virtual platform on arm64 is not formatted, so we add a specific loader for it here. Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
|
Hi @andreeaflorescu -, any comments? |
Thanks, I can take another look in a couple of days. Can you share an example of how this is used in practice? Do you happen to have a patch that adds this support in Cloud Hypervisor? @rbradford since it looks like this support is going to end up in Cloud Hypervisor, can you also please take a look at this PR? |
|
@andreeaflorescu , there is a PR in Cloud-hypervisor that includes the WIP commits for UEFI & ACPI support for AArch64. The code to call this new function is like this: cloud-hypervisor/cloud-hypervisor@9742ecd#diff-9c91c6326e9d86ef107a59aed3f13a9bb91790f9f4be1668d22cda12a28bc28cR905 The UEFI binary is header-less, it's impossible to recognize it by format. |
|
Hello @andreeaflorescu -, could you please take a look of this patch? We have a PR in Cloud Hypervisor to enable Acpi on arm64 which depends on this patch. Also, you can find the use case of the new handler added in this patch here We have blocked here so long, thus I'm very appreciate if there is any progress on this PR. Thanks! |
|
@jongwu I can only provide high level feedback, and that might not be very meaningful. Can someone from Cloud Hypervisor review this since it is going to be used there? You should not block on my approval as I really do not have enough context. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like it doesn't do much more than read the file into guest memory. Maybe it makes sense to just do that in CH?
|
Thanks @rbradford @andreeaflorescu -, since we can do this change in CLH, I will close this. |
UEFI image for virtual platform on arm64 is not formatted,
so I add a specific loader for it here.
Signed-off-by: Jianyong Wu jianyong.wu@arm.com
@aghecenco @andreeaflorescu