]> www.infradead.org Git - users/sagi/nvme-cli.git/commit
common.h: Avoid using unsupported load/store instructions in arm64 VMs
authorOliver Upton <oliver.upton@linux.dev>
Thu, 4 Jul 2024 09:09:40 +0000 (09:09 +0000)
committerDaniel Wagner <wagi@monom.org>
Thu, 4 Jul 2024 17:59:26 +0000 (19:59 +0200)
commitfa5a46cc25b884a61a14f06e6693373bcefff29d
tree6d986b9109f62dc896a3e15ebe7106f67d07c08f
parent9afc400af96227ff66cafe05e25a973db6f1884b
common.h: Avoid using unsupported load/store instructions in arm64 VMs

Using nvme show-regs within a VM on arm64 can sometimes lead to VM
termination.

To answer why this happens: one of the deficiencies of the Arm
architecture is that there exists a range of load/store instructions
that have insufficient decode information for traps taken to the
hypervisor. KVM, for example, may raise an external abort or outright
terminate the VM depending on the configuration.

This is a known problem on the kernel side, and is fixed by using
assembly MMIO accessors w/ 'safe' load/store instructions. So do
exactly that, providing arm64-specific accessors and falling back to
plain old volatile pointer accesses for other architectures.

Reported-by: William Butler <wab@google.com>
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
common.h