Skip to content

Commit

Permalink
Mark pointers in 32bit MMIO as volatile
Browse files Browse the repository at this point in the history
We observed a situation where the compiler combined the reads of two
distinct calls to mmio_read32 into a single ldp instruction on ARM. This
caused crashes on VMs where KVM could not support that instruction for
MMIO. Recent refactors to stdout_ctrl_registers fixed the instance of
the crash that we observed but we should fix the mmio helpers to prevent
future occurences.

Signed-off-by: William Butler <[email protected]>
  • Loading branch information
tachyonwill committed Jul 3, 2024
1 parent 9b175cd commit 6b89963
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

static inline uint32_t mmio_read32(void *addr)
{
leint32_t *p = addr;
const volatile leint32_t *p = addr;

return le32_to_cpu(*p);
}
Expand All @@ -38,7 +38,7 @@ static inline uint64_t mmio_read64(void *addr)

static inline void mmio_write32(void *addr, uint32_t value)
{
leint32_t *p = addr;
volatile leint32_t *p = addr;

*p = cpu_to_le32(value);
}
Expand Down

0 comments on commit 6b89963

Please sign in to comment.