-
Notifications
You must be signed in to change notification settings - Fork 66
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
Tianocore EDK2 UEFI firmware support #134
Comments
Afaik Did you try building and running a QEMU virt firmware? |
Okay I've built the firmware. It seems that I've tried to run Here is a QEMU cmdline that actually works:
Here is my build from tianocore/edk2@c0dfe3e: riscv_edk2.zip |
Yes, I built it and managed to run Haiku in QEMU with it. It builds surprisingly easy in Haiku host using Clang cross compiler. I used pflash for specifying EDK2 firmware ROM, other options did not work. |
Question: Does it only support UEFI or some way to simply load a kernel like with U-Boot scripts is also present? |
I am not completely confident, but I think that EDK2 supports running EFI PE binaries only and no scripts are supported. Some Linux distros such as Fedora provide EFI boot loader for riscv64 target. GRUB also probably works. |
For now I figured that EDK2 isn't loaded at usual Is there some kind of spec/documentation to all of this? |
I suspect that it use dynamic address allocation. It should just work after implementing requirements such as pflash without need to know all inner workings. |
I am able to get EDK2 output even when I use RVVM device tree with QEMU (or any tiny device tree with plic, clint, uart only). It crashes, but it at least outputs a crash so that I know it tried to do something.
On the other hand when fully running on RVVM and passing EDK2 as |
I know about |
Okay so apparently it jumps into
And it is likely not relocatable which would explains everything |
I also would like to ask a few unrelated/barely related questions that I had for a while:
|
For now I do not see cases where ACPI support is really required for RISC-V operating systems. I also do not know any real ACPI RISC-V hardware. But ACPI support may become needed if Microsoft decides to port Windows to RISC-V, Windows support ACPI only. For Haiku both ACPI and FDT support is planned. I managed to run my Haiku development branch on QEMU with ACPI after fixing minor QEMU bug (qemu/qemu@3018765).
I think it can if it do not need too invasive and global changes to Haiku kernel. First some detailed discussion is needed about necessary kernel features and kernel <-> VM communication protocol. |
Basic idea is:
This approach generally allows fully native execution, with the following downsides compared to full H-ext virtualization:
My initial idea of VM<->kernel interface (Pseudocode, this can really be implemented as a syscall or ioctl or whatever): // Creates a shadow pagetable, destroy with close()
int vm_pgt_create();
// Shares memory from a usual process into the shadow pagetable
// Can be replaced with mmap-like interface that accepts a FD if that makes things simpler, but this approach seems more extensible
int vcpu_map_pages(int pgt_fd, size_t va, void* uptr, size_t size);
int vcpu_unmap_pages(int pgt_fd, size_t va, size_t size);
struct vcpu_runner_state {
size_t pc;
size_t gpr[31];
double fpr[32];
size_t fcsr;
};
// Accepts initial vCPU U-mode state & shadow pagetable handle for address space
// Runs the vCPU until any kind of exception, modifies vcpu_state post execution
// This design allows vCPU entry/exit & state manipulation in a single syscall
int vcpu_run(int pgt_fd, struct vcpu_runner_state* vcpu_state);
|
Ah, almost forgot about interrupts. |
About EDK2: Maybe it makes more sense to ask them for an S-mode payload without cfi-flash requirement? If they won't agree then we can implement RVVM support anyways, but it probably makes more sense to have a more generic payload that may actually run on real hardware. The biggest problem with EDK2 riscv support currently is the requirement to use |
Asked for a generic S-mode payload in tianocore/edk2#5815 |
Reference: https://github.com/tianocore/edk2/tree/master/OvmfPkg/RiscVVirt
Note that EDK 2 support both ACPI and FDT hardware definitions, so existing FDT generation should be fine. Some NVRAM emulation may be needed.
The text was updated successfully, but these errors were encountered: