From fdb034444ed13f0ce06b1f4dafbb3fbbaabce8e8 Mon Sep 17 00:00:00 2001 From: sadoon Date: Fri, 25 Aug 2023 14:47:13 +0100 Subject: [PATCH] new page --- SFFS/qemu.mdwn | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 SFFS/qemu.mdwn diff --git a/SFFS/qemu.mdwn b/SFFS/qemu.mdwn new file mode 100644 index 000000000..bd4227292 --- /dev/null +++ b/SFFS/qemu.mdwn @@ -0,0 +1,39 @@ +# Documentation on the process of patching QEMU to support SFFS + +Useful Links: + +* bugreport: +* (External) [qemu source code](https://github.com/qemu/qemu) +* (External) [qemu cpu flags for x86*](https://www.linux-kvm.org/page/Tuning_KVM) + +## Reasoning: + +Libre-SOC builds upon the OpenPOWER ISA v3.0 but does not include many +parts of the architecture typically found on production silicon, like +AltiVec, VSX, and 128-bit hardware floating point. There are no commercially available chips that support OpenPOWER ISA v3.0 SFFS without VSX, AltiVec, and 128-bit hardware floating point. + +Because of this, we are stuck in a chicken and egg problem where we need the chip to test software, but we also need to test whether software is compliant with SFFS by using such a chip. This is where QEMU as an emulator can help us. + +The goal is to add a CPU definition in QEMU that specifically emulates an OpenPOWER ISA v3.0 SFFS chip that we can use to run tests and full operating system images on. + +## Progress and setbacks + +### We have first tried using POWER7 which is available on QEMU + +- POWER7 runs little endian without VSX, but is only ISA 2.06 compliant. +-- The assumption was that Any additions from ISA 3.0 would be emulated by the Linux kernel, that however did not work. +-- We tried booting [Gentoo SFFS](https://libre-soc.org/SFFS/gentoo_bootstrap/) with a kernel compiled for POWER9, POWER8, and POWER7, all seem to fail with a kernel panic due to missing instructions. +-- We also tried booting it with a kernel built for all three POWER versions mentioned earlier and also disabling VSX and/or AltiVec, still fails with a kernel panic due to missing instructions. + +### We have tried patching QEMU's definition for POWER9 to exclude VSX and AltiVec + +- This did not work and needs considerable amounts of patching. +- The relevant files are `tcg/ppc/tcg-target.h` and `target/ppc/{compat.c,cpu.c,cpu.h,cpu_init.c,cpu_models.c,cpu_models.h,cpu-qom.h,cpu-param.h}` none worked. + +### We have researched in length if the CPU capabilities feature of QEMU is available on POWER + +- It is not available and needs to be added in, unlike x86* and some other architectures that QEMU supports. +- However, it being a feature of QEMU to start means patching it in will be simpler than adding a fresh feature that was not available in the code before. + +## Conclusion as of 25 Aug 2023: +This task will need a considerable amount of research and work -- 2.30.2