Re: [PATCH v2 3/3] arm64: use generic MMIO accessors

From: Qingfang Deng

Date: Sun Sep 20 2026 - 05:26:56 EST


Hi,

On 2026/9/20 16:08, Arnd Bergmann wrote:
On Sun, Sep 20, 2026, at 03:43, Qingfang Deng wrote:
Use the generic raw write accessors in place of the inline assembly
stores. Include asm-generic/mmio.h after the arm64 ordering hooks so
these accessors are also available to the write-combining helpers
before asm-generic/io.h is included.

Retain the raw read overrides when either the Cortex-A57 erratum 832075
or NVIDIA Olympus erratum 1027 workaround is configured. This preserves
the alternative-patched load-acquire instructions and pre-load barriers.
Use generic raw reads when neither workaround is enabled.

Assisted-by: Codex:gpt-6-astra
Signed-off-by: Qingfang Deng <qingfang.deng@xxxxxxxxx>
Sorry, this is no good, we need the compiler to issue the exact
instructions from the inline asm here, both in order to guarantee
these can be virtualized, and to prevent it from splitting up
larger register accesses into byte load/store on unaligned pointers.

You're right about virtualization: an AArch64 compiler can generate writeback addressing loads/stores, which KVM's MMIO handler does not support.

Regarding unaligned accesses, the splitting can only happen when the address is known to be unaligned at compile-time. Do these accessors need to support unaligned MMIO? If so, I could add OPTIMIZER_HIDE_VAR(addr) to the generic accessors.

Best regards,
Qingfang