During early boot, we don't have a good way to map the UART page as Device-nGnRnE memory. I'm testing this on a hypervisor that maps the UART page as Device-GRE memory in the 2nd stage translation table. The OSv early page tables map everything as normal memory in stage 1. As a result, there will be missed characters during early boot, and the OSv version message will appear garbled.
After the memory barrier is introduced, OSv prints the proper early version message. The UART page does eventually get mapped as Device-nGnRnE memory, but not until later in the boot process when we switch over to the runtime page tables. Signed-off-by: Stewart Hildebrand <[email protected]> --- drivers/cadence-uart.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/cadence-uart.cc b/drivers/cadence-uart.cc index aa407008..52fc84ff 100644 --- a/drivers/cadence-uart.cc +++ b/drivers/cadence-uart.cc @@ -138,6 +138,9 @@ void Cadence_Console::write(const char *str, size_t len) { asm volatile("nop"); } uart->fifo = *str++; +#ifdef __aarch64__ + asm volatile("dmb nshst"); +#endif len--; } } -- 2.30.2 -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/20210311171431.31417-5-stewart.hildebrand%40dornerworks.com.
