Hi Andrew,
On 06/01/2023 15:19, Andrew Cooper wrote:
On 06/01/2023 1:40 pm, Julien Grall wrote:
Hi,
On 06/01/2023 13:14, Oleksii Kurochko wrote:
The patch introduce sbi_putchar() SBI call which is necessary
to implement initial early_printk
Signed-off-by: Oleksii Kurochko <oleksii.kuroc...@gmail.com>
---
xen/arch/riscv/Makefile | 1 +
xen/arch/riscv/include/asm/sbi.h | 34 ++++++++++++++++++++++++
xen/arch/riscv/sbi.c | 44 ++++++++++++++++++++++++++++++++
IMHO, it would be better to implement sbi.c in assembly so you can use
print in the console before you jump to C world.
That was already requested not to happen. Frankly, if I was an arm
maintainer I'd object to the how it's used there too, but RISCV is
massively more simple still.
There are a few reasons:
1) Xen is not fully position independent. Even if -fpic is enabled,
you would still need apply some relocation in order if you want to use
it before running in the virtual address space.
2) Doing any memory access before the MMU is setup requires some
careful though (see [1]). With function implemented in C, you can't
really control which memory accesses are done.
Not even the pagetable setup, or the physical relocation (if even
necessary) needs doing in ASM.
I'm not completely ruling it out in the future, but someone is going to
have to come up with a very convincing argument for why they can't do
this piece of critical setup in C.
That's great if RISC-V doesn't have the issues I mentioned above. On
Arm, I don't really think we can get away. But feel free to explain how
this could be done...
Cheers,
[1]
https://events.static.linuxfound.org/sites/events/files/slides/slides_10.pdf
--
Julien Grall