On Thu, 20 May 2021, Alexey Kardashevskiy wrote:
diff --git a/hw/ppc/spapr_vof.c b/hw/ppc/spapr_vof.c
new file mode 100644
index 000000000000..5e34d5402abf
--- /dev/null
+++ b/hw/ppc/spapr_vof.c
@@ -0,0 +1,156 @@
+/*
+ * SPAPR machine hooks to Virtual Open Firmware,
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include <sys/ioctl.h>
+#include "qapi/error.h"
+#include "hw/ppc/spapr.h"
+#include "hw/ppc/spapr_vio.h"
+#include "hw/ppc/fdt.h"
+#include "sysemu/sysemu.h"
+#include "qom/qom-qobject.h"
+#include "trace.h"
+
+/* Copied from SLOF, and 4K is definitely not enough for GRUB */
+#define OF_STACK_SIZE 0x8000
I found a reference explaining its value better than the comment above.
Section 8.2.2 here:
https://www.devicetree.org/open-firmware/bindings/ppc/release/ppc-2_1.html
says it should be at least 32k. This define should be in vof.h so I don't
have to duplicate it in pegasos2.c. Or vof_init could allocate and claim
the stack so board code doesn't have to do that either. Maybe taking a
pointer argument for preferred stack address as input and could return
the aligned address where the stack was allocated or just store stack_base
in struct vof where tha board code could get it for adding to r1 on
calling the guest code.
Regards,
BALATON Zoltan