Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37478 )
Change subject: libpayload: Cache physical cbmem console address ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/c/coreboot/+/37478/1/payloads/libpayload/drivers... File payloads/libpayload/drivers/cbmem_console.c:
https://review.coreboot.org/c/coreboot/+/37478/1/payloads/libpayload/drivers... PS1, Line 60: just keep the physical address which won't break on relocation. */
Only few drivers that cache pointers are affected...
Are you sure (maybe I'm still not understanding this right)? If this code runs before relocation then the phys_to_virt() in get_cbmem_ptr() also runs before relocation, right? So the pointer in lib_sysinfo still has the value of a physical pointer, even though it pretends to be a virtual pointer. So if some other driver doesn't cache it but instead just tries to access the pointer directly at a point after relocation, it'll also die.
At some point we decided to re-initialize sysinfo after the relocation, to support its virtual pointers. I don't remember why. Might just have been the worst idea ;)