Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40895 )
Change subject: libpayload: xhci: Do not memcpy registers ......................................................................
Patch Set 2:
The underlying issue here seems that `phys_to_virt()` returns a non-volatile pointer to things which are volatile. It should probably be split into `phys_mem_to_virt()` (same as `phys_to_virt()` today) and `phys_dev_to_virt()` (returning a volatile pointer) to catch such bugs in build, not in development or even production. A compiler warning would then be triggered, like "passing argument 2 of ‘memcpy’ discards ‘volatile’ qualifier from pointer target type [-Wdiscarded-qualifiers]"
I'm not sure if we're really using volatile in that capacity enough to make that useful. The USB stack is kind of a special case -- most other places where we do MMIO instead use the read32()/write32() accessors which cast to volatile internally. Really, for consistency we should probably rewrite the USB stuff to use those APIs as well. But it has worked for us so far so there is little pressure to invest a lot of effort into changing it.