We don't need these pagetables after the early boot. Remove the chance
we write to memory we didn't expect to and remove architectural undefined
i just realized that this breaks EARLY_UART because SOCDEV_PA mapping is not passed to initarm().
So I think that we should postpone change of kernel ttbt0 until cninit() is processed.
@@ -1164,6 +1164,7 @@ initarm(struct arm64_bootparams *abp) valid = bus_probe(); cninit(); + set_ttbr0((uint64_t)pagetable_l0_ttbr0 - abp->kern_delta); if (!valid) panic("Invalid bus configuration: %s",
Also, summary is slightly misleading. This patch doesn't fully remove architectural undefined behavior (and I'm able to demonstrate this on RK3399) because it still exist - same physical memory is mapped in identity map as uncached and in kernel map as cached. This is direct violation of B2.9 in ARMv8 ARM, and it causes lost of coherency visible later in boot process.
Moreover, same problem (Mismatched memory attributes) exist also for DMAPed memory, memory attribute changes are not propagated to it. Worstly, only legal way how to change attribute for page mapped to multiple VA is break before make approach (thus we should unmaps all VA first ...)