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
plat/kvm: Use AllocatePages()
to allocate memory regions in UEFI
#1061
plat/kvm: Use AllocatePages()
to allocate memory regions in UEFI
#1061
Conversation
✅ Checkpatch passed Beep boop! I ran Unikraft's
|
d088656
to
32411b4
Compare
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 have no idea about UEFI, and wasn't able to get QEMU working with it. I assume that somebody else will test it.
Okay seems to work, but we should really increase the default memory region count. With the default memory region count the image does not boot on QEMU+OVMF.
Reviewed-by: Marco Schlumpp marco@unikraft.io
According to the `UEFI` specifications, `AllocatePool()` is the safest allocation method, however there are two pitfalls: - we don't know the BIOS's memory allocator or the system's memory map, so the resulted allocation start address may be out of the range that would be compatible with a Unikraft configuration that does not have `CONFIG_HAVE_PAGING` - it does not guarantee page-aligned allocations and, even though we may be able to align the length or the end address, the allocation's start address may therefore not be page-aligned Thus, replace such calls to `AllocatePool()` with calls to `AllocatePages()` to ensure page-aligned start addresses. Furthermore, preserve backwards compatibility with Unikraft configurations that do not have `CONFIG_HAVE_PAGING` by limiting the allocation's start address to be below the highest address of the static boot page tables through the help of `bpt_unmap_mrd`. Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
32411b4
to
6b81bd5
Compare
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.
Looks very good to me. Thanks, @mogasergiu!
Reviewed-by: Eduard Vintilă eduard.vintila47@gmail.com
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.
Approved-by: Michalis Pappas michalis@unikraft.io
According to the `UEFI` specifications, `AllocatePool()` is the safest allocation method, however there are two pitfalls: - we don't know the BIOS's memory allocator or the system's memory map, so the resulted allocation start address may be out of the range that would be compatible with a Unikraft configuration that does not have `CONFIG_HAVE_PAGING` - it does not guarantee page-aligned allocations and, even though we may be able to align the length or the end address, the allocation's start address may therefore not be page-aligned Thus, replace such calls to `AllocatePool()` with calls to `AllocatePages()` to ensure page-aligned start addresses. Furthermore, preserve backwards compatibility with Unikraft configurations that do not have `CONFIG_HAVE_PAGING` by limiting the allocation's start address to be below the highest address of the static boot page tables through the help of `bpt_unmap_mrd`. Signed-off-by: Sergiu Moga <sergiu@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Approved-by: Michalis Pappas <michalis@unikraft.io> GitHub-Closes: #1061
According to the `UEFI` specifications, `AllocatePool()` is the safest allocation method, however there are two pitfalls: - we don't know the BIOS's memory allocator or the system's memory map, so the resulted allocation start address may be out of the range that would be compatible with a Unikraft configuration that does not have `CONFIG_HAVE_PAGING` - it does not guarantee page-aligned allocations and, even though we may be able to align the length or the end address, the allocation's start address may therefore not be page-aligned Thus, replace such calls to `AllocatePool()` with calls to `AllocatePages()` to ensure page-aligned start addresses. Furthermore, preserve backwards compatibility with Unikraft configurations that do not have `CONFIG_HAVE_PAGING` by limiting the allocation's start address to be below the highest address of the static boot page tables through the help of `bpt_unmap_mrd`. Signed-off-by: Sergiu Moga <sergiu@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Approved-by: Michalis Pappas <michalis@unikraft.io> GitHub-Closes: #1061
According to the
UEFI
specifications,AllocatePool()
is the safest allocation method, however there are two pitfalls:CONFIG_HAVE_PAGING
Thus, replace such calls to
AllocatePool()
with calls toAllocatePages()
to ensure page-aligned start addresses. Furthermore, preserve backwards compatibility with Unikraft configurations that do not haveCONFIG_HAVE_PAGING
by limiting the allocation's start address to be below the highest address of the static boot page tables through the help ofbpt_unmap_mrd
.Prerequisite checklist
checkpatch.uk
on your commit series before opening this PR;Base target
kvm
]Additional configuration
Description of changes